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.
- package/cli/bridge-flow-runner.ts +4 -8
- package/cli/commands/daemon.ts +117 -116
- package/cli/commands/install-desktop.ts +13 -8
- package/cli/commands/maestro.ts +1 -2
- package/cli/desktop-companion.ts +9 -2
- package/dist-lib/agent-daemon-client.cjs +1 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/agent-identity.cjs +1 -1
- package/dist-lib/agent-sessions.cjs +1 -1
- package/dist-lib/attached-projects.cjs +1 -1
- package/dist-lib/auth/shared-session.cjs +8 -5
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cli-constants.cjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/detox/index.cjs +1 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/home-paths.cjs +2 -23
- package/dist-lib/host/bridge-host.cjs +8 -3
- package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +1 -1
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +1 -1
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +1 -1
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +1 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/render-mode.cjs +1 -1
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +48 -47
- package/dist-lib/swift-compile.cjs +6 -2
- package/dist-lib/swift-compile.mjs +6 -2
- package/dist-lib/swift-package.cjs +1 -1
- package/dist-lib/swift-package.mjs +1 -1
- package/dist-lib/swift-submit.cjs +1 -1
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +1 -1
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +6 -2
- package/dist-lib/vite.cjs +1 -1
- package/package.json +1 -1
- package/skills/peach-test/SKILL.md +1 -4
- package/src/auth/shared-session.ts +9 -4
- package/src/desktop-host-delivery.ts +82 -19
- package/src/home-paths.ts +5 -22
- package/src/host/agent-host.ts +4 -1
- package/src/swift-compile.ts +4 -0
|
@@ -2931,13 +2931,9 @@ export class SootSimBridgeFlowRunner {
|
|
|
2931
2931
|
await this.rearmCaptureAfterRuntimeReload()
|
|
2932
2932
|
}
|
|
2933
2933
|
|
|
2934
|
-
//
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
clearKeychain() {
|
|
2938
|
-
console.warn(
|
|
2939
|
-
'[flow] clearKeychain: peach has no keychain surface — no-op (warning)',
|
|
2940
|
-
)
|
|
2934
|
+
// the guest owns both persistent credentials and live native-module caches.
|
|
2935
|
+
async clearKeychain() {
|
|
2936
|
+
await this.callTest('clearKeychain')
|
|
2941
2937
|
}
|
|
2942
2938
|
|
|
2943
2939
|
// maestro copyTextFrom: find an element and capture its text for use in
|
|
@@ -3386,7 +3382,7 @@ export class SootSimBridgeFlowRunner {
|
|
|
3386
3382
|
} else if (step.clearState !== undefined) {
|
|
3387
3383
|
await this.clearState()
|
|
3388
3384
|
} else if (step.clearKeychain !== undefined) {
|
|
3389
|
-
this.clearKeychain()
|
|
3385
|
+
await this.clearKeychain()
|
|
3390
3386
|
} else if (step.copyTextFrom !== undefined) {
|
|
3391
3387
|
await this.copyTextFrom(step.copyTextFrom)
|
|
3392
3388
|
} else if (step.assertTrue !== undefined) {
|
package/cli/commands/daemon.ts
CHANGED
|
@@ -226,86 +226,13 @@ export async function daemonInstall({ port, force }: { port: number; force: bool
|
|
|
226
226
|
console.log(` pass --force to overwrite, or use 'peach daemon restart' to reload`)
|
|
227
227
|
return
|
|
228
228
|
}
|
|
229
|
+
await stopMacDaemonBridge(invocation)
|
|
229
230
|
mkdirSync(dirname(path), { recursive: true })
|
|
230
231
|
writeFileSync(path, renderPlist(invocation, port))
|
|
231
232
|
console.log(` wrote ${path}`)
|
|
232
|
-
|
|
233
|
-
// bootstrap into the gui session. launchctl is famous for returning exit
|
|
234
|
-
// 0 from `bootstrap` while leaving the service unregistered (a stale
|
|
235
|
-
// bootout reference, an in-flight unload, etc.) — kickstart then fails
|
|
236
|
-
// with a confusing "service not found" 113. so: bootstrap, immediately
|
|
237
|
-
// verify with `launchctl print`, and if the verify fails do a clean
|
|
238
|
-
// bootout-then-bootstrap retry before giving up. we surface real stderr
|
|
239
|
-
// text from any of those steps so users see what launchd actually said.
|
|
240
|
-
const target = `gui/${process.getuid!()}`
|
|
241
|
-
const serviceTarget = `${target}/${SERVICE_LABEL_MAC}`
|
|
242
|
-
const tryBootstrap = (): { ok: true } | { ok: false; reason: string } => {
|
|
243
|
-
const bs = spawnSync('launchctl', ['bootstrap', target, path], {
|
|
244
|
-
stdio: 'pipe',
|
|
245
|
-
encoding: 'utf8',
|
|
246
|
-
})
|
|
247
|
-
const bsErr = (bs.stderr || bs.stdout || '').trim()
|
|
248
|
-
if (bs.status !== 0) {
|
|
249
|
-
return {
|
|
250
|
-
ok: false,
|
|
251
|
-
reason: `bootstrap exit ${bs.status}${bsErr ? `: ${bsErr}` : ''}`,
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
const verify = spawnSync('launchctl', ['print', serviceTarget], {
|
|
255
|
-
encoding: 'utf8',
|
|
256
|
-
})
|
|
257
|
-
if (verify.status !== 0) {
|
|
258
|
-
return {
|
|
259
|
-
ok: false,
|
|
260
|
-
reason: `bootstrap returned 0 but service not registered (print exit ${verify.status})`,
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return { ok: true }
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
let attempt = tryBootstrap()
|
|
267
|
-
if (!attempt.ok) {
|
|
268
|
-
const first = attempt.reason
|
|
269
|
-
// clean reload — bootout any stale reference then bootstrap again.
|
|
270
|
-
spawnSync('launchctl', ['bootout', serviceTarget], { stdio: 'ignore' })
|
|
271
|
-
attempt = tryBootstrap()
|
|
272
|
-
if (!attempt.ok) {
|
|
273
|
-
throw new Error(
|
|
274
|
-
`launchctl bootstrap failed: ${attempt.reason}` +
|
|
275
|
-
(first !== attempt.reason ? ` (initial: ${first})` : '') +
|
|
276
|
-
` — try \`peach daemon uninstall\` then retry, or reboot if launchd state is stuck.`,
|
|
277
|
-
)
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
// RunAtLoad=true on the plist means bootstrap already started the
|
|
282
|
-
// agent. an explicit `launchctl kickstart` is redundant here and on
|
|
283
|
-
// some machines fails with 113 ("service not found") when the agent
|
|
284
|
-
// crashes immediately and lands in launchd's throttle state — even
|
|
285
|
-
// though the service IS registered. instead, poll `launchctl print`
|
|
286
|
-
// for a few seconds until we see the service is running, then we're
|
|
287
|
-
// done; if it never reaches running, surface the err log path.
|
|
288
|
-
const deadline = Date.now() + 4000
|
|
289
|
-
let lastState: string | undefined
|
|
290
|
-
let lastPid: string | undefined
|
|
291
|
-
while (Date.now() < deadline) {
|
|
292
|
-
const p = spawnSync('launchctl', ['print', serviceTarget], { encoding: 'utf8' })
|
|
293
|
-
if (p.status === 0) {
|
|
294
|
-
lastState = p.stdout?.match(/state\s*=\s*(\w+)/)?.[1]
|
|
295
|
-
lastPid = p.stdout?.match(/pid\s*=\s*(\d+)/)?.[1]
|
|
296
|
-
if (lastState === 'running' || lastPid) break
|
|
297
|
-
}
|
|
298
|
-
await new Promise((r) => setTimeout(r, 150))
|
|
299
|
-
}
|
|
300
|
-
if (lastState !== 'running' && !lastPid) {
|
|
301
|
-
throw new Error(
|
|
302
|
-
`daemon registered but did not reach running state within 4s ` +
|
|
303
|
-
`(last state: ${lastState || 'unknown'}). check ${resolve(LOG_DIR, 'bridge.err.log')} ` +
|
|
304
|
-
`— typically a stale runtime or a port already bound by another process.`,
|
|
305
|
-
)
|
|
306
|
-
}
|
|
233
|
+
const pid = await startMacDaemon(path)
|
|
307
234
|
console.log(
|
|
308
|
-
` registered (state:
|
|
235
|
+
` registered (state: running, pid ${pid}, log: ${resolve(LOG_DIR, 'bridge.err.log')})`,
|
|
309
236
|
)
|
|
310
237
|
return
|
|
311
238
|
}
|
|
@@ -390,6 +317,103 @@ export async function daemonInstall({ port, force }: { port: number; force: bool
|
|
|
390
317
|
rnxExit(1)
|
|
391
318
|
}
|
|
392
319
|
|
|
320
|
+
function macServiceTarget(): string {
|
|
321
|
+
return `gui/${process.getuid!()}/${SERVICE_LABEL_MAC}`
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function readMacDaemonState(): { state: string; pid: number | null } | null {
|
|
325
|
+
const result = spawnSync('launchctl', ['print', macServiceTarget()], {
|
|
326
|
+
encoding: 'utf8',
|
|
327
|
+
})
|
|
328
|
+
if (result.status !== 0) return null
|
|
329
|
+
const pid = Number(result.stdout.match(/pid\s*=\s*(\d+)/)?.[1])
|
|
330
|
+
return {
|
|
331
|
+
state: result.stdout.match(/state\s*=\s*(\w+)/)?.[1] ?? 'unknown',
|
|
332
|
+
pid: pid > 0 ? pid : null,
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function runLaunchctl(args: string[]): void {
|
|
337
|
+
const result = spawnSync('launchctl', args, { encoding: 'utf8' })
|
|
338
|
+
if (result.status !== 0) {
|
|
339
|
+
const detail = (result.stderr || result.stdout).trim() || result.error?.message
|
|
340
|
+
throw new Error(
|
|
341
|
+
`launchctl ${args[0]} failed (exit ${result.status}, signal ${result.signal ?? 'none'})${detail ? `: ${detail}` : ''}`,
|
|
342
|
+
)
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function macBridgeHasListener(pid: number, port: number): boolean {
|
|
347
|
+
const result = spawnSync(
|
|
348
|
+
'lsof',
|
|
349
|
+
['-nP', '-a', '-p', String(pid), `-iTCP:${port}`, '-sTCP:LISTEN', '-t'],
|
|
350
|
+
{ encoding: 'utf8' },
|
|
351
|
+
)
|
|
352
|
+
if (result.status === 1 && !result.stderr.trim()) return false
|
|
353
|
+
if (result.status !== 0) {
|
|
354
|
+
throw new Error(
|
|
355
|
+
`cannot inspect bridge pid ${pid}: ${result.error?.message ?? result.stderr.trim()}`,
|
|
356
|
+
)
|
|
357
|
+
}
|
|
358
|
+
return result.stdout.trim() === String(pid)
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
async function stopMacDaemonBridge(invocation: RnxSelfInvocation): Promise<void> {
|
|
362
|
+
const service = readMacDaemonState()
|
|
363
|
+
const lock = readDaemonLockfile()
|
|
364
|
+
if (isDaemonLockfileFresh(lock) && lock.pid !== service?.pid) {
|
|
365
|
+
// a lockfile alone cannot authorize a signal after pid reuse.
|
|
366
|
+
const ownsListener = macBridgeHasListener(lock.pid, lock.bridgePort)
|
|
367
|
+
const processInfo = spawnSync('ps', ['-o', 'command=', '-p', String(lock.pid)], {
|
|
368
|
+
encoding: 'utf8',
|
|
369
|
+
})
|
|
370
|
+
const command = [invocation.executable, ...invocation.prefixArgs, 'serve'].join(' ')
|
|
371
|
+
if (
|
|
372
|
+
!ownsListener ||
|
|
373
|
+
processInfo.status !== 0 ||
|
|
374
|
+
!processInfo.stdout.trim().startsWith(`${command} `)
|
|
375
|
+
) {
|
|
376
|
+
throw new Error(
|
|
377
|
+
`cannot hand off bridge on port ${lock.bridgePort}: pid ${lock.pid} is not this Peach invocation`,
|
|
378
|
+
)
|
|
379
|
+
}
|
|
380
|
+
process.kill(lock.pid, 'SIGTERM')
|
|
381
|
+
}
|
|
382
|
+
if (service) runLaunchctl(['bootout', macServiceTarget()])
|
|
383
|
+
if (!lock) return
|
|
384
|
+
const deadline = Date.now() + 4000
|
|
385
|
+
while (Date.now() < deadline) {
|
|
386
|
+
if (!macBridgeHasListener(lock.pid, lock.bridgePort)) return
|
|
387
|
+
await new Promise((resolve) => setTimeout(resolve, 100))
|
|
388
|
+
}
|
|
389
|
+
throw new Error(`bridge pid ${lock.pid} did not release port ${lock.bridgePort}`)
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
async function startMacDaemon(path: string): Promise<number> {
|
|
393
|
+
if (readMacDaemonState()) {
|
|
394
|
+
runLaunchctl(['kickstart', macServiceTarget()])
|
|
395
|
+
} else {
|
|
396
|
+
runLaunchctl(['bootstrap', `gui/${process.getuid!()}`, path])
|
|
397
|
+
}
|
|
398
|
+
// registration and an xpcproxy pid precede the actual bridge bind.
|
|
399
|
+
const deadline = Date.now() + 4000
|
|
400
|
+
while (Date.now() < deadline) {
|
|
401
|
+
const service = readMacDaemonState()
|
|
402
|
+
const lock = readDaemonLockfile()
|
|
403
|
+
if (
|
|
404
|
+
service?.state === 'running' &&
|
|
405
|
+
service.pid !== null &&
|
|
406
|
+
isDaemonLockfileFresh(lock) &&
|
|
407
|
+
lock.pid === service.pid
|
|
408
|
+
)
|
|
409
|
+
return service.pid
|
|
410
|
+
await new Promise((resolve) => setTimeout(resolve, 100))
|
|
411
|
+
}
|
|
412
|
+
throw new Error(
|
|
413
|
+
`daemon registered but did not own a responding bridge within 4s. check ${resolve(LOG_DIR, 'bridge.err.log')}`,
|
|
414
|
+
)
|
|
415
|
+
}
|
|
416
|
+
|
|
393
417
|
// removed-path log (idempotent helpers track what they actually touched so the
|
|
394
418
|
// caller can report a unified "not installed" / "removed N entries" line).
|
|
395
419
|
type TeardownReport = { removed: string[]; missing: boolean }
|
|
@@ -542,9 +566,15 @@ async function daemonUninstall(rest: string[]) {
|
|
|
542
566
|
// which is how a fully broken daemon reported healthy on the 2026-08-19 drive.
|
|
543
567
|
// the lockfile carries a pid and a heartbeat, so it answers the question the
|
|
544
568
|
// caller actually asked.
|
|
545
|
-
function printBridgeLiveness() {
|
|
569
|
+
function printBridgeLiveness(expectedPid?: number | null) {
|
|
546
570
|
const lock = readDaemonLockfile()
|
|
547
571
|
if (isDaemonLockfileFresh(lock)) {
|
|
572
|
+
if (expectedPid !== undefined && lock.pid !== expectedPid) {
|
|
573
|
+
console.log(
|
|
574
|
+
` bridge: port ${lock.bridgePort} is served by pid ${lock.pid}, outside the registered daemon`,
|
|
575
|
+
)
|
|
576
|
+
return
|
|
577
|
+
}
|
|
548
578
|
console.log(` bridge: responding on port ${lock.bridgePort} (pid ${lock.pid})`)
|
|
549
579
|
return
|
|
550
580
|
}
|
|
@@ -565,19 +595,13 @@ async function daemonStatus() {
|
|
|
565
595
|
console.log(` installed: yes (${path})`)
|
|
566
596
|
const binary = readPlistBinary(path)
|
|
567
597
|
if (binary) console.log(` binary: ${binary}`)
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
598
|
+
const service = readMacDaemonState()
|
|
599
|
+
console.log(
|
|
600
|
+
service
|
|
601
|
+
? ` state: ${service.state}${service.pid ? ` (pid ${service.pid})` : ''}`
|
|
602
|
+
: ' state: not running',
|
|
572
603
|
)
|
|
573
|
-
|
|
574
|
-
const state = res.stdout.match(/state\s*=\s*(\w+)/)?.[1]
|
|
575
|
-
const pid = res.stdout.match(/pid\s*=\s*(\d+)/)?.[1]
|
|
576
|
-
console.log(` state: ${state || 'unknown'}${pid ? ` (pid ${pid})` : ''}`)
|
|
577
|
-
} else {
|
|
578
|
-
console.log(' state: not running')
|
|
579
|
-
}
|
|
580
|
-
printBridgeLiveness()
|
|
604
|
+
printBridgeLiveness(service?.pid ?? null)
|
|
581
605
|
return
|
|
582
606
|
}
|
|
583
607
|
if (process.platform === 'linux') {
|
|
@@ -605,15 +629,8 @@ async function daemonRestart() {
|
|
|
605
629
|
console.error(' daemon not registered. run `peach daemon install`')
|
|
606
630
|
rnxExit(1)
|
|
607
631
|
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
['kickstart', '-k', `gui/${process.getuid!()}/${SERVICE_LABEL_MAC}`],
|
|
611
|
-
{ stdio: 'pipe', encoding: 'utf8' },
|
|
612
|
-
)
|
|
613
|
-
if (res.status !== 0) {
|
|
614
|
-
console.error(` kickstart failed: ${res.stderr?.trim()}`)
|
|
615
|
-
rnxExit(1)
|
|
616
|
-
}
|
|
632
|
+
await stopMacDaemonBridge(resolveDaemonInvocation())
|
|
633
|
+
await startMacDaemon(path)
|
|
617
634
|
console.log(' restarted')
|
|
618
635
|
return
|
|
619
636
|
}
|
|
@@ -645,15 +662,7 @@ async function daemonStart() {
|
|
|
645
662
|
console.error(' daemon not registered. run `peach daemon install`')
|
|
646
663
|
rnxExit(1)
|
|
647
664
|
}
|
|
648
|
-
|
|
649
|
-
'launchctl',
|
|
650
|
-
['kickstart', `gui/${process.getuid!()}/${SERVICE_LABEL_MAC}`],
|
|
651
|
-
{ stdio: 'pipe', encoding: 'utf8' },
|
|
652
|
-
)
|
|
653
|
-
if (res.status !== 0) {
|
|
654
|
-
console.error(` start failed: ${res.stderr?.trim()}`)
|
|
655
|
-
rnxExit(1)
|
|
656
|
-
}
|
|
665
|
+
await startMacDaemon(path)
|
|
657
666
|
console.log(' started')
|
|
658
667
|
return
|
|
659
668
|
}
|
|
@@ -685,15 +694,7 @@ async function daemonStop() {
|
|
|
685
694
|
console.error(' daemon not registered — nothing to stop')
|
|
686
695
|
rnxExit(1)
|
|
687
696
|
}
|
|
688
|
-
|
|
689
|
-
'launchctl',
|
|
690
|
-
['bootout', `gui/${process.getuid!()}/${SERVICE_LABEL_MAC}`],
|
|
691
|
-
{ stdio: 'pipe', encoding: 'utf8' },
|
|
692
|
-
)
|
|
693
|
-
if (res.status !== 0) {
|
|
694
|
-
console.error(` stop failed: ${res.stderr?.trim()}`)
|
|
695
|
-
rnxExit(1)
|
|
696
|
-
}
|
|
697
|
+
await stopMacDaemonBridge(resolveDaemonInvocation())
|
|
697
698
|
console.log(' stopped')
|
|
698
699
|
return
|
|
699
700
|
}
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
// the CLI + daemon are the canonical peach surface; this command is only
|
|
4
4
|
// for users who want a GUI companion on top of that.
|
|
5
5
|
//
|
|
6
|
-
// --native installs the native desktop host
|
|
7
|
-
// ~/.peach/desktop/<version>/ through the
|
|
8
|
-
// `peach runtime install` uses (src/desktop-host-delivery.ts).
|
|
6
|
+
// --native installs the native desktop host at /Applications/Peach.app,
|
|
7
|
+
// verified and cached by version under ~/.peach/desktop/versions/<version>/ through the
|
|
8
|
+
// same delivery `peach runtime install` uses (src/desktop-host-delivery.ts).
|
|
9
9
|
//
|
|
10
10
|
// otherwise it installs the Electron companion: it
|
|
11
11
|
// fetches the right platform artifact from https://contrast.dev/api/electron-release/
|
|
12
12
|
// and installs it into the OS-native location that findInstalledDesktopCompanion() looks for:
|
|
13
|
-
// macos:
|
|
13
|
+
// macos: /Applications/peach.app when writable and free of the native host,
|
|
14
|
+
// else ~/Applications/peach.app
|
|
14
15
|
// linux: ~/Applications/peach.AppImage
|
|
15
16
|
// win: spawns the NSIS installer
|
|
16
17
|
//
|
|
@@ -33,6 +34,8 @@ import { basename, dirname, join, resolve } from 'path'
|
|
|
33
34
|
import {
|
|
34
35
|
DESKTOP_HOST_CHANNELS,
|
|
35
36
|
desktopHostDelivery,
|
|
37
|
+
isNativeHostBundle,
|
|
38
|
+
MAC_HOST_APP,
|
|
36
39
|
} from '../../src/desktop-host-delivery'
|
|
37
40
|
import { findInstalledDesktopCompanion } from '../desktop-companion'
|
|
38
41
|
import { confirm } from '../prompt'
|
|
@@ -176,6 +179,9 @@ async function installMacDmg(dmgPath: string): Promise<string> {
|
|
|
176
179
|
} catch {
|
|
177
180
|
destRoot = userApps
|
|
178
181
|
}
|
|
182
|
+
// the native host owns /Applications/Peach.app, the same path on a
|
|
183
|
+
// case-insensitive disk, so Electron goes beside the user's apps then
|
|
184
|
+
if (isNativeHostBundle(join(systemApps, 'peach.app'))) destRoot = userApps
|
|
179
185
|
if (destRoot === userApps) {
|
|
180
186
|
mkdirSync(destRoot, { recursive: true })
|
|
181
187
|
}
|
|
@@ -286,8 +292,8 @@ usage:
|
|
|
286
292
|
options:
|
|
287
293
|
-y, --yes skip confirmation and install immediately
|
|
288
294
|
--force reinstall even if the companion is already present
|
|
289
|
-
--native install the native desktop host (macOS arm64)
|
|
290
|
-
|
|
295
|
+
--native install the native desktop host (macOS arm64) at
|
|
296
|
+
/Applications/Peach.app
|
|
291
297
|
--channel <name> with --native: production (default) or staging
|
|
292
298
|
|
|
293
299
|
environment:
|
|
@@ -438,9 +444,8 @@ async function installNativeHost(args: string[], force: boolean): Promise<void>
|
|
|
438
444
|
quiet: true,
|
|
439
445
|
}),
|
|
440
446
|
)
|
|
441
|
-
const app = join(result.runtimeDir, 'PeachDesktop.app')
|
|
442
447
|
console.log(
|
|
443
|
-
` ${success('✓')} Native desktop host ${result.version} ${result.installed ? 'installed' : 'already installed'} at ${
|
|
448
|
+
` ${success('✓')} Native desktop host ${result.version} ${result.installed ? 'installed' : 'already installed'} at ${MAC_HOST_APP}`,
|
|
444
449
|
)
|
|
445
450
|
} catch (err) {
|
|
446
451
|
console.error(
|
package/cli/commands/maestro.ts
CHANGED
|
@@ -118,7 +118,7 @@ function printCompatMatrix() {
|
|
|
118
118
|
peach maestro — compatibility matrix
|
|
119
119
|
|
|
120
120
|
supported verbs:
|
|
121
|
-
launchApp (including arguments), stopApp, clearState, clearKeychain
|
|
121
|
+
launchApp (including arguments), stopApp, clearState, clearKeychain,
|
|
122
122
|
selectors: text, id, index (negative from the end), childOf, below, above,
|
|
123
123
|
leftOf, rightOf, width / height / tolerance, traits, enabled, selected, checked,
|
|
124
124
|
focused, containsChild, containsDescendants,
|
|
@@ -159,7 +159,6 @@ launch behavior:
|
|
|
159
159
|
openLink: replaces the guest, then delivers the URL to the new tenant.
|
|
160
160
|
|
|
161
161
|
partial:
|
|
162
|
-
clearKeychain — warn-only, peach has no keychain surface.
|
|
163
162
|
when.platform — peach reports iOS for this runner.
|
|
164
163
|
openLink: app routing works; no OS-level Safari fallback.
|
|
165
164
|
launchApp.resetRuntime — peach-only extension for recorded benchmarks:
|
package/cli/desktop-companion.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { execFileSync, spawn } from 'child_process'
|
|
|
2
2
|
import { existsSync, readdirSync } from 'fs'
|
|
3
3
|
import { dirname, join, resolve } from 'path'
|
|
4
4
|
import { fileURLToPath } from 'url'
|
|
5
|
-
import { activeDesktopHostApp } from '../src/desktop-host-delivery'
|
|
5
|
+
import { activeDesktopHostApp, isNativeHostBundle } from '../src/desktop-host-delivery'
|
|
6
6
|
|
|
7
7
|
// resolved lazily — sootsim-engine is a workspace package in dev, but absent
|
|
8
8
|
// from the published npm tarball. don't crash module load just because the
|
|
@@ -110,7 +110,11 @@ function findInstalledMacApp(): DesktopCompanionInstall | null {
|
|
|
110
110
|
resolve(process.env.HOME || '', 'Applications/peach.app'),
|
|
111
111
|
]
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
// the native host's /Applications/Peach.app is the same path on a
|
|
114
|
+
// case-insensitive disk
|
|
115
|
+
const found = candidates.find(
|
|
116
|
+
(candidate) => existsSync(candidate) && !isNativeHostBundle(candidate),
|
|
117
|
+
)
|
|
114
118
|
if (found) {
|
|
115
119
|
return {
|
|
116
120
|
path: found,
|
|
@@ -359,6 +363,9 @@ export async function launchDesktopCompanion(
|
|
|
359
363
|
// `open -a` splits app args before and after `--args`. anything after
|
|
360
364
|
// --args is forwarded to electron's process.argv.
|
|
361
365
|
const nativeApp = install.kind === 'native-mac-app'
|
|
366
|
+
// the personal home screen belongs to launches from Spotlight or the Dock;
|
|
367
|
+
// every CLI launch gets the plain one
|
|
368
|
+
if (nativeApp) extraArgs.push('--no-personal-home')
|
|
362
369
|
const openArgs: string[] = ['-g', '-a', install.path]
|
|
363
370
|
if (url) openArgs.push(buildMacLaunchUrl(url, opts, nativeApp))
|
|
364
371
|
else if (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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;
|
|
@@ -149,15 +149,18 @@ function readSharedDesktopAuthSession() {
|
|
|
149
149
|
function writeSharedDesktopAuthSession(session) {
|
|
150
150
|
const filepath = getSharedDesktopAuthFilePath();
|
|
151
151
|
(0, import_node_fs.mkdirSync)((0, import_node_path2.dirname)(filepath), { recursive: true });
|
|
152
|
+
const token = session.token.trim();
|
|
153
|
+
const stored = readSharedDesktopAuthSession();
|
|
154
|
+
const same = stored?.token === token ? stored : null;
|
|
152
155
|
const normalized = {
|
|
153
156
|
version: SESSION_VERSION,
|
|
154
|
-
token
|
|
157
|
+
token,
|
|
155
158
|
user: session.user ? normalizeUser(session.user) : null,
|
|
156
159
|
origin: session.origin?.trim() || DEFAULT_ORIGIN,
|
|
157
|
-
source: session.source,
|
|
160
|
+
source: same?.source ?? session.source,
|
|
158
161
|
updatedAt: session.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
159
|
-
validatedAt: session.validatedAt,
|
|
160
|
-
accountId: session.accountId?.trim() ||
|
|
162
|
+
validatedAt: session.validatedAt ?? same?.validatedAt,
|
|
163
|
+
accountId: session.accountId?.trim() || same?.accountId
|
|
161
164
|
};
|
|
162
165
|
const temporary = `${filepath}.${process.pid}.${(0, import_node_crypto.randomUUID)()}.tmp`;
|
|
163
166
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
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;
|
package/dist-lib/beta.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
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;
|
package/dist-lib/beta.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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;
|
package/dist-lib/cloud.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
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;
|
package/dist-lib/cloud.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
1
|
+
/*! rnx v0.1.755 | (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);
|
package/dist-lib/config.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
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;
|
package/dist-lib/detox/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! rnx v0.1.
|
|
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.
|
|
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;
|