peachsim 0.1.2248 → 0.1.2249

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 (99) hide show
  1. package/cli/bridge-flow-runner.ts +28 -2
  2. package/cli/commands/inspect/settling.ts +35 -4
  3. package/cli/drivers/playwright.ts +2 -0
  4. package/dist-lib/agent-daemon-client.cjs +1 -1
  5. package/dist-lib/agent-events.cjs +1 -1
  6. package/dist-lib/attached-projects.cjs +1 -1
  7. package/dist-lib/auth/shared-session.cjs +1 -1
  8. package/dist-lib/backend-origin.cjs +1 -1
  9. package/dist-lib/beta.cjs +1 -1
  10. package/dist-lib/beta.mjs +1 -1
  11. package/dist-lib/bridge-constants.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.mjs +1 -1
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +1 -1
  16. package/dist-lib/bundle-channel.cjs +150 -40
  17. package/dist-lib/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +1 -1
  19. package/dist-lib/cloud-contract.cjs +1 -1
  20. package/dist-lib/cloud-contract.mjs +1 -1
  21. package/dist-lib/cloud-test-args.cjs +1 -1
  22. package/dist-lib/cloud-test-args.mjs +1 -1
  23. package/dist-lib/cloud.cjs +1 -1
  24. package/dist-lib/cloud.mjs +1 -1
  25. package/dist-lib/config.cjs +1 -1
  26. package/dist-lib/config.mjs +1 -1
  27. package/dist-lib/detox/index.cjs +32 -8
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/expo-swift-bundle.cjs +148 -38
  30. package/dist-lib/expo-swift-metadata.cjs +1 -1
  31. package/dist-lib/expo-swift-metadata.mjs +1 -1
  32. package/dist-lib/home-paths.cjs +1 -1
  33. package/dist-lib/host/bridge-host.cjs +150 -40
  34. package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
  35. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  37. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  38. package/dist-lib/host/websocket-proxy.cjs +1 -1
  39. package/dist-lib/index.cjs +34 -10
  40. package/dist-lib/jump-to-source-babel.cjs +1 -1
  41. package/dist-lib/jump-to-source-native.cjs +1 -1
  42. package/dist-lib/kotlin-host.cjs +1 -1
  43. package/dist-lib/menu.cjs +1 -1
  44. package/dist-lib/menu.mjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  47. package/dist-lib/metro-production-bundle.cjs +1 -1
  48. package/dist-lib/metro-production-bundle.mjs +1 -1
  49. package/dist-lib/metro.cjs +4 -4
  50. package/dist-lib/native-app-identity-project.cjs +2 -2
  51. package/dist-lib/native-app-identity-project.mjs +2 -2
  52. package/dist-lib/native-app-identity.cjs +1 -1
  53. package/dist-lib/native-app-identity.mjs +1 -1
  54. package/dist-lib/native-firebase-metadata.cjs +1 -1
  55. package/dist-lib/native-firebase-metadata.mjs +1 -1
  56. package/dist-lib/pdfium-raster.cjs +1 -1
  57. package/dist-lib/pdfium-raster.mjs +1 -1
  58. package/dist-lib/plist.cjs +1 -1
  59. package/dist-lib/plist.mjs +1 -1
  60. package/dist-lib/profiles.cjs +1 -1
  61. package/dist-lib/public-brand.cjs +1 -1
  62. package/dist-lib/public-origins-lib-esm.json +24 -24
  63. package/dist-lib/public-origins-lib.json +53 -53
  64. package/dist-lib/react-native-host-modules.cjs +1 -1
  65. package/dist-lib/react-native-host-modules.mjs +1 -1
  66. package/dist-lib/reap-browser.cjs +1 -1
  67. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  68. package/dist-lib/sdk.cjs +31 -7
  69. package/dist-lib/sdk.mjs +31 -7
  70. package/dist-lib/skills.cjs +194 -49
  71. package/dist-lib/swift-compile.cjs +137 -28
  72. package/dist-lib/swift-compile.mjs +137 -28
  73. package/dist-lib/swift-package.cjs +1 -1
  74. package/dist-lib/swift-package.mjs +1 -1
  75. package/dist-lib/swift-submit.cjs +1 -1
  76. package/dist-lib/swift-submit.mjs +1 -1
  77. package/dist-lib/swift-toolchain.cjs +1 -1
  78. package/dist-lib/swift.cjs +1 -1
  79. package/dist-lib/vite-swift.cjs +146 -36
  80. package/dist-lib/vite.cjs +4 -4
  81. package/dist-lib/worklet-executable.cjs +1 -1
  82. package/dist-lib/worklet-executable.mjs +1 -1
  83. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +4 -0
  84. package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +1 -0
  85. package/dist-types/packages/peach-engine/src/render-worker/shell-tree-wire.d.ts +8 -0
  86. package/dist-types/packages/peach-engine/src/render-worker/webview-capture-protocol.d.ts +1 -0
  87. package/dist-types/packages/peach-globals/src/globalsContract.d.ts +5 -0
  88. package/kotlin/sdk.tar.gz +0 -0
  89. package/package.json +1 -1
  90. package/runtime-companion.json +1 -1
  91. package/sdk/ios/wasm/include/math.h +1 -1
  92. package/sdk/ios/wasm/include/pthread.h +1 -1
  93. package/src/assetCatalogContract.ts +6 -0
  94. package/src/sfSymbolMetricsContract.ts +73 -37
  95. package/src/swift-compile.ts +99 -7
  96. package/src/swift-guest-image-ledger.ts +10 -5
  97. package/src/swift-guest-link.ts +20 -14
  98. package/src/swift-standins.ts +11 -8
  99. package/src/swift-wasm-prune.ts +30 -0
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2248 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2249 | (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;
@@ -47853,7 +47853,11 @@ function parseWasmObjectBytes(file, buf, isDist, symbolFlagOffsets) {
47853
47853
  objcClassSymToTypePrefix,
47854
47854
  typePrefixesInObj,
47855
47855
  rootFuncs,
47856
- rootSegs
47856
+ rootSegs,
47857
+ segPayloadRanges: sEnds.map((end, i) => [
47858
+ dataStart + sPayloadStarts[i],
47859
+ dataStart + end
47860
+ ])
47857
47861
  };
47858
47862
  }
47859
47863
  function parseWasmObjectCached(file, isDist, useCache) {
@@ -48518,9 +48522,29 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
48518
48522
  "$s10Foundation16NSSortDescriptorC7keyPath9ascendingACs03KeyE0Cyxq_G_SbtcSLR_r0_lufC",
48519
48523
  "$s10Foundation16NSSortDescriptorC7keyPath9ascendingACs03KeyE0Cyxq_G_SbtcSLR_r0_lufc"
48520
48524
  ]);
48525
+ const objectBytes = /* @__PURE__ */ new Map();
48526
+ const keepObjCClassesNamedInSegment = (obj, segIdx) => {
48527
+ const range2 = obj.segPayloadRanges[segIdx];
48528
+ if (!range2) return;
48529
+ let bytes = objectBytes.get(obj);
48530
+ if (!bytes) objectBytes.set(obj, bytes = import_node_fs38.default.readFileSync(obj.file));
48531
+ const text6 = bytes.toString("latin1", range2[0], range2[1]);
48532
+ for (const match of text6.matchAll(/So(\d+)/g)) {
48533
+ const start = match.index + 2 + match[1].length;
48534
+ const length = Number(match[1]);
48535
+ if (text6[start + length] !== "C") continue;
48536
+ const symbol2 = `._OBJC_CLASS_${text6.slice(start, start + length)}`;
48537
+ for (const provider of lazyProviders.get(symbol2) ?? []) {
48538
+ eagerDynamicObjects.add(provider);
48539
+ extractObject(provider);
48540
+ activateSymbolInObj(provider, provider.symNames.indexOf(symbol2));
48541
+ }
48542
+ }
48543
+ };
48521
48544
  while (workQueue.length > 0) {
48522
48545
  const item = workQueue.pop();
48523
48546
  const obj = item.obj;
48547
+ if (item.kind === "seg") keepObjCClassesNamedInSegment(obj, item.idx);
48524
48548
  let relocs;
48525
48549
  if (item.kind === "func") {
48526
48550
  relocs = obj.funcRelocs[item.idx];
@@ -49466,8 +49490,12 @@ function createGuestImageLedger(input) {
49466
49490
  }
49467
49491
  }
49468
49492
  }
49493
+ const nameBytes = /* @__PURE__ */ new Map();
49494
+ for (const definition2 of definitions)
49495
+ if (!nameBytes.has(definition2.name))
49496
+ nameBytes.set(definition2.name, Buffer.from(definition2.name));
49469
49497
  definitions.sort(
49470
- (a, b) => Buffer.compare(Buffer.from(a.name), Buffer.from(b.name)) || a.image - b.image
49498
+ (a, b) => Buffer.compare(nameBytes.get(a.name), nameBytes.get(b.name)) || a.image - b.image
49471
49499
  );
49472
49500
  const preserveCanonical = /* @__PURE__ */ new Set();
49473
49501
  const definitionsByName = Map.groupBy(definitions, (definition2) => definition2.name);
@@ -49497,12 +49525,12 @@ function createGuestImageLedger(input) {
49497
49525
  preserveCanonical.add(name3);
49498
49526
  for (const name3 of input.commandLineSymbols ?? []) preserveCanonical.add(name3);
49499
49527
  const bindingsByImage = /* @__PURE__ */ new Map();
49528
+ const definitionsByImage = Map.groupBy(definitions, (definition2) => definition2.image);
49500
49529
  for (const caller of input.callers) {
49501
49530
  const bindings = /* @__PURE__ */ new Map();
49502
49531
  const seen = /* @__PURE__ */ new Map();
49503
49532
  for (const image of [caller.image, ...caller.next])
49504
- for (const definition2 of definitions) {
49505
- if (definition2.image !== image) continue;
49533
+ for (const definition2 of definitionsByImage.get(image) ?? []) {
49506
49534
  const previous = seen.get(definition2.name);
49507
49535
  if (previous?.image === definition2.image) {
49508
49536
  if (previous.weak && !definition2.weak) {
@@ -49542,8 +49570,9 @@ function createGuestImageLedger(input) {
49542
49570
  definitionsByAlias.set(definition2.alias, definition2);
49543
49571
  }
49544
49572
  const objects = units.map(({ image, object: object6, aliases, functionImports }) => {
49545
- const bindings = new Map(bindingsByImage.get(image));
49546
- for (const [name3, alias] of startup.get(object6.path) ?? []) bindings.set(name3, alias);
49573
+ const shared = bindingsByImage.get(image);
49574
+ const own = startup.get(object6.path);
49575
+ const bindings = own ? new Map([...shared, ...own]) : shared;
49547
49576
  for (const [name3, type] of functionImports) {
49548
49577
  const alias = bindings.get(name3);
49549
49578
  const provider = alias === void 0 ? void 0 : definitionsByAlias.get(alias);
@@ -51462,6 +51491,7 @@ function linkGuestImages(options) {
51462
51491
  );
51463
51492
  }
51464
51493
  const archives = /* @__PURE__ */ new Map();
51494
+ const memberBytes = /* @__PURE__ */ new Map();
51465
51495
  const prepare2 = (provider2) => {
51466
51496
  const trace = runLink("discovery", [
51467
51497
  ...withOutput(args, discovery, true),
@@ -51505,20 +51535,23 @@ function linkGuestImages(options) {
51505
51535
  }
51506
51536
  const objectsByImage = /* @__PURE__ */ new Map();
51507
51537
  for (const image of plan.images) objectsByImage.set(image.id, []);
51538
+ const artifacts = new Map(plan.artifacts.map((artifact) => [artifact.path, artifact]));
51508
51539
  for (const item of selected2) {
51509
- const artifact = plan.artifacts.find(
51510
- (candidate) => candidate.path === item.artifact
51511
- );
51540
+ const artifact = artifacts.get(item.artifact);
51512
51541
  const image = selectedGuestInputImage(artifact, item.member);
51513
51542
  let bytes;
51514
51543
  if (item.member === null) bytes = import_node_fs42.default.readFileSync(item.artifact);
51515
51544
  else {
51516
- let members2 = archives.get(item.artifact);
51517
- if (!members2) {
51518
- members2 = readArMembers(import_node_fs42.default.readFileSync(item.artifact));
51545
+ let byName = memberBytes.get(item.artifact);
51546
+ if (!byName) {
51547
+ const members2 = readArMembers(import_node_fs42.default.readFileSync(item.artifact));
51519
51548
  archives.set(item.artifact, members2);
51549
+ byName = /* @__PURE__ */ new Map();
51550
+ for (const member of members2)
51551
+ if (!byName.has(member.name)) byName.set(member.name, member.bytes);
51552
+ memberBytes.set(item.artifact, byName);
51520
51553
  }
51521
- bytes = members2.find((member) => member.name === item.member).bytes;
51554
+ bytes = byName.get(item.member);
51522
51555
  }
51523
51556
  const objects = objectsByImage.get(image);
51524
51557
  if (!objects) throw new Error(`unknown image ${image}`);
@@ -51551,10 +51584,11 @@ function linkGuestImages(options) {
51551
51584
  const { selected, ledger } = prepared;
51552
51585
  const replacements = /* @__PURE__ */ new Map();
51553
51586
  const linkedOwners = /* @__PURE__ */ new Map();
51587
+ const ledgerObjects = new Map(ledger.objects.map((item) => [item.path, item]));
51554
51588
  for (const [index, artifact] of plan.artifacts.entries()) {
51555
51589
  const prefix = `${artifact.path}(`;
51556
51590
  if (artifact.kind === "object") {
51557
- const object6 = ledger.objects.find((item) => item.path === artifact.path);
51591
+ const object6 = ledgerObjects.get(artifact.path);
51558
51592
  if (!object6) continue;
51559
51593
  const output3 = import_node_path39.default.join(directory2, `object-${index}.o`);
51560
51594
  import_node_fs42.default.writeFileSync(output3, object6.bytes);
@@ -51574,9 +51608,7 @@ function linkGuestImages(options) {
51574
51608
  const output2 = import_node_path39.default.join(directory2, `archive-${index}.a`);
51575
51609
  const inputs = members2.map((member) => {
51576
51610
  const memberOutput = import_node_path39.default.join(memberDir, member.name);
51577
- const rewritten = ledger.objects.find(
51578
- (item) => item.path === `${prefix}${member.name})`
51579
- );
51611
+ const rewritten = ledgerObjects.get(`${prefix}${member.name})`);
51580
51612
  import_node_fs42.default.writeFileSync(memberOutput, rewritten?.bytes ?? member.bytes);
51581
51613
  if (rewritten) {
51582
51614
  linkedOwners.set(
@@ -51915,10 +51947,13 @@ function selectedGuestSymbolInputs(plan, selected) {
51915
51947
  else {
51916
51948
  let members2 = archives.get(item.artifact);
51917
51949
  if (!members2) {
51918
- members2 = readArMembers(import_node_fs42.default.readFileSync(item.artifact));
51950
+ members2 = Map.groupBy(
51951
+ readArMembers(import_node_fs42.default.readFileSync(item.artifact)),
51952
+ (member) => member.name
51953
+ );
51919
51954
  archives.set(item.artifact, members2);
51920
51955
  }
51921
- const matching2 = members2.filter((member) => member.name === item.member);
51956
+ const matching2 = members2.get(item.member) ?? [];
51922
51957
  if (matching2.length !== 1)
51923
51958
  throw new Error(
51924
51959
  `ambiguous selected symbol input ${item.artifact}(${item.member})`
@@ -54351,6 +54386,46 @@ function swiftModuleInterface(moduleRoot, name3, interfaceRoot) {
54351
54386
  if (declared.size === 0) return null;
54352
54387
  return { declared, header: clangInterfaceHeader((0, import_node_fs53.readFileSync)(built2, "utf8")) };
54353
54388
  }
54389
+ function nativelyDeclaredFunctions(generated, headers) {
54390
+ const candidates = [
54391
+ ...new Set(
54392
+ [...generated.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
54393
+ (match) => match[1]
54394
+ )
54395
+ )
54396
+ ];
54397
+ if (candidates.length === 0) return [];
54398
+ const declaration = new RegExp(`^[^\\n#/*]*?\\b(${candidates.join("|")})\\s*\\(`, "gm");
54399
+ const found = /* @__PURE__ */ new Set();
54400
+ for (const header of headers)
54401
+ for (const match of header.matchAll(declaration)) found.add(match[1]);
54402
+ return [...found];
54403
+ }
54404
+ function sdkObjCDeclarationOwners(frameworks) {
54405
+ const known = sdkDeclarationOwners.get(frameworks);
54406
+ if (known) return known;
54407
+ const owners = /* @__PURE__ */ new Map();
54408
+ for (const framework of (0, import_node_fs53.readdirSync)(frameworks))
54409
+ if (framework.endsWith(".framework")) {
54410
+ const headers = import_node_path50.default.join(frameworks, framework, "Headers");
54411
+ if ((0, import_node_fs53.existsSync)(headers)) {
54412
+ for (const file of (0, import_node_fs53.readdirSync)(headers, { recursive: true, encoding: "utf8" }))
54413
+ if (file.endsWith(".h")) {
54414
+ const header = (0, import_node_fs53.readFileSync)(import_node_path50.default.join(headers, file), "utf8");
54415
+ for (const name3 of [
54416
+ ...swiftInterfaceDeclarations(header),
54417
+ ...objcEnumerations(header),
54418
+ ...[
54419
+ ...header.matchAll(/^[A-Z_]*_(?:EXTERN|EXPORT)\b[^;(\n]*?\b(\w+)\s*\(/gm)
54420
+ ].map((match) => match[1])
54421
+ ])
54422
+ owners.set(name3, framework.slice(0, -".framework".length));
54423
+ }
54424
+ }
54425
+ }
54426
+ sdkDeclarationOwners.set(frameworks, owners);
54427
+ return owners;
54428
+ }
54354
54429
  function swiftHeaderWithSuperclassImports(header, interfaceFor) {
54355
54430
  const superclasses = new Set(
54356
54431
  [...header.matchAll(/@interface\s+\w+\s*:\s*(\w+)/g)].map((match) => match[1])
@@ -54383,6 +54458,10 @@ function withoutSwiftDeclarations(text6, declared, interfaceImport) {
54383
54458
  const name3 = /^\s*(?:[A-Z_]\w*(?:\([^()\n]*\))?\s+)*@(?:protocol|interface)\s+(\w+)\s*(?=[:<{]|$)/.exec(
54384
54459
  line
54385
54460
  )?.[1];
54461
+ const external = /^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(.*\)[^;\n]*;\s*$/.exec(
54462
+ line
54463
+ )?.[1];
54464
+ if (external && declared.has(external)) continue;
54386
54465
  const enumeration = /^\s*typedef\s+(?:NS_ENUM|NS_OPTIONS|SWIFT_ENUM(?:_NAMED)?)\s*\(\s*\w+\s*,\s*(\w+)\b/.exec(
54387
54466
  line
54388
54467
  )?.[1];
@@ -58773,11 +58852,28 @@ function compileSwiftProjectOnce(input, options) {
58773
58852
  ))
58774
58853
  declared.add(name4);
58775
58854
  }
58776
- const header = withoutSwiftDeclarations(
58855
+ const own = withoutSwiftDeclarations(
58777
58856
  clangInterfaceHeader((0, import_node_fs53.readFileSync)(source, "utf8")),
58778
58857
  declared,
58779
58858
  `#import <${name3}/${name3}.h>`
58780
58859
  );
58860
+ const owners = sdkObjCDeclarationOwners(import_node_path50.default.dirname(import_node_path50.default.dirname(headers)));
58861
+ const foreign = /* @__PURE__ */ new Map();
58862
+ for (const declaration of [
58863
+ ...swiftInterfaceDeclarations(own),
58864
+ ...objcEnumerations(own),
58865
+ ...[...own.matchAll(/^\s*SWIFT_EXTERN\b[^(\n]*?\b(\w+)\s*\(/gm)].map(
58866
+ (match) => match[1]
58867
+ )
58868
+ ]) {
58869
+ const owner = owners.get(declaration);
58870
+ if (owner && owner !== name3) foreign.set(declaration, owner);
58871
+ }
58872
+ const header = foreign.size ? withoutSwiftDeclarations(
58873
+ own,
58874
+ new Set(foreign.keys()),
58875
+ [...new Set(foreign.values())].map((owner) => `#import <${owner}/${owner}.h>`).join("\n")
58876
+ ) : own;
58781
58877
  const value = {
58782
58878
  file: import_node_path50.default.join(root, ".build/peach-framework-objc", `${name3}-Swift.h`),
58783
58879
  header,
@@ -58814,18 +58910,25 @@ function compileSwiftProjectOnce(input, options) {
58814
58910
  `${producer}-Swift.h`
58815
58911
  );
58816
58912
  const original = preparation.nativeHeaderDeclarations[producer] ? emitted.replace(/-Swift\.h$/, "-Swift.original.h") : emitted;
58817
- if ((0, import_node_fs53.existsSync)(original))
58913
+ if ((0, import_node_fs53.existsSync)(original)) {
58914
+ const generated = clangInterfaceHeader((0, import_node_fs53.readFileSync)(original, "utf8"));
58818
58915
  writeBuildFile(
58819
58916
  emitted,
58820
58917
  withoutSwiftDeclarations(
58821
- swiftHeaderWithSuperclassImports(
58822
- clangInterfaceHeader((0, import_node_fs53.readFileSync)(original, "utf8")),
58823
- frameworkInterface
58824
- ),
58825
- new Set(preparation.nativeHeaderDeclarations[producer]),
58918
+ swiftHeaderWithSuperclassImports(generated, frameworkInterface),
58919
+ /* @__PURE__ */ new Set([
58920
+ ...preparation.nativeHeaderDeclarations[producer] ?? [],
58921
+ ...nativelyDeclaredFunctions(
58922
+ generated,
58923
+ Object.entries(input.files).filter(
58924
+ ([name3]) => name3.endsWith(".h") && !name3.endsWith("-Swift.h")
58925
+ ).map(([, source]) => source)
58926
+ )
58927
+ ]),
58826
58928
  `#import <${producer}/${producer}.h>`
58827
58929
  )
58828
58930
  );
58931
+ }
58829
58932
  }
58830
58933
  }
58831
58934
  const checkpoints = import_node_path50.default.join(
@@ -58963,7 +59066,7 @@ function compileSwiftProjectOnce(input, options) {
58963
59066
  options.signal
58964
59067
  );
58965
59068
  }
58966
- var import_node_child_process32, import_node_crypto24, import_node_fs53, import_node_os11, import_node_path50, v5, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, SWIFT_BUILDER_TRANSPORT_MARGIN_MS, SWIFT_BUILDER_DEFAULT_COMPILE_MS, clangInterfaceHeader, swiftInterfaceDeclarations, linkedModuleDigests, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, kleeneNot, kleeneAnd, kleeneOr, sdkPaths, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, FOUNDATION_IMPLICIT_MODULES, PRECONCURRENCY_FOUNDATION_IMPORT, FOUNDATION_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, DIRECTIVE, OS_IOS, NOT_ON_IOS, DELEGATE_CLASS, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, emptyMacroEnvironment, wasmMacroEnvironment, cPredefineTable, cPredefineCache, HIDDEN_UNITS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, SWIFT_LINK_STAMP, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN;
59069
+ var import_node_child_process32, import_node_crypto24, import_node_fs53, import_node_os11, import_node_path50, v5, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, SWIFT_BUILDER_TRANSPORT_MARGIN_MS, SWIFT_BUILDER_DEFAULT_COMPILE_MS, clangInterfaceHeader, objcEnumerations, sdkDeclarationOwners, swiftInterfaceDeclarations, linkedModuleDigests, SYSTEM_MODULE_LIBRARIES, SYSTEM_MODULE_IMPORT, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, kleeneNot, kleeneAnd, kleeneOr, sdkPaths, availableModules, sdkOverlayFrameworks, DISTRIBUTION_CLANG_MODULES, ONE_PRODUCT, GAME_FAMILY, gameProducts, gameProduct, GAME_REACH, FOUNDATION_IMPLICIT_MODULES, PRECONCURRENCY_FOUNDATION_IMPORT, FOUNDATION_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, executableLinkFlags, darwinRecordsRegion, REACTOR_FLAG, MULTI_MANIFEST_VERSION, SWIFT_HEADER_PRODUCTS_TARGET, compilerSourceDigest, nativeCxxCompilerFlags, cFlagArray, cxxFlagArray, SWIFTPM_DEFAULT_IOS_DEPLOYMENT_TARGET, DIRECTIVE, OS_IOS, NOT_ON_IOS, DELEGATE_CLASS, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, emptyMacroEnvironment, wasmMacroEnvironment, cPredefineTable, cPredefineCache, HIDDEN_UNITS, LIBXML_REFERENCE, LIBXML_SOURCE, ROOT_LOCKS, host, rootLocks, SHARED_ARTIFACT_BUDGET_BYTES, SHARED_ARTIFACT_GRACE_MS, RETIRED_PREFIX, retainedArtifacts, FRAMEWORK_LINK_TARGET, SWIFT_LINK_STAMP, SWIFT_FRAMEWORK_SLOTS, SWIFT_FRAMEWORK_SLOT_KEY, SWIFT_FRAMEWORK_SLOT_ORIGIN;
58967
59070
  var init_swift_compile = __esm({
58968
59071
  "src/swift-compile.ts"() {
58969
59072
  "use strict";
@@ -59011,6 +59114,12 @@ var init_swift_compile = __esm({
59011
59114
  /^@import (?:CoreFoundation|FoundationNetworking);$/gm,
59012
59115
  "@import Foundation;"
59013
59116
  ).replace(/\b_TtC10Foundation\d+(NS\w+)\b/g, "$1").replace(/\b__attribute__\(\(objc_subclassing_restricted\)\)\s*/g, "");
59117
+ objcEnumerations = (header) => [
59118
+ ...header.matchAll(
59119
+ /^\s*typedef\s+(?:NS|CF|SWIFT)_\w*(?:ENUM|OPTIONS)\w*\s*\(\s*\w+\s*,\s*(\w+)\b/gm
59120
+ )
59121
+ ].map((match) => match[1]);
59122
+ sdkDeclarationOwners = /* @__PURE__ */ new Map();
59014
59123
  swiftInterfaceDeclarations = (header) => /* @__PURE__ */ new Set([
59015
59124
  ...[
59016
59125
  ...header.matchAll(
@@ -59193,7 +59302,7 @@ int EXUpdatesApplyBSDiffPatch(const char * _Nonnull oldFilePath,
59193
59302
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
59194
59303
  MULTI_MANIFEST_VERSION = 68;
59195
59304
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
59196
- compilerSourceDigest = true ? "6b31bc2b6f1a60a8ff02569b886f5f3a6cca1ec484cdb3c17ac060942b93cb3e" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
59305
+ compilerSourceDigest = true ? "660487c29d9a45fcb5a83e23f25f239be6cc1cc7338a3a2c2f756a4c985ae043" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
59197
59306
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
59198
59307
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
59199
59308
  cxxFlagArray = (flags) => JSON.stringify([...nativeCxxCompilerFlags, ...withoutGlogModuleMap(flags)]);
@@ -65659,7 +65768,7 @@ var init_swift_standin_digest = __esm({
65659
65768
  STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
65660
65769
  SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
65661
65770
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
65662
- STANDIN_SOURCE_DIGEST = true ? "7b618908e76b704175d5c94e30ceb691f6a3f50052a1d5a7bc25f24a07375c9b" : standinSourceDigest();
65771
+ STANDIN_SOURCE_DIGEST = true ? "089050e56f3e4935fed286174446973ff56c0fb4ee8c326f19a71b9fecbe9d05" : standinSourceDigest();
65663
65772
  }
65664
65773
  });
65665
65774
 
@@ -66115,7 +66224,7 @@ var init_package_tree_digest = __esm({
66115
66224
 
66116
66225
  // src/expo-native-prebuilt.ts
66117
66226
  function expoNativeCompilerDigestValue() {
66118
- return true ? "446bf6dc0f5ffa819ef1aa8b28a7e2ced01c01b9d003c548d978b6610dec6435" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
66227
+ return true ? "892bd8a2c9864f5fadde8b48730dd4ac3a08d9a46503d5fc4e0332afdaa86657" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
66119
66228
  }
66120
66229
  function readSources(value) {
66121
66230
  const sources = isRecord(value) ? value.sources : null;
@@ -68441,9 +68550,9 @@ function exec(file, args, cwd) {
68441
68550
  }
68442
68551
  function failure(error) {
68443
68552
  const output2 = error && typeof error === "object" && "stderr" in error ? `${String(error.stderr)}
68444
- ${"stdout" in error ? String(error.stdout) : ""}` : String(error);
68445
- const errors = output2.split("\n").filter((line) => /^\S.*?:\d+:\d+: error:/.test(line)).map((line) => line.replace(/^.*?:\d+:\d+: error:\s*/, "").trim());
68446
- return [...new Set(errors)].slice(0, 3).join("; ") || output2.trim().slice(0, 400);
68553
+ ${"stdout" in error ? String(error.stdout) : ""}` : error instanceof Error ? error.message : String(error);
68554
+ const errors = output2.split("\n").filter((line) => /^(\S.*?:\d+:\d+: )?error:/.test(line)).map((line) => line.replace(/^(.*?:\d+:\d+: )?error:\s*/, "").trim());
68555
+ return [...new Set(errors)].slice(0, 3).join("; ") || output2.trim().slice(-600);
68447
68556
  }
68448
68557
  function treeDigest2(root) {
68449
68558
  const names = [];
@@ -68954,6 +69063,8 @@ function peachModuleDirs(toolchain, imports2, sdkIncludes) {
68954
69063
  target,
68955
69064
  "-Xswiftc",
68956
69065
  "-Osize",
69066
+ "-Xswiftc",
69067
+ "-gnone",
68957
69068
  ...plugins.libraries.flatMap((library) => [
68958
69069
  "-Xswiftc",
68959
69070
  "-load-plugin-library",
@@ -70589,10 +70700,9 @@ ${roots.map((file) => ` header "${file}"`).join("\n")}
70589
70700
  ) : binary2.cxxHeaders ? await cxxStandin(surface, binary2, toolchain, dir) : cStandin(surface, binary2, toolchain, dir)
70590
70701
  );
70591
70702
  } catch (error) {
70592
- throw new Error(
70593
- `no stand-in for ${surface.module}: ${error instanceof Error && !("stderr" in error) ? error.message : failure(error)}`,
70594
- { cause: error }
70595
- );
70703
+ throw new Error(`no stand-in for ${surface.module}: ${failure(error)}`, {
70704
+ cause: error
70705
+ });
70596
70706
  }
70597
70707
  }
70598
70708
  publish(result);
@@ -86866,7 +86976,7 @@ var init_nitro_superset = __esm({
86866
86976
  init_nitroContract();
86867
86977
  init_swift_standin_digest();
86868
86978
  NITRO_SUPERSET_ENTRY_NAME = "superset";
86869
- NITRO_COMPILER_DIGEST = true ? "d719141ae7515a0d6743db461f1634baaba243d994f8421790e5927a804d6fa4" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
86979
+ NITRO_COMPILER_DIGEST = true ? "c57cf64c215ae5447c1378bb3a9511f6b48bc5fd2b4f52e392fb171077898926" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
86870
86980
  nitroSupersetLock = parseLock(nitro_superset_lock_default);
86871
86981
  nitroSupersetKey = (inputs) => nativeEntryKey({ ...inputs, compiler: NITRO_COMPILER_DIGEST });
86872
86982
  published2 = /* @__PURE__ */ new Map();
@@ -87574,7 +87684,7 @@ var init_one_sdk_bundle = __esm({
87574
87684
  var runtime_companion_default;
87575
87685
  var init_runtime_companion = __esm({
87576
87686
  "runtime-companion.json"() {
87577
- runtime_companion_default = { abi: 1, sha256: "0a25deb1065a15100e9bbd938d998d015318b067a7ab5d6e666a7360a2ab446a", file: "node/cli-0a25deb1065a15100e9bbd938d998d015318b067a7ab5d6e666a7360a2ab446a.cjs" };
87687
+ runtime_companion_default = { abi: 1, sha256: "0576baa8f64749f044d1fee413b30d3459d6a2a5caf1435ecc04500a7031bf93", file: "node/cli-0576baa8f64749f044d1fee413b30d3459d6a2a5caf1435ecc04500a7031bf93.cjs" };
87578
87688
  }
87579
87689
  });
87580
87690
 
@@ -110016,6 +110126,7 @@ async function launch(opts) {
110016
110126
  SOOTSIM_PW_USERDATADIR: resolveUserDataDir(opts),
110017
110127
  SOOTSIM_PW_CDP_PORT: cdpPort ? String(cdpPort) : "",
110018
110128
  PEACH_PW_HOST_COMMAND: hostCommand ? JSON.stringify(hostCommand) : "",
110129
+ PEACH_PW_CODE_CACHE: (0, import_path8.join)(cacheDir(), "code-cache"),
110019
110130
  // when the caller passed no viewport, leave the inherited
110020
110131
  // SOOTSIM_PW_VIEWPORT (from playwrightEnv) alone instead of
110021
110132
  // clobbering it with '' — the driver reads it as its own default.
@@ -110072,6 +110183,7 @@ var init_playwright = __esm({
110072
110183
  init_bridge_constants();
110073
110184
  init_cli_version();
110074
110185
  init_desktop_host_delivery();
110186
+ init_home_paths();
110075
110187
  init_playwright_host_log();
110076
110188
  init_profiles();
110077
110189
  init_internal_child_contract();
@@ -133489,7 +133601,8 @@ async function waitForSootsimIdle({
133489
133601
  skipIfInspectActive = false,
133490
133602
  readyPlayback = false,
133491
133603
  transitionStartWindowMs = 80,
133492
- transitionTimeoutMs = 4e3
133604
+ transitionTimeoutMs = 4e3,
133605
+ stillSince = null
133493
133606
  }) {
133494
133607
  let result;
133495
133608
  const observationStartedAt = Date.now();
@@ -133528,6 +133641,7 @@ async function waitForSootsimIdle({
133528
133641
  const accessibilityBounds = ${accessibilityBounds.toString()}
133529
133642
  const sameNativeAccessibilityShape = ${sameNativeAccessibilityShape.toString()}
133530
133643
  const readyPlayback = ${readyPlayback ? "true" : "false"}
133644
+ const stillSince = ${JSON.stringify(stillSince)}
133531
133645
  // full mounted-geometry observation needs at least two hierarchy reads
133532
133646
  // plus the stillness window, which a sub-second budget cannot afford:
133533
133647
  // tight budgets (auto-wait) settle on worker stillness plus root
@@ -133546,7 +133660,7 @@ async function waitForSootsimIdle({
133546
133660
  // those that began after it drained still can. a loaded host runs a
133547
133661
  // push past a tap's budget, so the transition gets its own timeout and
133548
133662
  // the budget restarts once it drains.
133549
- let transitionWait = (async () => {
133663
+ const watchTransition = async () => {
133550
133664
  try {
133551
133665
  const wfst = globalThis.__sootsimTest?.waitForScreenTransitions
133552
133666
  if (typeof wfst === 'function' && budgetMs > 120) {
@@ -133566,7 +133680,9 @@ async function waitForSootsimIdle({
133566
133680
  }
133567
133681
  } catch {}
133568
133682
  return false
133569
- })()
133683
+ }
133684
+ // a wait that may settle on its first poll watches only once that poll does not
133685
+ let transitionWait = stillSince === null ? watchTransition() : null
133570
133686
 
133571
133687
  // a worker that cannot answer within the remaining budget is busy, not
133572
133688
  // idle: its poll reads as unsettled. bounding each read by the budget
@@ -133918,6 +134034,9 @@ async function waitForSootsimIdle({
133918
134034
  if (clockNow() >= deadline) break
133919
134035
  }
133920
134036
  const pollStarted = clockNow()
134037
+ const readRevision = () =>
134038
+ answer(() => globalThis.__sootsimTest?.getGeometryRevision?.()).catch(() => null)
134039
+ const pollRevision = readRevision()
133921
134040
  const snapshot = await readSnapshot()
133922
134041
  if (snapshot.runtimeUnsupported) return snapshot.runtimeUnsupported
133923
134042
  // a read the deadline cut short observed nothing: the last full poll
@@ -133925,6 +134044,18 @@ async function waitForSootsimIdle({
133925
134044
  // the loop head drains a transition still in flight before it ends.
133926
134045
  if (snapshot.workerBusy && clockNow() >= deadline && report) continue
133927
134046
  polls++
134047
+ if (
134048
+ polls === 1 && stillSince !== null &&
134049
+ !snapshot.workerBusy && snapshot.pendingFetches === 0 && snapshot.requestInFlight === 0 &&
134050
+ !snapshot.webViewStarting && !snapshot.animating && !snapshot.shellAnimating &&
134051
+ !snapshot.layoutDirty && !snapshot.visibleMotion
134052
+ ) {
134053
+ const [proving, replying] = await Promise.all([pollRevision, readRevision()])
134054
+ if (proving === stillSince && replying === stillSince) {
134055
+ return { settled: true, elapsed: clockNow() - start, blockedBy: '', stillRevision: stillSince }
134056
+ }
134057
+ }
134058
+ if (polls === 1 && stillSince !== null) transitionWait = watchTransition()
133928
134059
  report = { snapshot, nativeHierarchy: lastNativeHierarchy, layout: lastLayout, requestTotal: lastRequestTotal, appCommits: lastAppCommits, nodeCount: lastNodeCount }
133929
134060
  if (snapshot.layoutDirty) dirtyPolls++
133930
134061
  if (snapshot.animating || snapshot.shellAnimating) animatingPolls++
@@ -134009,7 +134140,11 @@ async function waitForSootsimIdle({
134009
134140
  await transitionWait
134010
134141
  transitionWait = null
134011
134142
  }
134012
- if (stillProven()) return { settled: true, elapsed: clockNow() - start, blockedBy: '' }
134143
+ if (stillProven()) {
134144
+ const [proving, replying] = await Promise.all([pollRevision, readRevision()])
134145
+ const stillRevision = typeof proving === 'string' && proving === replying ? proving : undefined
134146
+ return { settled: true, elapsed: clockNow() - start, blockedBy: '', stillRevision }
134147
+ }
134013
134148
  }
134014
134149
  } else {
134015
134150
  stillPolls = []
@@ -134074,11 +134209,12 @@ async function waitForSootsimIdle({
134074
134209
  result.missingFields
134075
134210
  );
134076
134211
  }
134077
- const { elapsed, settled, blockedBy } = result ?? {};
134212
+ const { elapsed, settled, blockedBy, stillRevision } = result ?? {};
134078
134213
  return {
134079
134214
  elapsed: typeof elapsed === "number" ? elapsed : maxMs,
134080
134215
  settled: settled === true,
134081
- blockedBy: typeof blockedBy === "string" ? blockedBy : "unknown"
134216
+ blockedBy: typeof blockedBy === "string" ? blockedBy : "unknown",
134217
+ ...settled === true && typeof stillRevision === "string" ? { stillRevision } : {}
134082
134218
  };
134083
134219
  }
134084
134220
  var RuntimeReadinessUnsupportedError, IdleObservationError;
@@ -135127,6 +135263,8 @@ var init_bridge_flow_runner = __esm({
135127
135263
  appStopped = false;
135128
135264
  animationClockLocked = false;
135129
135265
  flowDepth = 0;
135266
+ // the geometry revision the last settle proved still, until the next settle starts
135267
+ stillRevision = null;
135130
135268
  profilingEnabled = false;
135131
135269
  recordingEnabled = false;
135132
135270
  recordingAccessChecked = false;
@@ -135756,6 +135894,7 @@ var init_bridge_flow_runner = __esm({
135756
135894
  element = await this.findElement(opts, preferHittable);
135757
135895
  }
135758
135896
  if (!element) return element;
135897
+ if (revision !== null && revision === this.stillRevision) return element;
135759
135898
  const stabilityDeadline = Date.now() + 1200;
135760
135899
  let prev = element;
135761
135900
  do {
@@ -135812,7 +135951,7 @@ var init_bridge_flow_runner = __esm({
135812
135951
  }
135813
135952
  async tapOn(target) {
135814
135953
  const opts = typeof target === "string" ? { text: target } : target;
135815
- await this.waitForAppToSettle();
135954
+ await this.waitForAppToSettle({ beforeAction: true });
135816
135955
  const repeat = Math.max(1, Math.trunc(opts.repeat ?? 1));
135817
135956
  const repeatDelay = opts.delay !== void 0 && opts.delay >= 0 ? opts.delay : 100;
135818
135957
  const repeatTaps = async (tappedAtMs, tapAgain) => {
@@ -136698,7 +136837,9 @@ var init_bridge_flow_runner = __esm({
136698
136837
  // ios waits up to three seconds for a still screen, then compares native
136699
136838
  // hierarchies.
136700
136839
  // the observer overlaps those reads to keep this command's existing budget.
136701
- async waitForAppToSettle() {
136840
+ async waitForAppToSettle({ beforeAction = false } = {}) {
136841
+ const stillSince = beforeAction ? this.stillRevision : null;
136842
+ this.stillRevision = null;
136702
136843
  try {
136703
136844
  const result = await waitForSootsimIdle({
136704
136845
  bridge: this.bridge,
@@ -136706,8 +136847,10 @@ var init_bridge_flow_runner = __esm({
136706
136847
  maxMs: 3e3,
136707
136848
  pollMs: 32,
136708
136849
  maestro: true,
136709
- screenStill: true
136850
+ screenStill: true,
136851
+ stillSince
136710
136852
  });
136853
+ this.stillRevision = result.stillRevision ?? null;
136711
136854
  if (!result.settled) {
136712
136855
  console.warn(
136713
136856
  ` [flow] still moving after ${result.elapsed}ms: ${result.blockedBy}`
@@ -137150,6 +137293,8 @@ var init_bridge_flow_runner = __esm({
137150
137293
  }
137151
137294
  }
137152
137295
  async runStepInner(step) {
137296
+ if (!step.assertVisible && !step.assertNotVisible && step.assertTrue === void 0 && !step.assertTreeContains && !step.takeScreenshot && !step.dumpTree && step.copyTextFrom === void 0 && !step.waitFor && !step.extendedWaitUntil && !step.runFlow && !step.repeat && !step.retry)
137297
+ this.stillRevision = null;
137153
137298
  if (this.animationClockLocked && !step.advanceAnimationClock && !step.takeScreenshot && !step.assertVisible && !step.assertNotVisible && step.assertTrue === void 0 && !step.assertTreeContains && !step.dumpTree && step.copyTextFrom === void 0 && typeof step.evalScript !== "string" && !step.runScript && step.setClipboard === void 0 && !step.runFlow && !step.repeat && !step.retry) {
137154
137299
  await this.releaseAnimationClock();
137155
137300
  }