peachsim 0.1.2264 → 0.1.2266

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/command-registry.ts +2 -0
  2. package/cli/commands/control.ts +13 -20
  3. package/cli/commands/cpu-profile.ts +139 -0
  4. package/cli/commands/defaults.ts +71 -0
  5. package/cli/main.ts +6 -0
  6. package/cli/outbound-endpoints.ts +0 -4
  7. package/dist-lib/agent-daemon-client.cjs +1 -1
  8. package/dist-lib/agent-events.cjs +1 -1
  9. package/dist-lib/attached-projects.cjs +1 -1
  10. package/dist-lib/auth/shared-session.cjs +1 -1
  11. package/dist-lib/backend-origin.cjs +1 -1
  12. package/dist-lib/beta.cjs +1 -1
  13. package/dist-lib/beta.mjs +1 -1
  14. package/dist-lib/bridge-constants.cjs +1 -1
  15. package/dist-lib/bridge-contract-input.cjs +1 -1
  16. package/dist-lib/bridge-contract-input.mjs +1 -1
  17. package/dist-lib/bridge-contract.cjs +1 -1
  18. package/dist-lib/bridge-contract.mjs +1 -1
  19. package/dist-lib/bundle-channel.cjs +2 -2
  20. package/dist-lib/capture-contract.cjs +1 -1
  21. package/dist-lib/capture-contract.mjs +1 -1
  22. package/dist-lib/cloud-contract.cjs +1 -1
  23. package/dist-lib/cloud-contract.mjs +1 -1
  24. package/dist-lib/cloud-test-args.cjs +1 -1
  25. package/dist-lib/cloud-test-args.mjs +1 -1
  26. package/dist-lib/cloud.cjs +1 -1
  27. package/dist-lib/cloud.mjs +1 -1
  28. package/dist-lib/config.cjs +1 -1
  29. package/dist-lib/config.mjs +1 -1
  30. package/dist-lib/detox/index.cjs +48 -5
  31. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  32. package/dist-lib/expo-swift-bundle.cjs +1 -1
  33. package/dist-lib/expo-swift-metadata.cjs +1 -1
  34. package/dist-lib/expo-swift-metadata.mjs +1 -1
  35. package/dist-lib/home-paths.cjs +1 -1
  36. package/dist-lib/host/bridge-host.cjs +2 -2
  37. package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
  38. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  39. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  40. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  41. package/dist-lib/host/websocket-proxy.cjs +1 -1
  42. package/dist-lib/index.cjs +2 -2
  43. package/dist-lib/jump-to-source-babel.cjs +1 -1
  44. package/dist-lib/jump-to-source-native.cjs +1 -1
  45. package/dist-lib/kotlin-host.cjs +1 -1
  46. package/dist-lib/menu.cjs +1 -1
  47. package/dist-lib/menu.mjs +1 -1
  48. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  49. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  50. package/dist-lib/metro-production-bundle.cjs +1 -1
  51. package/dist-lib/metro-production-bundle.mjs +1 -1
  52. package/dist-lib/metro.cjs +2 -2
  53. package/dist-lib/native-app-identity-project.cjs +1 -1
  54. package/dist-lib/native-app-identity-project.mjs +1 -1
  55. package/dist-lib/native-app-identity.cjs +1 -1
  56. package/dist-lib/native-app-identity.mjs +1 -1
  57. package/dist-lib/native-firebase-metadata.cjs +1 -1
  58. package/dist-lib/native-firebase-metadata.mjs +1 -1
  59. package/dist-lib/pdfium-raster.cjs +1 -1
  60. package/dist-lib/pdfium-raster.mjs +1 -1
  61. package/dist-lib/plist.cjs +1 -1
  62. package/dist-lib/plist.mjs +1 -1
  63. package/dist-lib/profiles.cjs +1 -1
  64. package/dist-lib/public-brand.cjs +1 -1
  65. package/dist-lib/public-origins-lib-esm.json +24 -24
  66. package/dist-lib/public-origins-lib.json +56 -53
  67. package/dist-lib/react-native-host-modules.cjs +1 -1
  68. package/dist-lib/react-native-host-modules.mjs +1 -1
  69. package/dist-lib/reap-browser.cjs +50 -7
  70. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  71. package/dist-lib/sdk.cjs +1 -1
  72. package/dist-lib/sdk.mjs +1 -1
  73. package/dist-lib/skills.cjs +2586 -2510
  74. package/dist-lib/swift-compile.cjs +1 -1
  75. package/dist-lib/swift-compile.mjs +1 -1
  76. package/dist-lib/swift-package.cjs +1 -1
  77. package/dist-lib/swift-package.mjs +1 -1
  78. package/dist-lib/swift-submit.cjs +1 -1
  79. package/dist-lib/swift-submit.mjs +1 -1
  80. package/dist-lib/swift-toolchain.cjs +1 -1
  81. package/dist-lib/swift.cjs +1 -1
  82. package/dist-lib/vite-swift.cjs +1 -1
  83. package/dist-lib/vite.cjs +2 -2
  84. package/dist-lib/worklet-executable.cjs +1 -1
  85. package/dist-lib/worklet-executable.mjs +1 -1
  86. package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +4 -0
  87. package/kotlin/sdk.tar.gz +0 -0
  88. package/package.json +1 -1
  89. package/runtime-companion.json +1 -1
  90. package/skills/contrast/SKILL.md +1 -0
  91. package/skills/peach-perf/references/profiling.md +3 -0
  92. package/src/headless-policy.ts +67 -0
  93. package/src/reap-browser.ts +16 -1
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2264 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2266 | (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.2264 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2266 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2264 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2266 | (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.2264 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2266 | (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.2264 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2266 | (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.2264 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2266 | (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.2264 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2266 | (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.2264 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2266 | (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.2264 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2266 | (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;
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2264 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2266 | (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;
@@ -2742,7 +2742,7 @@ var init_src = __esm({
2742
2742
  var runtime_companion_default;
2743
2743
  var init_runtime_companion = __esm({
2744
2744
  "runtime-companion.json"() {
2745
- runtime_companion_default = { abi: 1, sha256: "9ea841897a63090ddbce1dbf9be3b55664d3630f612f68e9f3035948dc019b3b", file: "node/cli-9ea841897a63090ddbce1dbf9be3b55664d3630f612f68e9f3035948dc019b3b.cjs" };
2745
+ runtime_companion_default = { abi: 1, sha256: "e93e06ad59ffc08685ad0273fa479b7bcf943306a1e7d39f0116f30238a944c2", file: "node/cli-e93e06ad59ffc08685ad0273fa479b7bcf943306a1e7d39f0116f30238a944c2.cjs" };
2746
2746
  }
2747
2747
  });
2748
2748
 
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2264 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2266 | (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.2264 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2266 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/worklet-executable.ts
4
4
  import { parse } from "acorn";
@@ -265,6 +265,10 @@ export interface SootSimTestBridge {
265
265
  ok: boolean;
266
266
  error?: string;
267
267
  }>;
268
+ writeSwiftPreference(storageKey: string, plist: string): MaybeAsync<{
269
+ ok: boolean;
270
+ error?: string;
271
+ }>;
268
272
  getRouteInfo?(): MaybeAsync<SootSimRouteInfo>;
269
273
  undeclaredScreen?(href: string): MaybeAsync<SootSimUndeclaredScreen | null>;
270
274
  pushRoute?(href: string): MaybeAsync<boolean>;
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.2264",
3
+ "version": "0.1.2266",
4
4
  "description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
5
5
  "author": "Tamagui LLC",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -1 +1 @@
1
- {"abi":1,"sha256":"9ea841897a63090ddbce1dbf9be3b55664d3630f612f68e9f3035948dc019b3b","file":"node/cli-9ea841897a63090ddbce1dbf9be3b55664d3630f612f68e9f3035948dc019b3b.cjs"}
1
+ {"abi":1,"sha256":"e93e06ad59ffc08685ad0273fa479b7bcf943306a1e7d39f0116f30238a944c2","file":"node/cli-e93e06ad59ffc08685ad0273fa479b7bcf943306a1e7d39f0116f30238a944c2.cjs"}
@@ -27,6 +27,7 @@ automation, inspecting the render tree, and managing sims.
27
27
  | `peach location` | control the simulator's simulated device location |
28
28
  | `peach push` | deliver an APNs payload to an installed app |
29
29
  | `peach state` | capture the current app state in one call |
30
+ | `peach defaults` | write an app-group UserDefaults value into the running app |
30
31
  | `peach reset` | clear the current guest app and relaunch it |
31
32
  | `peach camera` | control the simulator camera source |
32
33
  | `peach perf` | CPU, React render, shell frame, and scroll-layer profiling |
@@ -44,6 +44,9 @@ nearly empty worker profile cannot explain scheduling starvation. Successful
44
44
  capture requires page, shell, compositor, tenant, and all discovered targets
45
45
  covering at least 99% of the requested window.
46
46
 
47
+ For the desktop app, which has no Chrome, run `peach perf cpu --host --duration 8`
48
+ against the connected app: it profiles the host thread and every realm.
49
+
47
50
  `--match <substring>` filters the page URL; `--sample-interval <ms>` controls
48
51
  sampling. See `peach perf cpu --help` for defaults.
49
52
 
@@ -0,0 +1,67 @@
1
+ import { readdirSync, statSync } from 'node:fs'
2
+
3
+ export type HeadlessHost = {
4
+ platform: NodeJS.Platform
5
+ env: Readonly<Record<string, string | undefined>>
6
+ // a window server a headed browser can connect to
7
+ display: boolean
8
+ // a hardware GPU a headed browser would render on
9
+ gpu: boolean
10
+ }
11
+
12
+ // the one place every Peach launcher decides headless versus headed.
13
+ // an explicit request for headless always wins. an explicit request for headed
14
+ // is honored only on a host that can show a window and has a GPU; elsewhere a
15
+ // headed browser either fails to start or renders in software slower than the
16
+ // headless shell. with no request, agents and CI run headless and a person at a
17
+ // desktop gets a window.
18
+ export function resolveHeadless(
19
+ requested: 'headless' | 'headed' | undefined,
20
+ host: HeadlessHost = currentHeadlessHost(),
21
+ ): boolean {
22
+ if (requested === 'headless') return true
23
+ if (!host.display || !host.gpu) return true
24
+ if (requested === 'headed') return false
25
+ return Boolean(host.env.TM_SESSION || host.env.CI || host.env.GITHUB_ACTIONS)
26
+ }
27
+
28
+ export function currentHeadlessHost(
29
+ platform: NodeJS.Platform = process.platform,
30
+ env: Readonly<Record<string, string | undefined>> = process.env,
31
+ ): HeadlessHost {
32
+ return {
33
+ platform,
34
+ env,
35
+ display: hostHasDisplay(platform, env),
36
+ gpu: hostHasGpu(platform),
37
+ }
38
+ }
39
+
40
+ function hostHasDisplay(
41
+ platform: NodeJS.Platform,
42
+ env: Readonly<Record<string, string | undefined>>,
43
+ ): boolean {
44
+ if (platform === 'linux') return Boolean(env.DISPLAY || env.WAYLAND_DISPLAY)
45
+ // no console user means loginwindow only: no window server session to join
46
+ if (platform === 'darwin') return safe(() => statSync('/dev/console').uid !== 0, false)
47
+ return true
48
+ }
49
+
50
+ function hostHasGpu(platform: NodeJS.Platform): boolean {
51
+ if (platform !== 'linux') return true
52
+ return safe(
53
+ () =>
54
+ readdirSync('/dev/dri').some((name) => name.startsWith('renderD')) ||
55
+ safe(() => statSync('/dev/nvidiactl').isCharacterDevice(), false),
56
+ false,
57
+ )
58
+ }
59
+
60
+ // a probe that cannot read the host reports the host lacks the capability
61
+ function safe<T>(read: () => T, fallback: T): T {
62
+ try {
63
+ return read()
64
+ } catch {
65
+ return fallback
66
+ }
67
+ }
@@ -46,6 +46,7 @@ import * as fs from 'node:fs'
46
46
  import * as os from 'node:os'
47
47
  import * as path from 'node:path'
48
48
  import { acquireChromiumAdmission, readChromiumQueue } from './chromium-admission.ts'
49
+ import { currentHeadlessHost, resolveHeadless } from './headless-policy.ts'
49
50
  import { startLaunchDeadline } from './launch-deadline.ts'
50
51
  import { listProcessChildren } from './process-group.ts'
51
52
 
@@ -119,6 +120,19 @@ function currentRuntime(): BrowserLaunchRuntime {
119
120
  return { platform: process.platform, env: process.env }
120
121
  }
121
122
 
123
+ // a caller that asks for a window (headless: false) gets one only on a host
124
+ // that can show it; software chromium never draws a window worth watching.
125
+ function withHostHeadless(
126
+ opts: Record<string, unknown>,
127
+ runtime: BrowserLaunchRuntime,
128
+ software: boolean,
129
+ ): Record<string, unknown> {
130
+ if (opts.headless !== false) return opts
131
+ const host = currentHeadlessHost(runtime.platform, runtime.env)
132
+ const headless = software || resolveHeadless('headed', host)
133
+ return headless ? { ...opts, headless: true } : opts
134
+ }
135
+
122
136
  function processCommand(pid: number): string {
123
137
  return execFileSync('/bin/ps', ['-p', String(pid), '-o', 'command='], {
124
138
  encoding: 'utf8',
@@ -709,6 +723,7 @@ export function gpuChromeLaunchOptions(
709
723
  opts: Record<string, unknown> = {},
710
724
  runtime: BrowserLaunchRuntime = currentRuntime(),
711
725
  ): Record<string, unknown> {
726
+ opts = withHostHeadless(opts, runtime, false)
712
727
  const callerArgs = Array.isArray(opts.args) ? opts.args : []
713
728
  const unsafe = callerArgs.find(isSoftwareRendererArgument)
714
729
  if (unsafe !== undefined) {
@@ -908,7 +923,7 @@ export function softwareChromeLaunchOptions(
908
923
  opts: Record<string, unknown>,
909
924
  runtime: BrowserLaunchRuntime = currentRuntime(),
910
925
  ): Record<string, unknown> {
911
- opts = withClaimedSignalShutdown(opts)
926
+ opts = withHostHeadless(withClaimedSignalShutdown(opts), runtime, true)
912
927
  if (opts.ignoreDefaultArgs === true) {
913
928
  throw new Error(
914
929
  '[reap-browser] ignoreDefaultArgs=true bypasses required Chrome launch defaults',