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
  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;
@@ -47791,9 +47791,9 @@ function emitSwiftPackageManifest(args) {
47791
47791
  foundationCategoryObjects.map((name3) => `lib/Foundation-${name3}.o`)
47792
47792
  );
47793
47793
  const roots = swiftObjcRootObjects(distribution.id, moduleRoot, distribution.objects);
47794
- const eager = new Set(
47794
+ const eager = args.lazyDistribution ? new Set(
47795
47795
  objects.filter((object4) => roots.has(object4) || categoryObjects.has(object4))
47796
- );
47796
+ ) : new Set(objects);
47797
47797
  const list2 = [
47798
47798
  ...[...eager].map(quoted),
47799
47799
  "-Wl,--start-lib",
@@ -50013,7 +50013,8 @@ module ${moduleName2}.Swift {
50013
50013
  distributionLink: {
50014
50014
  path: import_node_path40.default.join(layout.root, ".peach-distribution-objects.rsp"),
50015
50015
  files: files2
50016
- }
50016
+ },
50017
+ lazyDistribution: input.optimize
50017
50018
  } : {},
50018
50019
  ...prebuilt && frameworkLink ? {
50019
50020
  prebuilt: {
@@ -50830,7 +50831,7 @@ function compileSwiftProjectOnce(input, options) {
50830
50831
  process.env.LD_LIBRARY_PATH
50831
50832
  ].filter(Boolean).join(":")
50832
50833
  } : {},
50833
- PEACH_DEFER_WASM_LINK: "1"
50834
+ ...input.optimize ? { PEACH_DEFER_WASM_LINK: "1" } : {}
50834
50835
  },
50835
50836
  maxBuffer: 64 * 1024 * 1024,
50836
50837
  timeout: options.timeoutMs,
@@ -50930,9 +50931,11 @@ function compileSwiftProjectOnce(input, options) {
50930
50931
  ])
50931
50932
  ];
50932
50933
  const linked = builtArtifact(layout);
50933
- (0, import_node_fs43.rmSync)(import_node_path40.default.join(root, ".peach-link.rsp"), { force: true });
50934
- if ((0, import_node_fs43.existsSync)(linked) && (0, import_node_fs43.statSync)(linked).size <= 8)
50935
- (0, import_node_fs43.rmSync)(linked, { force: true });
50934
+ if (input.optimize) {
50935
+ (0, import_node_fs43.rmSync)(import_node_path40.default.join(root, ".peach-link.rsp"), { force: true });
50936
+ if ((0, import_node_fs43.existsSync)(linked) && (0, import_node_fs43.statSync)(linked).size <= 8)
50937
+ (0, import_node_fs43.rmSync)(linked, { force: true });
50938
+ }
50936
50939
  report("compiling and linking Swift modules");
50937
50940
  try {
50938
50941
  const headerBuilds = preparation.headerProductTarget ? [
@@ -51046,13 +51049,14 @@ function compileSwiftProjectOnce(input, options) {
51046
51049
  );
51047
51050
  }
51048
51051
  if (options.project) removeProjectLinks(root);
51049
- pruneSwiftWasmLink(
51050
- root,
51051
- options.toolchainBin,
51052
- frameworkRoot,
51053
- input.staticClangTargets,
51054
- options.project
51055
- );
51052
+ if (input.optimize)
51053
+ pruneSwiftWasmLink(
51054
+ root,
51055
+ options.toolchainBin,
51056
+ frameworkRoot,
51057
+ input.staticClangTargets,
51058
+ options.project
51059
+ );
51056
51060
  const output2 = options.project ? projectOutputFile(root, linked, options.project) : linked;
51057
51061
  const optimized = `${output2}.optimized`;
51058
51062
  if (input.optimize) await optimizeWasm(output2, optimized);
@@ -51239,7 +51243,7 @@ var init_swift_compile = __esm({
51239
51243
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
51240
51244
  MULTI_MANIFEST_VERSION = 65;
51241
51245
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
51242
- compilerSourceDigest = true ? "16355cfe66c10b553640a95acf7ed3b7f810db06602eb8edab8620da0ec7b94a" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
51246
+ compilerSourceDigest = true ? "bbb12360ef251bb3cd28572f60d5685f72ddb59c847cbbbf6d154c0bea302b2e" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
51243
51247
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
51244
51248
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
51245
51249
  cxxFlagArray = (flags) => JSON.stringify([...nativeCxxCompilerFlags, ...withoutGlogModuleMap(flags)]);
@@ -58583,7 +58587,7 @@ var init_swift_standin_digest = __esm({
58583
58587
  STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
58584
58588
  SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
58585
58589
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
58586
- STANDIN_SOURCE_DIGEST = true ? "bd8e32c07fde4e95b32471690e07a890275838ac56295defcbb56b4b59a7f066" : standinSourceDigest();
58590
+ STANDIN_SOURCE_DIGEST = true ? "3aae44df21589ccc4ee37b75dadeaabf7588816d438527b310b508e1e1c4833c" : standinSourceDigest();
58587
58591
  }
58588
58592
  });
58589
58593
 
@@ -58661,7 +58665,9 @@ function readNativeAppIdentityFromXcodeTarget(app, parseInfoPlist = parsePlistSo
58661
58665
  const appVersion = nonEmptyString2(dictionary2.CFBundleShortVersionString) ?? nonEmptyString2(settings?.("MARKETING_VERSION"));
58662
58666
  const buildVersion = nonEmptyString2(dictionary2.CFBundleVersion) ?? nonEmptyString2(settings?.("CURRENT_PROJECT_VERSION"));
58663
58667
  if (!appVersion || !buildVersion) {
58664
- throw new Error("native app has no version or build version");
58668
+ throw new Error(
58669
+ "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"
58670
+ );
58665
58671
  }
58666
58672
  const bundleName = nonEmptyString2(dictionary2.CFBundleName) ?? nonEmptyString2(settings?.("PRODUCT_NAME")) ?? app.name;
58667
58673
  const applicationDisplayName = nonEmptyString2(dictionary2.CFBundleDisplayName);
@@ -59026,22 +59032,37 @@ function readCompiledMetadata(label, value, readPackage, names) {
59026
59032
  return { platform: "ios", packages, url, hash, icuUrl: icuUrl2, bundleFiles };
59027
59033
  }
59028
59034
  function readTurboMetadata(value) {
59035
+ if (value === null || value === void 0) return null;
59036
+ if (typeof value !== "object" || Array.isArray(value) || Reflect.get(value, "platform") !== NITRO_GUEST_PLATFORM)
59037
+ throw new Error("invalid TurboModule compilation metadata");
59038
+ const listed = Reflect.get(value, "unavailable");
59039
+ if (listed !== void 0 && !Array.isArray(listed))
59040
+ throw new Error("invalid TurboModule compilation metadata");
59041
+ const unavailable2 = listed?.map((entry) => {
59042
+ if (!isRecord(entry) || typeof entry.name !== "string" || !entry.name || typeof entry.diagnostic !== "string" || !entry.diagnostic)
59043
+ throw new Error("invalid TurboModule compilation metadata");
59044
+ return { name: entry.name, diagnostic: entry.diagnostic };
59045
+ });
59046
+ const packages = Reflect.get(value, "packages");
59047
+ const packed = Reflect.get(value, "bundleFiles");
59048
+ if (Array.isArray(packages) && packages.length === 0 && unavailable2 && unavailable2.length > 0 && Reflect.get(value, "url") === "" && Reflect.get(value, "hash") === "" && Reflect.get(value, "icuUrl") === "" && isRecord(packed) && Object.keys(packed).length === 0) {
59049
+ return {
59050
+ platform: "ios",
59051
+ packages: [],
59052
+ url: "",
59053
+ hash: "",
59054
+ icuUrl: "",
59055
+ bundleFiles: {},
59056
+ unavailable: unavailable2
59057
+ };
59058
+ }
59029
59059
  const metadata = readCompiledMetadata(
59030
59060
  "TurboModule",
59031
59061
  value,
59032
59062
  readCompiledPackage,
59033
59063
  () => []
59034
59064
  );
59035
- if (!metadata) return null;
59036
- const listed = Reflect.get(Object(value), "unavailable");
59037
- if (listed === void 0) return metadata;
59038
- if (!Array.isArray(listed)) throw new Error("invalid TurboModule compilation metadata");
59039
- const unavailable2 = listed.map((entry) => {
59040
- if (!isRecord(entry) || typeof entry.name !== "string" || typeof entry.diagnostic !== "string")
59041
- throw new Error("invalid TurboModule compilation metadata");
59042
- return { name: entry.name, diagnostic: entry.diagnostic };
59043
- });
59044
- return { ...metadata, unavailable: unavailable2 };
59065
+ return metadata && (unavailable2 ? { ...metadata, unavailable: unavailable2 } : metadata);
59045
59066
  }
59046
59067
  var NITRO_GUEST_PLATFORM, readNitroMetadata;
59047
59068
  var init_nitroContract = __esm({
@@ -59110,8 +59131,9 @@ function readSources(value) {
59110
59131
  function packageRootOf(appRoot, file) {
59111
59132
  const parts = file.split("/");
59112
59133
  if (parts[0] !== "node_modules") return null;
59113
- const depth = parts[1]?.startsWith("@") ? 3 : 2;
59114
- return parts.length > depth ? import_node_path57.default.join(appRoot, ...parts.slice(0, depth)) : null;
59134
+ const at = parts.lastIndexOf("node_modules") + 1;
59135
+ const end = at + (parts[at]?.startsWith("@") ? 2 : 1);
59136
+ return parts.length > end ? import_node_path57.default.join(appRoot, ...parts.slice(0, end)) : null;
59115
59137
  }
59116
59138
  async function expoNativeInputs(appRoot) {
59117
59139
  appRoot = import_node_fs59.default.realpathSync(appRoot);
@@ -59294,7 +59316,7 @@ var init_expo_native_prebuilt = __esm({
59294
59316
  init_swift_native_pin();
59295
59317
  init_xcode_project();
59296
59318
  EXPO_NATIVE_ENTRY_NAME = "ios";
59297
- EXPO_NATIVE_COMPILER_DIGEST = true ? "56768b586c8abed368bc0b809466dd18e971de9e5684301bed01591bcbb3a12c" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
59319
+ EXPO_NATIVE_COMPILER_DIGEST = true ? "1651e5d5a4c1c41d29a8dfc1164aaf460a20a7ae8a359e302bcde615f26387b2" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
59298
59320
  IDENTITY_SOURCE_SKIPS = 1 | 4 | 8 | 16 | 32 | 64 | 128 | 4096;
59299
59321
  expoNativeEntryUrl = (key2, file) => `${NATIVE_PREBUILT_ORIGIN}/${nativeEntryPrefix("expo", EXPO_NATIVE_ENTRY_NAME, key2)}/${file}`;
59300
59322
  isStringRecord = (value) => isRecord(value) && Object.values(value).every((item) => typeof item === "string");
@@ -68374,8 +68396,9 @@ function sourceContentStamp(packagePath, moduleRootOverride) {
68374
68396
  hash.update(JSON.stringify(projects().get(packagePath)?.nativeFiles ?? {}));
68375
68397
  hash.update(JSON.stringify(projects().get(packagePath)?.resourceBundles ?? []));
68376
68398
  hash.update(JSON.stringify(projects().get(packagePath)?.bundleFiles ?? null));
68399
+ const root = import_node_fs73.default.realpathSync(packagePath);
68377
68400
  for (const file of [...new Set(packageFiles(packagePath))].sort()) {
68378
- hash.update(import_node_path70.default.relative(packagePath, file));
68401
+ hash.update(import_node_path70.default.relative(root, file));
68379
68402
  hash.update(import_node_fs73.default.readFileSync(file));
68380
68403
  }
68381
68404
  hash.update(moduleStamp(packagePath, moduleRootOverride, false));
@@ -71310,9 +71333,9 @@ function registersReactModule(source) {
71310
71333
  return OBJC_BRIDGE.test(stripped2) && !/-Swift\.h\b/.test(stripped2);
71311
71334
  }
71312
71335
  function fabricComponents(root) {
71313
- const manifest = JSON.parse(
71314
- import_node_fs77.default.readFileSync(import_node_path74.default.join(root, "package.json"), "utf8")
71315
- );
71336
+ const manifestPath = import_node_path74.default.join(root, "package.json");
71337
+ if (!import_node_fs77.default.existsSync(manifestPath)) return false;
71338
+ const manifest = JSON.parse(import_node_fs77.default.readFileSync(manifestPath, "utf8"));
71316
71339
  if (!object3(manifest) || !object3(manifest.codegenConfig)) return false;
71317
71340
  return manifest.codegenConfig.type !== "modules";
71318
71341
  }
@@ -77070,7 +77093,7 @@ var init_nitro_superset = __esm({
77070
77093
  init_swift_standin_digest();
77071
77094
  NITRO_SUPERSET_ENTRY_NAME = "superset";
77072
77095
  packageVersion = (root) => JSON.parse((0, import_node_fs86.readFileSync)((0, import_node_path83.join)(root, "package.json"), "utf8")).version;
77073
- NITRO_COMPILER_DIGEST = true ? "5a02e7fa03e20f7cc2acbe461109d7f5fbb6d88c7377335749c98c5d31329376" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
77096
+ NITRO_COMPILER_DIGEST = true ? "db7c5efbd6c73a155ea9f813c5f790bea9300cdae787dbbe13a796793329ff23" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
77074
77097
  nitroSupersetLock = parseLock(nitro_superset_lock_default);
77075
77098
  nitroSupersetKey = (inputs) => nativeEntryKey({ ...inputs, compiler: NITRO_COMPILER_DIGEST });
77076
77099
  published2 = /* @__PURE__ */ new Map();
@@ -77318,7 +77341,7 @@ var init_expo_widgets_bundle = __esm({
77318
77341
  var runtime_companion_default;
77319
77342
  var init_runtime_companion = __esm({
77320
77343
  "runtime-companion.json"() {
77321
- runtime_companion_default = { abi: 1, sha256: "1e9d1926d6b063b7e648e1d5c73450253a26fa9c9d64ed164b9cde20eb45f373", file: "node/cli-1e9d1926d6b063b7e648e1d5c73450253a26fa9c9d64ed164b9cde20eb45f373.cjs" };
77344
+ runtime_companion_default = { abi: 1, sha256: "f4d0f1f81d2b1da32bc29c46144f871a0455de78cbad62a2eaa660f63aed2467", file: "node/cli-f4d0f1f81d2b1da32bc29c46144f871a0455de78cbad62a2eaa660f63aed2467.cjs" };
77322
77345
  }
77323
77346
  });
77324
77347
 
@@ -77798,7 +77821,18 @@ async function compileTurboApp(appRoot, origin, moduleRoot, iosTarget) {
77798
77821
  const compiled = providers.filter(({ name: name3 }) => !installed2?.unavailable.has(name3));
77799
77822
  if (compiled.length === 0) {
77800
77823
  for (const { diagnostic } of unavailable2) console.warn(`[peach] ${diagnostic}`);
77801
- return null;
77824
+ return unavailable2.length > 0 ? {
77825
+ artifact: null,
77826
+ metadata: {
77827
+ platform: "ios",
77828
+ packages: [],
77829
+ url: "",
77830
+ hash: "",
77831
+ icuUrl: "",
77832
+ bundleFiles: {},
77833
+ unavailable: unavailable2
77834
+ }
77835
+ } : null;
77802
77836
  }
77803
77837
  const { artifact, collection } = await compileTurboModule({
77804
77838
  appRoot,
@@ -116781,6 +116815,105 @@ var init_maestro_accessibility = __esm({
116781
116815
  });
116782
116816
 
116783
116817
  // cli/commands/inspect/settling.ts
116818
+ function renderActivityIdleScript({
116819
+ maxMs,
116820
+ requiredStillMs,
116821
+ transitionStartWindowMs,
116822
+ transitionTimeoutMs
116823
+ }) {
116824
+ return `(async () => {
116825
+ const start = Date.now()
116826
+ const budgetMs = ${Math.max(0, Math.round(maxMs))}
116827
+ const requiredStillMs = ${Math.max(1, Math.round(requiredStillMs))}
116828
+ let deadline = start + budgetMs
116829
+ // with no tenant running, nothing an app draws can move.
116830
+ const host = window.__sootsimRenderHost ?? null
116831
+ const initial = host ? host.getRenderActivity() : null
116832
+ // a published frame proves the idle flag is an observed worker state, not
116833
+ // the host's pre-boot default, so its idle interval counts from now even
116834
+ // when the busy-to-idle edge preceded this wait.
116835
+ let busySeen = !initial || initial.busy || initial.frameToken > 0
116836
+ let idleSince = !initial || (!initial.busy && initial.frameToken > 0) ? start : null
116837
+ let wake = null
116838
+ const notify = () => {
116839
+ const resolve = wake
116840
+ wake = null
116841
+ resolve?.()
116842
+ }
116843
+ const unsubscribe = host?.subscribeRenderActivity(() => {
116844
+ if (host.getRenderActivity().busy) {
116845
+ busySeen = true
116846
+ idleSince = null
116847
+ } else if (busySeen && idleSince === null) {
116848
+ idleSince = Date.now()
116849
+ }
116850
+ notify()
116851
+ })
116852
+ // a started screen transition moves the deadline: it drains, then the
116853
+ // budget proves the new screen. a loaded host runs a push past a tap's
116854
+ // budget, so the transition carries its own timeout.
116855
+ let transitionEndedAt = null
116856
+ let transitionPending = budgetMs > 120 && typeof window.__sootsimTest?.waitForScreenTransitions === 'function'
116857
+ if (transitionPending) {
116858
+ Promise.resolve()
116859
+ .then(() => window.__sootsimTest.waitForScreenTransitions({
116860
+ timeoutMs: ${Math.max(0, Math.round(transitionTimeoutMs))},
116861
+ settleMs: 64,
116862
+ startWindowMs: ${Math.max(0, Math.round(transitionStartWindowMs))},
116863
+ }))
116864
+ .then((transition) => {
116865
+ if (transition?.started !== true) return
116866
+ // a loaded worker replies after the motion stopped and says how long ago.
116867
+ transitionEndedAt = Date.now() - Math.max(0, transition.restedMs ?? 0)
116868
+ deadline = Math.max(deadline, transitionEndedAt + budgetMs)
116869
+ }, () => {})
116870
+ .finally(() => {
116871
+ transitionPending = false
116872
+ notify()
116873
+ })
116874
+ }
116875
+ try {
116876
+ while (true) {
116877
+ const now = Date.now()
116878
+ const quietSince = idleSince === null ? null : Math.max(idleSince, transitionEndedAt ?? idleSince)
116879
+ if (!transitionPending && quietSince !== null && now - quietSince >= requiredStillMs) {
116880
+ return { settled: true, elapsed: now - start, blockedBy: '' }
116881
+ }
116882
+ if (!transitionPending && now >= deadline) break
116883
+ const until = !transitionPending && quietSince !== null
116884
+ ? Math.min(quietSince + requiredStillMs, deadline)
116885
+ : deadline
116886
+ let timer = null
116887
+ await new Promise((resolve) => {
116888
+ wake = resolve
116889
+ if (until > now) timer = setTimeout(notify, until - now)
116890
+ })
116891
+ clearTimeout(timer)
116892
+ }
116893
+ } finally {
116894
+ unsubscribe?.()
116895
+ }
116896
+ const blockers = []
116897
+ const stats = await Promise.race([
116898
+ Promise.resolve().then(() => host?.queryStats()).catch(() => null),
116899
+ new Promise((resolve) => setTimeout(() => resolve(null), 500)),
116900
+ ])
116901
+ if (stats) {
116902
+ if (stats.hasActiveAnims) blockers.push('animations still running')
116903
+ if (stats.hasActiveBlockingNativeAnimations) blockers.push('native animations still running')
116904
+ if (stats.hasPendingBlockingAnimationFrames) blockers.push('frame callbacks still pending')
116905
+ if (stats.layoutDirty && stats.renderRequested) blockers.push('layout still dirty')
116906
+ }
116907
+ if (!blockers.length) blockers.push(idleSince === null ? 'tenant render activity still busy' : 'motion ended before stillness was proven')
116908
+ return {
116909
+ settled: false,
116910
+ elapsed: Date.now() - start,
116911
+ blockedBy: blockers.join(', ') + '; tenant activity ' + JSON.stringify({
116912
+ initial, current: host?.getRenderActivity() ?? null, busySeen, idleSince, transitionEndedAt, startedAt: start,
116913
+ }),
116914
+ }
116915
+ })()`;
116916
+ }
116784
116917
  async function waitForSootsimIdle({
116785
116918
  bridge,
116786
116919
  simId,
@@ -116802,7 +116935,12 @@ async function waitForSootsimIdle({
116802
116935
  {
116803
116936
  type: "evaluate",
116804
116937
  simId,
116805
- code: `(async () => {
116938
+ code: motionOnly ? renderActivityIdleScript({
116939
+ maxMs,
116940
+ requiredStillMs: Math.max(1, Math.round(stablePolls)) * Math.max(1, Math.round(pollMs)),
116941
+ transitionStartWindowMs,
116942
+ transitionTimeoutMs
116943
+ }) : `(async () => {
116806
116944
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
116807
116945
  // tests inject a virtual clock as window.__sootsimIdleClock ({ now, sleep })
116808
116946
  // so the stillness window is proven in virtual time: real-timer polls under
@@ -116825,13 +116963,12 @@ async function waitForSootsimIdle({
116825
116963
  const maestro = ${maestro ? "true" : "false"}
116826
116964
  const accessibilityBounds = ${accessibilityBounds.toString()}
116827
116965
  const sameNativeAccessibilityShape = ${sameNativeAccessibilityShape.toString()}
116828
- const motionOnly = ${motionOnly ? "true" : "false"}
116829
116966
  const readyPlayback = ${readyPlayback ? "true" : "false"}
116830
116967
  // full mounted-geometry observation needs at least two hierarchy reads
116831
116968
  // plus the stillness window, which a sub-second budget cannot afford:
116832
116969
  // tight budgets (auto-wait) settle on worker stillness plus root
116833
116970
  // membership, generous ones confirm the geometry too.
116834
- const fullGeometry = ${!maestro && !motionOnly && maxMs >= 1e3 ? "true" : "false"}
116971
+ const fullGeometry = ${!maestro && maxMs >= 1e3 ? "true" : "false"}
116835
116972
  const requiredStillMs = paintStill ? 0 : ${Math.max(1, Math.round(stablePolls)) * Math.max(1, Math.round(pollMs))}
116836
116973
  const minimumStablePolls = paintStill ? 1 : ${Math.min(2, Math.max(1, Math.round(stablePolls)))}
116837
116974
  const composite = paintStill ? window.SootSim?.bridges?.liveComposite : null
@@ -116841,50 +116978,7 @@ async function waitForSootsimIdle({
116841
116978
  // subscribe to presented frames; authoritative screenshots force a
116842
116979
  // worker render, which changes the very counter we used to inspect.
116843
116980
  const unsubscribe = composite?.subscribe(() => {})
116844
- // the tenant pushes each busy change to the page on the port its stats
116845
- // replies use, so a wait on motion alone learns when the worker went
116846
- // idle without asking it. its busy flag covers render work, guest and
116847
- // blocking native animation, blocking frame callbacks and text waits,
116848
- // everything a motion-only poll reads from it, so once it has held idle
116849
- // for the still window that proves stillness without a poll: a worker
116850
- // too loaded to answer twice within a gesture's budget still settles
116851
- // once its motion ends.
116852
- const activityHost = motionOnly ? window.__sootsimRenderHost : null
116853
- const initialActivity = activityHost?.getRenderActivity?.()
116854
- // a published frame proves this is an observed worker state, rather than
116855
- // the host's pre-boot default. subscribe to its continuous idle interval
116856
- // even when the busy-to-idle edge preceded this command.
116857
- let busySeen = initialActivity?.busy === true || initialActivity?.frameToken > 0
116858
- let idleSince = initialActivity?.busy === false && initialActivity?.frameToken > 0
116859
- ? clockNow()
116860
- : null
116861
- let idleWaiters = []
116862
- const unsubscribeActivity = activityHost?.subscribeRenderActivity?.(() => {
116863
- if (activityHost.getRenderActivity().busy) {
116864
- busySeen = true
116865
- idleSince = null
116866
- } else if (busySeen && idleSince === null) {
116867
- idleSince = clockNow()
116868
- const waiters = idleWaiters
116869
- idleWaiters = []
116870
- for (const waiter of waiters) waiter()
116871
- }
116872
- })
116873
116981
  let transitionEndedAt = null
116874
- // resolves once both the tenant and any drained transition have held idle.
116875
- const idleHeld = () =>
116876
- new Promise((resolve) => {
116877
- const check = () => {
116878
- if (idleSince === null) idleWaiters.push(check)
116879
- else {
116880
- const quietSince = Math.max(idleSince, transitionEndedAt ?? idleSince)
116881
- const remaining = requiredStillMs - (clockNow() - quietSince)
116882
- if (remaining <= 0) resolve(true)
116883
- else setTimeout(check, Math.max(1, remaining))
116884
- }
116885
- }
116886
- check()
116887
- })
116888
116982
  let pixelFrameToken = -1
116889
116983
  let screenPixels = null
116890
116984
  // the hierarchy read last taken and the geometry revision it answered.
@@ -116966,7 +117060,7 @@ async function waitForSootsimIdle({
116966
117060
  // and realizes its pixels. both owners must finish before settling.
116967
117061
  // the compositor rejects a stats request it is too busy to answer.
116968
117062
  const compositorRead = answer(() => window.__sootsimCompositor.getStats({ detail: 'readiness' })).catch(() => BUSY)
116969
- const countsRead = motionOnly ? null : answer(() => window.__sootsimTest?.getRequestCounts?.()).catch(() => null)
117063
+ const countsRead = answer(() => window.__sootsimTest?.getRequestCounts?.()).catch(() => null)
116970
117064
  // the mounted hierarchy in render-worker mode comes from the test
116971
117065
  // bridge: window.__sootsimRoot is an empty placeholder there, so a
116972
117066
  // walk over it hashes every screen to the same empty string while
@@ -117255,7 +117349,6 @@ async function waitForSootsimIdle({
117255
117349
  const hierarchyUnchanged = (current, previous) =>
117256
117350
  current !== null && previous !== null && current.length === previous.length &&
117257
117351
  current.every((node, index) => sameNativeAccessibilityShape(node, previous[index], accessibilityBounds))
117258
- const IDLE_HELD = { idleHeld: true }
117259
117352
  while (true) {
117260
117353
  if (clockNow() >= deadline) {
117261
117354
  if (!transitionWait) break
@@ -117267,33 +117360,7 @@ async function waitForSootsimIdle({
117267
117360
  if (clockNow() >= deadline) break
117268
117361
  }
117269
117362
  const pollStarted = clockNow()
117270
- const read = readSnapshot()
117271
- let snapshot = activityHost
117272
- ? await Promise.race([read, idleHeld().then(() => IDLE_HELD)])
117273
- : await read
117274
- // a completed read can win the race before a delayed timer callback.
117275
- // the recorded idle interval remains evidence even on that turn.
117276
- const idleProven = () => {
117277
- const quietSince = Math.max(idleSince ?? Infinity, transitionEndedAt ?? 0)
117278
- return idleSince !== null && quietSince + requiredStillMs <= deadline && clockNow() - quietSince >= requiredStillMs
117279
- }
117280
- while (activityHost && (snapshot === IDLE_HELD || idleProven())) {
117281
- if (transitionWait) {
117282
- await transitionWait
117283
- transitionWait = null
117284
- }
117285
- if (idleProven()) {
117286
- return { settled: true, elapsed: clockNow() - start, blockedBy: '' }
117287
- }
117288
- if (clockNow() >= deadline) {
117289
- snapshot = await read
117290
- break
117291
- }
117292
- // a transition can drain after the first idle interval. keep the
117293
- // pushed evidence armed while its remaining quiet interval holds;
117294
- // awaiting only the in-flight stats read would discard that proof.
117295
- snapshot = await Promise.race([read, idleHeld().then(() => IDLE_HELD)])
117296
- }
117363
+ const snapshot = await readSnapshot()
117297
117364
  if (snapshot.runtimeUnsupported) return snapshot.runtimeUnsupported
117298
117365
  // a read the deadline cut short observed nothing: the last full poll
117299
117366
  // names what held the settle, not a worker that ran out of budget.
@@ -117338,7 +117405,7 @@ async function waitForSootsimIdle({
117338
117405
  !snapshot.animating &&
117339
117406
  !snapshot.shellAnimating &&
117340
117407
  !snapshot.layoutDirty &&
117341
- (motionOnly || snapshot.pendingFetches === 0) &&
117408
+ snapshot.pendingFetches === 0 &&
117342
117409
  !snapshot.workerBusy &&
117343
117410
  !snapshot.webViewStarting
117344
117411
  const visuallyStill = maestro ? maestroStill :
@@ -117370,7 +117437,7 @@ async function waitForSootsimIdle({
117370
117437
  // grace (continuous background traffic must not block forever).
117371
117438
  if (
117372
117439
  stillProven() &&
117373
- (maestro || motionOnly || networkQuiet || clockNow() - visuallyStillSince >= networkQuietGraceMs)
117440
+ (maestro || networkQuiet || clockNow() - visuallyStillSince >= networkQuietGraceMs)
117374
117441
  ) {
117375
117442
  if (transitionWait) {
117376
117443
  await transitionWait
@@ -117395,13 +117462,6 @@ async function waitForSootsimIdle({
117395
117462
  const remainingPollMs = pollMs - (clockNow() - pollStarted)
117396
117463
  if (remainingPollMs > 0) await clockSleep(remainingPollMs)
117397
117464
  }
117398
- if (activityHost && idleSince !== null && idleSince + requiredStillMs <= deadline) {
117399
- if (transitionWait) await transitionWait
117400
- const quietSince = Math.max(idleSince ?? Infinity, transitionEndedAt ?? 0)
117401
- if (quietSince + requiredStillMs <= deadline && clockNow() - quietSince >= requiredStillMs) {
117402
- return { settled: true, elapsed: clockNow() - start, blockedBy: '' }
117403
- }
117404
- }
117405
117465
  if (!report) {
117406
117466
  return { settled: false, elapsed: clockNow() - start, blockedBy: 'no poll fit the budget' }
117407
117467
  }
@@ -117413,15 +117473,15 @@ async function waitForSootsimIdle({
117413
117473
  if (!maestro && last.layoutDirty) blockers.push('layout still dirty')
117414
117474
  if (!maestro && last.appCommits !== null && report.appCommits !== null && last.appCommits !== report.appCommits) blockers.push('layout commits still landing')
117415
117475
  if (!maestro && last.nodeCount !== null && report.nodeCount !== null && last.nodeCount !== report.nodeCount) blockers.push('node count still changing')
117416
- if (!maestro && !motionOnly && last.pendingFetches > 0) blockers.push(last.pendingFetches + ' image fetches pending')
117476
+ if (!maestro && last.pendingFetches > 0) blockers.push(last.pendingFetches + ' image fetches pending')
117417
117477
  if (last.workerBusy) blockers.push('a render worker too busy to report')
117418
117478
  if (last.webViewStarting) blockers.push(last.webViewBlocker || 'webView still starting')
117419
117479
  if (!maestro && last.layout !== report.layout) blockers.push('layout still changing')
117420
117480
  if (maestro && !hierarchyUnchanged(last.nativeHierarchy, report.nativeHierarchy)) blockers.push(last.nativeHierarchy === null ? 'native accessibility hierarchy unavailable' : 'native accessibility hierarchy still changing')
117421
117481
  if (paintStill && !last.screenPixels) blockers.push('screen pixels unavailable')
117422
117482
  else if (paintStill && !screenUnchanged(last.screenPixels, report.screenPixels)) blockers.push('screen pixels still changing')
117423
- if (!maestro && !motionOnly && last.requestInFlight > 0) blockers.push(last.requestInFlight + ' requests in flight')
117424
- else if (!maestro && !motionOnly && last.requestTotal !== report.requestTotal) blockers.push('new requests issued')
117483
+ if (!maestro && last.requestInFlight > 0) blockers.push(last.requestInFlight + ' requests in flight')
117484
+ else if (!maestro && last.requestTotal !== report.requestTotal) blockers.push('new requests issued')
117425
117485
  if (polls < 2) blockers.push('sim too busy to poll twice')
117426
117486
  // the last read is still: motion ended too near the deadline for the
117427
117487
  // stillness window to hold before it.
@@ -117432,12 +117492,10 @@ async function waitForSootsimIdle({
117432
117492
  blockedBy:
117433
117493
  blockers.join(', ') + ' over ' + polls + ' polls (layout changed ' + layoutChangedPolls +
117434
117494
  'x, layoutDirty ' + dirtyPolls + 'x, animating ' + animatingPolls + 'x, webViewStarting ' + webViewStartingPolls + 'x, screen changed ' + screenChangedPolls + 'x)' +
117435
- (lastLayoutChange ? '; last layout change ' + JSON.stringify(lastLayoutChange) : '') +
117436
- (activityHost ? '; tenant activity ' + JSON.stringify({ initial: initialActivity, current: activityHost.getRenderActivity?.(), busySeen, idleSince, transitionEndedAt, startedAt: start }) : ''),
117495
+ (lastLayoutChange ? '; last layout change ' + JSON.stringify(lastLayoutChange) : ''),
117437
117496
  }
117438
117497
  } finally {
117439
117498
  unsubscribe?.()
117440
- unsubscribeActivity?.()
117441
117499
  }
117442
117500
  })()`
117443
117501
  },
@@ -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;
@@ -7879,7 +7879,7 @@ var darwinRecordsRegion = (quoted) => quoted.length ? ["-Wl,--start-lib", ...quo
7879
7879
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
7880
7880
  var MULTI_MANIFEST_VERSION = 65;
7881
7881
  var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
7882
- var compilerSourceDigest = true ? "16355cfe66c10b553640a95acf7ed3b7f810db06602eb8edab8620da0ec7b94a" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
7882
+ var compilerSourceDigest = true ? "bbb12360ef251bb3cd28572f60d5685f72ddb59c847cbbbf6d154c0bea302b2e" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
7883
7883
  function swiftArtifactHash(input, release, moduleRoot) {
7884
7884
  const hash = (0, import_node_crypto8.createHash)("sha256");
7885
7885
  hash.update(`swift-compile
@@ -8030,9 +8030,9 @@ function emitSwiftPackageManifest(args) {
8030
8030
  foundationCategoryObjects.map((name2) => `lib/Foundation-${name2}.o`)
8031
8031
  );
8032
8032
  const roots = swiftObjcRootObjects(distribution.id, moduleRoot, distribution.objects);
8033
- const eager = new Set(
8033
+ const eager = args.lazyDistribution ? new Set(
8034
8034
  objects.filter((object) => roots.has(object) || categoryObjects.has(object))
8035
- );
8035
+ ) : new Set(objects);
8036
8036
  const list = [
8037
8037
  ...[...eager].map(quoted),
8038
8038
  "-Wl,--start-lib",
@@ -10957,7 +10957,8 @@ module ${moduleName}.Swift {
10957
10957
  distributionLink: {
10958
10958
  path: import_node_path19.default.join(layout.root, ".peach-distribution-objects.rsp"),
10959
10959
  files
10960
- }
10960
+ },
10961
+ lazyDistribution: input.optimize
10961
10962
  } : {},
10962
10963
  ...prebuilt && frameworkLink ? {
10963
10964
  prebuilt: {
@@ -11784,7 +11785,7 @@ function compileSwiftProjectOnce(input, options) {
11784
11785
  process.env.LD_LIBRARY_PATH
11785
11786
  ].filter(Boolean).join(":")
11786
11787
  } : {},
11787
- PEACH_DEFER_WASM_LINK: "1"
11788
+ ...input.optimize ? { PEACH_DEFER_WASM_LINK: "1" } : {}
11788
11789
  },
11789
11790
  maxBuffer: 64 * 1024 * 1024,
11790
11791
  timeout: options.timeoutMs,
@@ -11884,9 +11885,11 @@ function compileSwiftProjectOnce(input, options) {
11884
11885
  ])
11885
11886
  ];
11886
11887
  const linked = builtArtifact(layout);
11887
- (0, import_node_fs17.rmSync)(import_node_path19.default.join(root, ".peach-link.rsp"), { force: true });
11888
- if ((0, import_node_fs17.existsSync)(linked) && (0, import_node_fs17.statSync)(linked).size <= 8)
11889
- (0, import_node_fs17.rmSync)(linked, { force: true });
11888
+ if (input.optimize) {
11889
+ (0, import_node_fs17.rmSync)(import_node_path19.default.join(root, ".peach-link.rsp"), { force: true });
11890
+ if ((0, import_node_fs17.existsSync)(linked) && (0, import_node_fs17.statSync)(linked).size <= 8)
11891
+ (0, import_node_fs17.rmSync)(linked, { force: true });
11892
+ }
11890
11893
  report("compiling and linking Swift modules");
11891
11894
  try {
11892
11895
  const headerBuilds = preparation.headerProductTarget ? [
@@ -12000,13 +12003,14 @@ function compileSwiftProjectOnce(input, options) {
12000
12003
  );
12001
12004
  }
12002
12005
  if (options.project) removeProjectLinks(root);
12003
- pruneSwiftWasmLink(
12004
- root,
12005
- options.toolchainBin,
12006
- frameworkRoot,
12007
- input.staticClangTargets,
12008
- options.project
12009
- );
12006
+ if (input.optimize)
12007
+ pruneSwiftWasmLink(
12008
+ root,
12009
+ options.toolchainBin,
12010
+ frameworkRoot,
12011
+ input.staticClangTargets,
12012
+ options.project
12013
+ );
12010
12014
  const output = options.project ? projectOutputFile(root, linked, options.project) : linked;
12011
12015
  const optimized = `${output}.optimized`;
12012
12016
  if (input.optimize) await optimizeWasm(output, optimized);