peachsim 0.1.2244 → 0.1.2247

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 (93) hide show
  1. package/cli/bridge-flow-runner.ts +7 -6
  2. package/cli/commands/inspect/settling.ts +2 -1
  3. package/dist-lib/agent-daemon-client.cjs +1 -1
  4. package/dist-lib/agent-events.cjs +1 -1
  5. package/dist-lib/attached-projects.cjs +1 -1
  6. package/dist-lib/auth/shared-session.cjs +1 -1
  7. package/dist-lib/backend-origin.cjs +1 -1
  8. package/dist-lib/beta.cjs +1 -1
  9. package/dist-lib/beta.mjs +1 -1
  10. package/dist-lib/bridge-constants.cjs +1 -1
  11. package/dist-lib/bridge-contract-input.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.mjs +1 -1
  13. package/dist-lib/bridge-contract.cjs +1 -1
  14. package/dist-lib/bridge-contract.mjs +1 -1
  15. package/dist-lib/bundle-channel.cjs +90 -14
  16. package/dist-lib/capture-contract.cjs +1 -1
  17. package/dist-lib/capture-contract.mjs +1 -1
  18. package/dist-lib/cloud-contract.cjs +1 -1
  19. package/dist-lib/cloud-contract.mjs +1 -1
  20. package/dist-lib/cloud-test-args.cjs +1 -1
  21. package/dist-lib/cloud-test-args.mjs +1 -1
  22. package/dist-lib/cloud.cjs +1 -1
  23. package/dist-lib/cloud.mjs +1 -1
  24. package/dist-lib/config.cjs +1 -1
  25. package/dist-lib/config.mjs +1 -1
  26. package/dist-lib/detox/index.cjs +3 -2
  27. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  28. package/dist-lib/expo-swift-bundle.cjs +89 -13
  29. package/dist-lib/expo-swift-metadata.cjs +1 -1
  30. package/dist-lib/expo-swift-metadata.mjs +1 -1
  31. package/dist-lib/home-paths.cjs +1 -1
  32. package/dist-lib/host/bridge-host.cjs +90 -14
  33. package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
  34. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  35. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  36. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  37. package/dist-lib/host/websocket-proxy.cjs +1 -1
  38. package/dist-lib/index.cjs +5 -4
  39. package/dist-lib/jump-to-source-babel.cjs +1 -1
  40. package/dist-lib/jump-to-source-native.cjs +1 -1
  41. package/dist-lib/kotlin-host.cjs +1 -1
  42. package/dist-lib/menu.cjs +1 -1
  43. package/dist-lib/menu.mjs +1 -1
  44. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  46. package/dist-lib/metro-production-bundle.cjs +1 -1
  47. package/dist-lib/metro-production-bundle.mjs +1 -1
  48. package/dist-lib/metro.cjs +3 -3
  49. package/dist-lib/native-app-identity-project.cjs +2 -2
  50. package/dist-lib/native-app-identity-project.mjs +2 -2
  51. package/dist-lib/native-app-identity.cjs +1 -1
  52. package/dist-lib/native-app-identity.mjs +1 -1
  53. package/dist-lib/native-firebase-metadata.cjs +1 -1
  54. package/dist-lib/native-firebase-metadata.mjs +1 -1
  55. package/dist-lib/pdfium-raster.cjs +1 -1
  56. package/dist-lib/pdfium-raster.mjs +1 -1
  57. package/dist-lib/plist.cjs +1 -1
  58. package/dist-lib/plist.mjs +1 -1
  59. package/dist-lib/profiles.cjs +1 -1
  60. package/dist-lib/public-brand.cjs +1 -1
  61. package/dist-lib/public-origins-lib-esm.json +24 -24
  62. package/dist-lib/public-origins-lib.json +53 -53
  63. package/dist-lib/react-native-host-modules.cjs +1 -1
  64. package/dist-lib/react-native-host-modules.mjs +1 -1
  65. package/dist-lib/reap-browser.cjs +1 -1
  66. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  67. package/dist-lib/sdk.cjs +3 -2
  68. package/dist-lib/sdk.mjs +3 -2
  69. package/dist-lib/skills.cjs +99 -21
  70. package/dist-lib/swift-compile.cjs +87 -11
  71. package/dist-lib/swift-compile.mjs +87 -11
  72. package/dist-lib/swift-package.cjs +1 -1
  73. package/dist-lib/swift-package.mjs +1 -1
  74. package/dist-lib/swift-submit.cjs +1 -1
  75. package/dist-lib/swift-submit.mjs +1 -1
  76. package/dist-lib/swift-toolchain.cjs +1 -1
  77. package/dist-lib/swift.cjs +1 -1
  78. package/dist-lib/vite-swift.cjs +88 -12
  79. package/dist-lib/vite.cjs +3 -3
  80. package/dist-lib/worklet-executable.cjs +1 -1
  81. package/dist-lib/worklet-executable.mjs +1 -1
  82. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +1 -1
  83. package/dist-types/packages/peach-engine/src/engine/node.d.ts +2 -0
  84. package/dist-types/packages/peach-engine/src/engine/text-nested.d.ts +1 -1
  85. package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -0
  86. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +8 -1
  87. package/dist-types/packages/peach-engine/src/render-worker/image-pixel-contract.d.ts +4 -0
  88. package/dist-types/packages/peach-engine/src/render-worker/resilient-frame-clock.d.ts +1 -0
  89. package/kotlin/sdk.tar.gz +0 -0
  90. package/package.json +1 -1
  91. package/src/swift-guest-image-ledger.ts +74 -7
  92. package/src/swift-guest-link.ts +3 -1
  93. package/src/swift-guest-linked-spans.ts +31 -1
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2247 | (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.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2247 | (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.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2247 | (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.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2247 | (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.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2247 | (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.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2247 | (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;
@@ -11795,6 +11795,7 @@ function rewriteObject(bytes, names, callerAlias, bindings, instrumentDynamicLoo
11795
11795
  const types = [];
11796
11796
  const functionTypes = [];
11797
11797
  const definitions = [];
11798
+ const functionImports = /* @__PURE__ */ new Map();
11798
11799
  let usesDlsym = false;
11799
11800
  let usesDlerror = false;
11800
11801
  const usedSymbols = /* @__PURE__ */ new Set();
@@ -11864,6 +11865,11 @@ function rewriteObject(bytes, names, callerAlias, bindings, instrumentDynamicLoo
11864
11865
  const isDlsym = instrumentDynamicLookups && module2 === "env" && name3 === "dlsym" && kind === 0;
11865
11866
  const isDlerror = instrumentDynamicLookups && module2 === "env" && name3 === "dlerror" && kind === 0;
11866
11867
  if (module2 === "env" && names.has(name3)) usedSymbols.add(name3);
11868
+ if (module2 === "env" && kind === 0 && names.has(name3)) {
11869
+ const type = types[functionType2];
11870
+ if (!type) throw new Error(`missing import type for ${name3}`);
11871
+ functionImports.set(name3, type);
11872
+ }
11867
11873
  if (isDlsym || isDlerror) {
11868
11874
  const type = types[functionType2];
11869
11875
  const expected = isDlsym ? "126,126:126" : ":126";
@@ -12013,6 +12019,7 @@ function rewriteObject(bytes, names, callerAlias, bindings, instrumentDynamicLoo
12013
12019
  return {
12014
12020
  bytes: Buffer.concat(sections2),
12015
12021
  definitions,
12022
+ functionImports,
12016
12023
  usesDlsym,
12017
12024
  usedSymbols: [...usedSymbols]
12018
12025
  };
@@ -12060,7 +12067,13 @@ function createGuestImageLedger(input) {
12060
12067
  /* @__PURE__ */ new Set()
12061
12068
  );
12062
12069
  if (rewritten.usesDlsym) callersUsingDlsym.add(image.id);
12063
- units.push({ image: image.id, object: object4, aliases, usedSymbols: rewritten.usedSymbols });
12070
+ units.push({
12071
+ image: image.id,
12072
+ object: object4,
12073
+ aliases,
12074
+ usedSymbols: rewritten.usedSymbols,
12075
+ functionImports: rewritten.functionImports
12076
+ });
12064
12077
  for (const symbol2 of rewritten.definitions) {
12065
12078
  if (symbol2.type && symbol2.type.results.length > 1)
12066
12079
  throw new Error(`multiple results for ${symbol2.name}`);
@@ -12145,9 +12158,33 @@ function createGuestImageLedger(input) {
12145
12158
  bindings.set(binding.symbol, matches[0].alias);
12146
12159
  startup.set(binding.object, bindings);
12147
12160
  }
12148
- const objects = units.map(({ image, object: object4, aliases }) => {
12161
+ const resultWrappers = /* @__PURE__ */ new Map();
12162
+ const definitionsByAlias = /* @__PURE__ */ new Map();
12163
+ for (const definition2 of definitions) {
12164
+ const previous = definitionsByAlias.get(definition2.alias);
12165
+ if (!previous || previous.weak && !definition2.weak)
12166
+ definitionsByAlias.set(definition2.alias, definition2);
12167
+ }
12168
+ const objects = units.map(({ image, object: object4, aliases, functionImports }) => {
12149
12169
  const bindings = new Map(bindingsByImage.get(image));
12150
12170
  for (const [name3, alias] of startup.get(object4.path) ?? []) bindings.set(name3, alias);
12171
+ for (const [name3, type] of functionImports) {
12172
+ const alias = bindings.get(name3);
12173
+ const provider = alias === void 0 ? void 0 : definitionsByAlias.get(alias);
12174
+ if (!provider || provider.kind !== "function" || provider.result !== "i32" || type.results.length !== 1 || type.results[0] !== 126 || type.parameters.map(llvmType).join(",") !== provider.parameters.join(","))
12175
+ continue;
12176
+ const key2 = `${image}:${provider.alias}`;
12177
+ let wrapper = resultWrappers.get(key2);
12178
+ if (!wrapper) {
12179
+ wrapper = {
12180
+ symbol: `__peach_integer_result_${image}_${resultWrappers.size}`,
12181
+ image,
12182
+ provider
12183
+ };
12184
+ resultWrappers.set(key2, wrapper);
12185
+ }
12186
+ bindings.set(name3, wrapper.symbol);
12187
+ }
12151
12188
  return {
12152
12189
  path: object4.path,
12153
12190
  instrumentDynamicLookups: object4.instrumentDynamicLookups,
@@ -12181,13 +12218,26 @@ function createGuestImageLedger(input) {
12181
12218
  'target triple = "wasm64-unknown-wasip1"',
12182
12219
  `@.names = private constant [${nameSize} x i8] c"${nameContents}"`
12183
12220
  ];
12184
- for (const definition2 of exported.values()) {
12221
+ const declarations = new Map(exported);
12222
+ for (const { provider } of resultWrappers.values())
12223
+ declarations.set(provider.alias, provider);
12224
+ for (const definition2 of declarations.values()) {
12185
12225
  if (definition2.kind === "function")
12186
12226
  ir.push(
12187
12227
  `declare ${definition2.result} @${definition2.alias}(${definition2.parameters.join(", ")})`
12188
12228
  );
12189
12229
  else ir.push(`@${definition2.alias} = external global i8`);
12190
12230
  }
12231
+ for (const { symbol: symbol2, provider } of resultWrappers.values()) {
12232
+ const parameters = provider.parameters.map((type, index) => `${type} %arg${index}`);
12233
+ ir.push(
12234
+ `define i64 @${symbol2}(${parameters.join(", ")}) {`,
12235
+ ` %word = call i32 @${provider.alias}(${parameters.join(", ")})`,
12236
+ " %result = zext i32 %word to i64",
12237
+ " ret i64 %result",
12238
+ "}"
12239
+ );
12240
+ }
12191
12241
  ir.push(`@__peach_dyld_symbols = constant [${exported.size} x { ptr, i32, ptr }] [`);
12192
12242
  ir.push(
12193
12243
  [...exported.values()].map(
@@ -12226,10 +12276,13 @@ function createGuestImageLedger(input) {
12226
12276
  callers: input.callers,
12227
12277
  definitions,
12228
12278
  objects,
12229
- callerWrappers: [...callersUsingDlsym].map((image) => ({
12230
- symbol: `__peach_dlsym_caller_${image}`,
12231
- image
12232
- })),
12279
+ callerWrappers: [
12280
+ ...[...callersUsingDlsym].map((image) => ({
12281
+ symbol: `__peach_dlsym_caller_${image}`,
12282
+ image
12283
+ })),
12284
+ ...[...resultWrappers.values()].map(({ symbol: symbol2, image }) => ({ symbol: symbol2, image }))
12285
+ ],
12233
12286
  llvmIR: ir.join("\n") + "\n"
12234
12287
  };
12235
12288
  }
@@ -12537,10 +12590,17 @@ function layout(bytes) {
12537
12590
  }
12538
12591
  if (pos !== dataSection[1]) throw new Error("invalid wasm data section");
12539
12592
  }
12593
+ const dataByAddress = data.map((segment, order) => ({ ...segment, order, maximumEnd: 0 })).sort((a, b) => a.address - b.address || a.order - b.order);
12594
+ let maximumEnd = 0;
12595
+ for (const segment of dataByAddress) {
12596
+ maximumEnd = Math.max(maximumEnd, segment.address + segment.bytes.length);
12597
+ segment.maximumEnd = maximumEnd;
12598
+ }
12540
12599
  return {
12541
12600
  functionsByCodeOffset,
12542
12601
  functionsByTableSlot,
12543
12602
  data,
12603
+ dataByAddress,
12544
12604
  memoryBytes: memoryPages * 65536
12545
12605
  };
12546
12606
  }
@@ -12595,7 +12655,21 @@ function guestLinkedSpans(map, before, after, owners, sectionOwners = /* @__PURE
12595
12655
  const optimizedOwners = /* @__PURE__ */ new Map();
12596
12656
  const dataAt = (module2, start, length) => {
12597
12657
  const result = Buffer.alloc(length);
12598
- for (const segment of module2.data) {
12658
+ let low = 0;
12659
+ let high = module2.dataByAddress.length;
12660
+ while (low < high) {
12661
+ const middle = Math.floor((low + high) / 2);
12662
+ if (module2.dataByAddress[middle].maximumEnd <= start) low = middle + 1;
12663
+ else high = middle;
12664
+ }
12665
+ const matching = [];
12666
+ for (let index = low; index < module2.dataByAddress.length; index++) {
12667
+ const segment = module2.dataByAddress[index];
12668
+ if (segment.address >= start + length) break;
12669
+ if (segment.address + segment.bytes.length > start) matching.push(segment);
12670
+ }
12671
+ matching.sort((a, b) => a.order - b.order);
12672
+ for (const segment of matching) {
12599
12673
  const first = Math.max(start, segment.address);
12600
12674
  const last = Math.min(start + length, segment.address + segment.bytes.length);
12601
12675
  if (first < last)
@@ -14036,7 +14110,9 @@ function linkGuestImages(options) {
14036
14110
  return { selected: selected2, ledger: ledger2 };
14037
14111
  };
14038
14112
  let prepared = prepare(false);
14039
- const provider = prepared.ledger.callerWrappers.length > 0;
14113
+ const provider = prepared.ledger.callerWrappers.some(
14114
+ ({ symbol: symbol2 }) => symbol2.startsWith("__peach_dlsym_caller_")
14115
+ );
14040
14116
  if (provider) prepared = prepare(true);
14041
14117
  const { selected, ledger } = prepared;
14042
14118
  const replacements = /* @__PURE__ */ new Map();
@@ -17856,7 +17932,7 @@ var darwinRecordsRegion = (quoted2) => quoted2.length ? ["-Wl,--start-lib", ...q
17856
17932
  var REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
17857
17933
  var MULTI_MANIFEST_VERSION = 68;
17858
17934
  var SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
17859
- var compilerSourceDigest = true ? "b60df189803fef5c8b8fd902ae0a694ffbefe056af8f5fc06f707750dc97f09b" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
17935
+ var compilerSourceDigest = true ? "c08bc25b20368e967d20bd07b2812d538ac73d60f4f4790ad0a59924bba3b684" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
17860
17936
  function swiftArtifactHash(input, release, moduleRoot) {
17861
17937
  const hash = (0, import_node_crypto13.createHash)("sha256");
17862
17938
  hash.update(`swift-compile
@@ -31471,7 +31547,7 @@ function sourceClosureDigest(srcDir, entrypoints) {
31471
31547
  return hash.digest("hex");
31472
31548
  }
31473
31549
  var standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
31474
- var STANDIN_SOURCE_DIGEST = true ? "9d24428078636d005cc1401363f5f50704e049f52802b0493da7eea674470942" : standinSourceDigest();
31550
+ var STANDIN_SOURCE_DIGEST = true ? "5060fb77e22fd3d9fa69d6e25dbc7bca5b3605d41a6bc164f40ccaee2a131504" : standinSourceDigest();
31475
31551
 
31476
31552
  // src/swift-standins.ts
31477
31553
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2247 | (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;
@@ -3228,7 +3228,7 @@ function readIosSdkTree(root) {
3228
3228
 
3229
3229
  // src/swift-standin-digest.ts
3230
3230
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
3231
- var STANDIN_SOURCE_DIGEST = true ? "9d24428078636d005cc1401363f5f50704e049f52802b0493da7eea674470942" : standinSourceDigest();
3231
+ var STANDIN_SOURCE_DIGEST = true ? "5060fb77e22fd3d9fa69d6e25dbc7bca5b3605d41a6bc164f40ccaee2a131504" : standinSourceDigest();
3232
3232
 
3233
3233
  // src/expo-native-workspace.ts
3234
3234
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
@@ -6790,7 +6790,7 @@ var FOUNDATION_IMPLICIT_MODULES = [
6790
6790
  var FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
6791
6791
  (module2) => `, "-Xfrontend", "-import-module", "-Xfrontend", "${module2}"`
6792
6792
  ).join("");
6793
- var compilerSourceDigest = true ? "b60df189803fef5c8b8fd902ae0a694ffbefe056af8f5fc06f707750dc97f09b" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
6793
+ var compilerSourceDigest = true ? "c08bc25b20368e967d20bd07b2812d538ac73d60f4f4790ad0a59924bba3b684" : swiftCompilerSourceDigest2(__sootsim_import_meta_dirname);
6794
6794
  var CORE_FOUNDATION_HANDLE_IMPORTS = [
6795
6795
  "CFAllocator",
6796
6796
  "CFArray",
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2247 | (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.2244 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2247 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/worklet-executable.ts
4
4
  import { parse } from "acorn";
@@ -59,7 +59,7 @@ export interface SharedDeviceImageBridgeStats {
59
59
  }
60
60
  export interface SharedDeviceImageBridge {
61
61
  resolveBitmapImage(sourceKey: string, revision: number, bitmap: ImageFrameSource, width: number, height: number, holdUpload: boolean): SkImage | null;
62
- decodeStaticPixels(bytes: Uint8Array, size: ImagePixelDecodeSize, signal?: AbortSignal): Promise<DecodedImagePixels>;
62
+ decodeStaticPixels(bytes: Uint8Array, size: ImagePixelDecodeSize, signal?: AbortSignal, urgency?: AbortSignal): Promise<DecodedImagePixels>;
63
63
  resolveStaticPixelsImage(sourceKey: string, decoded: DecodedImagePixels, discard: () => void): SkImage | null;
64
64
  hasOpenTransaction(): boolean;
65
65
  releaseDecodedPixels(decoded: DecodedImagePixels): void;
@@ -183,6 +183,7 @@ export declare function getNodeTransformedRect(node: SootSimNode, options?: {
183
183
  width: number;
184
184
  height: number;
185
185
  };
186
+ export declare function withNativePlacementMeasurementOrigin<T extends NodePoint>(node: SootSimNode, rect: T, options?: LayoutPositionOptions): T;
186
187
  export declare function writeScenePropFlags(node: SootSimNode): void;
187
188
  export declare class SootSimNode {
188
189
  readonly nativeRenderer: NativeRenderer;
@@ -246,6 +247,7 @@ export declare class SootSimNode {
246
247
  _textGuides: TextGuides | null;
247
248
  _guideOffset: number;
248
249
  _listCellPitch: number | null;
250
+ _yogaY: number | null;
249
251
  _layoutHook: ((view: SootSimNode) => void) | null;
250
252
  _layoutHookSubtree: boolean;
251
253
  _hookFrameEpoch: number;
@@ -49,7 +49,7 @@ export declare const TEXTKIT_UNATTRIBUTED_METRICS: {
49
49
  export declare function resolveTextKitAttachmentTop(node: SootSimNode, lineBottom: number, attachmentHeight: number): number | null;
50
50
  export declare function resolveUnattributedTextAttachment(node: SootSimNode | null | undefined, text: string, slots: readonly InlineEmbedSlot[]): InlineEmbedSlot | null;
51
51
  export declare function emitNestedTextRuns(builder: ParagraphBuilderLike, rootNode: SootSimNode, rootStyle: SootSimStyle, buildRunStyle: (mergedStyle: SootSimStyle, node: SootSimNode, natural: boolean) => Record<string, any> | null, rootStyles: TextRunStyles, embedPolicy?: {
52
- addPlaceholder: (width: number, height: number, offset: number, natural: boolean) => number;
52
+ addPlaceholder: (width: number, height: number, baselineOffset: number, natural: boolean) => number;
53
53
  embedSlots: InlineEmbedSlot[];
54
54
  naturalRootStyles?: TextRunStyles;
55
55
  }): InlineEmbedSlot[];
@@ -462,6 +462,7 @@ export interface SootSimStyle {
462
462
  _swiftUIWidthProposal?: number;
463
463
  _swiftUIHeightProposal?: number;
464
464
  _minimumScaleFactor?: number;
465
+ _baselineOffset?: number;
465
466
  _hyphenationLocale?: string;
466
467
  _hyphenationFactor?: number;
467
468
  _swiftUIText?: true;
@@ -478,6 +479,7 @@ export interface SootSimStyle {
478
479
  _swiftUIAlignmentFraction?: number;
479
480
  _swiftUIPlatformView?: true;
480
481
  _swiftUIListCell?: true;
482
+ _swiftUIListSection?: true;
481
483
  _swiftUIListSeparator?: true;
482
484
  _swiftUIFrameSnapped?: true;
483
485
  _uikitControlContent?: true;
@@ -1209,6 +1209,7 @@ export interface CompositorStats {
1209
1209
  };
1210
1210
  webViewCaptureSettled?: boolean;
1211
1211
  }
1212
+ export type CompositorPixelReads = 'frame' | 'composite';
1212
1213
  export interface PromotedLayerOffer {
1213
1214
  key: string;
1214
1215
  surfaceId: CompositorSurfaceId;
@@ -1345,6 +1346,7 @@ export type CompositorHostToWorker = {
1345
1346
  format?: PresentedFrameCaptureFormat;
1346
1347
  suppressText?: SootSimCaptureOptions['suppressText'];
1347
1348
  captureFilter?: SootSimCaptureOptions['captureFilter'];
1349
+ reads?: CompositorPixelReads;
1348
1350
  } | ({
1349
1351
  type: 'dump';
1350
1352
  requestId: number;
@@ -1438,6 +1440,7 @@ export type CompositorHostToWorker = {
1438
1440
  } | {
1439
1441
  type: 'renderActivitySubscription';
1440
1442
  active: boolean;
1443
+ holds: boolean;
1441
1444
  } | {
1442
1445
  type: 'ambientGlow';
1443
1446
  active: boolean;
@@ -1534,6 +1537,10 @@ export type ShellToCompositorMessage = {
1534
1537
  } | {
1535
1538
  type: 'foldMotion';
1536
1539
  active: boolean;
1540
+ } | {
1541
+ type: 'treeFence';
1542
+ } | {
1543
+ type: 'treeSettled';
1537
1544
  } | EngineResourceResponse | WireSurfaceUpdate | {
1538
1545
  type: 'shellInbox';
1539
1546
  buffer: SharedArrayBuffer;
@@ -1801,7 +1808,7 @@ export type ShellToCompositorMessage = {
1801
1808
  port: MessagePort;
1802
1809
  };
1803
1810
  export type ShellCompositorInboxMessage = Extract<ShellToCompositorMessage, WireSurfaceUpdate | {
1804
- type: 'appMotion' | 'retireAnimatedDrivenStyle' | 'animatedPresentation' | 'animatedPresentationChanged' | 'clearAnimatedPresentation' | 'screenTransitionDrive' | 'screenTransitionCancel';
1811
+ type: 'appMotion' | 'retireAnimatedDrivenStyle' | 'animatedPresentation' | 'animatedPresentationChanged' | 'clearAnimatedPresentation' | 'screenTransitionDrive' | 'screenTransitionCancel' | 'treeFence' | 'treeSettled';
1805
1812
  }>;
1806
1813
  export declare function isShellCompositorInboxMessage(message: ShellToCompositorMessage): message is ShellCompositorInboxMessage;
1807
1814
  export type CompositorWorkerToHost = {
@@ -6,6 +6,10 @@ export type ImagePixelRequest = {
6
6
  readonly width: number;
7
7
  readonly height: number;
8
8
  } | null;
9
+ readonly urgent: boolean;
10
+ } | {
11
+ readonly kind: 'raise';
12
+ readonly id: number;
9
13
  } | {
10
14
  readonly kind: 'cancel';
11
15
  readonly id: number;
@@ -19,5 +19,6 @@ export interface ResilientFrameClock {
19
19
  resetStats(): void;
20
20
  dispose(): void;
21
21
  nextDisplayAfter(t: number): number | null;
22
+ displayIntervalMs(): number | null;
22
23
  }
23
24
  export declare function createResilientFrameClock(options: ResilientFrameClockOptions): ResilientFrameClock;
package/kotlin/sdk.tar.gz CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.2244",
3
+ "version": "0.1.2247",
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",
@@ -133,6 +133,7 @@ function rewriteObject(
133
133
  ): {
134
134
  readonly bytes: Uint8Array
135
135
  readonly definitions: readonly ObjectDefinition[]
136
+ readonly functionImports: ReadonlyMap<string, FunctionType>
136
137
  readonly usesDlsym: boolean
137
138
  readonly usedSymbols: readonly string[]
138
139
  } {
@@ -142,6 +143,7 @@ function rewriteObject(
142
143
  const types: FunctionType[] = []
143
144
  const functionTypes: number[] = []
144
145
  const definitions: ObjectDefinition[] = []
146
+ const functionImports = new Map<string, FunctionType>()
145
147
  let usesDlsym = false
146
148
  let usesDlerror = false
147
149
  const usedSymbols = new Set<string>()
@@ -213,6 +215,11 @@ function rewriteObject(
213
215
  const isDlerror =
214
216
  instrumentDynamicLookups && module === 'env' && name === 'dlerror' && kind === 0
215
217
  if (module === 'env' && names.has(name)) usedSymbols.add(name)
218
+ if (module === 'env' && kind === 0 && names.has(name)) {
219
+ const type = types[functionType]
220
+ if (!type) throw new Error(`missing import type for ${name}`)
221
+ functionImports.set(name, type)
222
+ }
216
223
  if (isDlsym || isDlerror) {
217
224
  const type = types[functionType]
218
225
  const expected = isDlsym ? '126,126:126' : ':126'
@@ -395,6 +402,7 @@ function rewriteObject(
395
402
  return {
396
403
  bytes: Buffer.concat(sections),
397
404
  definitions,
405
+ functionImports,
398
406
  usesDlsym,
399
407
  usedSymbols: [...usedSymbols],
400
408
  }
@@ -429,6 +437,7 @@ export function createGuestImageLedger(input: GuestImageLedgerInput): GuestImage
429
437
  object: GuestImageObject
430
438
  aliases: Map<string, string>
431
439
  usedSymbols: readonly string[]
440
+ functionImports: ReadonlyMap<string, FunctionType>
432
441
  }[] = []
433
442
  const callersUsingDlsym = new Set<number>()
434
443
  for (const image of input.images) {
@@ -452,7 +461,13 @@ export function createGuestImageLedger(input: GuestImageLedgerInput): GuestImage
452
461
  new Set(),
453
462
  )
454
463
  if (rewritten.usesDlsym) callersUsingDlsym.add(image.id)
455
- units.push({ image: image.id, object, aliases, usedSymbols: rewritten.usedSymbols })
464
+ units.push({
465
+ image: image.id,
466
+ object,
467
+ aliases,
468
+ usedSymbols: rewritten.usedSymbols,
469
+ functionImports: rewritten.functionImports,
470
+ })
456
471
  for (const symbol of rewritten.definitions) {
457
472
  if (symbol.type && symbol.type.results.length > 1)
458
473
  throw new Error(`multiple results for ${symbol.name}`)
@@ -563,9 +578,43 @@ export function createGuestImageLedger(input: GuestImageLedgerInput): GuestImage
563
578
  bindings.set(binding.symbol, matches[0]!.alias)
564
579
  startup.set(binding.object, bindings)
565
580
  }
566
- const objects = units.map(({ image, object, aliases }) => {
581
+ const resultWrappers = new Map<
582
+ string,
583
+ { symbol: string; image: number; provider: GuestImageDefinition }
584
+ >()
585
+ const definitionsByAlias = new Map<string, GuestImageDefinition>()
586
+ for (const definition of definitions) {
587
+ const previous = definitionsByAlias.get(definition.alias)
588
+ if (!previous || (previous.weak && !definition.weak))
589
+ definitionsByAlias.set(definition.alias, definition)
590
+ }
591
+ const objects = units.map(({ image, object, aliases, functionImports }) => {
567
592
  const bindings = new Map(bindingsByImage.get(image)!)
568
593
  for (const [name, alias] of startup.get(object.path) ?? []) bindings.set(name, alias)
594
+ for (const [name, type] of functionImports) {
595
+ const alias = bindings.get(name)
596
+ const provider = alias === undefined ? undefined : definitionsByAlias.get(alias)
597
+ if (
598
+ !provider ||
599
+ provider.kind !== 'function' ||
600
+ provider.result !== 'i32' ||
601
+ type.results.length !== 1 ||
602
+ type.results[0] !== 0x7e ||
603
+ type.parameters.map(llvmType).join(',') !== provider.parameters.join(',')
604
+ )
605
+ continue
606
+ const key = `${image}:${provider.alias}`
607
+ let wrapper = resultWrappers.get(key)
608
+ if (!wrapper) {
609
+ wrapper = {
610
+ symbol: `__peach_integer_result_${image}_${resultWrappers.size}`,
611
+ image,
612
+ provider,
613
+ }
614
+ resultWrappers.set(key, wrapper)
615
+ }
616
+ bindings.set(name, wrapper.symbol)
617
+ }
569
618
  return {
570
619
  path: object.path,
571
620
  instrumentDynamicLookups: object.instrumentDynamicLookups,
@@ -601,13 +650,28 @@ export function createGuestImageLedger(input: GuestImageLedgerInput): GuestImage
601
650
  'target triple = "wasm64-unknown-wasip1"',
602
651
  `@.names = private constant [${nameSize} x i8] c"${nameContents}"`,
603
652
  ]
604
- for (const definition of exported.values()) {
653
+ const declarations = new Map(exported)
654
+ for (const { provider } of resultWrappers.values())
655
+ declarations.set(provider.alias, provider)
656
+ for (const definition of declarations.values()) {
605
657
  if (definition.kind === 'function')
606
658
  ir.push(
607
659
  `declare ${definition.result} @${definition.alias}(${definition.parameters.join(', ')})`,
608
660
  )
609
661
  else ir.push(`@${definition.alias} = external global i8`)
610
662
  }
663
+ // arm64 writes to w0 clear x0's upper word, including a c enum returned
664
+ // through an objective-c declaration whose underlying type is NSInteger.
665
+ for (const { symbol, provider } of resultWrappers.values()) {
666
+ const parameters = provider.parameters.map((type, index) => `${type} %arg${index}`)
667
+ ir.push(
668
+ `define i64 @${symbol}(${parameters.join(', ')}) {`,
669
+ ` %word = call i32 @${provider.alias}(${parameters.join(', ')})`,
670
+ ' %result = zext i32 %word to i64',
671
+ ' ret i64 %result',
672
+ '}',
673
+ )
674
+ }
611
675
  ir.push(`@__peach_dyld_symbols = constant [${exported.size} x { ptr, i32, ptr }] [`)
612
676
  ir.push(
613
677
  [...exported.values()]
@@ -652,10 +716,13 @@ export function createGuestImageLedger(input: GuestImageLedgerInput): GuestImage
652
716
  callers: input.callers,
653
717
  definitions,
654
718
  objects,
655
- callerWrappers: [...callersUsingDlsym].map((image) => ({
656
- symbol: `__peach_dlsym_caller_${image}`,
657
- image,
658
- })),
719
+ callerWrappers: [
720
+ ...[...callersUsingDlsym].map((image) => ({
721
+ symbol: `__peach_dlsym_caller_${image}`,
722
+ image,
723
+ })),
724
+ ...[...resultWrappers.values()].map(({ symbol, image }) => ({ symbol, image })),
725
+ ],
659
726
  llvmIR: ir.join('\n') + '\n',
660
727
  }
661
728
  }
@@ -444,7 +444,9 @@ export function linkGuestImages(
444
444
  return { selected, ledger }
445
445
  }
446
446
  let prepared = prepare(false)
447
- const provider = prepared.ledger.callerWrappers.length > 0
447
+ const provider = prepared.ledger.callerWrappers.some(({ symbol }) =>
448
+ symbol.startsWith('__peach_dlsym_caller_'),
449
+ )
448
450
  // a generated caller wrapper introduces this provider reference. include it
449
451
  // in discovery before deciding which archive members the ledger owns.
450
452
  if (provider) prepared = prepare(true)
@@ -13,6 +13,12 @@ interface WasmLayout {
13
13
  readonly functionsByCodeOffset: Map<number, number>
14
14
  readonly functionsByTableSlot: Map<number, number>
15
15
  readonly data: readonly { address: number; bytes: Uint8Array }[]
16
+ readonly dataByAddress: readonly {
17
+ address: number
18
+ bytes: Uint8Array
19
+ order: number
20
+ maximumEnd: number
21
+ }[]
16
22
  readonly memoryBytes: number
17
23
  }
18
24
 
@@ -205,10 +211,19 @@ function layout(bytes: Uint8Array): WasmLayout {
205
211
  }
206
212
  if (pos !== dataSection[1]) throw new Error('invalid wasm data section')
207
213
  }
214
+ const dataByAddress = data
215
+ .map((segment, order) => ({ ...segment, order, maximumEnd: 0 }))
216
+ .sort((a, b) => a.address - b.address || a.order - b.order)
217
+ let maximumEnd = 0
218
+ for (const segment of dataByAddress) {
219
+ maximumEnd = Math.max(maximumEnd, segment.address + segment.bytes.length)
220
+ segment.maximumEnd = maximumEnd
221
+ }
208
222
  return {
209
223
  functionsByCodeOffset,
210
224
  functionsByTableSlot,
211
225
  data,
226
+ dataByAddress,
212
227
  memoryBytes: memoryPages * 65536,
213
228
  }
214
229
  }
@@ -284,7 +299,22 @@ export function guestLinkedSpans(
284
299
  const optimizedOwners = new Map<number, number>()
285
300
  const dataAt = (module: WasmLayout, start: number, length: number): Buffer => {
286
301
  const result = Buffer.alloc(length)
287
- for (const segment of module.data) {
302
+ let low = 0
303
+ let high = module.dataByAddress.length
304
+ while (low < high) {
305
+ const middle = Math.floor((low + high) / 2)
306
+ if (module.dataByAddress[middle]!.maximumEnd <= start) low = middle + 1
307
+ else high = middle
308
+ }
309
+ const matching: (typeof module.dataByAddress)[number][] = []
310
+ for (let index = low; index < module.dataByAddress.length; index++) {
311
+ const segment = module.dataByAddress[index]!
312
+ if (segment.address >= start + length) break
313
+ if (segment.address + segment.bytes.length > start) matching.push(segment)
314
+ }
315
+ // active segments overwrite in module order even when their ranges overlap.
316
+ matching.sort((a, b) => a.order - b.order)
317
+ for (const segment of matching) {
288
318
  const first = Math.max(start, segment.address)
289
319
  const last = Math.min(start + length, segment.address + segment.bytes.length)
290
320
  if (first < last)