peachsim 0.1.1653 → 0.1.1654

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 (110) hide show
  1. package/cli/app-stubs.ts +97 -14
  2. package/cli/bridge-diagnostics.ts +10 -7
  3. package/cli/cloud-client.ts +11 -2
  4. package/cli/commands/doctor.ts +20 -10
  5. package/cli/commands/inspect/core.ts +2 -1
  6. package/cli/commands/inspect/shared.ts +2 -0
  7. package/cli/commands/inspect.ts +11 -2
  8. package/cli/output-redaction.ts +22 -6
  9. package/cli/pause-aware-timeout.ts +24 -10
  10. package/cli/ws-bridge.ts +17 -1
  11. package/dist-lib/agent-daemon-client.cjs +1 -1
  12. package/dist-lib/agent-events.cjs +1 -1
  13. package/dist-lib/attached-projects.cjs +1 -1
  14. package/dist-lib/auth/shared-session.cjs +1 -1
  15. package/dist-lib/backend-origin.cjs +1 -1
  16. package/dist-lib/beta.cjs +1 -1
  17. package/dist-lib/beta.mjs +1 -1
  18. package/dist-lib/bridge-constants.cjs +1 -1
  19. package/dist-lib/bridge-contract-input.cjs +1 -1
  20. package/dist-lib/bridge-contract-input.mjs +1 -1
  21. package/dist-lib/bridge-contract.cjs +1 -1
  22. package/dist-lib/bridge-contract.mjs +1 -1
  23. package/dist-lib/bundle-channel.cjs +42 -50
  24. package/dist-lib/capture-contract.cjs +1 -1
  25. package/dist-lib/capture-contract.mjs +1 -1
  26. package/dist-lib/cloud-contract.cjs +1 -1
  27. package/dist-lib/cloud-contract.mjs +1 -1
  28. package/dist-lib/cloud-test-args.cjs +1 -1
  29. package/dist-lib/cloud-test-args.mjs +1 -1
  30. package/dist-lib/cloud.cjs +1 -1
  31. package/dist-lib/cloud.mjs +1 -1
  32. package/dist-lib/config.cjs +1 -1
  33. package/dist-lib/config.mjs +1 -1
  34. package/dist-lib/detox/index.cjs +47 -12
  35. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  36. package/dist-lib/expo-swift-bundle.cjs +41 -49
  37. package/dist-lib/expo-swift-metadata.cjs +1 -1
  38. package/dist-lib/expo-swift-metadata.mjs +1 -1
  39. package/dist-lib/home-paths.cjs +1 -1
  40. package/dist-lib/host/bridge-host.cjs +70 -52
  41. package/dist-lib/host/fetch-proxy-handler.cjs +176 -31
  42. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  43. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  44. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  45. package/dist-lib/host/websocket-proxy.cjs +1 -1
  46. package/dist-lib/index.cjs +633 -373
  47. package/dist-lib/jump-to-source-babel.cjs +1 -1
  48. package/dist-lib/jump-to-source-native.cjs +1 -1
  49. package/dist-lib/kotlin-host.cjs +1 -1
  50. package/dist-lib/menu.cjs +1 -1
  51. package/dist-lib/menu.mjs +1 -1
  52. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  53. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  54. package/dist-lib/metro-production-bundle.cjs +1 -1
  55. package/dist-lib/metro-production-bundle.mjs +1 -1
  56. package/dist-lib/metro.cjs +62 -14
  57. package/dist-lib/native-app-identity-project.cjs +1 -1
  58. package/dist-lib/native-app-identity-project.mjs +1 -1
  59. package/dist-lib/native-app-identity.cjs +1 -1
  60. package/dist-lib/native-app-identity.mjs +1 -1
  61. package/dist-lib/native-firebase-metadata.cjs +1 -1
  62. package/dist-lib/native-firebase-metadata.mjs +1 -1
  63. package/dist-lib/plist.cjs +1 -1
  64. package/dist-lib/plist.mjs +1 -1
  65. package/dist-lib/profiles.cjs +1 -1
  66. package/dist-lib/public-brand.cjs +1 -1
  67. package/dist-lib/public-origins-lib-esm.json +23 -23
  68. package/dist-lib/public-origins-lib.json +62 -54
  69. package/dist-lib/react-native-host-modules.cjs +1 -1
  70. package/dist-lib/react-native-host-modules.mjs +1 -1
  71. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  72. package/dist-lib/sdk.cjs +2 -2
  73. package/dist-lib/sdk.mjs +2 -2
  74. package/dist-lib/skills.cjs +284 -185
  75. package/dist-lib/swift-compile.cjs +23 -3
  76. package/dist-lib/swift-compile.mjs +22 -3
  77. package/dist-lib/swift-package.cjs +1 -1
  78. package/dist-lib/swift-package.mjs +1 -1
  79. package/dist-lib/swift-submit.cjs +1 -1
  80. package/dist-lib/swift-submit.mjs +1 -1
  81. package/dist-lib/swift-toolchain.cjs +1 -1
  82. package/dist-lib/swift.cjs +1 -1
  83. package/dist-lib/vite-swift.cjs +41 -49
  84. package/dist-lib/vite.cjs +385 -200
  85. package/dist-lib/worklet-executable.cjs +1 -1
  86. package/dist-lib/worklet-executable.mjs +1 -1
  87. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +1 -0
  88. package/dist-types/packages/peach-compat/src/stubs/screen-transition-math.d.ts +10 -7
  89. package/dist-types/packages/peach-engine/src/capture/browser-composite.d.ts +10 -0
  90. package/dist-types/packages/peach-engine/src/cli-companion.d.ts +1 -0
  91. package/dist-types/packages/peach-engine/src/engine/node.d.ts +3 -1
  92. package/dist-types/packages/peach-engine/src/engine/scene-table.d.ts +1 -1
  93. package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +23 -0
  94. package/dist-types/packages/peach-engine/src/engine/types.d.ts +1 -1
  95. package/dist-types/packages/peach-engine/src/engine/visible-frame.d.ts +1 -0
  96. package/dist-types/packages/peach-engine/src/observability/types.d.ts +1 -0
  97. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +38 -0
  98. package/dist-types/packages/peach-engine/src/rolldown-bundle-inventory.d.ts +5 -0
  99. package/package.json +5 -1
  100. package/runtime-companion.json +1 -1
  101. package/src/bridge-contract.ts +2 -0
  102. package/src/bundleGlobalFooter.ts +9 -0
  103. package/src/host/fetch-proxy-handler.ts +37 -0
  104. package/src/sfSymbolMetricsContract.ts +268 -0
  105. package/src/swift-compile.ts +16 -1
  106. package/src/swift-distribution.lock.json +20 -46
  107. package/src/swift-objc-metadata.ts +21 -7
  108. package/src/swift-objc-sdk.ts +13 -0
  109. package/src/vite-plugin-one.ts +161 -16
  110. package/src/host/lease-owner.test.ts +0 -49
package/cli/app-stubs.ts CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  } from 'node:fs'
14
14
  import { dirname, join, relative, resolve } from 'node:path'
15
15
  import { resolveCompatVersionRange } from '@peach/compat/version-range'
16
- import { parseSync, type Expression } from 'oxc-parser'
16
+ import { parseSync, type Expression, type PrivateIdentifier } from 'oxc-parser'
17
17
  import { transform } from 'sucrase'
18
18
  import {
19
19
  isPackageStubs,
@@ -261,12 +261,32 @@ export function installedPackageDir(appDir: string, name: string): string | null
261
261
  export interface NativeRequest {
262
262
  kind: 'module' | 'view'
263
263
  name: string
264
+ // every lookup of the name tolerates a missing module (requireOptionalNativeModule)
265
+ optional: boolean
266
+ // every lookup of the name sits in an android-only file or Platform.OS branch
267
+ androidOnly: boolean
264
268
  }
265
269
 
266
270
  export const SOURCE_FILE = /\.[cm]?[jt]sx?$/
267
271
  const NATIVE_LOOKUP =
268
272
  /requireNative|requireOptionalNative|TurboModuleRegistry|codegenNativeComponent|NativeModules/
269
273
 
274
+ function isAndroidCheck(node: Expression): boolean {
275
+ if (node.type !== 'BinaryExpression' || !['===', '=='].includes(node.operator))
276
+ return false
277
+ const side = (
278
+ value: Expression | PrivateIdentifier,
279
+ literal: Expression | PrivateIdentifier,
280
+ ) =>
281
+ value.type === 'MemberExpression' &&
282
+ !value.computed &&
283
+ nativeLookupName(value.object) === 'Platform' &&
284
+ nativeLookupName(value) === 'OS' &&
285
+ literal.type === 'Literal' &&
286
+ literal.value === 'android'
287
+ return side(node.left, node.right) || side(node.right, node.left)
288
+ }
289
+
270
290
  function nativeLookupName(node: Expression): string | null {
271
291
  if (node.type === 'Identifier') return node.name
272
292
  if (
@@ -287,6 +307,7 @@ export function sourceNativeRequests(
287
307
  includeLegacy = false,
288
308
  ): (NativeRequest & { line: number })[] {
289
309
  if (!NATIVE_LOOKUP.test(text)) return []
310
+ const androidFile = /\.android\.[cm]?[jt]sx?$/.test(file)
290
311
  let code: string
291
312
  try {
292
313
  code = transform(text, {
@@ -299,10 +320,36 @@ export function sourceNativeRequests(
299
320
  const { program, errors } = parseSync(file, code, { lang: 'jsx' })
300
321
  if (errors.length) return []
301
322
  const found: (NativeRequest & { line: number })[] = []
302
- const add = (kind: NativeRequest['kind'], name: string, at: number) => {
303
- found.push({ kind, name, line: code.slice(0, at).split('\n').length })
323
+ // source ranges only an android device runs: the branch a Platform.OS === 'android' guards
324
+ const androidRanges: [number, number][] = []
325
+ const guard = (test: Expression, branch: { start: number; end: number }) => {
326
+ if (isAndroidCheck(test)) androidRanges.push([branch.start, branch.end])
327
+ }
328
+ const add = (
329
+ kind: NativeRequest['kind'],
330
+ name: string,
331
+ at: number,
332
+ optional: boolean,
333
+ ) => {
334
+ found.push({
335
+ kind,
336
+ name,
337
+ optional,
338
+ androidOnly:
339
+ androidFile || androidRanges.some(([start, end]) => at >= start && at < end),
340
+ line: code.slice(0, at).split('\n').length,
341
+ })
304
342
  }
305
343
  visitParsedProgram(program, {
344
+ IfStatement(node) {
345
+ guard(node.test, node.consequent)
346
+ },
347
+ ConditionalExpression(node) {
348
+ guard(node.test, node.consequent)
349
+ },
350
+ LogicalExpression(node) {
351
+ if (node.operator === '&&') guard(node.left, node.right)
352
+ },
306
353
  CallExpression(node) {
307
354
  const first = node.arguments[0]
308
355
  if (first?.type !== 'Literal' || typeof first.value !== 'string') return
@@ -314,12 +361,12 @@ export function sourceNativeRequests(
314
361
  nativeLookupName(callee.object) === 'TurboModuleRegistry' &&
315
362
  (lookup === 'get' || lookup === 'getEnforcing')
316
363
  ) {
317
- add('module', first.value, node.start)
364
+ add('module', first.value, node.start, false)
318
365
  } else if (lookup) {
319
366
  if (['requireNativeModule', 'requireOptionalNativeModule'].includes(lookup))
320
- add('module', first.value, node.start)
367
+ add('module', first.value, node.start, lookup === 'requireOptionalNativeModule')
321
368
  else if (['requireNativeComponent', 'codegenNativeComponent'].includes(lookup))
322
- add('view', first.value, node.start)
369
+ add('view', first.value, node.start, false)
323
370
  else if (['requireNativeView', 'requireNativeViewManager'].includes(lookup)) {
324
371
  const second = node.arguments[1]
325
372
  // expo registers a named view under the module_view key.
@@ -327,7 +374,7 @@ export function sourceNativeRequests(
327
374
  second?.type === 'Literal' && typeof second.value === 'string'
328
375
  ? `${first.value}_${second.value}`
329
376
  : first.value
330
- add('view', name, node.start)
377
+ add('view', name, node.start, false)
331
378
  }
332
379
  }
333
380
  },
@@ -338,7 +385,7 @@ export function sourceNativeRequests(
338
385
  nativeLookupName(node.object) === 'NativeModules' &&
339
386
  node.property.type === 'Identifier'
340
387
  )
341
- add('module', node.property.name, node.start)
388
+ add('module', node.property.name, node.start, false)
342
389
  },
343
390
  })
344
391
  return found
@@ -355,6 +402,19 @@ const PACKAGE_SKIP_DIRS = new Set([
355
402
  'docs',
356
403
  ])
357
404
 
405
+ // a name is optional or android-only only when every lookup of it is
406
+ function mergeRequests(
407
+ previous: NativeRequest | undefined,
408
+ next: NativeRequest,
409
+ ): NativeRequest {
410
+ if (!previous) return next
411
+ return {
412
+ ...next,
413
+ optional: previous.optional && next.optional,
414
+ androidOnly: previous.androidOnly && next.androidOnly,
415
+ }
416
+ }
417
+
358
418
  export function packageNativeRequests(dir: string): NativeRequest[] {
359
419
  const found = new Map<string, NativeRequest>()
360
420
  const directories = scanRepository(dir).directories.filter((sub) => {
@@ -372,8 +432,11 @@ export function packageNativeRequests(dir: string): NativeRequest[] {
372
432
  const file = join(sub, name)
373
433
  const text = readSmallFile(file)
374
434
  if (!text) continue
375
- for (const { kind, name } of sourceNativeRequests(file, text, true))
376
- found.set(`${kind}:${name}`, { kind, name })
435
+ for (const { line: _line, ...request } of sourceNativeRequests(file, text, true))
436
+ found.set(
437
+ `${request.kind}:${request.name}`,
438
+ mergeRequests(found.get(`${request.kind}:${request.name}`), request),
439
+ )
377
440
  }
378
441
  }
379
442
  return [...found.values()].sort(
@@ -566,6 +629,8 @@ export interface LocalNative {
566
629
  // the local Expo module directory the name belongs to, relative to the app
567
630
  expoModule: string | null
568
631
  swift: boolean
632
+ // every lookup of the name tolerates a missing module
633
+ optional: boolean
569
634
  // a stub already answers it
570
635
  answered: boolean
571
636
  }
@@ -640,9 +705,19 @@ export function scanLocalNative(
640
705
  const found = new Map<string, LocalNative>()
641
706
  // a name an installed dependency asks for belongs to that dependency, whoever
642
707
  // in the app spells it out
643
- const add = (kind: LocalNative['kind'], name: string, file: string, line: number) => {
708
+ const add = (
709
+ kind: LocalNative['kind'],
710
+ name: string,
711
+ file: string,
712
+ line: number,
713
+ optional = false,
714
+ ) => {
644
715
  const key = `${kind}:${name}`
645
- if (found.has(key)) return
716
+ const known = found.get(key)
717
+ if (known) {
718
+ known.optional &&= optional
719
+ return
720
+ }
646
721
  providers ??= dependencyNativeOwners(appDir, pkg)
647
722
  const packageName = providers.get(key) ?? owner(dirname(file))
648
723
  if (knownPackages.has(packageName)) return
@@ -653,6 +728,7 @@ export function scanLocalNative(
653
728
  package: packageName,
654
729
  path: `${relative(appDir, file)}:${line}`,
655
730
  expoModule: moduleDir ? relative(appDir, moduleDir) || '.' : null,
731
+ optional,
656
732
  swift: moduleDir
657
733
  ? (nativeFilesByModule.get(moduleDir) ?? []).some(
658
734
  (path) =>
@@ -668,8 +744,15 @@ export function scanLocalNative(
668
744
  for (const file of sourceFiles) {
669
745
  const text = readSmallFile(file)
670
746
  if (!text) continue
671
- for (const { kind, name, line } of sourceNativeRequests(file, text, includeLegacy))
672
- add(kind, name, file, line)
747
+ for (const { kind, name, line, optional, androidOnly } of sourceNativeRequests(
748
+ file,
749
+ text,
750
+ includeLegacy,
751
+ )) {
752
+ // an android-only lookup is no requirement of an ios app
753
+ if (androidOnly && platform === 'ios') continue
754
+ add(kind, name, file, line, optional)
755
+ }
673
756
  }
674
757
  // a local expo module declares its name in its native definition, Name("X"),
675
758
  // whether or not the app's javascript spells it out. swift first, so a
@@ -1,5 +1,6 @@
1
1
  import { MERGED_CONSOLE_COUNT_EVAL, inspectErrors } from './commands/inspect/core'
2
2
  import { formatLogTimestamp } from './commands/inspect/shared'
3
+ import { redactConfigurationForDiagnostics as safe } from './output-redaction'
3
4
  import type { WsBridge } from './ws-bridge'
4
5
  import type { SootSimRequestEntry } from '@peach/globals'
5
6
 
@@ -23,12 +24,14 @@ interface FailureDiagnosticsOptions {
23
24
  function formatRequestMessage(entry: SootSimRequestEntry) {
24
25
  const target = entry.displayUrl || entry.url
25
26
  if (entry.status != null) {
26
- return `${entry.method} ${target} -> ${entry.status}${entry.statusText ? ` ${entry.statusText}` : ''}`
27
+ return safe(
28
+ `${entry.method} ${target} -> ${entry.status}${entry.statusText ? ` ${entry.statusText}` : ''}`,
29
+ )
27
30
  }
28
31
  if (entry.error) {
29
- return `${entry.method} ${target} -> ${entry.error}`
32
+ return safe(`${entry.method} ${target} -> ${entry.error}`)
30
33
  }
31
- return `${entry.method} ${target}`
34
+ return safe(`${entry.method} ${target}`)
32
35
  }
33
36
 
34
37
  async function callTestBridge<T = unknown>(
@@ -89,7 +92,7 @@ export async function printBridgeConsoleSummary(
89
92
  )
90
93
  .join(' ')
91
94
  : String(entry)
92
- console.log(` [${time}] ${msg}`)
95
+ console.log(` [${time}] ${safe(msg)}`)
93
96
  }
94
97
  }
95
98
 
@@ -123,9 +126,9 @@ export async function printBridgeRequestSummary(
123
126
  const time = formatLogTimestamp(entry.timestamp)
124
127
  console.log(` [${time}] ${formatRequestMessage(entry)}`)
125
128
  if (entry.responseBody) {
126
- console.log(` ${entry.responseBody}`)
129
+ console.log(` ${safe(entry.responseBody)}`)
127
130
  } else if (entry.error) {
128
- console.log(` ${entry.error}`)
131
+ console.log(` ${safe(entry.error)}`)
129
132
  }
130
133
  }
131
134
  }
@@ -178,7 +181,7 @@ export async function printBridgeStateSummary(bridge: WsBridge) {
178
181
 
179
182
  console.log('\n state:')
180
183
  if (state.simId) console.log(` sim: ${state.simId}`)
181
- if (state.url) console.log(` url: ${state.url}`)
184
+ if (state.url) console.log(` url: ${safe(state.url)}`)
182
185
  if (state.mode) console.log(` mode: ${state.mode}`)
183
186
  const nodeCount = Number(state.nodeCount) || 0
184
187
  console.log(` nodes: ${nodeCount}${nodeCount > 10 ? ' (ready)' : ' (not ready)'}`)
@@ -744,7 +744,11 @@ export async function producePreviewArtifact(bundlePath: string) {
744
744
  minified: true,
745
745
  }
746
746
  }
747
- const bytes = Buffer.from(prepared.code, 'utf8')
747
+ const annotated =
748
+ await getCliRuntime().rolldown_bundle_inventory.attachRolldownBundleInventory(
749
+ prepared.code,
750
+ )
751
+ const bytes = Buffer.from(annotated, 'utf8')
748
752
  const sha256 = createHash('sha256').update(bytes).digest('hex')
749
753
  return {
750
754
  bytes,
@@ -799,8 +803,13 @@ export async function produceCloudBoxArtifact(
799
803
  `peach box create embedded a placeholder image for ${prepared.substituted.length} asset(s) no scale of which is in ${prepared.search.searched.join(', ') || 'any asset dest directory'}: ${prepared.substituted.join(', ')}. Rebuild with \`react-native bundle --assets-dest\` to ship the real images.`,
800
804
  )
801
805
  }
806
+ const code = getCliRuntime().preview_bundle_layout.isRolldownBundle(prepared.code)
807
+ ? await getCliRuntime().rolldown_bundle_inventory.attachRolldownBundleInventory(
808
+ prepared.code,
809
+ )
810
+ : prepared.code
802
811
  return {
803
- bytes: Buffer.from(prepared.code, 'utf8'),
812
+ bytes: Buffer.from(code, 'utf8'),
804
813
  assetsDirectory: prepared.dest?.directory ?? null,
805
814
  warnings,
806
815
  }
@@ -183,6 +183,9 @@ interface NativeRequest extends PackageNativeRequest {
183
183
  answered: boolean
184
184
  }
185
185
 
186
+ // the part of a package or local request that the stub hint reads
187
+ type OpenRequest = Pick<NativeRequest, 'kind' | 'name' | 'answered' | 'optional'>
188
+
186
189
  type AppTarget =
187
190
  | {
188
191
  dir: string
@@ -552,7 +555,7 @@ function printNativeGuidance(
552
555
  for (const item of unknownNative) {
553
556
  const names = item.requests.map(
554
557
  (request) =>
555
- `${request.kind} ${request.name}${request.answered ? ' (answered)' : ''}`,
558
+ `${request.kind} ${request.name}${request.answered ? ' (answered)' : request.optional ? ' (optional)' : ''}`,
556
559
  )
557
560
  console.log(
558
561
  ` ${stubbed(item) ? success('✓') : accent('?')} ${item.name} ${muted(names.length ? names.join(', ') : 'no native names found in its JavaScript')}`,
@@ -568,14 +571,14 @@ function printNativeGuidance(
568
571
  )
569
572
  }
570
573
  // the open names grouped by the package they belong to, the key `packages` takes
571
- const open = new Map<string, Map<string, NativeRequest>>()
574
+ const open = new Map<string, Map<string, OpenRequest>>()
572
575
  for (const [owner, requests] of [
573
576
  ...unknownNative.map((item) => [item.name, item.requests] as const),
574
577
  ...local.map((item) => [item.package, [item]] as const),
575
578
  ]) {
576
579
  for (const request of requests) {
577
- if (request.answered) continue
578
- const names = open.get(owner) ?? new Map<string, NativeRequest>()
580
+ if (request.answered || request.optional) continue
581
+ const names = open.get(owner) ?? new Map<string, OpenRequest>()
579
582
  names.set(`${request.kind}:${request.name}`, request)
580
583
  open.set(owner, names)
581
584
  }
@@ -677,7 +680,10 @@ function printStubs(stubs: AppStubs): void {
677
680
  }
678
681
 
679
682
  function stubbed(item: UnknownNativePackage): boolean {
680
- return item.requests.length > 0 && item.requests.every((request) => request.answered)
683
+ return (
684
+ item.requests.length > 0 &&
685
+ item.requests.every((request) => request.answered || request.optional)
686
+ )
681
687
  }
682
688
 
683
689
  function printReportHint(): void {
@@ -833,10 +839,14 @@ function findUnknownNative(
833
839
  .flatMap((item) => {
834
840
  const dir = installedPackageDir(appDir, item.name)
835
841
  if (!dir || !hasNativeCode(dir, scan.scoreSummary.platform)) return []
836
- const requests = packageNativeRequests(dir).map((request) => ({
837
- ...request,
838
- answered: answered[request.kind].has(request.name),
839
- }))
842
+ const requests = packageNativeRequests(dir)
843
+ .filter(
844
+ (request) => !(request.androidOnly && scan.scoreSummary.platform === 'ios'),
845
+ )
846
+ .map((request) => ({
847
+ ...request,
848
+ answered: answered[request.kind].has(request.name),
849
+ }))
840
850
  return [{ name: item.name, version: item.version, requests }]
841
851
  })
842
852
  }
@@ -847,7 +857,7 @@ function reportLocalNative(local: readonly LocalNative[]): void {
847
857
  ? `${item.path} (Expo module ${item.expoModule}${item.swift ? ', Swift' : ''})`
848
858
  : item.path
849
859
  console.log(
850
- ` ${item.answered ? success('✓') : accent('?')} ${item.kind} ${item.name} ${muted(where)}${item.answered ? muted(' answered') : ''}`,
860
+ ` ${item.answered ? success('✓') : item.optional ? muted('·') : accent('?')} ${item.kind} ${item.name} ${muted(where)}${item.answered ? muted(' answered') : item.optional ? muted(' optional') : ''}`,
851
861
  )
852
862
  }
853
863
  }
@@ -1196,6 +1196,7 @@ export function waitReadyReason(
1196
1196
  | 'externalStatus'
1197
1197
  | 'flag'
1198
1198
  | 'targets'
1199
+ | 'paintedAppContent'
1199
1200
  | 'suppressedEntryError'
1200
1201
  > & { bridgeError?: string },
1201
1202
  ): string {
@@ -1219,7 +1220,7 @@ export function waitReadyReason(
1219
1220
  ? 'native content is rendered but the ready signal has not settled'
1220
1221
  : status.flag !== true
1221
1222
  ? 'guest app has not emitted sootsim:externalAppReady'
1222
- : status.targets <= 0
1223
+ : status.targets <= 0 && !status.paintedAppContent
1223
1224
  ? 'ready flag emitted but no visible app content is inspectable yet'
1224
1225
  : 'node tree is still changing'
1225
1226
  // suppressed entry errors never gate readiness, but on a stall they are
@@ -256,6 +256,7 @@ export interface ReloadReadyResult {
256
256
  elapsedMs: number
257
257
  nodes: number
258
258
  targets: number
259
+ paintedAppContent: boolean
259
260
  liveFrameActive: boolean
260
261
  browserSurfaceCount: number
261
262
  liveFrameChannels: number
@@ -290,6 +291,7 @@ export async function pollForReloadReady(
290
291
  elapsedMs: status.elapsedMs,
291
292
  nodes: status.nodes,
292
293
  targets: status.targets,
294
+ paintedAppContent: status.paintedAppContent,
293
295
  liveFrameActive: status.liveFrameActive,
294
296
  browserSurfaceCount: status.browserSurfaceCount,
295
297
  liveFrameChannels: status.liveFrameChannels,
@@ -147,6 +147,7 @@ interface NetworkEntryPayload {
147
147
  error: string | null
148
148
  size: number | null
149
149
  type: string | null
150
+ requestedType?: string
150
151
  }
151
152
 
152
153
  function formatNetworkSize(bytes: number | null): string {
@@ -306,7 +307,7 @@ function describeReloadReadyBlocker(result: ReloadReadyResult): string {
306
307
  if (result.loadingText) return `still showing "${result.loadingText}"`
307
308
  if (result.externalReady === false) return 'guest app is still loading'
308
309
  if (result.flag !== true) return 'guest app has not emitted sootsim:externalAppReady'
309
- if (result.targets <= 0) {
310
+ if (result.targets <= 0 && !result.paintedAppContent) {
310
311
  return 'ready flag emitted but no visible app content is inspectable yet'
311
312
  }
312
313
  return 'node tree is still changing'
@@ -4385,7 +4386,15 @@ export async function runInspect(args: string[], opts: InspectOptions) {
4385
4386
  }
4386
4387
  if (filter) {
4387
4388
  const lf = filter.toLowerCase()
4388
- out = out.filter((e) => (e.displayUrl || e.url).toLowerCase().includes(lf))
4389
+ // the response content type and the file type the loader asked
4390
+ // for are matched too: a url without the extension (a 404 or an
4391
+ // extensionless asset) still names its type
4392
+ out = out.filter(
4393
+ (e) =>
4394
+ (e.displayUrl || e.url).toLowerCase().includes(lf) ||
4395
+ (e.type ?? '').toLowerCase().includes(lf) ||
4396
+ (e.requestedType ?? '').toLowerCase().includes(lf),
4397
+ )
4389
4398
  }
4390
4399
  // when --slow is on without --tail, sort by durationMs descending
4391
4400
  // so the slowest requests print first regardless of finish order.
@@ -80,11 +80,14 @@ function redactString(quoted: string, configurationOnly: boolean): string {
80
80
  return redacted === decoded ? quoted : JSON.stringify(redacted)
81
81
  }
82
82
 
83
- function decodeOrSelf(value: string): string {
83
+ // undefined when the value is not wholly valid percent-encoding. callers mask
84
+ // such a value, since a partial decode could leave an encoded credential
85
+ // readable.
86
+ function decodeStrict(value: string): string | undefined {
84
87
  try {
85
88
  return decodeURIComponent(value)
86
89
  } catch {
87
- return value
90
+ return undefined
88
91
  }
89
92
  }
90
93
 
@@ -122,6 +125,19 @@ export function redactForSharing(text: string): string {
122
125
  return redactText(text, false)
123
126
  }
124
127
 
128
+ // an encoded value whose decoding is encoded again is unwrapped one level at
129
+ // a time, so each level's document is redacted at its own escaping.
130
+ function redactEncoded(value: string, configurationOnly: boolean): string {
131
+ const decoded = decodeStrict(value)
132
+ if (decoded === undefined) return mask(value)
133
+ if (decoded === value) return value
134
+ const redacted =
135
+ /%[0-9a-f]{2}/i.test(decoded) && !/["{}&=]/.test(decoded)
136
+ ? redactEncoded(decoded, configurationOnly)
137
+ : redactText(decoded, configurationOnly)
138
+ return redacted === decoded ? value : encodeURIComponent(redacted)
139
+ }
140
+
125
141
  function redactText(text: string, configurationOnly: boolean): string {
126
142
  if (!configurationOnly) {
127
143
  text = text
@@ -134,16 +150,16 @@ function redactText(text: string, configurationOnly: boolean): string {
134
150
  redactPair(pair, prefix, quotedName, bareName, value, configurationOnly),
135
151
  )
136
152
  .replace(QUERY_PAIR, (pair, prefix: string, name: string, value: string) => {
137
- const decodedName = decodeOrSelf(name)
153
+ const decodedName = decodeStrict(name)
154
+ if (decodedName === undefined) return `${prefix}${mask(value)}`
138
155
  if (decodedName === PEACH_CONFIG_QUERY_PARAM) return `${prefix}%5Bredacted%5D`
139
156
  if (!configurationOnly && SECRET_NAME.test(decodedName))
140
157
  return `${prefix}${mask(value)}`
141
158
  // a launch url can carry a whole config object, or another url with its
142
159
  // own query, as one encoded value; each decode is shorter, so this ends.
143
160
  if (!/%[0-9a-f]{2}/i.test(value)) return pair
144
- const decoded = decodeOrSelf(value)
145
- const redacted = redactText(decoded, configurationOnly)
146
- return redacted === decoded ? pair : `${prefix}${encodeURIComponent(redacted)}`
161
+ const redacted = redactEncoded(value, configurationOnly)
162
+ return redacted === value ? pair : `${prefix}${redacted}`
147
163
  })
148
164
  if (configurationOnly) return redacted
149
165
  return redacted
@@ -23,7 +23,8 @@ interface Timer {
23
23
  }
24
24
 
25
25
  const timers = new Set<Timer>()
26
- let poll: ReturnType<typeof setInterval> | undefined
26
+ let poll: ReturnType<typeof setTimeout> | undefined
27
+ let pollDueAt = 0
27
28
 
28
29
  function pausedPids(): number[] {
29
30
  try {
@@ -59,6 +60,7 @@ function heldRoots(paused: number[], roots: Set<number>): Set<number> {
59
60
  }
60
61
 
61
62
  function tick() {
63
+ poll = undefined
62
64
  const now = Date.now()
63
65
  const paused = pausedPids()
64
66
  const held = paused.length
@@ -73,10 +75,27 @@ function tick() {
73
75
  timer.fire()
74
76
  }
75
77
  }
76
- if (timers.size === 0 && poll) {
77
- clearInterval(poll)
78
+ schedule()
79
+ }
80
+
81
+ // the next tick comes no later than the soonest deadline, so a budget shorter
82
+ // than the poll interval still fires on time. an armed tick that is already
83
+ // due sooner stays, so a stream of commands cannot keep pushing the poll back.
84
+ function schedule() {
85
+ if (timers.size === 0) {
86
+ if (poll) clearTimeout(poll)
78
87
  poll = undefined
88
+ return
79
89
  }
90
+ const now = Date.now()
91
+ const soonest = Math.min(
92
+ ...[...timers].map((timer) => timer.remaining - (now - timer.accountedAt)),
93
+ )
94
+ const due = now + Math.max(0, Math.min(TICK_MS, soonest))
95
+ if (poll && pollDueAt <= due) return
96
+ if (poll) clearTimeout(poll)
97
+ pollDueAt = due
98
+ poll = setTimeout(tick, due - now)
80
99
  }
81
100
 
82
101
  // like setTimeout, but the budget does not advance while the governor holds
@@ -93,14 +112,9 @@ export function setPauseAwareTimeout(
93
112
  }
94
113
  const timer: Timer = { hostPid, remaining: budgetMs, accountedAt: Date.now(), fire: fn }
95
114
  timers.add(timer)
96
- if (!poll) {
97
- poll = setInterval(tick, TICK_MS)
98
- }
115
+ schedule()
99
116
  return () => {
100
117
  timers.delete(timer)
101
- if (timers.size === 0 && poll) {
102
- clearInterval(poll)
103
- poll = undefined
104
- }
118
+ schedule()
105
119
  }
106
120
  }
package/cli/ws-bridge.ts CHANGED
@@ -35,6 +35,7 @@ import {
35
35
  saveCurrentSimId,
36
36
  } from './current-sim'
37
37
  import { setPauseAwareTimeout } from './pause-aware-timeout'
38
+ import { peachExit } from './run-rnx'
38
39
 
39
40
  // --- bridge world resolution ---------------------------------------------
40
41
  //
@@ -471,6 +472,21 @@ interface BridgeFlagState {
471
472
  // missing from that list is not a parse failure, it is a command that hunts a
472
473
  // positional in raw argv and takes the flag's value instead: `maestro test
473
474
  // --newflag value login.yaml` would run `value` as the flow.
475
+ // a bare number is milliseconds; ms, s and m suffixes are accepted. a value
476
+ // that is not a positive duration never reaches a timer.
477
+ const TIMEOUT_UNIT_MS: Record<string, number> = { ms: 1, s: 1000, m: 60_000 }
478
+ function parseTimeoutMs(value: string): number {
479
+ const match = /^(\d+(?:\.\d+)?)(ms|s|m)?$/.exec(value.trim())
480
+ const ms = match ? Number(match[1]) * TIMEOUT_UNIT_MS[match[2] ?? 'ms'] : NaN
481
+ if (!(ms > 0)) {
482
+ console.error(
483
+ `--timeout takes a positive duration in milliseconds (or with an ms, s or m suffix), got "${value}"`,
484
+ )
485
+ peachExit(2)
486
+ }
487
+ return ms
488
+ }
489
+
474
490
  const BRIDGE_VALUE_FLAGS_TABLE: readonly {
475
491
  names: readonly string[]
476
492
  apply: (state: BridgeFlagState, value: string | undefined) => void
@@ -488,7 +504,7 @@ const BRIDGE_VALUE_FLAGS_TABLE: readonly {
488
504
  names: ['--timeout'],
489
505
  apply: (state, value) => {
490
506
  if (value !== undefined) {
491
- state.commandTimeoutMs = Number(value)
507
+ state.commandTimeoutMs = parseTimeoutMs(value)
492
508
  state.explicitTimeout = true
493
509
  }
494
510
  },
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1653 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1654 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1653 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1654 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1653 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1654 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1653 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1654 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1653 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1654 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } 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.1653 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1654 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
package/dist-lib/beta.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1653 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1654 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/beta.ts
4
4
  var IS_BETA = true;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1653 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1654 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1653 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1654 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;