peachsim 0.1.1874 → 0.1.1876

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 (96) hide show
  1. package/README.md +1 -0
  2. package/cli/commands/do-chain.ts +1 -1
  3. package/cli/commands/inspect/settling.ts +132 -92
  4. package/cli/outbound-endpoints.ts +4 -0
  5. package/dist-lib/agent-daemon-client.cjs +1 -1
  6. package/dist-lib/agent-events.cjs +1 -1
  7. package/dist-lib/attached-projects.cjs +1 -1
  8. package/dist-lib/auth/shared-session.cjs +1 -1
  9. package/dist-lib/backend-origin.cjs +1 -1
  10. package/dist-lib/beta.cjs +1 -1
  11. package/dist-lib/beta.mjs +1 -1
  12. package/dist-lib/bridge-constants.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.cjs +1 -1
  14. package/dist-lib/bridge-contract-input.mjs +1 -1
  15. package/dist-lib/bridge-contract.cjs +1 -1
  16. package/dist-lib/bridge-contract.mjs +1 -1
  17. package/dist-lib/bundle-channel.cjs +174 -127
  18. package/dist-lib/capture-contract.cjs +1 -1
  19. package/dist-lib/capture-contract.mjs +1 -1
  20. package/dist-lib/cloud-contract.cjs +1 -1
  21. package/dist-lib/cloud-contract.mjs +1 -1
  22. package/dist-lib/cloud-test-args.cjs +1 -1
  23. package/dist-lib/cloud-test-args.mjs +1 -1
  24. package/dist-lib/cloud.cjs +1 -1
  25. package/dist-lib/cloud.mjs +1 -1
  26. package/dist-lib/config.cjs +1 -1
  27. package/dist-lib/config.mjs +1 -1
  28. package/dist-lib/detox/index.cjs +141 -102
  29. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  30. package/dist-lib/expo-swift-bundle.cjs +55 -32
  31. package/dist-lib/expo-swift-metadata.cjs +1 -1
  32. package/dist-lib/expo-swift-metadata.mjs +1 -1
  33. package/dist-lib/home-paths.cjs +1 -1
  34. package/dist-lib/host/bridge-host.cjs +72 -38
  35. package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
  36. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  37. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  38. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  39. package/dist-lib/host/websocket-proxy.cjs +1 -1
  40. package/dist-lib/index.cjs +124 -96
  41. package/dist-lib/jump-to-source-babel.cjs +1 -1
  42. package/dist-lib/jump-to-source-native.cjs +1 -1
  43. package/dist-lib/kotlin-host.cjs +1 -1
  44. package/dist-lib/menu.cjs +1 -1
  45. package/dist-lib/menu.mjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  47. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  48. package/dist-lib/metro-production-bundle.cjs +1 -1
  49. package/dist-lib/metro-production-bundle.mjs +1 -1
  50. package/dist-lib/metro.cjs +6 -4
  51. package/dist-lib/native-app-identity-project.cjs +5 -3
  52. package/dist-lib/native-app-identity-project.mjs +5 -3
  53. package/dist-lib/native-app-identity.cjs +1 -1
  54. package/dist-lib/native-app-identity.mjs +1 -1
  55. package/dist-lib/native-firebase-metadata.cjs +1 -1
  56. package/dist-lib/native-firebase-metadata.mjs +1 -1
  57. package/dist-lib/pdfium-raster.cjs +1 -1
  58. package/dist-lib/pdfium-raster.mjs +1 -1
  59. package/dist-lib/plist.cjs +1 -1
  60. package/dist-lib/plist.mjs +1 -1
  61. package/dist-lib/profiles.cjs +1 -1
  62. package/dist-lib/public-brand.cjs +1 -1
  63. package/dist-lib/public-origins-lib-esm.json +24 -24
  64. package/dist-lib/public-origins-lib.json +54 -54
  65. package/dist-lib/react-native-host-modules.cjs +1 -1
  66. package/dist-lib/react-native-host-modules.mjs +1 -1
  67. package/dist-lib/reap-browser.cjs +1 -1
  68. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  69. package/dist-lib/sdk.cjs +119 -93
  70. package/dist-lib/sdk.mjs +119 -93
  71. package/dist-lib/skills.cjs +186 -128
  72. package/dist-lib/swift-compile.cjs +20 -16
  73. package/dist-lib/swift-compile.mjs +20 -16
  74. package/dist-lib/swift-package.cjs +1 -1
  75. package/dist-lib/swift-package.mjs +1 -1
  76. package/dist-lib/swift-submit.cjs +1 -1
  77. package/dist-lib/swift-submit.mjs +1 -1
  78. package/dist-lib/swift-toolchain.cjs +1 -1
  79. package/dist-lib/swift.cjs +1 -1
  80. package/dist-lib/vite-swift.cjs +21 -17
  81. package/dist-lib/vite.cjs +2 -2
  82. package/dist-lib/worklet-executable.cjs +1 -1
  83. package/dist-lib/worklet-executable.mjs +1 -1
  84. package/package.json +1 -1
  85. package/runtime-companion.json +1 -1
  86. package/skills/contrast/SKILL.md +3 -2
  87. package/src/bundle-channel.mjs +21 -11
  88. package/src/expo-native-prebuilt.ts +4 -2
  89. package/src/native-app-identity-project.ts +3 -1
  90. package/src/native-bundles.ts +5 -1
  91. package/src/nitroContract.ts +43 -12
  92. package/src/sim-client.ts +4 -2
  93. package/src/swift-compile.ts +22 -14
  94. package/src/swift-host.ts +5 -1
  95. package/src/turbo-bundle.ts +14 -1
  96. package/src/turbo-source.ts +4 -3
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1874 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1876 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/swift-compile.ts
4
4
  import {
@@ -7849,7 +7849,7 @@ var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quo
7849
7849
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
7850
7850
  var MULTI_MANIFEST_VERSION = 65;
7851
7851
  var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
7852
- var compilerSourceDigest = true ? "16355cfe66c10b553640a95acf7ed3b7f810db06602eb8edab8620da0ec7b94a" : swiftCompilerSourceDigest(import.meta.dirname);
7852
+ var compilerSourceDigest = true ? "bbb12360ef251bb3cd28572f60d5685f72ddb59c847cbbbf6d154c0bea302b2e" : swiftCompilerSourceDigest(import.meta.dirname);
7853
7853
  function swiftArtifactHash(input, release, moduleRoot) {
7854
7854
  const hash = createHash8("sha256");
7855
7855
  hash.update(`swift-compile
@@ -8000,9 +8000,9 @@ function emitSwiftPackageManifest(args) {
8000
8000
  foundationCategoryObjects.map((name2) => `lib/Foundation-${name2}.o`)
8001
8001
  );
8002
8002
  const roots = swiftObjcRootObjects(distribution.id, moduleRoot, distribution.objects);
8003
- const eager = new Set(
8003
+ const eager = args.lazyDistribution ? new Set(
8004
8004
  objects.filter((object) => roots.has(object) || categoryObjects.has(object))
8005
- );
8005
+ ) : new Set(objects);
8006
8006
  const list = [
8007
8007
  ...[...eager].map(quoted),
8008
8008
  "-Wl,--start-lib",
@@ -10927,7 +10927,8 @@ module ${moduleName}.Swift {
10927
10927
  distributionLink: {
10928
10928
  path: path19.join(layout.root, ".peach-distribution-objects.rsp"),
10929
10929
  files
10930
- }
10930
+ },
10931
+ lazyDistribution: input.optimize
10931
10932
  } : {},
10932
10933
  ...prebuilt && frameworkLink ? {
10933
10934
  prebuilt: {
@@ -11754,7 +11755,7 @@ function compileSwiftProjectOnce(input, options) {
11754
11755
  process.env.LD_LIBRARY_PATH
11755
11756
  ].filter(Boolean).join(":")
11756
11757
  } : {},
11757
- PEACH_DEFER_WASM_LINK: "1"
11758
+ ...input.optimize ? { PEACH_DEFER_WASM_LINK: "1" } : {}
11758
11759
  },
11759
11760
  maxBuffer: 64 * 1024 * 1024,
11760
11761
  timeout: options.timeoutMs,
@@ -11854,9 +11855,11 @@ function compileSwiftProjectOnce(input, options) {
11854
11855
  ])
11855
11856
  ];
11856
11857
  const linked = builtArtifact(layout);
11857
- rmSync5(path19.join(root, ".peach-link.rsp"), { force: true });
11858
- if (existsSync4(linked) && statSync2(linked).size <= 8)
11859
- rmSync5(linked, { force: true });
11858
+ if (input.optimize) {
11859
+ rmSync5(path19.join(root, ".peach-link.rsp"), { force: true });
11860
+ if (existsSync4(linked) && statSync2(linked).size <= 8)
11861
+ rmSync5(linked, { force: true });
11862
+ }
11860
11863
  report("compiling and linking Swift modules");
11861
11864
  try {
11862
11865
  const headerBuilds = preparation.headerProductTarget ? [
@@ -11970,13 +11973,14 @@ function compileSwiftProjectOnce(input, options) {
11970
11973
  );
11971
11974
  }
11972
11975
  if (options.project) removeProjectLinks(root);
11973
- pruneSwiftWasmLink(
11974
- root,
11975
- options.toolchainBin,
11976
- frameworkRoot,
11977
- input.staticClangTargets,
11978
- options.project
11979
- );
11976
+ if (input.optimize)
11977
+ pruneSwiftWasmLink(
11978
+ root,
11979
+ options.toolchainBin,
11980
+ frameworkRoot,
11981
+ input.staticClangTargets,
11982
+ options.project
11983
+ );
11980
11984
  const output = options.project ? projectOutputFile(root, linked, options.project) : linked;
11981
11985
  const optimized = `${output}.optimized`;
11982
11986
  if (input.optimize) await optimizeWasm(output, optimized);
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1874 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1876 | (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;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1874 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1876 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/swift-package.ts
4
4
  function swiftManifestSettings(target) {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1874 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1876 | (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;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1874 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1876 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/is-record.ts
4
4
  function isRecord(value) {
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1874 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1876 | (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.1874 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1876 | (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;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1874 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1876 | (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;
@@ -12175,7 +12175,7 @@ var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quo
12175
12175
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
12176
12176
  var MULTI_MANIFEST_VERSION = 65;
12177
12177
  var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
12178
- var compilerSourceDigest = true ? "16355cfe66c10b553640a95acf7ed3b7f810db06602eb8edab8620da0ec7b94a" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
12178
+ var compilerSourceDigest = true ? "bbb12360ef251bb3cd28572f60d5685f72ddb59c847cbbbf6d154c0bea302b2e" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
12179
12179
  function swiftArtifactHash(input, release, moduleRoot) {
12180
12180
  const hash = (0, import_node_crypto8.createHash)("sha256");
12181
12181
  hash.update(`swift-compile
@@ -12326,9 +12326,9 @@ function emitSwiftPackageManifest(args) {
12326
12326
  foundationCategoryObjects.map((name3) => `lib/Foundation-${name3}.o`)
12327
12327
  );
12328
12328
  const roots = swiftObjcRootObjects(distribution.id, moduleRoot, distribution.objects);
12329
- const eager = new Set(
12329
+ const eager = args.lazyDistribution ? new Set(
12330
12330
  objects.filter((object2) => roots.has(object2) || categoryObjects.has(object2))
12331
- );
12331
+ ) : new Set(objects);
12332
12332
  const list2 = [
12333
12333
  ...[...eager].map(quoted),
12334
12334
  "-Wl,--start-lib",
@@ -15178,7 +15178,8 @@ module ${moduleName}.Swift {
15178
15178
  distributionLink: {
15179
15179
  path: import_node_path19.default.join(layout.root, ".peach-distribution-objects.rsp"),
15180
15180
  files: files2
15181
- }
15181
+ },
15182
+ lazyDistribution: input.optimize
15182
15183
  } : {},
15183
15184
  ...prebuilt && frameworkLink ? {
15184
15185
  prebuilt: {
@@ -16005,7 +16006,7 @@ function compileSwiftProjectOnce(input, options) {
16005
16006
  process.env.LD_LIBRARY_PATH
16006
16007
  ].filter(Boolean).join(":")
16007
16008
  } : {},
16008
- PEACH_DEFER_WASM_LINK: "1"
16009
+ ...input.optimize ? { PEACH_DEFER_WASM_LINK: "1" } : {}
16009
16010
  },
16010
16011
  maxBuffer: 64 * 1024 * 1024,
16011
16012
  timeout: options.timeoutMs,
@@ -16105,9 +16106,11 @@ function compileSwiftProjectOnce(input, options) {
16105
16106
  ])
16106
16107
  ];
16107
16108
  const linked = builtArtifact(layout);
16108
- (0, import_node_fs19.rmSync)(import_node_path19.default.join(root, ".peach-link.rsp"), { force: true });
16109
- if ((0, import_node_fs19.existsSync)(linked) && (0, import_node_fs19.statSync)(linked).size <= 8)
16110
- (0, import_node_fs19.rmSync)(linked, { force: true });
16109
+ if (input.optimize) {
16110
+ (0, import_node_fs19.rmSync)(import_node_path19.default.join(root, ".peach-link.rsp"), { force: true });
16111
+ if ((0, import_node_fs19.existsSync)(linked) && (0, import_node_fs19.statSync)(linked).size <= 8)
16112
+ (0, import_node_fs19.rmSync)(linked, { force: true });
16113
+ }
16111
16114
  report("compiling and linking Swift modules");
16112
16115
  try {
16113
16116
  const headerBuilds = preparation.headerProductTarget ? [
@@ -16221,13 +16224,14 @@ function compileSwiftProjectOnce(input, options) {
16221
16224
  );
16222
16225
  }
16223
16226
  if (options.project) removeProjectLinks(root);
16224
- pruneSwiftWasmLink(
16225
- root,
16226
- options.toolchainBin,
16227
- frameworkRoot,
16228
- input.staticClangTargets,
16229
- options.project
16230
- );
16227
+ if (input.optimize)
16228
+ pruneSwiftWasmLink(
16229
+ root,
16230
+ options.toolchainBin,
16231
+ frameworkRoot,
16232
+ input.staticClangTargets,
16233
+ options.project
16234
+ );
16231
16235
  const output2 = options.project ? projectOutputFile(root, linked, options.project) : linked;
16232
16236
  const optimized = `${output2}.optimized`;
16233
16237
  if (input.optimize) await optimizeWasm(output2, optimized);
@@ -24925,7 +24929,7 @@ function sourceClosureDigest(srcDir, entrypoints) {
24925
24929
  return hash.digest("hex");
24926
24930
  }
24927
24931
  var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
24928
- var STANDIN_SOURCE_DIGEST = true ? "bd8e32c07fde4e95b32471690e07a890275838ac56295defcbb56b4b59a7f066" : standinSourceDigest();
24932
+ var STANDIN_SOURCE_DIGEST = true ? "3aae44df21589ccc4ee37b75dadeaabf7588816d438527b310b508e1e1c4833c" : standinSourceDigest();
24929
24933
 
24930
24934
  // src/swift-standins.ts
24931
24935
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1874 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1876 | (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;
@@ -203,7 +203,7 @@ function isValidRuntimeVersion(value) {
203
203
  }
204
204
 
205
205
  // runtime-companion.json
206
- var runtime_companion_default = { abi: 1, sha256: "1e9d1926d6b063b7e648e1d5c73450253a26fa9c9d64ed164b9cde20eb45f373", file: "node/cli-1e9d1926d6b063b7e648e1d5c73450253a26fa9c9d64ed164b9cde20eb45f373.cjs" };
206
+ var runtime_companion_default = { abi: 1, sha256: "f4d0f1f81d2b1da32bc29c46144f871a0455de78cbad62a2eaa660f63aed2467", file: "node/cli-f4d0f1f81d2b1da32bc29c46144f871a0455de78cbad62a2eaa660f63aed2467.cjs" };
207
207
 
208
208
  // src/answeredNativePackages.ts
209
209
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1874 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1876 | (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;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1874 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1876 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/worklet-executable.ts
4
4
  import { parse } from "acorn";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.1874",
3
+ "version": "0.1.1876",
4
4
  "description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
5
5
  "author": "Tamagui LLC",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -1 +1 @@
1
- {"abi":1,"sha256":"1e9d1926d6b063b7e648e1d5c73450253a26fa9c9d64ed164b9cde20eb45f373","file":"node/cli-1e9d1926d6b063b7e648e1d5c73450253a26fa9c9d64ed164b9cde20eb45f373.cjs"}
1
+ {"abi":1,"sha256":"f4d0f1f81d2b1da32bc29c46144f871a0455de78cbad62a2eaa660f63aed2467","file":"node/cli-f4d0f1f81d2b1da32bc29c46144f871a0455de78cbad62a2eaa660f63aed2467.cjs"}
@@ -123,8 +123,9 @@ commands in your own `sleep` or chain `do settle` "just to be safe"**.
123
123
  - **after write commands** (`tap`, `tap-text`, `tap-id`, `type`,
124
124
  `type-into`, `key`, `key-sequence`, `keycode`, `drag`, `swipe`,
125
125
  `long-press`, `touch`, `gesture`, `pinch`, `scroll`, `shell`)
126
- the CLI polls the layout hash until it is stable for two consecutive
127
- frames. budget: **800 ms for agents** (`PEACH_AGENT=1`, set by the
126
+ the CLI waits for the app's render activity to go idle and stay idle
127
+ for two frames (plus any screen transition it started), without polling
128
+ the app. budget: **800 ms for agents** (`PEACH_AGENT=1`, set by the
128
129
  harness), 200 ms for humans.
129
130
 
130
131
  what this means:
@@ -1,9 +1,12 @@
1
1
  // publish the plain OTA bundle for Peach without changing the phone's bytecode.
2
2
  import { createHash } from 'node:crypto'
3
+ import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'
4
+ import { basename, dirname, join } from 'node:path'
3
5
  import { Script } from 'node:vm'
4
6
  import { brotliCompressSync, constants as zlibConstants, gunzipSync } from 'node:zlib'
5
7
  import { isLoopbackHost } from './backend-origin'
6
8
  import { resolveConnectionInput } from './dev-bundle-resolution'
9
+ import { cacheDir } from './home-paths'
7
10
  import { readInstalledNativePackageVersionsAsync } from './installed-package-versions'
8
11
  import { buildNativeBundles, insertNativeBundleFooters } from './native-bundles'
9
12
  import { nodeHttpFetch } from './node-http-fetch'
@@ -219,6 +222,23 @@ function prepareChannel({
219
222
  return { platform, key: `${prefix}/${channelKey(platform)}`, metadata, objects }
220
223
  }
221
224
 
225
+ // quality 11 takes minutes on the large swift and icu objects, which rarely
226
+ // change between releases, so their compressed bytes are kept by content.
227
+ function brotliCompressCached(bytes) {
228
+ const file = join(cacheDir(), 'bundle-channel-brotli', `${digest(bytes)}-q11-w24.br`)
229
+ if (existsSync(file)) return readFileSync(file)
230
+ const compressed = brotliCompressSync(bytes, {
231
+ params: {
232
+ [zlibConstants.BROTLI_PARAM_QUALITY]: 11,
233
+ [zlibConstants.BROTLI_PARAM_LGWIN]: 24,
234
+ },
235
+ })
236
+ mkdirSync(dirname(file), { recursive: true })
237
+ writeFileSync(`${file}.${process.pid}`, compressed)
238
+ renameSync(`${file}.${process.pid}`, file)
239
+ return compressed
240
+ }
241
+
222
242
  export async function publishBundleChannel(release, { put, fetchObject = fetch }) {
223
243
  const precompressBrotli = !isLoopbackHost(new URL(release.origin).hostname)
224
244
  // prove every immutable object is downloadable before changing a channel.
@@ -238,12 +258,7 @@ export async function publishBundleChannel(release, { put, fetchObject = fetch }
238
258
  object.contentType === 'application/gzip'
239
259
  ? gunzipSync(object.bytes)
240
260
  : object.bytes
241
- wireBytes = brotliCompressSync(expectedDecoded, {
242
- params: {
243
- [zlibConstants.BROTLI_PARAM_QUALITY]: 11,
244
- [zlibConstants.BROTLI_PARAM_LGWIN]: 24,
245
- },
246
- })
261
+ wireBytes = brotliCompressCached(expectedDecoded)
247
262
  if (object.contentType === 'application/gzip')
248
263
  contentType = 'application/octet-stream'
249
264
  contentEncoding = 'br'
@@ -297,8 +312,6 @@ async function packagePlatformBundle(
297
312
  bundle,
298
313
  { config, versions, readAssetFile, configuration },
299
314
  ) {
300
- const { readFileSync } = await import('node:fs')
301
- const { basename } = await import('node:path')
302
315
  const { produceConfiguredBundle } = await import('./configured-bundle-producer')
303
316
  const assets = new Map()
304
317
  for (const [registration] of bundle
@@ -426,7 +439,6 @@ export async function snapshotOneProductionBundle(
426
439
  const { execFile } = await import('node:child_process')
427
440
  const { mkdtemp, readFile, rm } = await import('node:fs/promises')
428
441
  const { tmpdir } = await import('node:os')
429
- const { join } = await import('node:path')
430
442
  const { promisify } = await import('node:util')
431
443
  const inputs = await readPackagingInputs(projectRoot)
432
444
  const snapshots = []
@@ -470,9 +482,7 @@ export async function snapshotOneDevBundle(
470
482
  { runtimeExecutable = process.execPath, platforms = ['ios', 'android'] } = {},
471
483
  ) {
472
484
  const { spawn } = await import('node:child_process')
473
- const { readFileSync } = await import('node:fs')
474
485
  const { createServer } = await import('node:net')
475
- const { dirname, join } = await import('node:path')
476
486
  const { createRequire } = await import('node:module')
477
487
  const onePackage = createRequire(join(projectRoot, 'package.json')).resolve(
478
488
  'one/package.json',
@@ -85,8 +85,10 @@ function readSources(value: unknown): FingerprintSource[] {
85
85
  function packageRootOf(appRoot: string, file: string): string | null {
86
86
  const parts = file.split('/')
87
87
  if (parts[0] !== 'node_modules') return null
88
- const depth = parts[1]?.startsWith('@') ? 3 : 2
89
- return parts.length > depth ? path.join(appRoot, ...parts.slice(0, depth)) : null
88
+ // pnpm keeps a package at node_modules/.pnpm/<id>/node_modules/<name>
89
+ const at = parts.lastIndexOf('node_modules') + 1
90
+ const end = at + (parts[at]?.startsWith('@') ? 2 : 1)
91
+ return parts.length > end ? path.join(appRoot, ...parts.slice(0, end)) : null
90
92
  }
91
93
 
92
94
  /**
@@ -61,7 +61,9 @@ export function readNativeAppIdentityFromXcodeTarget(
61
61
  nonEmptyString(dictionary.CFBundleVersion) ??
62
62
  nonEmptyString(settings?.('CURRENT_PROJECT_VERSION'))
63
63
  if (!appVersion || !buildVersion) {
64
- throw new Error('native app has no version or build version')
64
+ throw new Error(
65
+ 'native app has no version or build version; values its Xcode scheme derives in a build phase can be exported as process environment variables when opening',
66
+ )
65
67
  }
66
68
 
67
69
  const bundleName =
@@ -115,7 +115,11 @@ export function insertNativeBundleFooters(
115
115
  }
116
116
  if (natives.turbo) {
117
117
  const turbo = natives.turbo.metadata
118
- metadata.turbo = { ...turbo, url: served(turbo.url), icuUrl: served(turbo.icuUrl) }
118
+ metadata.turbo = {
119
+ ...turbo,
120
+ url: turbo.url && served(turbo.url),
121
+ icuUrl: turbo.icuUrl && served(turbo.icuUrl),
122
+ }
119
123
  source = insertTurboFooter(source, metadata.turbo)
120
124
  }
121
125
  return { source, metadata: Object.keys(metadata).length ? metadata : null }
@@ -147,26 +147,57 @@ function readCompiledMetadata<Package extends CompiledPackage>(
147
147
  export const readNitroMetadata = (value: unknown): NitroCompiledModule | null =>
148
148
  readCompiledMetadata('Nitro', value, readNitroPackage, (entry) => entry.hybridObjects)
149
149
  export function readTurboMetadata(value: unknown): TurboCompiledModule | null {
150
- const metadata = readCompiledMetadata(
151
- 'TurboModule',
152
- value,
153
- readCompiledPackage,
154
- () => [],
150
+ if (value === null || value === undefined) return null
151
+ if (
152
+ typeof value !== 'object' ||
153
+ Array.isArray(value) ||
154
+ Reflect.get(value, 'platform') !== NITRO_GUEST_PLATFORM
155
155
  )
156
- if (!metadata) return null
157
- const listed = Reflect.get(Object(value), 'unavailable')
158
- if (listed === undefined) return metadata
159
- if (!Array.isArray(listed)) throw new Error('invalid TurboModule compilation metadata')
160
- const unavailable = listed.map((entry) => {
156
+ throw new Error('invalid TurboModule compilation metadata')
157
+ const listed: unknown = Reflect.get(value, 'unavailable')
158
+ if (listed !== undefined && !Array.isArray(listed))
159
+ throw new Error('invalid TurboModule compilation metadata')
160
+ const unavailable = listed?.map((entry: unknown) => {
161
161
  if (
162
162
  !isRecord(entry) ||
163
163
  typeof entry.name !== 'string' ||
164
- typeof entry.diagnostic !== 'string'
164
+ !entry.name ||
165
+ typeof entry.diagnostic !== 'string' ||
166
+ !entry.diagnostic
165
167
  )
166
168
  throw new Error('invalid TurboModule compilation metadata')
167
169
  return { name: entry.name, diagnostic: entry.diagnostic }
168
170
  })
169
- return { ...metadata, unavailable }
171
+ const packages = Reflect.get(value, 'packages')
172
+ const packed = Reflect.get(value, 'bundleFiles')
173
+ if (
174
+ Array.isArray(packages) &&
175
+ packages.length === 0 &&
176
+ unavailable &&
177
+ unavailable.length > 0 &&
178
+ Reflect.get(value, 'url') === '' &&
179
+ Reflect.get(value, 'hash') === '' &&
180
+ Reflect.get(value, 'icuUrl') === '' &&
181
+ isRecord(packed) &&
182
+ Object.keys(packed).length === 0
183
+ ) {
184
+ return {
185
+ platform: 'ios',
186
+ packages: [],
187
+ url: '',
188
+ hash: '',
189
+ icuUrl: '',
190
+ bundleFiles: {},
191
+ unavailable,
192
+ }
193
+ }
194
+ const metadata = readCompiledMetadata(
195
+ 'TurboModule',
196
+ value,
197
+ readCompiledPackage,
198
+ () => [],
199
+ )
200
+ return metadata && (unavailable ? { ...metadata, unavailable } : metadata)
170
201
  }
171
202
 
172
203
  export function readNitroFooter(source: string): NitroCompiledModule | null {
package/src/sim-client.ts CHANGED
@@ -364,15 +364,17 @@ export class SimClient implements WsBridge, InspectBridge {
364
364
  * wait for layout/animation/transition settle after an interaction.
365
365
  * a still-busy guest returns settled false with its own elapsed time.
366
366
  * a failed idle read throws IdleObservationError with the host elapsed
367
- * time and the original failure.
367
+ * time and the original failure. motionOnly waits on pushed render activity
368
+ * and screen transitions alone, the settle that follows a gesture.
368
369
  */
369
370
  settle(
370
- opts: { maxMs?: number; strict?: boolean } = {},
371
+ opts: { maxMs?: number; strict?: boolean; motionOnly?: boolean } = {},
371
372
  ): Promise<WaitForSootsimIdleResult> {
372
373
  return waitForSootsimIdle({
373
374
  bridge: this,
374
375
  maxMs: opts.maxMs ?? 3_000,
375
376
  strict: opts.strict,
377
+ ...(opts.motionOnly ? { motionOnly: true, pollMs: 32, stablePolls: 2 } : {}),
376
378
  })
377
379
  }
378
380
 
@@ -1613,6 +1613,8 @@ export function emitSwiftPackageManifest(args: {
1613
1613
  * then links only the stdlib and system archives its sources reference.
1614
1614
  */
1615
1615
  distributionLink?: { path: string; files: Map<string, string | Buffer> }
1616
+ /** link the distribution as an archive pruned after the link: size-optimized artifacts only. */
1617
+ lazyDistribution?: boolean
1616
1618
  /**
1617
1619
  * framework products already built in their own scratch. objects link whole,
1618
1620
  * and modules import from that scratch, so this package's targets never
@@ -1673,9 +1675,11 @@ export function emitSwiftPackageManifest(args: {
1673
1675
  foundationCategoryObjects.map((name) => `lib/Foundation-${name}.o`),
1674
1676
  )
1675
1677
  const roots = swiftObjcRootObjects(distribution.id, moduleRoot, distribution.objects)
1676
- const eager = new Set(
1677
- objects.filter((object) => roots.has(object) || categoryObjects.has(object)),
1678
- )
1678
+ const eager = args.lazyDistribution
1679
+ ? new Set(
1680
+ objects.filter((object) => roots.has(object) || categoryObjects.has(object)),
1681
+ )
1682
+ : new Set(objects)
1679
1683
  // native headers can reference a framework without a Swift import, and a
1680
1684
  // native target can share a module name with distribution Swift helpers.
1681
1685
  // retain those objects in the archive so undefined symbols select them.
@@ -5449,6 +5453,7 @@ export function writeSwiftProject(
5449
5453
  path: path.join(layout.root, '.peach-distribution-objects.rsp'),
5450
5454
  files,
5451
5455
  },
5456
+ lazyDistribution: input.optimize,
5452
5457
  }
5453
5458
  : {}),
5454
5459
  ...(prebuilt && frameworkLink
@@ -6526,7 +6531,7 @@ function compileSwiftProjectOnce(
6526
6531
  .join(':'),
6527
6532
  }
6528
6533
  : {}),
6529
- PEACH_DEFER_WASM_LINK: '1',
6534
+ ...(input.optimize ? { PEACH_DEFER_WASM_LINK: '1' } : {}),
6530
6535
  },
6531
6536
  maxBuffer: 64 * 1024 * 1024,
6532
6537
  timeout: options.timeoutMs,
@@ -6646,9 +6651,11 @@ function compileSwiftProjectOnce(
6646
6651
  ]),
6647
6652
  ]
6648
6653
  const linked = builtArtifact(layout)
6649
- rmSync(path.join(root, '.peach-link.rsp'), { force: true })
6650
- if (existsSync(linked) && statSync(linked).size <= 8)
6651
- rmSync(linked, { force: true })
6654
+ if (input.optimize) {
6655
+ rmSync(path.join(root, '.peach-link.rsp'), { force: true })
6656
+ if (existsSync(linked) && statSync(linked).size <= 8)
6657
+ rmSync(linked, { force: true })
6658
+ }
6652
6659
  report('compiling and linking Swift modules')
6653
6660
  try {
6654
6661
  // clang consumes the real emitted headers after swift finishes.
@@ -6786,13 +6793,14 @@ function compileSwiftProjectOnce(
6786
6793
  )
6787
6794
  }
6788
6795
  if (options.project) removeProjectLinks(root)
6789
- pruneSwiftWasmLink(
6790
- root,
6791
- options.toolchainBin,
6792
- frameworkRoot,
6793
- input.staticClangTargets,
6794
- options.project,
6795
- )
6796
+ if (input.optimize)
6797
+ pruneSwiftWasmLink(
6798
+ root,
6799
+ options.toolchainBin,
6800
+ frameworkRoot,
6801
+ input.staticClangTargets,
6802
+ options.project,
6803
+ )
6796
6804
  const output = options.project
6797
6805
  ? projectOutputFile(root, linked, options.project)
6798
6806
  : linked
package/src/swift-host.ts CHANGED
@@ -2110,8 +2110,12 @@ export function sourceContentStamp(
2110
2110
  hash.update(JSON.stringify(projects().get(packagePath)?.nativeFiles ?? {}))
2111
2111
  hash.update(JSON.stringify(projects().get(packagePath)?.resourceBundles ?? []))
2112
2112
  hash.update(JSON.stringify(projects().get(packagePath)?.bundleFiles ?? null))
2113
+ // packageFiles answers canonical paths; a temporary build copy sits under a
2114
+ // linked directory on macOS, and relative to the link its names would carry
2115
+ // this process's copy directory.
2116
+ const root = fs.realpathSync(packagePath)
2113
2117
  for (const file of [...new Set(packageFiles(packagePath))].sort()) {
2114
- hash.update(path.relative(packagePath, file))
2118
+ hash.update(path.relative(root, file))
2115
2119
  hash.update(fs.readFileSync(file))
2116
2120
  }
2117
2121
  hash.update(moduleStamp(packagePath, moduleRootOverride, false))
@@ -65,7 +65,20 @@ export async function compileTurboApp(
65
65
  const compiled = providers.filter(({ name }) => !installed?.unavailable.has(name))
66
66
  if (compiled.length === 0) {
67
67
  for (const { diagnostic } of unavailable) console.warn(`[peach] ${diagnostic}`)
68
- return null
68
+ return unavailable.length > 0
69
+ ? {
70
+ artifact: null,
71
+ metadata: {
72
+ platform: 'ios',
73
+ packages: [],
74
+ url: '',
75
+ hash: '',
76
+ icuUrl: '',
77
+ bundleFiles: {},
78
+ unavailable,
79
+ },
80
+ }
81
+ : null
69
82
  }
70
83
  const { artifact, collection } = await compileTurboModule({
71
84
  appRoot,
@@ -139,9 +139,10 @@ export function registersReactModule(source: string): boolean {
139
139
  }
140
140
 
141
141
  function fabricComponents(root: string): boolean {
142
- const manifest: unknown = JSON.parse(
143
- fs.readFileSync(path.join(root, 'package.json'), 'utf8'),
144
- )
142
+ // an app-local Expo module has no manifest, so no codegen config
143
+ const manifestPath = path.join(root, 'package.json')
144
+ if (!fs.existsSync(manifestPath)) return false
145
+ const manifest: unknown = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
145
146
  if (!object(manifest) || !object(manifest.codegenConfig)) return false
146
147
  // codegen's third-party component generator excludes only module libraries;
147
148
  // component classes may come from ios.components or native annotations.