peachsim 0.1.753 → 0.1.755

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 (81) hide show
  1. package/cli/bridge-flow-runner.ts +4 -8
  2. package/cli/commands/daemon.ts +117 -116
  3. package/cli/commands/install-desktop.ts +13 -8
  4. package/cli/commands/maestro.ts +1 -2
  5. package/cli/desktop-companion.ts +9 -2
  6. package/dist-lib/agent-daemon-client.cjs +1 -1
  7. package/dist-lib/agent-events.cjs +1 -1
  8. package/dist-lib/agent-identity.cjs +1 -1
  9. package/dist-lib/agent-sessions.cjs +1 -1
  10. package/dist-lib/attached-projects.cjs +1 -1
  11. package/dist-lib/auth/shared-session.cjs +8 -5
  12. package/dist-lib/backend-origin.cjs +1 -1
  13. package/dist-lib/beta.cjs +1 -1
  14. package/dist-lib/beta.mjs +1 -1
  15. package/dist-lib/bridge-constants.cjs +1 -1
  16. package/dist-lib/bridge-contract-input.cjs +1 -1
  17. package/dist-lib/bridge-contract-input.mjs +1 -1
  18. package/dist-lib/bridge-contract.cjs +1 -1
  19. package/dist-lib/bridge-contract.mjs +1 -1
  20. package/dist-lib/capture-contract.cjs +1 -1
  21. package/dist-lib/capture-contract.mjs +1 -1
  22. package/dist-lib/cli-constants.cjs +1 -1
  23. package/dist-lib/cloud-contract.cjs +1 -1
  24. package/dist-lib/cloud-contract.mjs +1 -1
  25. package/dist-lib/cloud-test-args.cjs +1 -1
  26. package/dist-lib/cloud-test-args.mjs +1 -1
  27. package/dist-lib/cloud.cjs +1 -1
  28. package/dist-lib/cloud.mjs +1 -1
  29. package/dist-lib/config.cjs +1 -1
  30. package/dist-lib/detox/index.cjs +1 -1
  31. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  32. package/dist-lib/home-paths.cjs +2 -23
  33. package/dist-lib/host/bridge-host.cjs +8 -3
  34. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  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 +1 -1
  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 +1 -1
  50. package/dist-lib/native-app-identity.cjs +1 -1
  51. package/dist-lib/native-app-identity.mjs +1 -1
  52. package/dist-lib/native-firebase-metadata.cjs +1 -1
  53. package/dist-lib/native-firebase-metadata.mjs +1 -1
  54. package/dist-lib/plist.cjs +1 -1
  55. package/dist-lib/plist.mjs +1 -1
  56. package/dist-lib/profiles.cjs +1 -1
  57. package/dist-lib/public-brand.cjs +1 -1
  58. package/dist-lib/react-native-host-modules.cjs +1 -1
  59. package/dist-lib/react-native-host-modules.mjs +1 -1
  60. package/dist-lib/render-mode.cjs +1 -1
  61. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  62. package/dist-lib/sdk.cjs +1 -1
  63. package/dist-lib/sdk.mjs +1 -1
  64. package/dist-lib/skills.cjs +48 -47
  65. package/dist-lib/swift-compile.cjs +6 -2
  66. package/dist-lib/swift-compile.mjs +6 -2
  67. package/dist-lib/swift-package.cjs +1 -1
  68. package/dist-lib/swift-package.mjs +1 -1
  69. package/dist-lib/swift-submit.cjs +1 -1
  70. package/dist-lib/swift-submit.mjs +1 -1
  71. package/dist-lib/swift-toolchain.cjs +1 -1
  72. package/dist-lib/swift.cjs +1 -1
  73. package/dist-lib/vite-swift.cjs +6 -2
  74. package/dist-lib/vite.cjs +1 -1
  75. package/package.json +1 -1
  76. package/skills/peach-test/SKILL.md +1 -4
  77. package/src/auth/shared-session.ts +9 -4
  78. package/src/desktop-host-delivery.ts +82 -19
  79. package/src/home-paths.ts +5 -22
  80. package/src/host/agent-host.ts +4 -1
  81. package/src/swift-compile.ts +4 -0
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.753 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.755 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
 
3
3
  // src/swift-submit.ts
4
4
  var SWIFT_COMPILE_PATH = "/api/swift-compile";
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.753 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.755 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.753 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.755 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.753 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.755 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -831,7 +831,11 @@ var OPTIONAL_FRAMEWORK_DEPENDENCIES = {
831
831
  DatadogCore: [],
832
832
  DatadogLogs: ["DatadogCore"],
833
833
  DatadogRUM: ["DatadogCore"],
834
- DatadogTrace: ["DatadogCore"]
834
+ DatadogTrace: ["DatadogCore"],
835
+ AppLovinSDK: [],
836
+ AppsFlyerLib: [],
837
+ FBSDKCoreKit: [],
838
+ FBAudienceNetwork: []
835
839
  };
836
840
  var OPTIONAL_FRAMEWORKS = new Set(Object.keys(OPTIONAL_FRAMEWORK_DEPENDENCIES));
837
841
  var SWIFT_IMPORT = /^\s*(?:@\w+(?:\([^)]*\))?\s+)*import\s+(?:(?:typealias|struct|class|enum|protocol|let|var|func)\s+)?([A-Za-z_][A-Za-z0-9_]*)/;
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.753 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.755 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.753",
3
+ "version": "0.1.755",
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",
@@ -179,7 +179,7 @@ peach maestro --env USERNAME=alice test .maestro/login.yaml
179
179
 
180
180
  ### supported verbs
181
181
 
182
- `launchApp` (including JSON `arguments`), `stopApp`, `clearState`, `tapOn`, `tapAtCoords`, `longPressOn`, `inputText`,
182
+ `launchApp` (including JSON `arguments`), `stopApp`, `clearState`, `clearKeychain`, `tapOn`, `tapAtCoords`, `longPressOn`, `inputText`,
183
183
  `pressKey`, `dispatchKey`, `hideKeyboard`, `eraseText`, `assertVisible`,
184
184
  `assertNotVisible`, `assertTreeContains`, `waitFor`, `extendedWaitUntil`,
185
185
  `waitForAnimationToEnd`, `scroll`, `scrollUntilVisible`, `scrollTo`,
@@ -191,9 +191,6 @@ interpolation.
191
191
 
192
192
  ### partial
193
193
 
194
- - `clearKeychain` — no keychain in Peach; logs a warning and continues.
195
- if a test depends on keychain state being reset, add an explicit
196
- in-app "sign out" step instead.
197
194
  - `when.platform` — Peach emulates iOS; android branches are skipped.
198
195
  - `openLink`: app routing works; there is no OS-level browser fallback.
199
196
 
@@ -177,15 +177,20 @@ export function writeSharedDesktopAuthSession(
177
177
  ) {
178
178
  const filepath = getSharedDesktopAuthFilePath()
179
179
  mkdirSync(dirname(filepath), { recursive: true })
180
+ const token = session.token.trim()
181
+ // a write of the session already stored (a page echoing what it adopted, or
182
+ // refreshing its user) keeps where that session came from and its account
183
+ const stored = readSharedDesktopAuthSession()
184
+ const same = stored?.token === token ? stored : null
180
185
  const normalized: SharedDesktopAuthSession = {
181
186
  version: SESSION_VERSION,
182
- token: session.token.trim(),
187
+ token,
183
188
  user: session.user ? normalizeUser(session.user) : null,
184
189
  origin: session.origin?.trim() || DEFAULT_ORIGIN,
185
- source: session.source,
190
+ source: same?.source ?? session.source,
186
191
  updatedAt: session.updatedAt || new Date().toISOString(),
187
- validatedAt: session.validatedAt,
188
- accountId: session.accountId?.trim() || undefined,
192
+ validatedAt: session.validatedAt ?? same?.validatedAt,
193
+ accountId: session.accountId?.trim() || same?.accountId,
189
194
  }
190
195
  // readers and directory watchers see a complete session, including replacement writes.
191
196
  const temporary = `${filepath}.${process.pid}.${randomUUID()}.tmp`
@@ -1,21 +1,18 @@
1
1
  // peach's binding of the shared runtime-delivery machinery for the native
2
2
  // desktop host. the host releases on its own (packages/peach-desktop's Native
3
- // Desktop Release workflow) and the CLI installs it by version under
4
- // ~/.peach/desktop/<version>/, exactly as `peach runtime install` manages the
5
- // engine runtime. each channel publishes its own manifest per platform, so the
6
- // staging and production queues never write the same object.
3
+ // Desktop Release workflow) and the CLI downloads and verifies each version
4
+ // into ~/.peach/desktop/versions/<version>/, exactly as `peach runtime install` manages
5
+ // the engine runtime. the active version is the one at /Applications/Peach.app,
6
+ // where Spotlight finds it and the CLI, the fleet installer and the app's own
7
+ // updater share it. each channel publishes its own manifest per platform, so
8
+ // the staging and production queues never write the same object.
7
9
 
8
10
  import { spawnSync } from 'node:child_process'
11
+ import fs from 'node:fs'
12
+ import os from 'node:os'
9
13
  import path from 'node:path'
10
14
  import { createRuntimeDelivery, type RuntimeDelivery } from '@contrast/runtime-delivery'
11
- import {
12
- cacheDir,
13
- desktopHostDir,
14
- desktopHostsDir,
15
- ensureRnxHome,
16
- readActiveDesktopHost,
17
- writeActiveDesktopHost,
18
- } from './home-paths.ts'
15
+ import { cacheDir, desktopHostDir, desktopHostsDir, ensureRnxHome } from './home-paths.ts'
19
16
 
20
17
  export const DESKTOP_HOST_CDN_ORIGIN = 'https://r2.rnxsim.com'
21
18
  export const DESKTOP_HOST_CHANNELS = ['production', 'staging'] as const
@@ -33,11 +30,8 @@ export function desktopHostExecutable(): string {
33
30
  return 'PeachDesktop.app/Contents/MacOS/PeachDesktop'
34
31
  }
35
32
 
36
- /** the app bundle of the active installed version, or null when none is. */
37
- export function activeDesktopHostApp(): string | null {
38
- const version = readActiveDesktopHost()
39
- return version ? path.join(desktopHostDir(version), 'PeachDesktop.app') : null
40
- }
33
+ export const MAC_HOST_APP = '/Applications/Peach.app'
34
+ const HOST_BUNDLE_ID = 'dev.contrast.peach-desktop'
41
35
 
42
36
  // the host's identity: the manifest checksum proves the bytes are the published
43
37
  // ones, this proves who signed them
@@ -60,6 +54,75 @@ function verifyHost(dir: string): void {
60
54
  }
61
55
  }
62
56
 
57
+ function bundleValue(app: string, key: string): string | null {
58
+ const read = spawnSync(
59
+ 'plutil',
60
+ ['-extract', key, 'raw', '-o', '-', path.join(app, 'Contents/Info.plist')],
61
+ { encoding: 'utf8' },
62
+ )
63
+ return read.status === 0 ? read.stdout.trim() : null
64
+ }
65
+
66
+ /** whether `app` is the native host, as opposed to the Electron app, which
67
+ * installs to the same path on a case-insensitive disk. */
68
+ export function isNativeHostBundle(app: string): boolean {
69
+ return (
70
+ process.platform === 'darwin' &&
71
+ bundleValue(app, 'CFBundleIdentifier') === HOST_BUNDLE_ID
72
+ )
73
+ }
74
+
75
+ function placedHostVersion(): string | null {
76
+ return isNativeHostBundle(MAC_HOST_APP)
77
+ ? bundleValue(MAC_HOST_APP, 'CFBundleVersion')
78
+ : null
79
+ }
80
+
81
+ /** the active native host's app bundle, or null when none is installed. */
82
+ export function activeDesktopHostApp(): string | null {
83
+ return placedHostVersion() ? MAC_HOST_APP : null
84
+ }
85
+
86
+ function run(command: string, args: string[]): void {
87
+ const result = spawnSync(command, args, { encoding: 'utf8' })
88
+ if (result.status !== 0)
89
+ throw new Error(`${command} ${args.join(' ')} failed: ${result.stderr.trim()}`)
90
+ }
91
+
92
+ // lands a verified cached version at /Applications/Peach.app. the copy is an
93
+ // APFS clone of the cache, so it costs no space, and it swaps in by rename so a
94
+ // failure leaves the previous app in place. an Electron app in the slot moves to
95
+ // ~/Applications, where the CLI still finds it.
96
+ function placeHost(version: string): void {
97
+ if (placedHostVersion() === version) return
98
+ const parent = path.dirname(MAC_HOST_APP)
99
+ const incoming = path.join(parent, `.Peach-incoming-${process.pid}.app`)
100
+ const previous = path.join(parent, `.Peach-previous-${process.pid}.app`)
101
+ run('cp', ['-cR', path.join(desktopHostDir(version), 'PeachDesktop.app'), incoming])
102
+ try {
103
+ if (fs.existsSync(MAC_HOST_APP)) {
104
+ if (isNativeHostBundle(MAC_HOST_APP)) fs.renameSync(MAC_HOST_APP, previous)
105
+ else {
106
+ const electron = path.join(os.homedir(), 'Applications/peach.app')
107
+ if (fs.existsSync(electron))
108
+ throw new Error(
109
+ `${MAC_HOST_APP} holds another app and ${electron} exists; move one aside`,
110
+ )
111
+ fs.mkdirSync(path.dirname(electron), { recursive: true })
112
+ fs.renameSync(MAC_HOST_APP, electron)
113
+ }
114
+ }
115
+ fs.renameSync(incoming, MAC_HOST_APP)
116
+ } catch (err) {
117
+ if (fs.existsSync(previous) && !fs.existsSync(MAC_HOST_APP))
118
+ fs.renameSync(previous, MAC_HOST_APP)
119
+ throw err
120
+ } finally {
121
+ fs.rmSync(incoming, { recursive: true, force: true })
122
+ fs.rmSync(previous, { recursive: true, force: true })
123
+ }
124
+ }
125
+
63
126
  function isChannel(value: string): value is DesktopHostChannel {
64
127
  return DESKTOP_HOST_CHANNELS.some((channel) => channel === value)
65
128
  }
@@ -98,7 +161,7 @@ export function desktopHostDelivery(channelInput?: string): RuntimeDelivery {
98
161
  runtimesDir: desktopHostsDir,
99
162
  runtimeDir: desktopHostDir,
100
163
  cacheDir,
101
- readActiveRuntime: readActiveDesktopHost,
102
- writeActiveRuntime: writeActiveDesktopHost,
164
+ readActiveRuntime: placedHostVersion,
165
+ writeActiveRuntime: placeHost,
103
166
  })
104
167
  }
package/src/home-paths.ts CHANGED
@@ -119,35 +119,18 @@ export function activeRuntimeFile(): string {
119
119
  }
120
120
 
121
121
  // versioned native desktop hosts, laid out like runtimes: one directory per
122
- // version plus an `active` file naming the one `peach desktop` launches.
122
+ // version. the active one is the copy at /Applications/Peach.app. they sit
123
+ // apart from the host's own state in ~/.peach/desktop (profiles, window state,
124
+ // the node host's web data), since pruning removes every directory here that is
125
+ // not a kept version.
123
126
  export function desktopHostsDir(): string {
124
- return path.join(rnxHomeDir(), 'desktop')
127
+ return path.join(rnxHomeDir(), 'desktop', 'versions')
125
128
  }
126
129
 
127
130
  export function desktopHostDir(version: string): string {
128
131
  return path.join(desktopHostsDir(), version)
129
132
  }
130
133
 
131
- export function readActiveDesktopHost(): string | null {
132
- try {
133
- const value = fs
134
- .readFileSync(path.join(desktopHostsDir(), ACTIVE_RUNTIME_FILE), 'utf8')
135
- .trim()
136
- return value.length > 0 ? value : null
137
- } catch {
138
- return null
139
- }
140
- }
141
-
142
- export function writeActiveDesktopHost(version: string): void {
143
- fs.mkdirSync(desktopHostsDir(), { recursive: true })
144
- fs.writeFileSync(
145
- path.join(desktopHostsDir(), ACTIVE_RUNTIME_FILE),
146
- `${version}\n`,
147
- 'utf8',
148
- )
149
- }
150
-
151
134
  export function electronDir(): string {
152
135
  return path.join(rnxHomeDir(), 'electron')
153
136
  }
@@ -397,12 +397,14 @@ export class AgentHost {
397
397
  if (sockets.has(sessionId)) {
398
398
  return { ok: true, refCount: this.subscriptions.get(sessionId)?.refCount ?? 1 }
399
399
  }
400
- sockets.add(sessionId)
401
400
  const existing = this.subscriptions.get(sessionId)
402
401
  if (existing) {
402
+ sockets.add(sessionId)
403
403
  existing.refCount++
404
404
  return { ok: true, refCount: existing.refCount }
405
405
  }
406
+ // the socket holds the session only once its events open: a missing FIFO
407
+ // throws here and leaves nothing behind for a retry to count
406
408
  const unsubscribe = subscribeAgentEvents(sessionId, (event) => {
407
409
  const coalesced = this.coalescePromptEcho(sessionId, event)
408
410
  if (coalesced) {
@@ -427,6 +429,7 @@ export class AgentHost {
427
429
  }
428
430
  }
429
431
  })
432
+ sockets.add(sessionId)
430
433
  this.subscriptions.set(sessionId, { unsubscribe, refCount: 1 })
431
434
  return { ok: true, refCount: 1 }
432
435
  }
@@ -263,6 +263,10 @@ const OPTIONAL_FRAMEWORK_DEPENDENCIES: Record<string, string[]> = {
263
263
  DatadogLogs: ['DatadogCore'],
264
264
  DatadogRUM: ['DatadogCore'],
265
265
  DatadogTrace: ['DatadogCore'],
266
+ AppLovinSDK: [],
267
+ AppsFlyerLib: [],
268
+ FBSDKCoreKit: [],
269
+ FBAudienceNetwork: [],
266
270
  }
267
271
  const OPTIONAL_FRAMEWORKS = new Set(Object.keys(OPTIONAL_FRAMEWORK_DEPENDENCIES))
268
272