peachsim 0.1.2238 → 0.1.2242

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 (107) hide show
  1. package/cli/bridge-flow-runner.ts +10 -9
  2. package/cli/commands/inspect/settling.ts +491 -506
  3. package/cli/commands/platform.ts +2 -0
  4. package/cli/drivers/playwright-provisioning.ts +160 -37
  5. package/cli/internal-child.ts +5 -79
  6. package/dist-lib/agent-daemon-client.cjs +1 -1
  7. package/dist-lib/agent-events.cjs +1 -1
  8. package/dist-lib/attached-projects.cjs +1 -1
  9. package/dist-lib/auth/shared-session.cjs +1 -1
  10. package/dist-lib/backend-origin.cjs +1 -1
  11. package/dist-lib/beta.cjs +1 -1
  12. package/dist-lib/beta.mjs +1 -1
  13. package/dist-lib/bridge-constants.cjs +1 -1
  14. package/dist-lib/bridge-contract-input.cjs +1 -1
  15. package/dist-lib/bridge-contract-input.mjs +1 -1
  16. package/dist-lib/bridge-contract.cjs +1 -1
  17. package/dist-lib/bridge-contract.mjs +1 -1
  18. package/dist-lib/bundle-channel.cjs +115 -89
  19. package/dist-lib/capture-contract.cjs +1 -1
  20. package/dist-lib/capture-contract.mjs +1 -1
  21. package/dist-lib/cloud-contract.cjs +1 -1
  22. package/dist-lib/cloud-contract.mjs +1 -1
  23. package/dist-lib/cloud-test-args.cjs +1 -1
  24. package/dist-lib/cloud-test-args.mjs +1 -1
  25. package/dist-lib/cloud.cjs +1 -1
  26. package/dist-lib/cloud.mjs +1 -1
  27. package/dist-lib/config.cjs +1 -1
  28. package/dist-lib/config.mjs +1 -1
  29. package/dist-lib/detox/index.cjs +494 -510
  30. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  31. package/dist-lib/expo-swift-bundle.cjs +101 -75
  32. package/dist-lib/expo-swift-metadata.cjs +1 -1
  33. package/dist-lib/expo-swift-metadata.mjs +1 -1
  34. package/dist-lib/home-paths.cjs +1 -1
  35. package/dist-lib/host/bridge-host.cjs +119 -93
  36. package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
  37. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  38. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  39. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  40. package/dist-lib/host/websocket-proxy.cjs +1 -1
  41. package/dist-lib/index.cjs +492 -508
  42. package/dist-lib/jump-to-source-babel.cjs +1 -1
  43. package/dist-lib/jump-to-source-native.cjs +1 -1
  44. package/dist-lib/kotlin-host.cjs +1 -1
  45. package/dist-lib/menu.cjs +1 -1
  46. package/dist-lib/menu.mjs +1 -1
  47. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  48. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  49. package/dist-lib/metro-production-bundle.cjs +1 -1
  50. package/dist-lib/metro-production-bundle.mjs +1 -1
  51. package/dist-lib/metro.cjs +4 -4
  52. package/dist-lib/native-app-identity-project.cjs +2 -2
  53. package/dist-lib/native-app-identity-project.mjs +7 -8
  54. package/dist-lib/native-app-identity.cjs +1 -1
  55. package/dist-lib/native-app-identity.mjs +1 -1
  56. package/dist-lib/native-firebase-metadata.cjs +1 -1
  57. package/dist-lib/native-firebase-metadata.mjs +1 -1
  58. package/dist-lib/pdfium-raster.cjs +1 -1
  59. package/dist-lib/pdfium-raster.mjs +1 -1
  60. package/dist-lib/plist.cjs +1 -1
  61. package/dist-lib/plist.mjs +1 -1
  62. package/dist-lib/profiles.cjs +1 -1
  63. package/dist-lib/public-brand.cjs +1 -1
  64. package/dist-lib/public-origins-lib-esm.json +24 -24
  65. package/dist-lib/public-origins-lib.json +53 -53
  66. package/dist-lib/react-native-host-modules.cjs +1 -1
  67. package/dist-lib/react-native-host-modules.mjs +1 -1
  68. package/dist-lib/reap-browser.cjs +1 -1
  69. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  70. package/dist-lib/sdk.cjs +487 -503
  71. package/dist-lib/sdk.mjs +487 -503
  72. package/dist-lib/skills.cjs +1327 -1235
  73. package/dist-lib/swift-compile.cjs +46 -27
  74. package/dist-lib/swift-compile.mjs +42 -23
  75. package/dist-lib/swift-package.cjs +1 -1
  76. package/dist-lib/swift-package.mjs +1 -1
  77. package/dist-lib/swift-submit.cjs +2 -2
  78. package/dist-lib/swift-submit.mjs +2 -2
  79. package/dist-lib/swift-toolchain.cjs +1 -1
  80. package/dist-lib/swift.cjs +1 -1
  81. package/dist-lib/vite-swift.cjs +89 -64
  82. package/dist-lib/vite.cjs +4 -4
  83. package/dist-lib/worklet-executable.cjs +1 -1
  84. package/dist-lib/worklet-executable.mjs +1 -1
  85. package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
  86. package/dist-types/packages/peach-engine/src/engine/secureItemHostContract.d.ts +5 -1
  87. package/dist-types/packages/peach-engine/src/engine/types.d.ts +1 -0
  88. package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +6 -0
  89. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +4 -1
  90. package/dist-types/packages/peach-engine/src/render-worker/webview-capture-protocol.d.ts +14 -0
  91. package/dist-types/packages/peach-globals/src/nativeSurfaceContract.d.ts +1 -0
  92. package/dist-types/packages/peach-globals/src/secure-item-store.d.ts +2 -0
  93. package/kotlin/sdk.tar.gz +0 -0
  94. package/package.json +1 -1
  95. package/runtime-companion.json +1 -1
  96. package/src/native-static-libraries.ts +20 -20
  97. package/src/native-swift-slices.ts +1 -0
  98. package/src/nitro-adapter.lock.json +253 -253
  99. package/src/nitro-superset.lock.json +4 -4
  100. package/src/swift-compile.ts +10 -3
  101. package/src/swift-distribution.lock.json +11 -11
  102. package/src/swift-host.ts +2 -1
  103. package/src/swift-shared-sdk.ts +10 -1
  104. package/src/swift-standins.ts +5 -2
  105. package/src/swift-submit.ts +3 -1
  106. package/src/swift-wasm-prune.ts +23 -14
  107. package/src/turbo-runtime.lock.json +22 -22
@@ -70,7 +70,12 @@ function readULEB(b: Uint8Array, o: number): [number, number] {
70
70
  return [res, p]
71
71
  }
72
72
 
73
+ // public runtimes pinned to a distribution before 7eb5f6473249e4be still
74
+ // override preferredLocalizations in PeachFoundation-Localization.o.
73
75
  const WEAKEN_FOUNDATION_SYMS = new Set([
76
+ '$s10Foundation6BundleC22preferredLocalizations4from14forPreferencesSaySSGAG_AGSgtFZ',
77
+ '$s10Foundation6BundleC22preferredLocalizations4fromSaySSGAF_tFZ',
78
+ '$s10Foundation6BundleC22preferredLocalizationsSaySSGvg',
74
79
  '$s10Foundation16NSSortDescriptorC3key9ascendingACSSSg_SbtcfC',
75
80
  '$s10Foundation16NSSortDescriptorC3key9ascendingACSSSg_Sbtcfc',
76
81
  '$s10Foundation16NSSortDescriptorC3keySSSgvg',
@@ -183,7 +188,7 @@ export function weakenFoundationOverridesInArchive(arBuf: Uint8Array): void {
183
188
  } else if (name.endsWith('/')) {
184
189
  name = name.slice(0, -1)
185
190
  }
186
- if (name.endsWith('NSSortDescriptor.o')) {
191
+ if (name.endsWith('Bundle.o') || name.endsWith('NSSortDescriptor.o')) {
187
192
  weakenFoundationSymbolsInWasmObj(arBuf.subarray(bodyStart, bodyEnd))
188
193
  }
189
194
  pos = bodyEnd + (size & 1)
@@ -258,6 +263,10 @@ export function swiftSharedSdkViewOptions(
258
263
  .sort()
259
264
  const key = JSON.stringify([
260
265
  'v23',
266
+ [...WEAKEN_FOUNDATION_SYMS],
267
+ readULEB.toString(),
268
+ weakenFoundationSymbolsInWasmObj.toString(),
269
+ weakenFoundationOverridesInArchive.toString(),
261
270
  toolchainBin,
262
271
  sdk,
263
272
  frameworks,
@@ -2451,10 +2451,13 @@ export function buildRustCrate(
2451
2451
  },
2452
2452
  )
2453
2453
  if (result.error) throw result.error
2454
- if (result.status !== 0)
2454
+ if (result.status !== 0) {
2455
+ const diagnostic = path.join(work, 'build.log')
2456
+ fs.writeFileSync(diagnostic, `${result.stderr}\n${result.stdout}`)
2455
2457
  throw new Error(
2456
- `Rust wasm64 could not build ${path.relative(searchRoot, manifest)}: ${failure(result)}`,
2458
+ `Rust wasm64 could not build ${path.relative(searchRoot, manifest)}: ${failure(result)}\nfull diagnostic: ${diagnostic}`,
2457
2459
  )
2460
+ }
2458
2461
  for (const line of result.stdout.split('\n')) {
2459
2462
  if (!line.startsWith('{')) continue
2460
2463
  const message: unknown = JSON.parse(line)
@@ -147,7 +147,9 @@ export const MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024
147
147
  // 69: `peach.icu_item_v1` replaces `icu_data_v1`: the host fills icu's table of
148
148
  // contents and places each item's pack the first time icu opens it.
149
149
  // 70: full Objective-C forwarding uses exact typed IMPs (`peach.imp_forwarder_mint`).
150
- export const SWIFT_HOST_ABI = 70
150
+ // 71: UIImage pixels register once through `peach.bitmap_register` and
151
+ // `peach.bitmap_release`; trees name them `peach-bitmap:<id>`.
152
+ export const SWIFT_HOST_ABI = 71
151
153
 
152
154
  export interface SwiftImageUpload {
153
155
  /** the raster file picked for the asset (has the extension). */
@@ -20,10 +20,10 @@
20
20
  import { execFileSync } from 'node:child_process'
21
21
  import { createHash } from 'node:crypto'
22
22
  import fs from 'node:fs'
23
- import os from 'node:os'
24
23
  import path from 'node:path'
25
24
  import * as v from 'valibot'
26
25
  import { foundationCategoryObjects } from './swift-foundation'
26
+ import { swiftCacheDir, swiftFileChecksum } from './swift-toolchain'
27
27
  import {
28
28
  SWIFT_FRAMEWORK_PRODUCT_FILE,
29
29
  swiftFrameworkProductSchema,
@@ -863,11 +863,6 @@ export function guestWasmSymbols(bytes: Uint8Array): {
863
863
  }
864
864
  }
865
865
 
866
- function peachHome(): string {
867
- const override = process.env.PEACH_HOME
868
- return override ? path.resolve(override) : path.join(os.homedir(), '.peach')
869
- }
870
-
871
866
  function sdkObjectName(archive: string, member: string, ordinal: number): string {
872
867
  const base = archive.replace(/\.a$/, '')
873
868
  const suffix = ordinal > 1 ? `_${ordinal}` : ''
@@ -1018,17 +1013,22 @@ export function swiftPrunedSdkObjectOrigins(
1018
1013
  }
1019
1014
 
1020
1015
  function ensureUnpackedSdkObjects(sdkWasiDir: string): string {
1021
- const sdkKey = createHash('sha256').update(sdkWasiDir).digest('hex').slice(0, 16)
1022
- const outDir = path.join(peachHome(), 'cache', 'swift-builds', `sdk-objs-${sdkKey}`)
1016
+ const archives = fs
1017
+ .readdirSync(sdkWasiDir)
1018
+ .filter((file) => file.endsWith('.a'))
1019
+ .sort()
1020
+ const hash = createHash('sha256')
1021
+ for (const archive of archives) {
1022
+ hash.update(archive + '\0')
1023
+ hash.update(swiftFileChecksum(path.join(sdkWasiDir, archive)))
1024
+ }
1025
+ const sdkKey = hash.digest('hex')
1026
+ const outDir = path.join(swiftCacheDir(), 'swift-builds', `sdk-objs-${sdkKey}`)
1023
1027
  const stamp = path.join(outDir, '.complete')
1024
1028
  if (fs.existsSync(stamp)) return outDir
1025
1029
 
1026
1030
  const tmpDir = `${outDir}.${process.pid}.${Date.now()}.tmp`
1027
1031
  fs.mkdirSync(tmpDir, { recursive: true })
1028
- const archives = fs
1029
- .readdirSync(sdkWasiDir)
1030
- .filter((f) => f.endsWith('.a'))
1031
- .sort()
1032
1032
  for (const archive of archives) {
1033
1033
  const members = readArMembers(
1034
1034
  new Uint8Array(fs.readFileSync(path.join(sdkWasiDir, archive))),
@@ -1047,8 +1047,12 @@ function ensureUnpackedSdkObjects(sdkWasiDir: string): string {
1047
1047
  fs.rmSync(tmpDir, { recursive: true, force: true })
1048
1048
  return outDir
1049
1049
  }
1050
- fs.rmSync(outDir, { recursive: true, force: true })
1051
- fs.renameSync(tmpDir, outDir)
1050
+ try {
1051
+ fs.renameSync(tmpDir, outDir)
1052
+ } catch (error) {
1053
+ if (!fs.existsSync(stamp)) throw error
1054
+ fs.rmSync(tmpDir, { recursive: true, force: true })
1055
+ }
1052
1056
  return outDir
1053
1057
  }
1054
1058
 
@@ -1705,6 +1709,11 @@ export function pruneSwiftWasmLink(
1705
1709
  }
1706
1710
 
1707
1711
  const WEAKEN_SDK_FOUNDATION_SYMS = new Set([
1712
+ '$s10Foundation6BundleC22preferredLocalizations4from14forPreferencesSaySSGAG_AGSgtFZ',
1713
+ '$s10Foundation6BundleC22preferredLocalizations4fromSaySSGAF_tFZ',
1714
+ '$s10Foundation6BundleC22preferredLocalizationsSaySSGvg',
1715
+ '$s10Foundation6BundleC22preferredLocalizations4from14forPreferencesSaySSGAG_AGSgtFZTf4nnd_n',
1716
+ '$s10Foundation6BundleC22preferredLocalizations4fromSaySSGAF_tFZTf4nd_n',
1708
1717
  '$s10Foundation16NSSortDescriptorC3key9ascendingACSSSg_SbtcfC',
1709
1718
  '$s10Foundation16NSSortDescriptorC3key9ascendingACSSSg_Sbtcfc',
1710
1719
  '$s10Foundation16NSSortDescriptorC3keySSSgvg',
@@ -8,11 +8,11 @@
8
8
  },
9
9
  "compiler": "swift-6.4.0-RELEASE-custom-fb42d2535739dfd2",
10
10
  "sdk": {
11
- "id": "swift-6.4.0-RELEASE_wasm-peach-b577231e",
12
- "checksum": "9a8f0c694ada318ede49413cd72395e34a7fbb1b9a227b31eff8b05371ffb9aa"
11
+ "id": "swift-6.4.0-RELEASE_wasm-peach-11784d37",
12
+ "checksum": "2f79c08f5df1a4c36803d1555e874d37d30c39f6f5f6c03c515812a5b71d2bbf"
13
13
  },
14
14
  "framework": {
15
- "distribution": "c7825880e72c77d4",
15
+ "distribution": "7eb5f6473249e4be",
16
16
  "wireAbi": "38eed69f6b7391584112981b7892914e7033d7e0c17c2e8d4a4448030618bd2b"
17
17
  },
18
18
  "archives": [
@@ -20,71 +20,71 @@
20
20
  "headers": {
21
21
  "reactNativeJsi": "0f8c2defbca69a27a848a81ae72363073bf9602fd316e57a75811be1a0528358"
22
22
  },
23
- "sha256": "675b1c6d919198a3329fa48d9ad74c05c093201fc4abe246436f7f8e1d47887f",
24
- "size": 26175
23
+ "sha256": "ec1db15c0c1cdafcfbb0d6e46b70218479e7987e46db0fecbb12e3227fb557f0",
24
+ "size": 26171
25
25
  },
26
26
  {
27
27
  "headers": {
28
28
  "reactNativeJsi": "21a624ea24fd17d56bf26832d496fc1177067f89640414c20e6486c7984dfb0a"
29
29
  },
30
- "sha256": "fb2a2b16ef4963022676c04a8acc23a10a3c7de9b1fb2760743a299eb5fb6cda",
31
- "size": 26914
30
+ "sha256": "27eba9bd34fbdc8c80ebfc192b31b3ee89d027d2ae9816b7ada54e3de42c3d8b",
31
+ "size": 26913
32
32
  },
33
33
  {
34
34
  "headers": {
35
35
  "reactNativeJsi": "324aefd8591d9ce688bce7589c4c2b516cd33ecb95d35c47239a87a8fcf6a8da"
36
36
  },
37
- "sha256": "3b5f5db71ed80b6c5563332e81edd9d9a7d626740471892e3a3aecf34946df8d",
37
+ "sha256": "78831ce6c2e1fe1d164998aead5bbfc1283c31250426f6ee06311ba56551f802",
38
38
  "size": 26167
39
39
  },
40
40
  {
41
41
  "headers": {
42
42
  "reactNativeJsi": "33596664ee7d7a6623f0796a6feb429543316c3a41b211150acda6e1d835286c"
43
43
  },
44
- "sha256": "7577e8dc552780eed3ee136fb7a77e19345199c4d87420b21a444adf647bf2ec",
45
- "size": 25957
44
+ "sha256": "9e64875f841d719b3f2b81fc2bd459e4c293f812a60c07d8b811991d443ec97d",
45
+ "size": 25954
46
46
  },
47
47
  {
48
48
  "headers": {
49
49
  "reactNativeJsi": "66b2cd5a38511195207f6c8a76aba735f9b9cc66a52a0d00780ffe5d331623f7"
50
50
  },
51
- "sha256": "1ccfb1335ba66d6f53d27a5a1ee9c223b7d05a9c0abb6eb7dccdc6124245e470",
52
- "size": 26172
51
+ "sha256": "68b2b211a2f5c2ed00497fce5e0f433ce76afa96de2cc6ba934343e6e0de06f6",
52
+ "size": 26168
53
53
  },
54
54
  {
55
55
  "headers": {
56
56
  "reactNativeJsi": "96db4e758dd53e9320cef7cad485e00aa06e7a982cefd920f17007de8a5bd9f9"
57
57
  },
58
- "sha256": "15e27e276e9add8769400c323ea880867ebbefd3efb823b203b2eaae0be23fa4",
59
- "size": 26913
58
+ "sha256": "ee90b76a0d9ccbf7056451855820bfef97f39c9b45730155a1bfa160dba85b07",
59
+ "size": 26910
60
60
  },
61
61
  {
62
62
  "headers": {
63
63
  "reactNativeJsi": "aeab590ddd1218df963462242d3954ce467b0fa88f70e91429e4ffc74d230893"
64
64
  },
65
- "sha256": "f0243c32cdbe887ce7672e2abf3338dccbd76c43dfeb8686b7269f0d3272fb88",
66
- "size": 26914
65
+ "sha256": "97881f12d2e6168645984291a920961f1667a61bd9c448e546a40456a4cfe9b3",
66
+ "size": 26911
67
67
  },
68
68
  {
69
69
  "headers": {
70
70
  "reactNativeJsi": "b5fb260522384dd7ab07d740cdc534b529922446fcec798341c7817d9eaa49f4"
71
71
  },
72
- "sha256": "b107936623043c5cbf4353acbbfadb6426750138304befd9e0fa768d6e256e49",
73
- "size": 26046
72
+ "sha256": "e97b334fd4105e356bb3958214b52b953928828f31f35c9d273b150736530be1",
73
+ "size": 26045
74
74
  },
75
75
  {
76
76
  "headers": {
77
77
  "reactNativeJsi": "c6b391a1e870ccf7cdd534be63582862840f8245b99ebd253317deece1e6ffd5"
78
78
  },
79
- "sha256": "3c56322e46544e260cbbc6f90720cb2bdfd5373e744801e55b778113d99e8799",
80
- "size": 26912
79
+ "sha256": "3be1e1c6f5dda70945a1afb2cea67fc1093704c71e20f4eb3d344371fdfea755",
80
+ "size": 26911
81
81
  },
82
82
  {
83
83
  "headers": {
84
84
  "reactNativeJsi": "c8270f1315745ecc204c4209a4f50f58ff6f14b4a385ad6820a69800270b53c6"
85
85
  },
86
- "sha256": "e96bfa3c28e45bd3d4d64a059449d1960e7136a966d746662834ff3aa2d1ce6b",
87
- "size": 25921
86
+ "sha256": "76d5af4649ecf90a32a2c25739747e08deefeebe0054a030c6bc718d872c4625",
87
+ "size": 25918
88
88
  }
89
89
  ]
90
90
  }