peachsim 0.1.2605 → 0.1.2607

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 (147) hide show
  1. package/cli/commands/package.ts +71 -39
  2. package/cli/commands/perf-native.ts +259 -6
  3. package/cli/commands/shell-url.ts +1 -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 +2 -2
  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 +5 -5
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +3 -3
  16. package/dist-lib/bundle-channel.cjs +1520 -932
  17. package/dist-lib/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +3 -3
  19. package/dist-lib/cloud-contract.cjs +1 -1
  20. package/dist-lib/cloud-contract.mjs +3 -3
  21. package/dist-lib/cloud-test-args.cjs +1 -1
  22. package/dist-lib/cloud-test-args.mjs +2 -2
  23. package/dist-lib/cloud.cjs +1 -1
  24. package/dist-lib/cloud.mjs +7 -7
  25. package/dist-lib/config.cjs +1 -1
  26. package/dist-lib/config.mjs +5 -5
  27. package/dist-lib/detox/index.cjs +1 -1
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/esm-chunks/{acorn-UNOYFUKI.mjs → acorn-KFWXYMX5.mjs} +3 -3
  30. package/dist-lib/esm-chunks/{chunk-WSRPZF7M.mjs → chunk-6JPUMAC2.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-M4G5YUO7.mjs → chunk-6NDABMDX.mjs} +3 -3
  32. package/dist-lib/esm-chunks/{chunk-GT54N3GG.mjs → chunk-7SKDPTZN.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-FXONOT2L.mjs → chunk-ACAXWH62.mjs} +1 -1
  34. package/dist-lib/esm-chunks/chunk-ARYRQJUB.mjs +326 -0
  35. package/dist-lib/esm-chunks/{chunk-WB2EBX5Q.mjs → chunk-BNAXRY5Q.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-AST6VA7D.mjs → chunk-CA64UUHF.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-B54SPDLA.mjs → chunk-DBW62F4N.mjs} +3 -2
  38. package/dist-lib/esm-chunks/{chunk-7K33ENH6.mjs → chunk-ESS2CG5G.mjs} +5 -5
  39. package/dist-lib/esm-chunks/{chunk-LFN7VAPB.mjs → chunk-IGSLOAPL.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-RJCM34J7.mjs → chunk-KIIALACX.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-YO756PYQ.mjs → chunk-LJZ373SO.mjs} +819 -681
  42. package/dist-lib/esm-chunks/{chunk-VRQPEROV.mjs → chunk-M4ORY3NH.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-3XUIDCBF.mjs → chunk-MBWWOGI5.mjs} +4 -4
  44. package/dist-lib/esm-chunks/{chunk-M3V4F5OV.mjs → chunk-O5BPZVLB.mjs} +5 -5
  45. package/dist-lib/esm-chunks/chunk-P5Q5QCTP.mjs +32 -0
  46. package/dist-lib/esm-chunks/{chunk-O55DZ2EL.mjs → chunk-QJUAWJDB.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-HHS4A7GI.mjs → chunk-RIDXKGBZ.mjs} +1 -1
  48. package/dist-lib/esm-chunks/{chunk-LG76KUUO.mjs → chunk-TD2DBEKQ.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{chunk-AYHTHFG4.mjs → chunk-UTSB5CDG.mjs} +1 -1
  50. package/dist-lib/esm-chunks/{chunk-UPUOCALX.mjs → chunk-WMWOBH7E.mjs} +1 -1
  51. package/dist-lib/esm-chunks/{chunk-6TE7WLSF.mjs → chunk-ZNGLVJYL.mjs} +1 -1
  52. package/dist-lib/esm-chunks/{metro-layout-parser-YRBZCLVD.mjs → metro-layout-parser-UY3B6VGU.mjs} +3 -3
  53. package/dist-lib/esm-chunks/{swift-package-prebuilt-S7KR6TKE.mjs → swift-package-prebuilt-HDHPWS44.mjs} +10 -10
  54. package/dist-lib/esm-chunks/{swift-sdk-app-module-3JNA7PCB.mjs → swift-sdk-app-module-U6G5RZV2.mjs} +14 -14
  55. package/dist-lib/esm-chunks/{swift-sdk-image-3P4IUP2A.mjs → swift-sdk-image-PVDA2MVM.mjs} +14 -14
  56. package/dist-lib/esm-chunks/{swift-sdk-image-producer-EA2RYBM4.mjs → swift-sdk-image-producer-YHPS3KNR.mjs} +4 -4
  57. package/dist-lib/expo-swift-bundle.cjs +1519 -931
  58. package/dist-lib/expo-swift-metadata.cjs +1 -1
  59. package/dist-lib/expo-swift-metadata.mjs +7 -7
  60. package/dist-lib/home-paths.cjs +1 -1
  61. package/dist-lib/host/bridge-host.cjs +1677 -947
  62. package/dist-lib/host/fetch-proxy-handler.cjs +44 -37
  63. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  64. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  65. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  66. package/dist-lib/host/websocket-proxy.cjs +1 -1
  67. package/dist-lib/index.cjs +1 -1
  68. package/dist-lib/kotlin-host.cjs +1 -1
  69. package/dist-lib/menu.cjs +1 -1
  70. package/dist-lib/menu.mjs +3 -3
  71. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  72. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  73. package/dist-lib/metro-production-bundle.cjs +1 -1
  74. package/dist-lib/metro-production-bundle.mjs +4 -4
  75. package/dist-lib/native-app-identity-project.cjs +540 -247
  76. package/dist-lib/native-app-identity-project.mjs +218 -1828
  77. package/dist-lib/native-app-identity.cjs +1 -1
  78. package/dist-lib/native-app-identity.mjs +6 -6
  79. package/dist-lib/native-firebase-metadata.cjs +1 -1
  80. package/dist-lib/native-firebase-metadata.mjs +3 -3
  81. package/dist-lib/pdfium-raster.cjs +1 -1
  82. package/dist-lib/pdfium-raster.mjs +2 -2
  83. package/dist-lib/plist.cjs +327 -15
  84. package/dist-lib/plist.mjs +13 -5
  85. package/dist-lib/profiles.cjs +1 -1
  86. package/dist-lib/public-brand.cjs +1 -1
  87. package/dist-lib/public-origins-lib-esm.json +82 -129
  88. package/dist-lib/public-origins-lib.json +69 -140
  89. package/dist-lib/react-native-host-modules.cjs +1 -1
  90. package/dist-lib/react-native-host-modules.mjs +2 -2
  91. package/dist-lib/reap-browser.cjs +1 -1
  92. package/dist-lib/scripts/dev-server-scanner.cjs +211 -3
  93. package/dist-lib/sdk.cjs +1 -1
  94. package/dist-lib/sdk.mjs +8 -8
  95. package/dist-lib/skills.cjs +1693 -963
  96. package/dist-lib/swift-compile.cjs +812 -673
  97. package/dist-lib/swift-compile.mjs +10 -10
  98. package/dist-lib/swift-package.cjs +1 -1
  99. package/dist-lib/swift-package.mjs +3 -3
  100. package/dist-lib/swift-submit.cjs +1 -1
  101. package/dist-lib/swift-submit.mjs +6 -6
  102. package/dist-lib/swift-svg-raster.cjs +1 -1
  103. package/dist-lib/swift-svg-raster.mjs +2 -2
  104. package/dist-lib/swift-toolchain.cjs +3 -2
  105. package/dist-lib/swift.cjs +1 -1
  106. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  107. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  108. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  109. package/dist-lib/vendor/acorn.cjs +1 -1
  110. package/dist-lib/vendor/magic-string.cjs +1 -1
  111. package/dist-lib/vendor/stream-json.cjs +1 -1
  112. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  113. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  114. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  115. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  116. package/dist-lib/vendor/sucrase.cjs +1 -1
  117. package/dist-lib/vendor/terser.cjs +1 -1
  118. package/dist-lib/vendor/valibot.cjs +1 -1
  119. package/dist-lib/vendor/ws.cjs +1 -1
  120. package/dist-lib/vendor/zod.cjs +1 -1
  121. package/dist-lib/worklet-executable.cjs +1 -1
  122. package/dist-lib/worklet-executable.mjs +3 -3
  123. package/dist-types/packages/peach-engine/src/ios/apps/canvas-map-data.d.ts +38 -2
  124. package/dist-types/packages/peach-globals/src/canvasAgentContract.d.ts +8 -0
  125. package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
  126. package/package.json +1 -6
  127. package/src/agent-prompt.ts +5 -1
  128. package/src/bazel-project.ts +1 -1
  129. package/src/expo-native-prebuilt.ts +1 -1
  130. package/src/expo-workspace-exclusion.ts +1 -1
  131. package/src/gitignore.ts +175 -0
  132. package/src/intent-definition/plist-reader.ts +22 -168
  133. package/src/one-native-controls-package.ts +143 -1
  134. package/src/oneNativeControlsContract.ts +1 -0
  135. package/src/plist-bytes.ts +144 -2
  136. package/src/plist.ts +359 -2
  137. package/src/swift-compile-budget.ts +28 -7
  138. package/src/swift-compile.ts +972 -809
  139. package/src/swift-guest-compile.ts +3 -0
  140. package/src/swift-toolchain.ts +4 -1
  141. package/src/xcode-project.ts +1 -1
  142. package/dist-lib/esm-chunks/chunk-OW4VRQKO.mjs +0 -10993
  143. package/dist-lib/esm-chunks/chunk-ZSHGFGW7.mjs +0 -65
  144. package/dist-lib/vendor/@xmldom/xmldom.cjs +0 -6481
  145. package/dist-lib/vendor/bplist-parser.cjs +0 -1589
  146. package/dist-lib/vendor/ignore.cjs +0 -455
  147. package/dist-lib/vendor/plist.cjs +0 -10978
@@ -1,8 +1,9 @@
1
- import { execFileSync, spawn, spawnSync } from 'node:child_process'
1
+ import { execFile, execFileSync, spawn, spawnSync } from 'node:child_process'
2
2
  import { createHash, randomUUID } from 'node:crypto'
3
3
  import fs from 'node:fs'
4
4
  import os from 'node:os'
5
5
  import path from 'node:path'
6
+ import { promisify } from 'node:util'
6
7
  import {
7
8
  detachBundleGlobalFooter,
8
9
  stripBundleMetadataFooter,
@@ -65,6 +66,23 @@ import {
65
66
  } from './control'
66
67
 
67
68
  const origin = APP_PACKAGE_ORIGIN
69
+ const execFileAsync = promisify(execFile)
70
+
71
+ function cloneTree(source: string, destination: string, dereference = false): void {
72
+ fs.rmSync(destination, { recursive: true, force: true })
73
+ const flag = dereference ? '-cRL' : '-cR'
74
+ if (
75
+ spawnSync('/bin/cp', [flag, source, destination], { stdio: 'ignore' }).status === 0
76
+ ) {
77
+ return
78
+ }
79
+ fs.rmSync(destination, { recursive: true, force: true })
80
+ if (dereference) {
81
+ fs.cpSync(source, destination, { recursive: true, dereference: true })
82
+ } else {
83
+ execFileSync('/usr/bin/ditto', [source, destination])
84
+ }
85
+ }
68
86
 
69
87
  // a launch compiles every script the app runs as it starts. the bytecode v8 keeps from one launch
70
88
  // here ships in the bundle, where the realms read it (peach-desktop node/realm.mjs), so the first
@@ -146,7 +164,7 @@ async function primeCodeCache(app: string, home: string): Promise<void> {
146
164
  `the packaged app did not start: ${(ready.stderr + ready.stdout).slice(-400)}`,
147
165
  )
148
166
  }
149
- await new Promise((resolve) => setTimeout(resolve, 500))
167
+ await new Promise((resolve) => setTimeout(resolve, 100))
150
168
  }
151
169
  // what the first screen runs once its data arrives belongs in the cache too
152
170
  spawnSync(peach, ['wait', 'idle', '--max-ms', '10000'], { env: bridgeEnv })
@@ -690,7 +708,7 @@ export async function runPackage(args: string[]): Promise<void> {
690
708
  }
691
709
  return stageHostLaunchMetadata(new URL(launchUrl), origin)
692
710
  })
693
- execFileSync('/usr/bin/ditto', [host, temporary])
711
+ cloneTree(host, temporary)
694
712
  const contents = path.join(temporary, 'Contents')
695
713
  const resources = path.join(contents, 'Resources')
696
714
  const plist = path.join(contents, 'Info.plist')
@@ -702,11 +720,12 @@ export async function runPackage(args: string[]): Promise<void> {
702
720
  if (!isRecord(hostInfo) || typeof hostInfo.CFBundleExecutable !== 'string')
703
721
  throw new Error('native host has no executable')
704
722
  const hostExecutable = hostInfo.CFBundleExecutable
705
- fs.cpSync(runtime, path.join(resources, 'runtime'), {
706
- recursive: true,
707
- dereference: true,
708
- })
709
- fs.copyFileSync(cli, path.join(resources, 'bin', 'peach'))
723
+ cloneTree(runtime, path.join(resources, 'runtime'), true)
724
+ fs.copyFileSync(
725
+ cli,
726
+ path.join(resources, 'bin', 'peach'),
727
+ fs.constants.COPYFILE_FICLONE,
728
+ )
710
729
  fs.mkdirSync(path.join(resources, 'payload'))
711
730
  const relocatableFiles: string[] = []
712
731
  for (const [file, source] of captured.files) {
@@ -716,7 +735,11 @@ export async function runPackage(args: string[]): Promise<void> {
716
735
  new RegExp(APP_PACKAGE_ADDRESS_PATTERN, 'i').test(bytes.toString('utf8'))
717
736
  )
718
737
  relocatableFiles.push(file)
719
- fs.copyFileSync(source, path.join(resources, 'payload', file))
738
+ fs.copyFileSync(
739
+ source,
740
+ path.join(resources, 'payload', file),
741
+ fs.constants.COPYFILE_FICLONE,
742
+ )
720
743
  }
721
744
  const manifest: AppPackageManifest = {
722
745
  schemaVersion: 1,
@@ -764,38 +787,33 @@ export async function runPackage(args: string[]): Promise<void> {
764
787
  if (icon) {
765
788
  const iconset = path.join(scratch, 'App.iconset')
766
789
  fs.mkdirSync(iconset)
767
- for (const size of [16, 32, 128, 256, 512]) {
768
- execFileSync(
769
- '/usr/bin/sips',
770
- [
790
+ const resolvedIcon = path.resolve(icon)
791
+ await Promise.all(
792
+ [16, 32, 128, 256, 512].flatMap((size) => [
793
+ execFileAsync('/usr/bin/sips', [
771
794
  '-s',
772
795
  'format',
773
796
  'png',
774
797
  '-z',
775
798
  String(size),
776
799
  String(size),
777
- path.resolve(icon),
800
+ resolvedIcon,
778
801
  '--out',
779
802
  path.join(iconset, `icon_${size}x${size}.png`),
780
- ],
781
- { stdio: 'ignore' },
782
- )
783
- execFileSync(
784
- '/usr/bin/sips',
785
- [
803
+ ]),
804
+ execFileAsync('/usr/bin/sips', [
786
805
  '-s',
787
806
  'format',
788
807
  'png',
789
808
  '-z',
790
809
  String(size * 2),
791
810
  String(size * 2),
792
- path.resolve(icon),
811
+ resolvedIcon,
793
812
  '--out',
794
813
  path.join(iconset, `icon_${size}x${size}@2x.png`),
795
- ],
796
- { stdio: 'ignore' },
797
- )
798
- }
814
+ ]),
815
+ ]),
816
+ )
799
817
  execFileSync('/usr/bin/iconutil', [
800
818
  '-c',
801
819
  'icns',
@@ -820,15 +838,18 @@ export async function runPackage(args: string[]): Promise<void> {
820
838
  return file
821
839
  }
822
840
  const appEntitlements = entitlementsOf(`MacOS/${hostExecutable}`)
841
+ const signArgs = (target: string, entitlements?: string) => [
842
+ '--force',
843
+ '--sign',
844
+ identity ?? '-',
845
+ ...(identity ? ['--options', 'runtime', '--timestamp'] : []),
846
+ ...(entitlements ? ['--entitlements', entitlements] : []),
847
+ target,
848
+ ]
823
849
  const sign = (target: string, entitlements?: string) =>
824
- execFileSync('/usr/bin/codesign', [
825
- '--force',
826
- '--sign',
827
- identity ?? '-',
828
- ...(identity ? ['--options', 'runtime', '--timestamp'] : []),
829
- ...(entitlements ? ['--entitlements', entitlements] : []),
830
- target,
831
- ])
850
+ execFileSync('/usr/bin/codesign', signArgs(target, entitlements))
851
+ const signAsync = (target: string, entitlements?: string) =>
852
+ execFileAsync('/usr/bin/codesign', signArgs(target, entitlements))
832
853
  if (identity) {
833
854
  // the release order of the host's own signing: every nested binary, then
834
855
  // nested bundles deepest first, then the entitled binaries and the app
@@ -853,12 +874,23 @@ export async function runPackage(args: string[]): Promise<void> {
853
874
  .map((entry) => path.join(entry.parentPath, entry.name))
854
875
  .sort((a, b) => b.length - a.length))
855
876
  sign(bundle)
856
- sign(path.join(resources, 'bin', 'peach'), entitlementsOf('Resources/bin/peach'))
857
- sign(path.join(contents, 'Frameworks', 'node'), entitlementsOf('Frameworks/node'))
858
- } else sign(path.join(resources, 'bin', 'peach'), appEntitlements)
859
- // the launcher script is the bundle executable, so the host binary
860
- // needs its jit entitlements signed on directly
861
- sign(path.join(contents, 'MacOS', hostExecutable), appEntitlements)
877
+ await Promise.all([
878
+ signAsync(
879
+ path.join(resources, 'bin', 'peach'),
880
+ entitlementsOf('Resources/bin/peach'),
881
+ ),
882
+ signAsync(
883
+ path.join(contents, 'Frameworks', 'node'),
884
+ entitlementsOf('Frameworks/node'),
885
+ ),
886
+ signAsync(path.join(contents, 'MacOS', hostExecutable), appEntitlements),
887
+ ])
888
+ } else {
889
+ await Promise.all([
890
+ signAsync(path.join(resources, 'bin', 'peach'), appEntitlements),
891
+ signAsync(path.join(contents, 'MacOS', hostExecutable), appEntitlements),
892
+ ])
893
+ }
862
894
  await primeCodeCache(temporary, path.join(scratch, 'prime-home'))
863
895
  sign(temporary, identity ? appEntitlements : undefined)
864
896
  execFileSync('/usr/bin/codesign', ['--verify', '--deep', '--strict', temporary])
@@ -55,6 +55,14 @@ type NativeProfileReport = {
55
55
  topJsCallers?: NativeProfileFunction[]
56
56
  reactCommits: number
57
57
  topReactComponents: NativeProfileComponent[]
58
+ nativeSamples: number
59
+ topNativeSelf: Record<string, unknown>[]
60
+ topNativeInclusive: Record<string, unknown>[]
61
+ topNativeStacks: Record<string, unknown>[]
62
+ turnsOver16ms: number
63
+ worstStall: Record<string, unknown> | null
64
+ slowBridgeCalls: Record<string, unknown>[]
65
+ slowBridgeTotal: number
58
66
  files: {
59
67
  cpuprofile: string
60
68
  trace: string
@@ -77,6 +85,9 @@ type ParsedSourceMap = {
77
85
  }
78
86
 
79
87
  type SourceMapBundle = {
88
+ directory: string
89
+ compiled: { offset: number; name: string }[]
90
+ compiledEnd: number
80
91
  rawMaps: Record<string, string>
81
92
  decoded: Map<string, ParsedSourceMap | null>
82
93
  declByFileAndName: Map<string, number>
@@ -199,6 +210,9 @@ function loadSourceMapsBundle(
199
210
  executableUUID: string,
200
211
  ): SourceMapBundle {
201
212
  const empty: SourceMapBundle = {
213
+ directory: '',
214
+ compiled: [],
215
+ compiledEnd: 0,
202
216
  rawMaps: {},
203
217
  decoded: new Map(),
204
218
  declByFileAndName: new Map(),
@@ -224,6 +238,7 @@ function loadSourceMapsBundle(
224
238
  }
225
239
  }
226
240
  if (!existsSync(targetFile)) return empty
241
+ empty.directory = dirname(targetFile)
227
242
  const parsed: unknown = JSON.parse(readFileSync(targetFile, 'utf8'))
228
243
  if (!parsed || typeof parsed !== 'object') return empty
229
244
  const mapsObj = Reflect.get(parsed, 'maps')
@@ -237,12 +252,19 @@ function loadSourceMapsBundle(
237
252
  compiledFrames && typeof compiledFrames === 'object'
238
253
  ? Reflect.get(compiledFrames, 'entries')
239
254
  : null
255
+ const end =
256
+ compiledFrames && typeof compiledFrames === 'object'
257
+ ? Reflect.get(compiledFrames, 'end')
258
+ : null
259
+ if (typeof end === 'number') empty.compiledEnd = end
240
260
  if (Array.isArray(entries)) {
241
261
  const frameRe = /^(\S+)\s+.*one-native-aot\/([a-f0-9]{64}\.[a-z.]+):(\d+)$/
242
262
  for (const entry of entries) {
243
263
  if (!entry || typeof entry !== 'object') continue
244
264
  const name = Reflect.get(entry, 'name')
245
265
  if (typeof name !== 'string') continue
266
+ const offset = Reflect.get(entry, 'offset')
267
+ if (typeof offset === 'number') empty.compiled.push({ offset, name })
246
268
  const match = frameRe.exec(name)
247
269
  if (!match) continue
248
270
  const fn = match[1]!
@@ -431,10 +453,13 @@ function symbolicateFnList(list: ProfileLocation[], bundle: SourceMapBundle): vo
431
453
  }
432
454
 
433
455
  function symbolicateReport(report: NativeProfileReport, bundle: SourceMapBundle): void {
434
- if (!Object.keys(bundle.rawMaps).length) return
435
- symbolicateFnList(report.topJsFunctions, bundle)
436
- if (report.topJsCallers) symbolicateFnList(report.topJsCallers, bundle)
437
- symbolicateReactNames(report.topReactComponents, bundle)
456
+ if (Object.keys(bundle.rawMaps).length) {
457
+ symbolicateFnList(report.topJsFunctions, bundle)
458
+ if (report.topJsCallers) symbolicateFnList(report.topJsCallers, bundle)
459
+ symbolicateReactNames(report.topReactComponents, bundle)
460
+ }
461
+ if (report.executableUUID)
462
+ symbolicateNativeFrames([report], bundle, report.executableUUID)
438
463
  }
439
464
 
440
465
  function symbolicateReactNames(
@@ -451,10 +476,197 @@ function symbolicateReactNames(
451
476
  }
452
477
  }
453
478
 
479
+ // the device names an app frame it has no symbol for as image`0x<offset of the function start>.
480
+ const rawNativeFrame = /^([^`]+)`0x([0-9a-f]+)$/
481
+ const aotFrame = /^(\S+) (\S*one-native-aot\/[a-f0-9]{64}\.[a-z.]+):(\d+)/
482
+ const bridgeFrame =
483
+ /PeachJSC|JscRuntime|facebook::jsi::|margelo::nitro::|JSObjectCallAsFunction|JSObjectMakeFunction|bridge_watch/
484
+ const engineFrame = /`(?:JSC::|WTF::|llint_|jsc_llint|bmalloc)/
485
+
486
+ type NativeLayer = 'JS' | 'Bridge' | 'Native'
487
+
488
+ // names the app image's frames for one executable UUID: compiled javascript through the
489
+ // source map's compiled frame table, everything else through atos and the matching dSYM.
490
+ class AppImageSymbols {
491
+ private readonly names = new Map<number, string>()
492
+ private readonly pending = new Set<number>()
493
+ private constructor(
494
+ private readonly bundle: SourceMapBundle,
495
+ private readonly image: string,
496
+ private readonly dwarf: string | undefined,
497
+ ) {}
498
+
499
+ // the executable is the image that owns main, so its compiled javascript resolves without a dSYM.
500
+ static load(bundle: SourceMapBundle, uuid: string, frames: string[]): AppImageSymbols {
501
+ const dwarf = findDsymBinary(bundle.directory, uuid)
502
+ if (!dwarf)
503
+ console.error(`no dSYM found for ${uuid}; native app frames keep their offsets`)
504
+ const image = dwarf
505
+ ? basename(dwarf)
506
+ : (frames.find((frame) => frame.endsWith('`main'))?.slice(0, -'`main'.length) ?? '')
507
+ return new AppImageSymbols(bundle, image, dwarf)
508
+ }
509
+
510
+ want(frame: string): void {
511
+ const offset = this.offset(frame)
512
+ if (offset === undefined || this.compiled(offset) || this.names.has(offset)) return
513
+ this.pending.add(offset)
514
+ }
515
+
516
+ resolve(): void {
517
+ if (!this.dwarf || !this.pending.size) return
518
+ const offsets = [...this.pending]
519
+ this.pending.clear()
520
+ const lines = execFileSync(
521
+ 'xcrun',
522
+ ['atos', '-o', this.dwarf, '-arch', 'arm64', '-offset'],
523
+ {
524
+ input: offsets.map((offset) => `0x${offset.toString(16)}`).join('\n'),
525
+ encoding: 'utf8',
526
+ maxBuffer: 64 * 1024 * 1024,
527
+ },
528
+ ).split('\n')
529
+ offsets.forEach((offset, i) => {
530
+ const match = /^(.*?) \(in [^)]+\)(?: \+ \d+)?(?: \((.+)\))?$/.exec(lines[i] ?? '')
531
+ if (match?.[1] && !match[1].startsWith('0x'))
532
+ this.names.set(
533
+ offset,
534
+ `${this.image}\`${match[1]}${match[2] ? ` (${match[2]})` : ''}`,
535
+ )
536
+ })
537
+ }
538
+
539
+ name(frame: string): { layer: NativeLayer; name: string } {
540
+ const offset = this.offset(frame)
541
+ let name = frame
542
+ if (offset !== undefined) {
543
+ const entry = this.compiled(offset)
544
+ const js = entry && aotFrame.exec(entry.name)
545
+ if (js) {
546
+ const location = resolveAotLocation(this.bundle, js[2]!, Number(js[3]), 1, js[1]!)
547
+ const fn = location?.name ?? js[1]!
548
+ const source = location ? formatLocation(location.url, location.line) : ''
549
+ return { layer: 'JS', name: source ? `${fn} (${source})` : fn }
550
+ }
551
+ name = entry ? `${this.image}\`${entry.name}` : (this.names.get(offset) ?? frame)
552
+ }
553
+ if (bridgeFrame.test(name)) return { layer: 'Bridge', name }
554
+ return { layer: engineFrame.test(name) ? 'JS' : 'Native', name }
555
+ }
556
+
557
+ private offset(frame: string): number | undefined {
558
+ const match = rawNativeFrame.exec(frame)
559
+ return match && match[1] === this.image ? Number.parseInt(match[2]!, 16) : undefined
560
+ }
561
+
562
+ private compiled(offset: number) {
563
+ const { compiled, compiledEnd } = this.bundle
564
+ if (!compiled.length || offset < compiled[0]!.offset || offset >= compiledEnd) return
565
+ let low = 0
566
+ let high = compiled.length - 1
567
+ while (low < high) {
568
+ const mid = (low + high + 1) >> 1
569
+ if (compiled[mid]!.offset <= offset) low = mid
570
+ else high = mid - 1
571
+ }
572
+ return compiled[low]
573
+ }
574
+ }
575
+
576
+ // the build keeps OneNativeSymbols-<uuid>.dSYM beside its source map; spotlight finds a dSYM
577
+ // that was moved or archived anywhere else.
578
+ function findDsymBinary(directory: string, uuid: string): string | undefined {
579
+ const indexed = execFileSync('mdfind', [`com_apple_xcode_dsym_uuids == ${uuid}`], {
580
+ encoding: 'utf8',
581
+ })
582
+ const bundles = [
583
+ join(directory, `OneNativeSymbols-${uuid}.dSYM`),
584
+ ...indexed.split('\n'),
585
+ ]
586
+ for (const bundle of bundles) {
587
+ const dwarfDirectory = join(bundle, 'Contents/Resources/DWARF')
588
+ if (!bundle || !existsSync(dwarfDirectory)) continue
589
+ for (const name of readdirSync(dwarfDirectory)) {
590
+ const binary = join(dwarfDirectory, name)
591
+ const uuids = execFileSync('xcrun', ['dwarfdump', '--uuid', binary], {
592
+ encoding: 'utf8',
593
+ })
594
+ if (uuids.toUpperCase().includes(`UUID: ${uuid.toUpperCase()} (ARM64)`))
595
+ return binary
596
+ }
597
+ }
598
+ }
599
+
600
+ // every native frame list a report or snapshot carries, renamed in place. worstStall and
601
+ // slowBridgeCalls trade their leaf-first nativeStack for one stack read from the root down,
602
+ // each frame tagged with the layer it runs in.
603
+ function nativeFrameLists(report: Record<string, unknown>) {
604
+ const entries = ['topNativeSelf', 'topNativeInclusive', 'topNativeStacks'].flatMap(
605
+ (key) => {
606
+ const list = report[key]
607
+ return Array.isArray(list) ? list.filter(isRecord) : []
608
+ },
609
+ )
610
+ const stacks = [
611
+ report.worstStall,
612
+ ...(Array.isArray(report.slowBridgeCalls) ? report.slowBridgeCalls : []),
613
+ ].filter(isRecord)
614
+ const framesOf = (row: Record<string, unknown>) =>
615
+ Array.isArray(row.nativeStack)
616
+ ? row.nativeStack.filter((frame): frame is string => typeof frame === 'string')
617
+ : []
618
+ return {
619
+ frames: [
620
+ ...entries.flatMap((entry) =>
621
+ typeof entry.name === 'string' ? entry.name.split(' > ') : [],
622
+ ),
623
+ ...stacks.flatMap(framesOf),
624
+ ],
625
+ rename(symbols: AppImageSymbols) {
626
+ for (const entry of entries) {
627
+ if (typeof entry.name !== 'string') continue
628
+ entry.name = entry.name
629
+ .split(' > ')
630
+ .map((frame) => symbols.name(frame).name)
631
+ .join(' > ')
632
+ }
633
+ for (const row of stacks) {
634
+ row.stack = framesOf(row)
635
+ .reverse()
636
+ .map((frame) => {
637
+ const { layer, name } = symbols.name(frame)
638
+ return `${layer}: ${name}`
639
+ })
640
+ delete row.nativeStack
641
+ }
642
+ },
643
+ }
644
+ }
645
+
646
+ function symbolicateNativeFrames(
647
+ reports: Record<string, unknown>[],
648
+ bundle: SourceMapBundle,
649
+ uuid: string,
650
+ ) {
651
+ const lists = reports.map(nativeFrameLists)
652
+ const symbols = AppImageSymbols.load(
653
+ bundle,
654
+ uuid,
655
+ lists.flatMap((list) => list.frames),
656
+ )
657
+ for (const list of lists) for (const frame of list.frames) symbols.want(frame)
658
+ symbols.resolve()
659
+ for (const list of lists) list.rename(symbols)
660
+ }
661
+
454
662
  function symbolicateTelemetry(input: string, mapsPath: string): string {
455
663
  const mapDirectory = statSync(mapsPath).isDirectory()
456
664
  const snapshots: Record<string, unknown>[] = []
457
- let current: { uuid: string; bundle: SourceMapBundle } | undefined
665
+ let current:
666
+ | { uuid: string; bundle: SourceMapBundle; reports: Record<string, unknown>[] }
667
+ | undefined
668
+ const finish = () =>
669
+ current && symbolicateNativeFrames(current.reports, current.bundle, current.uuid)
458
670
  for (const line of readFileSync(input, 'utf8').split('\n')) {
459
671
  if (!line.trim()) continue
460
672
  const row: unknown = JSON.parse(line)
@@ -470,6 +682,7 @@ function symbolicateTelemetry(input: string, mapsPath: string): string {
470
682
  continue
471
683
 
472
684
  if (current?.uuid !== executableUUID) {
685
+ finish()
473
686
  const expected = `OneJavaScriptSourceMaps-${executableUUID}.json`
474
687
  const mapFile = mapDirectory ? join(mapsPath, expected) : mapsPath
475
688
  if (basename(mapFile) !== expected || !existsSync(mapFile)) {
@@ -478,7 +691,7 @@ function symbolicateTelemetry(input: string, mapsPath: string): string {
478
691
  const bundle = loadSourceMapsBundle(mapFile, executableUUID)
479
692
  if (!Object.keys(bundle.rawMaps).length)
480
693
  throw new Error(`No source maps in ${mapFile}`)
481
- current = { uuid: executableUUID, bundle }
694
+ current = { uuid: executableUUID, bundle, reports: [] }
482
695
  }
483
696
 
484
697
  const jsFunctions = topJsFunctions.filter(
@@ -495,8 +708,10 @@ function symbolicateTelemetry(input: string, mapsPath: string): string {
495
708
  )
496
709
  symbolicateFnList(jsFunctions, current.bundle)
497
710
  symbolicateReactNames(components, current.bundle)
711
+ current.reports.push(snapshot)
498
712
  snapshots.push(row)
499
713
  }
714
+ finish()
500
715
  if (!snapshots.length) throw new Error(`No profiler telemetry snapshots in ${input}`)
501
716
  return `${JSON.stringify(snapshots, null, 2)}\n`
502
717
  }
@@ -609,6 +824,32 @@ function printSummary(
609
824
  }
610
825
  }
611
826
 
827
+ const leafFrames = (row: Record<string, unknown>) =>
828
+ (Array.isArray(row.stack)
829
+ ? row.stack
830
+ : Array.isArray(row.nativeStack)
831
+ ? [...row.nativeStack].reverse()
832
+ : []
833
+ )
834
+ .slice(-8)
835
+ .map((frame) => ` ${String(frame)}`)
836
+ const stall = report.worstStall
837
+ if (stall) {
838
+ console.log(
839
+ `\nWorst stall (${report.turnsOver16ms} turns over 16 ms): ${asNum(stall.durationMs).toFixed(1)} ms in ${asStr(stall.phase)}, ${stall.idle === true ? 'idle' : 'during interaction'}`,
840
+ )
841
+ for (const line of leafFrames(stall)) console.log(line)
842
+ }
843
+ if (report.slowBridgeCalls.length) {
844
+ console.log(`\nSlow bridge calls (${report.slowBridgeTotal} over 256 KB or 4 ms):`)
845
+ for (const call of report.slowBridgeCalls.slice(-5)) {
846
+ console.log(
847
+ ` ${asStr(call.op)}: ${(asNum(call.bytes) / 1024).toFixed(0)} KB in ${asNum(call.durationMs).toFixed(1)} ms`,
848
+ )
849
+ for (const line of leafFrames(call)) console.log(line)
850
+ }
851
+ }
852
+
612
853
  console.log('\nArtifacts:')
613
854
  console.log(` cpuprofile: ${outFiles.cpuprofile}`)
614
855
  console.log(` trace: ${outFiles.trace}`)
@@ -654,6 +895,10 @@ function asStr(value: unknown): string {
654
895
  return typeof value === 'string' ? value : ''
655
896
  }
656
897
 
898
+ function records(value: unknown): Record<string, unknown>[] {
899
+ return Array.isArray(value) ? value.filter(isRecord) : []
900
+ }
901
+
657
902
  function parseNativeReport(value: unknown): NativeProfileReport | undefined {
658
903
  if (!isRecord(value)) return undefined
659
904
  const phasesRaw = isRecord(value.phases) ? value.phases : {}
@@ -709,6 +954,14 @@ function parseNativeReport(value: unknown): NativeProfileReport | undefined {
709
954
  topJsCallers,
710
955
  reactCommits: asNum(value.reactCommits),
711
956
  topReactComponents,
957
+ nativeSamples: asNum(value.nativeSamples),
958
+ topNativeSelf: records(value.topNativeSelf),
959
+ topNativeInclusive: records(value.topNativeInclusive),
960
+ topNativeStacks: records(value.topNativeStacks),
961
+ turnsOver16ms: asNum(value.turnsOver16ms),
962
+ worstStall: isRecord(value.worstStall) ? value.worstStall : null,
963
+ slowBridgeCalls: records(value.slowBridgeCalls),
964
+ slowBridgeTotal: asNum(value.slowBridgeTotal),
712
965
  files: {
713
966
  cpuprofile: asStr(files.cpuprofile),
714
967
  trace: asStr(files.trace),
@@ -595,6 +595,7 @@ export interface BuildShellUrlOptions {
595
595
  // capture matches simctl's rectangular framebuffer. without it a
596
596
  // screen holding a focused text field never reaches three identical idle
597
597
  // frames, so the screenshot guard burns all 12 attempts and then fails.
598
+ // it also keeps schema-default settings, apart from the shared config.json.
598
599
  proof?: boolean
599
600
  // a temporary storage profile, stamped as ?ephemeral=1. the shell then
600
601
  // neither reads nor writes the machine-wide settings in
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2605 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2607 | (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.2605 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2607 | (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.2605 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2607 | (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.2605 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2607 | (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.2605 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2607 | (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;
package/dist-lib/beta.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2605 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2607 | (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;
package/dist-lib/beta.mjs CHANGED
@@ -1,5 +1,5 @@
1
- /*! peach v0.1.2605 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
- import "./esm-chunks/chunk-ZSHGFGW7.mjs";
1
+ /*! peach v0.1.2607 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+ import "./esm-chunks/chunk-P5Q5QCTP.mjs";
3
3
 
4
4
  // src/beta.ts
5
5
  var IS_BETA = true;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2605 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2607 | (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.2605 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2607 | (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.2605 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2607 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  import {
3
3
  BridgeInputError,
4
4
  SEMANTIC_WAIT_MAX_TIMEOUT_MS,
@@ -17,10 +17,10 @@ import {
17
17
  parseSemanticWaitOptions,
18
18
  parseStateOptions,
19
19
  parseTapTarget
20
- } from "./esm-chunks/chunk-M4G5YUO7.mjs";
21
- import "./esm-chunks/chunk-WB2EBX5Q.mjs";
22
- import "./esm-chunks/chunk-VRQPEROV.mjs";
23
- import "./esm-chunks/chunk-ZSHGFGW7.mjs";
20
+ } from "./esm-chunks/chunk-6NDABMDX.mjs";
21
+ import "./esm-chunks/chunk-BNAXRY5Q.mjs";
22
+ import "./esm-chunks/chunk-M4ORY3NH.mjs";
23
+ import "./esm-chunks/chunk-P5Q5QCTP.mjs";
24
24
  export {
25
25
  BridgeInputError,
26
26
  SEMANTIC_WAIT_MAX_TIMEOUT_MS,
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2605 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2607 | (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;