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
@@ -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;
@@ -45019,6 +45019,19 @@ __attribute__((swift_bridge("Swift.String")))
45019
45019
  - (void)appendFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2);
45020
45020
  + (NSMutableString *)stringWithCapacity:(NSUInteger)capacity;
45021
45021
  @end
45022
+ NS_SWIFT_UNAVAILABLE("Use String or NSString instead.")
45023
+ @interface NSSimpleCString : NSString {
45024
+ @package
45025
+ char *bytes;
45026
+ int numBytes;
45027
+ #if __LP64__
45028
+ int _unused;
45029
+ #endif
45030
+ }
45031
+ @end
45032
+ NS_SWIFT_UNAVAILABLE("Use String or NSString instead.")
45033
+ @interface NSConstantString : NSSimpleCString
45034
+ @end
45022
45035
  @interface NSAttributedString : NSObject <NSCopying, NSMutableCopying, NSSecureCoding>
45023
45036
  @property (readonly, copy) NSString *string;
45024
45037
  @end
@@ -48034,6 +48047,9 @@ async function runCompiler(command, args, options, stream = false, quiet) {
48034
48047
  await stopping;
48035
48048
  }
48036
48049
  }
48050
+ function swiftBuilderHopTimeoutMs(compileTimeoutMs) {
48051
+ return (compileTimeoutMs ?? SWIFT_BUILDER_DEFAULT_COMPILE_MS) + SWIFT_BUILDER_TRANSPORT_MARGIN_MS;
48052
+ }
48037
48053
  function swiftDistributionAt(root) {
48038
48054
  const file = import_node_path11.default.join(root, SWIFT_DISTRIBUTION_MANIFEST);
48039
48055
  if (!(0, import_node_fs13.existsSync)(file)) return null;
@@ -51195,7 +51211,7 @@ function compileSwiftProjectUnit(input, options) {
51195
51211
  ],
51196
51212
  {
51197
51213
  cwd: repo,
51198
- timeout: options.timeoutMs,
51214
+ timeout: options.timeoutMs === void 0 ? void 0 : swiftBuilderHopTimeoutMs(options.timeoutMs),
51199
51215
  maxBuffer: 64 * 1024 * 1024,
51200
51216
  signal: options.signal
51201
51217
  },
@@ -51404,7 +51420,7 @@ function compileSwiftProjectUnit(input, options) {
51404
51420
  options.signal
51405
51421
  );
51406
51422
  }
51407
- var import_node_child_process11, import_node_crypto11, import_node_fs13, import_node_os6, import_node_path11, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, BUILD_JOBS, linkedModuleDigests, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, sdkPaths, availableModules, ONE_PRODUCT, SPRITEKIT_PRODUCT, importsSpriteKit, FOUNDATION_IMPLICIT_MODULES, FOUNDATION_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, EXECUTABLE_LINK_FLAGS, REACTOR_FLAG, MULTI_MANIFEST_VERSION, compilerSourceDigest, DIRECTIVE, OS_IOS, OBJC_ATTRIBUTE, SELECTOR, PROTOCOL_NAME, KEY_PATH, TYPE_AFTER_ATTRIBUTE, DELEGATE_CLASS, REUSABLE_INIT, REUSABLE_VIEW_BASES, CLASS_BASE, FRAME_INIT, APPLE_CLASS, EXTENSION_DECL, CLASS_DECL, MODIFIERS, OVERRIDE_FUNC, OVERRIDE_VAR, APPLE_PROTOCOL, OBJC_PROTOCOL, OBJC_PREPOSITIONS, DECLARATION_MODIFIERS, optionalResult, SDK_OBJC_OPTIONAL, IMP_CONVENTION, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, ROOT_LOCKS, host, rootLocks, retainedArtifacts;
51423
+ var import_node_child_process11, import_node_crypto11, import_node_fs13, import_node_os6, import_node_path11, WASM_TRIPLE, SWIFTPM_PROGRESS, SWIFTPM_NOISE, BUILD_JOBS, SWIFT_BUILDER_TRANSPORT_MARGIN_MS, SWIFT_BUILDER_DEFAULT_COMPILE_MS, linkedModuleDigests, OPTIONAL_FRAMEWORK_DEPENDENCIES, OPTIONAL_FRAMEWORKS, SWIFT_IMPORT, sdkPaths, availableModules, ONE_PRODUCT, SPRITEKIT_PRODUCT, importsSpriteKit, FOUNDATION_IMPLICIT_MODULES, FOUNDATION_IMPLICIT_FLAGS, ONE_IMPLICIT_FLAGS, EXECUTABLE_LINK_FLAGS, REACTOR_FLAG, MULTI_MANIFEST_VERSION, compilerSourceDigest, DIRECTIVE, OS_IOS, OBJC_ATTRIBUTE, SELECTOR, PROTOCOL_NAME, KEY_PATH, TYPE_AFTER_ATTRIBUTE, DELEGATE_CLASS, REUSABLE_INIT, REUSABLE_VIEW_BASES, CLASS_BASE, FRAME_INIT, APPLE_CLASS, EXTENSION_DECL, CLASS_DECL, MODIFIERS, OVERRIDE_FUNC, OVERRIDE_VAR, APPLE_PROTOCOL, OBJC_PROTOCOL, OBJC_PREPOSITIONS, DECLARATION_MODIFIERS, optionalResult, SDK_OBJC_OPTIONAL, IMP_CONVENTION, FOUNDATION_NETWORKING_TYPES, FOUNDATION_OVERLAY_TYPES, FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_OVERLAY_GLOBALS, CORE_FOUNDATION_GEOMETRY_TYPES, CORE_FOUNDATION_GRAPHICS_TYPES, CORE_FOUNDATION_HANDLE_IMPORTS, ROOT_LOCKS, host, rootLocks, retainedArtifacts;
51408
51424
  var init_swift_compile = __esm({
51409
51425
  "src/swift-compile.ts"() {
51410
51426
  "use strict";
@@ -51436,6 +51452,8 @@ var init_swift_compile = __esm({
51436
51452
  BUILD_JOBS = String(
51437
51453
  Math.min(4, Math.max(1, Math.floor(import_node_os6.default.availableParallelism() / 2)))
51438
51454
  );
51455
+ SWIFT_BUILDER_TRANSPORT_MARGIN_MS = 3e5;
51456
+ SWIFT_BUILDER_DEFAULT_COMPILE_MS = 18e5;
51439
51457
  linkedModuleDigests = /* @__PURE__ */ new Map();
51440
51458
  OPTIONAL_FRAMEWORK_DEPENDENCIES = {
51441
51459
  GameplayKit: [],
@@ -51508,7 +51526,7 @@ var init_swift_compile = __esm({
51508
51526
  `;
51509
51527
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
51510
51528
  MULTI_MANIFEST_VERSION = 39;
51511
- compilerSourceDigest = true ? "f4eb526a3d0d01972f3bb179b60c2b10df37c90e90ad1717a3b4946374cdb248" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
51529
+ compilerSourceDigest = true ? "bcd59db8ba588a1eb76c6f08e64f5b5b6acda2e913adef5edd85345fef2c0cc7" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
51512
51530
  DIRECTIVE = /^[ \t]*#(?:if|elseif)\b/;
51513
51531
  OS_IOS = /\b(?:os\(\s*iOS\s*\)|targetEnvironment\(\s*simulator\s*\))/g;
51514
51532
  OBJC_ATTRIBUTE = /^@(?:objcMembers\b|objc\b(?:(\s*)\(([^()]*)\))?|IBAction\b)/;
@@ -56769,12 +56787,12 @@ var swift_distribution_lock_default;
56769
56787
  var init_swift_distribution_lock = __esm({
56770
56788
  "src/swift-distribution.lock.json"() {
56771
56789
  swift_distribution_lock_default = {
56772
- id: "e3bdd3d8fa4f9993",
56790
+ id: "ca4dfda0ca14bc49",
56773
56791
  release: "swift-6.4.0-RELEASE-custom-0d775d32d7c74eae",
56774
56792
  wasmSdkId: "swift-6.4.0-RELEASE_wasm-peach-f02bd198",
56775
56793
  wasmSdkUrl: "https://r2.sootsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-f02bd198.artifactbundle.tar.gz",
56776
56794
  wasmSdkChecksum: "1e19ea768fd4e821aae34b8966c4ddcee45615c4b3cf018979b061aee2fb5504",
56777
- source: "5791eeff9ca9c054514aeb4a6599e1de8e1e4711",
56795
+ source: "33e8641403dd73a7ce0ca902007e3a36407e1f0b",
56778
56796
  targets: [
56779
56797
  "ImagePlayground",
56780
56798
  "QuickLookThumbnailing",
@@ -56819,6 +56837,7 @@ var init_swift_distribution_lock = __esm({
56819
56837
  "PeachObjCRuntime",
56820
56838
  "PeachObjC",
56821
56839
  "UIUtilities",
56840
+ "UIKitEnums",
56822
56841
  "UIKitCore",
56823
56842
  "PeachICU",
56824
56843
  "PeachCMark",
@@ -56934,33 +56953,14 @@ var init_swift_distribution_lock = __esm({
56934
56953
  "PeachBox2D"
56935
56954
  ],
56936
56955
  systemEnvironment: {
56937
- scenePhase: [
56938
- "string:active",
56939
- "string:inactive",
56940
- "string:background"
56941
- ],
56942
- deviceModel: [
56943
- "string"
56944
- ],
56945
- systemName: [
56946
- "string"
56947
- ],
56948
- systemVersion: [
56949
- "string"
56950
- ],
56951
- colorScheme: [
56952
- "string:light",
56953
- "string:dark"
56954
- ],
56955
- semanticColors: [
56956
- "object"
56957
- ],
56958
- imageAssets: [
56959
- "object"
56960
- ],
56961
- locale: [
56962
- "string"
56963
- ],
56956
+ scenePhase: ["string:active", "string:inactive", "string:background"],
56957
+ deviceModel: ["string"],
56958
+ systemName: ["string"],
56959
+ systemVersion: ["string"],
56960
+ colorScheme: ["string:light", "string:dark"],
56961
+ semanticColors: ["object"],
56962
+ imageAssets: ["object"],
56963
+ locale: ["string"],
56964
56964
  dynamicTypeSize: [
56965
56965
  "string:xSmall",
56966
56966
  "string:small",
@@ -56975,30 +56975,22 @@ var init_swift_distribution_lock = __esm({
56975
56975
  "string:accessibility4",
56976
56976
  "string:accessibility5"
56977
56977
  ],
56978
- horizontalSizeClass: [
56979
- "string:compact",
56980
- "string:regular"
56981
- ],
56982
- verticalSizeClass: [
56983
- "string:compact",
56984
- "string:regular"
56985
- ],
56986
- accessibilityReduceMotion: [
56987
- "bool"
56988
- ]
56978
+ horizontalSizeClass: ["string:compact", "string:regular"],
56979
+ verticalSizeClass: ["string:compact", "string:regular"],
56980
+ accessibilityReduceMotion: ["bool"]
56989
56981
  },
56990
56982
  hosts: {
56991
56983
  "darwin-arm64": {
56992
- sha256: "278cf5301795dd1e9f0f044bdb4e079b45ab4eb72a6e72331b06916115e34902",
56993
- size: 71532233
56984
+ sha256: "8679052c4c2b21ad748a8db40cdbc0c91ab14a29fc06bbed777efb57030c01fa",
56985
+ size: 70963039
56994
56986
  },
56995
56987
  "linux-x64": {
56996
- sha256: "920c6fe08ba45930880fee133a3cb85b310d713a4d60404f29d03555d3df879c",
56997
- size: 71538725
56988
+ sha256: "a1719d844e2f45e8c9a2ccb9dbe7857978918639a3933c225a328d84cae235cf",
56989
+ size: 70968746
56998
56990
  },
56999
56991
  "linux-arm64": {
57000
- sha256: "d3a3421e0c80cc698869bc39dd538d42b0e053db02526d3f5f22acf8e7c6dca9",
57001
- size: 71536749
56992
+ sha256: "3da8f2c920e65c633b5310c778b4a5c54b0f5f8278d58fd109f3db4310794c04",
56993
+ size: 70967077
57002
56994
  }
57003
56995
  }
57004
56996
  };
@@ -58469,9 +58461,11 @@ ${prefix}${json}${suffix}`;
58469
58461
  const identity = findBundleFooter(source, "globalThis.__sootsimModulePaths=");
58470
58462
  return identity < 0 ? source + footer : source.slice(0, identity) + footer + source.slice(identity);
58471
58463
  }
58464
+ var ROLLDOWN_INVENTORY_HEADER;
58472
58465
  var init_bundleGlobalFooter = __esm({
58473
58466
  "src/bundleGlobalFooter.ts"() {
58474
58467
  "use strict";
58468
+ ROLLDOWN_INVENTORY_HEADER = "X-Peach-Rolldown-Inventory";
58475
58469
  }
58476
58470
  });
58477
58471
 
@@ -64640,7 +64634,7 @@ var init_runtime_assets = __esm({
64640
64634
  var runtime_companion_default;
64641
64635
  var init_runtime_companion = __esm({
64642
64636
  "runtime-companion.json"() {
64643
- runtime_companion_default = { abi: 1, sha256: "d58f0fedc3c0065faaafcf578781567b6cdac88e5c062a8354111d37fdf3c465", file: "node/cli-d58f0fedc3c0065faaafcf578781567b6cdac88e5c062a8354111d37fdf3c465.cjs" };
64637
+ runtime_companion_default = { abi: 1, sha256: "a1b49c57129dd06888a9cdfbb05051be3626e8233980236705a3efd52b651623", file: "node/cli-a1b49c57129dd06888a9cdfbb05051be3626e8233980236705a3efd52b651623.cjs" };
64644
64638
  }
64645
64639
  });
64646
64640
 
@@ -70950,6 +70944,10 @@ async function handleFetchProxyRequest(req, res) {
70950
70944
  if (packageVersions)
70951
70945
  res.setHeader(PACKAGE_VERSIONS_HEADER, JSON.stringify(packageVersions));
70952
70946
  }
70947
+ if (isBundleProxyRequestUrl(req.url) && req.method === "GET" && upstream.statusCode === 200 && upstreamUrl.pathname.endsWith(".bundle") && upstream.headers["x-peach-rolldown-inventory"] !== "1") {
70948
+ res.setHeader(ROLLDOWN_INVENTORY_HEADER, "1");
70949
+ res.removeHeader("content-length");
70950
+ }
70953
70951
  applyFetchProxyCors(req, res);
70954
70952
  if (setCookies.length > 0)
70955
70953
  res.setHeader("x-sootsim-set-cookie", setCookies.join(", "));
@@ -71113,6 +71111,21 @@ async function proxyUpstream(req, res, upstreamUrl, reportFailure, route) {
71113
71111
  if (redirects > 0) res.setHeader(FETCH_PROXY_RESPONSE_URL_HEADER, targetUrl.href);
71114
71112
  await route.respond(proxyRes, hopCookies);
71115
71113
  res.statusCode = status;
71114
+ if (isBundleProxyRequestUrl(req.url) && method === "GET" && status === 200 && targetUrl.pathname.endsWith(".bundle") && proxyRes.headers["x-peach-rolldown-inventory"] !== "1") {
71115
+ const chunks = [];
71116
+ for await (const chunk of proxyRes) {
71117
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
71118
+ }
71119
+ const payload = Buffer.concat(chunks).toString("utf8");
71120
+ const contentType2 = typeof proxyRes.headers["content-type"] === "string" ? proxyRes.headers["content-type"] : void 0;
71121
+ const annotated = await getCliRuntime().rolldown_bundle_inventory.attachRolldownBundleHttpPayload(
71122
+ payload,
71123
+ contentType2
71124
+ );
71125
+ res.removeHeader("content-length");
71126
+ res.end(Buffer.from(annotated, "utf8"));
71127
+ return;
71128
+ }
71116
71129
  await (0, import_promises5.pipeline)(proxyRes, res);
71117
71130
  };
71118
71131
  let body;
@@ -71166,6 +71179,8 @@ var init_fetch_proxy_handler = __esm({
71166
71179
  import_node_http2 = require("node:http2");
71167
71180
  import_promises5 = require("stream/promises");
71168
71181
  init_backend_origin();
71182
+ init_bundleGlobalFooter();
71183
+ init_cli_runtime();
71169
71184
  init_packageVersionsContract();
71170
71185
  init_dev_server_package_versions();
71171
71186
  init_fetch_proxy_overrides();
@@ -76632,9 +76647,12 @@ async function buildRnxCloudArtifact(bundle, options = {}) {
76632
76647
  if (getCliRuntime().preview_bundle_layout.isRolldownBundle(bundle)) {
76633
76648
  if (mode !== "production")
76634
76649
  throw new Error("peach Cloud One artifacts require a production bundle");
76650
+ const { attachRolldownBundleInventory, stripRolldownBundleInventoryFooter } = getCliRuntime().rolldown_bundle_inventory;
76635
76651
  const { readRolldownProductionInput } = getCliRuntime().rolldown_production_fingerprint;
76636
- code = (0, import_metro_production_bundle.detachRNXMetroSourceMapUrl)(bundle).source;
76637
- modules = (await readRolldownProductionInput(code)).modules.length;
76652
+ const raw2 = (0, import_metro_production_bundle.detachRNXMetroSourceMapUrl)(bundle).source;
76653
+ const annotated = await attachRolldownBundleInventory(raw2);
76654
+ modules = (await readRolldownProductionInput(annotated)).modules.length;
76655
+ code = stripRolldownBundleInventoryFooter(annotated);
76638
76656
  } else {
76639
76657
  const hostVersionEvidence = readHostVersionEvidence(bundle);
76640
76658
  const autolinked = detachAndroidAutolinkingFooter(bundle);
@@ -80640,6 +80658,7 @@ function heldRoots(paused, roots) {
80640
80658
  return held;
80641
80659
  }
80642
80660
  function tick2() {
80661
+ poll = void 0;
80643
80662
  const now = Date.now();
80644
80663
  const paused = pausedPids();
80645
80664
  const held = paused.length ? heldRoots(paused, new Set([...timers].map((timer) => timer.hostPid))) : /* @__PURE__ */ new Set();
@@ -80651,10 +80670,23 @@ function tick2() {
80651
80670
  timer.fire();
80652
80671
  }
80653
80672
  }
80654
- if (timers.size === 0 && poll) {
80655
- clearInterval(poll);
80673
+ schedule();
80674
+ }
80675
+ function schedule() {
80676
+ if (timers.size === 0) {
80677
+ if (poll) clearTimeout(poll);
80656
80678
  poll = void 0;
80679
+ return;
80657
80680
  }
80681
+ const now = Date.now();
80682
+ const soonest = Math.min(
80683
+ ...[...timers].map((timer) => timer.remaining - (now - timer.accountedAt))
80684
+ );
80685
+ const due = now + Math.max(0, Math.min(TICK_MS2, soonest));
80686
+ if (poll && pollDueAt <= due) return;
80687
+ if (poll) clearTimeout(poll);
80688
+ pollDueAt = due;
80689
+ poll = setTimeout(tick2, due - now);
80658
80690
  }
80659
80691
  function setPauseAwareTimeout(fn, budgetMs, hostPid) {
80660
80692
  if (hostPid === void 0) {
@@ -80663,18 +80695,13 @@ function setPauseAwareTimeout(fn, budgetMs, hostPid) {
80663
80695
  }
80664
80696
  const timer = { hostPid, remaining: budgetMs, accountedAt: Date.now(), fire: fn };
80665
80697
  timers.add(timer);
80666
- if (!poll) {
80667
- poll = setInterval(tick2, TICK_MS2);
80668
- }
80698
+ schedule();
80669
80699
  return () => {
80670
80700
  timers.delete(timer);
80671
- if (timers.size === 0 && poll) {
80672
- clearInterval(poll);
80673
- poll = void 0;
80674
- }
80701
+ schedule();
80675
80702
  };
80676
80703
  }
80677
- var import_node_child_process21, import_node_fs49, import_node_os10, import_node_path46, LEDGER_PATH2, TICK_MS2, timers, poll;
80704
+ var import_node_child_process21, import_node_fs49, import_node_os10, import_node_path46, LEDGER_PATH2, TICK_MS2, timers, poll, pollDueAt;
80678
80705
  var init_pause_aware_timeout = __esm({
80679
80706
  "cli/pause-aware-timeout.ts"() {
80680
80707
  "use strict";
@@ -80688,6 +80715,7 @@ var init_pause_aware_timeout = __esm({
80688
80715
  );
80689
80716
  TICK_MS2 = 500;
80690
80717
  timers = /* @__PURE__ */ new Set();
80718
+ pollDueAt = 0;
80691
80719
  }
80692
80720
  });
80693
80721
 
@@ -80881,6 +80909,17 @@ function describeSimIdSource(source) {
80881
80909
  function disconnectedSavedSimMessage(simId, detail = "") {
80882
80910
  return `saved sim ${simId} is not connected${detail}; commands resume when it reconnects, or run \`peach list\` and \`peach use <sim>\`, or open a fresh sim`;
80883
80911
  }
80912
+ function parseTimeoutMs(value) {
80913
+ const match = /^(\d+(?:\.\d+)?)(ms|s|m)?$/.exec(value.trim());
80914
+ const ms = match ? Number(match[1]) * TIMEOUT_UNIT_MS[match[2] ?? "ms"] : NaN;
80915
+ if (!(ms > 0)) {
80916
+ console.error(
80917
+ `--timeout takes a positive duration in milliseconds (or with an ms, s or m suffix), got "${value}"`
80918
+ );
80919
+ peachExit(2);
80920
+ }
80921
+ return ms;
80922
+ }
80884
80923
  function parseBridgeCliArgs(args, opts = {}) {
80885
80924
  const flagIndices = /* @__PURE__ */ new Set();
80886
80925
  const state = {
@@ -81391,7 +81430,7 @@ async function callInBridge(bridge, path56, ...args) {
81391
81430
  async function callInBridgeWrite(bridge, path56, ...args) {
81392
81431
  return bridge.send({ type: "call", path: path56, args, acquireLock: true });
81393
81432
  }
81394
- var import_node_fs50, import_node_path47, import_ws3, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, DisconnectedSimError, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
81433
+ var import_node_fs50, import_node_path47, import_ws3, PEACH_PLACEMENT_ENV, resolvedWorld, BridgeSimLockedError, DisconnectedSimError, TIMEOUT_UNIT_MS, BRIDGE_VALUE_FLAGS_TABLE, BRIDGE_VALUE_FLAGS;
81395
81434
  var init_ws_bridge = __esm({
81396
81435
  "cli/ws-bridge.ts"() {
81397
81436
  "use strict";
@@ -81405,6 +81444,7 @@ var init_ws_bridge = __esm({
81405
81444
  init_cloud_client();
81406
81445
  init_current_sim();
81407
81446
  init_pause_aware_timeout();
81447
+ init_run_rnx();
81408
81448
  PEACH_PLACEMENT_ENV = "PEACH_PLACEMENT";
81409
81449
  resolvedWorld = null;
81410
81450
  BridgeSimLockedError = class extends Error {
@@ -81417,6 +81457,7 @@ var init_ws_bridge = __esm({
81417
81457
  };
81418
81458
  DisconnectedSimError = class extends Error {
81419
81459
  };
81460
+ TIMEOUT_UNIT_MS = { ms: 1, s: 1e3, m: 6e4 };
81420
81461
  BRIDGE_VALUE_FLAGS_TABLE = [
81421
81462
  {
81422
81463
  names: ["--port", "-p"],
@@ -81431,7 +81472,7 @@ var init_ws_bridge = __esm({
81431
81472
  names: ["--timeout"],
81432
81473
  apply: (state, value) => {
81433
81474
  if (value !== void 0) {
81434
- state.commandTimeoutMs = Number(value);
81475
+ state.commandTimeoutMs = parseTimeoutMs(value);
81435
81476
  state.explicitTimeout = true;
81436
81477
  }
81437
81478
  }
@@ -82634,6 +82675,12 @@ function installedPackageDir(appDir, name3) {
82634
82675
  current = parent;
82635
82676
  }
82636
82677
  }
82678
+ function isAndroidCheck(node) {
82679
+ if (node.type !== "BinaryExpression" || !["===", "=="].includes(node.operator))
82680
+ return false;
82681
+ const side = (value, literal3) => value.type === "MemberExpression" && !value.computed && nativeLookupName(value.object) === "Platform" && nativeLookupName(value) === "OS" && literal3.type === "Literal" && literal3.value === "android";
82682
+ return side(node.left, node.right) || side(node.right, node.left);
82683
+ }
82637
82684
  function nativeLookupName(node) {
82638
82685
  if (node.type === "Identifier") return node.name;
82639
82686
  if (node.type === "MemberExpression" && !node.computed && node.property.type === "Identifier")
@@ -82642,6 +82689,7 @@ function nativeLookupName(node) {
82642
82689
  }
82643
82690
  function sourceNativeRequests(file, text5, includeLegacy = false) {
82644
82691
  if (!NATIVE_LOOKUP.test(text5)) return [];
82692
+ const androidFile = /\.android\.[cm]?[jt]sx?$/.test(file);
82645
82693
  let code;
82646
82694
  try {
82647
82695
  code = (0, import_sucrase2.transform)(text5, {
@@ -82654,36 +82702,63 @@ function sourceNativeRequests(file, text5, includeLegacy = false) {
82654
82702
  const { program, errors } = (0, import_oxc_parser2.parseSync)(file, code, { lang: "jsx" });
82655
82703
  if (errors.length) return [];
82656
82704
  const found = [];
82657
- const add = (kind, name3, at) => {
82658
- found.push({ kind, name: name3, line: code.slice(0, at).split("\n").length });
82705
+ const androidRanges = [];
82706
+ const guard = (test, branch) => {
82707
+ if (isAndroidCheck(test)) androidRanges.push([branch.start, branch.end]);
82708
+ };
82709
+ const add = (kind, name3, at, optional) => {
82710
+ found.push({
82711
+ kind,
82712
+ name: name3,
82713
+ optional,
82714
+ androidOnly: androidFile || androidRanges.some(([start, end]) => at >= start && at < end),
82715
+ line: code.slice(0, at).split("\n").length
82716
+ });
82659
82717
  };
82660
82718
  visitParsedProgram(program, {
82719
+ IfStatement(node) {
82720
+ guard(node.test, node.consequent);
82721
+ },
82722
+ ConditionalExpression(node) {
82723
+ guard(node.test, node.consequent);
82724
+ },
82725
+ LogicalExpression(node) {
82726
+ if (node.operator === "&&") guard(node.left, node.right);
82727
+ },
82661
82728
  CallExpression(node) {
82662
82729
  const first = node.arguments[0];
82663
82730
  if (first?.type !== "Literal" || typeof first.value !== "string") return;
82664
82731
  const callee = node.callee;
82665
82732
  const lookup = nativeLookupName(callee);
82666
82733
  if (callee.type === "MemberExpression" && !callee.computed && nativeLookupName(callee.object) === "TurboModuleRegistry" && (lookup === "get" || lookup === "getEnforcing")) {
82667
- add("module", first.value, node.start);
82734
+ add("module", first.value, node.start, false);
82668
82735
  } else if (lookup) {
82669
82736
  if (["requireNativeModule", "requireOptionalNativeModule"].includes(lookup))
82670
- add("module", first.value, node.start);
82737
+ add("module", first.value, node.start, lookup === "requireOptionalNativeModule");
82671
82738
  else if (["requireNativeComponent", "codegenNativeComponent"].includes(lookup))
82672
- add("view", first.value, node.start);
82739
+ add("view", first.value, node.start, false);
82673
82740
  else if (["requireNativeView", "requireNativeViewManager"].includes(lookup)) {
82674
82741
  const second = node.arguments[1];
82675
82742
  const name3 = second?.type === "Literal" && typeof second.value === "string" ? `${first.value}_${second.value}` : first.value;
82676
- add("view", name3, node.start);
82743
+ add("view", name3, node.start, false);
82677
82744
  }
82678
82745
  }
82679
82746
  },
82680
82747
  MemberExpression(node) {
82681
82748
  if (includeLegacy && !node.computed && nativeLookupName(node.object) === "NativeModules" && node.property.type === "Identifier")
82682
- add("module", node.property.name, node.start);
82749
+ add("module", node.property.name, node.start, false);
82683
82750
  }
82684
82751
  });
82685
82752
  return found;
82686
82753
  }
82754
+ function mergeRequests(previous, next) {
82755
+ if (!previous) return next;
82756
+ return {
82757
+ ...next,
82758
+ optional: previous.optional && next.optional,
82759
+ androidOnly: previous.androidOnly && next.androidOnly
82760
+ };
82761
+ }
82687
82762
  function packageNativeRequests(dir) {
82688
82763
  const found = /* @__PURE__ */ new Map();
82689
82764
  const directories = scanRepository(dir).directories.filter((sub) => {
@@ -82698,8 +82773,11 @@ function packageNativeRequests(dir) {
82698
82773
  const file = (0, import_node_path53.join)(sub, name3);
82699
82774
  const text5 = readSmallFile(file);
82700
82775
  if (!text5) continue;
82701
- for (const { kind, name: name4 } of sourceNativeRequests(file, text5, true))
82702
- found.set(`${kind}:${name4}`, { kind, name: name4 });
82776
+ for (const { line: _line, ...request } of sourceNativeRequests(file, text5, true))
82777
+ found.set(
82778
+ `${request.kind}:${request.name}`,
82779
+ mergeRequests(found.get(`${request.kind}:${request.name}`), request)
82780
+ );
82703
82781
  }
82704
82782
  }
82705
82783
  return [...found.values()].sort(
@@ -82878,9 +82956,13 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
82878
82956
  return result;
82879
82957
  };
82880
82958
  const found = /* @__PURE__ */ new Map();
82881
- const add = (kind, name3, file, line) => {
82959
+ const add = (kind, name3, file, line, optional = false) => {
82882
82960
  const key2 = `${kind}:${name3}`;
82883
- if (found.has(key2)) return;
82961
+ const known = found.get(key2);
82962
+ if (known) {
82963
+ known.optional &&= optional;
82964
+ return;
82965
+ }
82884
82966
  providers ??= dependencyNativeOwners(appDir, pkg);
82885
82967
  const packageName = providers.get(key2) ?? owner((0, import_node_path53.dirname)(file));
82886
82968
  if (knownPackages.has(packageName)) return;
@@ -82891,6 +82973,7 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
82891
82973
  package: packageName,
82892
82974
  path: `${(0, import_node_path53.relative)(appDir, file)}:${line}`,
82893
82975
  expoModule: moduleDir ? (0, import_node_path53.relative)(appDir, moduleDir) || "." : null,
82976
+ optional,
82894
82977
  swift: moduleDir ? (nativeFilesByModule.get(moduleDir) ?? []).some(
82895
82978
  (path56) => path56.endsWith(".swift") && [...(readSmallFile(path56) ?? "").matchAll(/\bName\(\s*"(\w+)"\s*\)/g)].some(
82896
82979
  (match) => match[1] === name3
@@ -82902,8 +82985,14 @@ function scanLocalNative(appDir, pkg, answered, platform, knownPackages = /* @__
82902
82985
  for (const file of sourceFiles2) {
82903
82986
  const text5 = readSmallFile(file);
82904
82987
  if (!text5) continue;
82905
- for (const { kind, name: name3, line } of sourceNativeRequests(file, text5, includeLegacy))
82906
- add(kind, name3, file, line);
82988
+ for (const { kind, name: name3, line, optional, androidOnly } of sourceNativeRequests(
82989
+ file,
82990
+ text5,
82991
+ includeLegacy
82992
+ )) {
82993
+ if (androidOnly && platform === "ios") continue;
82994
+ add(kind, name3, file, line, optional);
82995
+ }
82907
82996
  }
82908
82997
  for (const [, files2] of nativeFilesByModule) {
82909
82998
  const swiftFirst = [...files2].sort(
@@ -84013,7 +84102,7 @@ function waitReadyReason(status) {
84013
84102
  return `sim unreachable: ${status.bridgeError} \u2014 the target tab is closed or no sim is connected (check \`peach list\`, reopen with \`peach open\`)`;
84014
84103
  }
84015
84104
  const waitingOnGuestFetch = status.externalReady === false && /https?:\/\//.test(status.externalStatus);
84016
- const base = status.externalError ? `guest app errored: ${status.externalError}` : waitingOnGuestFetch ? `waiting on a guest fetch: ${status.externalStatus}` : status.loadingText ? `still showing "${status.loadingText}"` : status.externalReady === false ? "guest app is still loading" : status.flag !== true && status.targets > 0 ? "native content is rendered but the ready signal has not settled" : status.flag !== true ? "guest app has not emitted sootsim:externalAppReady" : status.targets <= 0 ? "ready flag emitted but no visible app content is inspectable yet" : "node tree is still changing";
84105
+ const base = status.externalError ? `guest app errored: ${status.externalError}` : waitingOnGuestFetch ? `waiting on a guest fetch: ${status.externalStatus}` : status.loadingText ? `still showing "${status.loadingText}"` : status.externalReady === false ? "guest app is still loading" : status.flag !== true && status.targets > 0 ? "native content is rendered but the ready signal has not settled" : status.flag !== true ? "guest app has not emitted sootsim:externalAppReady" : status.targets <= 0 && !status.paintedAppContent ? "ready flag emitted but no visible app content is inspectable yet" : "node tree is still changing";
84017
84106
  return !status.externalError && status.suppressedEntryError ? `${base} (suppressed entry error: ${status.suppressedEntryError})` : base;
84018
84107
  }
84019
84108
  async function inspectWaitReady(bridge, timeoutMs = 2e4, options = {}) {
@@ -84308,16 +84397,121 @@ var init_shared = __esm({
84308
84397
  }
84309
84398
  });
84310
84399
 
84400
+ // cli/output-redaction.ts
84401
+ function mask(value) {
84402
+ if (MASKED.test(value)) return value;
84403
+ return `<redacted:${(0, import_node_crypto31.createHash)("sha256").update(value).digest("hex").slice(0, 4)}>`;
84404
+ }
84405
+ function maskQuoted(quoted) {
84406
+ return `${quoted[0]}${mask(quoted.slice(1, -1))}${quoted[0]}`;
84407
+ }
84408
+ function redactString(quoted, configurationOnly) {
84409
+ if (quoted.startsWith("'")) {
84410
+ const inner = quoted.slice(1, -1);
84411
+ const redacted2 = redactText(inner, configurationOnly);
84412
+ return redacted2 === inner ? quoted : `'${redacted2}'`;
84413
+ }
84414
+ let decoded;
84415
+ try {
84416
+ decoded = JSON.parse(quoted);
84417
+ } catch {
84418
+ decoded = quoted.slice(1, -1).replace(/\\(["\\/])/g, "$1");
84419
+ }
84420
+ const redacted = redactText(decoded, configurationOnly);
84421
+ return redacted === decoded ? quoted : JSON.stringify(redacted);
84422
+ }
84423
+ function decodeStrict(value) {
84424
+ try {
84425
+ return decodeURIComponent(value);
84426
+ } catch {
84427
+ return void 0;
84428
+ }
84429
+ }
84430
+ function redactPair(pair, prefix, quotedName, bareName, value, configurationOnly) {
84431
+ const name3 = quotedName ?? bareName;
84432
+ if (name3 === PEACH_CONFIG_QUERY_PARAM) return `${prefix}"[redacted]"`;
84433
+ if (configurationOnly || !SECRET_NAME.test(name3)) {
84434
+ if (!/^["'[]/.test(value)) return pair;
84435
+ const inner = value.startsWith("[") ? value.replace(STRING_TOKEN, (quoted) => redactString(quoted, configurationOnly)) : redactString(value, configurationOnly);
84436
+ return inner === value ? pair : `${prefix}${inner}`;
84437
+ }
84438
+ if (value.startsWith("[")) return `${prefix}${value.replace(STRING_TOKEN, maskQuoted)}`;
84439
+ return `${prefix}${/^["']/.test(value) ? maskQuoted(value) : `"${mask(value)}"`}`;
84440
+ }
84441
+ function redactConfigurationForDiagnostics(text5) {
84442
+ return redactText(text5, true);
84443
+ }
84444
+ function redactForSharing(text5) {
84445
+ return redactText(text5, false);
84446
+ }
84447
+ function redactEncoded(value, configurationOnly) {
84448
+ const decoded = decodeStrict(value);
84449
+ if (decoded === void 0) return mask(value);
84450
+ if (decoded === value) return value;
84451
+ const redacted = /%[0-9a-f]{2}/i.test(decoded) && !/["{}&=]/.test(decoded) ? redactEncoded(decoded, configurationOnly) : redactText(decoded, configurationOnly);
84452
+ return redacted === decoded ? value : encodeURIComponent(redacted);
84453
+ }
84454
+ function redactText(text5, configurationOnly) {
84455
+ if (!configurationOnly) {
84456
+ text5 = text5.replace(JWT, mask).replace(GOOGLE_API_KEY, mask).replace(BEARER, (match, scheme) => `${scheme} ${mask(match)}`);
84457
+ }
84458
+ const redacted = text5.replace(
84459
+ PAIR2,
84460
+ (pair, prefix, quotedName, bareName, value) => redactPair(pair, prefix, quotedName, bareName, value, configurationOnly)
84461
+ ).replace(QUERY_PAIR, (pair, prefix, name3, value) => {
84462
+ const decodedName = decodeStrict(name3);
84463
+ if (decodedName === void 0) return `${prefix}${mask(value)}`;
84464
+ if (decodedName === PEACH_CONFIG_QUERY_PARAM) return `${prefix}%5Bredacted%5D`;
84465
+ if (!configurationOnly && SECRET_NAME.test(decodedName))
84466
+ return `${prefix}${mask(value)}`;
84467
+ if (!/%[0-9a-f]{2}/i.test(value)) return pair;
84468
+ const redacted2 = redactEncoded(value, configurationOnly);
84469
+ return redacted2 === value ? pair : `${prefix}${redacted2}`;
84470
+ });
84471
+ if (configurationOnly) return redacted;
84472
+ return redacted.replace(
84473
+ HEADER_LINE,
84474
+ (line, prefix, name3, value) => SECRET_NAME.test(name3) ? `${prefix}${mask(value)}` : line
84475
+ ).replace(EMAIL, mask).replace(OPAQUE_ID, mask);
84476
+ }
84477
+ var import_node_crypto31, SECRET_NAME, JWT, GOOGLE_API_KEY, BEARER, EMAIL, OPAQUE_ID, STRING, NUMBER, PAIR2, STRING_TOKEN, QUERY_PAIR, HEADER_LINE, MASKED, utf8;
84478
+ var init_output_redaction = __esm({
84479
+ "cli/output-redaction.ts"() {
84480
+ "use strict";
84481
+ import_node_crypto31 = require("node:crypto");
84482
+ init_config();
84483
+ SECRET_NAME = /^(?:[\w-]*(?:api[-_]?key|token|secret|password|passwd|authorization|cookie|signature|credential)s?|auth|sig|email|uid|[\w-]*(?:user|account|local|device|installation|client|app|project|sender|measurement|tenant)[-_]?id)$/i;
84484
+ JWT = /\beyJ[\w-]{6,}\.[\w-]{6,}\.[\w-]{6,}/g;
84485
+ GOOGLE_API_KEY = /\bAIza[\w-]{30,}/g;
84486
+ BEARER = /\b(Bearer|Basic)\s+[\w.~+/=-]{8,}/gi;
84487
+ EMAIL = /\b[\w.+-]+@[\w-]+(?:\.[\w-]+)+\b/g;
84488
+ OPAQUE_ID = /\b(?=[A-Za-z0-9]*[A-Z])(?=[A-Za-z0-9]*[a-z])(?=[A-Za-z0-9]*\d)[A-Za-z0-9]{20,}\b/g;
84489
+ STRING = String.raw`(?:"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*')`;
84490
+ NUMBER = String.raw`-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?`;
84491
+ PAIR2 = new RegExp(
84492
+ String.raw`((?:"([\w-]+)"|\b([\w-]+))\s*:\s*)(${STRING}|${NUMBER}\b|\[\s*${STRING}(?:\s*,\s*${STRING})*\s*\])`,
84493
+ "g"
84494
+ );
84495
+ STRING_TOKEN = new RegExp(STRING, "g");
84496
+ QUERY_PAIR = /([?&;]([\w.%-]+)=)([^&#\s"'\\]+)/g;
84497
+ HEADER_LINE = /^(\s*([\w-]+)\s*:\s+)(\S.*)$/gm;
84498
+ MASKED = /^<redacted:[0-9a-f]{4}>$/;
84499
+ utf8 = new TextDecoder("utf-8", { fatal: true });
84500
+ }
84501
+ });
84502
+
84311
84503
  // cli/bridge-diagnostics.ts
84312
84504
  function formatRequestMessage(entry) {
84313
84505
  const target = entry.displayUrl || entry.url;
84314
84506
  if (entry.status != null) {
84315
- return `${entry.method} ${target} -> ${entry.status}${entry.statusText ? ` ${entry.statusText}` : ""}`;
84507
+ return redactConfigurationForDiagnostics(
84508
+ `${entry.method} ${target} -> ${entry.status}${entry.statusText ? ` ${entry.statusText}` : ""}`
84509
+ );
84316
84510
  }
84317
84511
  if (entry.error) {
84318
- return `${entry.method} ${target} -> ${entry.error}`;
84512
+ return redactConfigurationForDiagnostics(`${entry.method} ${target} -> ${entry.error}`);
84319
84513
  }
84320
- return `${entry.method} ${target}`;
84514
+ return redactConfigurationForDiagnostics(`${entry.method} ${target}`);
84321
84515
  }
84322
84516
  async function callTestBridge(bridge, method, ...args) {
84323
84517
  return bridge.send({
@@ -84355,7 +84549,7 @@ async function printBridgeConsoleSummary(bridge, opts = {}) {
84355
84549
  const msg = Array.isArray(entry.args) ? entry.args.map(
84356
84550
  (value) => typeof value === "object" ? JSON.stringify(value) : String(value)
84357
84551
  ).join(" ") : String(entry);
84358
- console.log(` [${time}] ${msg}`);
84552
+ console.log(` [${time}] ${redactConfigurationForDiagnostics(msg)}`);
84359
84553
  }
84360
84554
  }
84361
84555
  async function printBridgeRequestSummary(bridge, opts = {}) {
@@ -84381,9 +84575,9 @@ async function printBridgeRequestSummary(bridge, opts = {}) {
84381
84575
  const time = formatLogTimestamp(entry.timestamp);
84382
84576
  console.log(` [${time}] ${formatRequestMessage(entry)}`);
84383
84577
  if (entry.responseBody) {
84384
- console.log(` ${entry.responseBody}`);
84578
+ console.log(` ${redactConfigurationForDiagnostics(entry.responseBody)}`);
84385
84579
  } else if (entry.error) {
84386
- console.log(` ${entry.error}`);
84580
+ console.log(` ${redactConfigurationForDiagnostics(entry.error)}`);
84387
84581
  }
84388
84582
  }
84389
84583
  }
@@ -84420,7 +84614,7 @@ async function printBridgeStateSummary(bridge) {
84420
84614
  if (!state || typeof state !== "object") return;
84421
84615
  console.log("\n state:");
84422
84616
  if (state.simId) console.log(` sim: ${state.simId}`);
84423
- if (state.url) console.log(` url: ${state.url}`);
84617
+ if (state.url) console.log(` url: ${redactConfigurationForDiagnostics(state.url)}`);
84424
84618
  if (state.mode) console.log(` mode: ${state.mode}`);
84425
84619
  const nodeCount = Number(state.nodeCount) || 0;
84426
84620
  console.log(` nodes: ${nodeCount}${nodeCount > 10 ? " (ready)" : " (not ready)"}`);
@@ -84467,6 +84661,7 @@ var init_bridge_diagnostics = __esm({
84467
84661
  "use strict";
84468
84662
  init_core();
84469
84663
  init_shared();
84664
+ init_output_redaction();
84470
84665
  }
84471
84666
  });
84472
84667
 
@@ -84680,7 +84875,7 @@ function macDesktopLaunchHome(bridgePort) {
84680
84875
  const dev = readDevBridgeLockfiles().find(
84681
84876
  (lock) => lock.bridgePort === bridgePort && isDevBridgeLockfileFresh(lock)
84682
84877
  );
84683
- const homeKey = (0, import_node_crypto31.createHash)("sha256").update(home).digest("hex");
84878
+ const homeKey = (0, import_node_crypto32.createHash)("sha256").update(home).digest("hex");
84684
84879
  const dir = (0, import_path7.join)((0, import_os3.tmpdir)(), "peach-desktop-launch", homeKey, String(bridgePort));
84685
84880
  (0, import_fs8.mkdirSync)(dir, { recursive: true });
84686
84881
  if ((0, import_fs8.existsSync)(home)) {
@@ -84783,13 +84978,13 @@ function buildMacLaunchUrl(url, opts, nativeApp = false) {
84783
84978
  }
84784
84979
  return deepLink.toString();
84785
84980
  }
84786
- var import_child_process5, import_fs8, import_node_crypto31, import_os3, import_path7, import_url2, import_meta2, _sootsimRoot;
84981
+ var import_child_process5, import_fs8, import_node_crypto32, import_os3, import_path7, import_url2, import_meta2, _sootsimRoot;
84787
84982
  var init_desktop_companion = __esm({
84788
84983
  "cli/desktop-companion.ts"() {
84789
84984
  "use strict";
84790
84985
  import_child_process5 = require("child_process");
84791
84986
  import_fs8 = require("fs");
84792
- import_node_crypto31 = require("node:crypto");
84987
+ import_node_crypto32 = require("node:crypto");
84793
84988
  import_os3 = require("os");
84794
84989
  import_path7 = require("path");
84795
84990
  import_url2 = require("url");
@@ -86582,102 +86777,6 @@ var init_open_url2 = __esm({
86582
86777
  }
86583
86778
  });
86584
86779
 
86585
- // cli/output-redaction.ts
86586
- function mask(value) {
86587
- if (MASKED.test(value)) return value;
86588
- return `<redacted:${(0, import_node_crypto32.createHash)("sha256").update(value).digest("hex").slice(0, 4)}>`;
86589
- }
86590
- function maskQuoted(quoted) {
86591
- return `${quoted[0]}${mask(quoted.slice(1, -1))}${quoted[0]}`;
86592
- }
86593
- function redactString(quoted, configurationOnly) {
86594
- if (quoted.startsWith("'")) {
86595
- const inner = quoted.slice(1, -1);
86596
- const redacted2 = redactText(inner, configurationOnly);
86597
- return redacted2 === inner ? quoted : `'${redacted2}'`;
86598
- }
86599
- let decoded;
86600
- try {
86601
- decoded = JSON.parse(quoted);
86602
- } catch {
86603
- decoded = quoted.slice(1, -1).replace(/\\(["\\/])/g, "$1");
86604
- }
86605
- const redacted = redactText(decoded, configurationOnly);
86606
- return redacted === decoded ? quoted : JSON.stringify(redacted);
86607
- }
86608
- function decodeOrSelf(value) {
86609
- try {
86610
- return decodeURIComponent(value);
86611
- } catch {
86612
- return value;
86613
- }
86614
- }
86615
- function redactPair(pair, prefix, quotedName, bareName, value, configurationOnly) {
86616
- const name3 = quotedName ?? bareName;
86617
- if (name3 === PEACH_CONFIG_QUERY_PARAM) return `${prefix}"[redacted]"`;
86618
- if (configurationOnly || !SECRET_NAME.test(name3)) {
86619
- if (!/^["'[]/.test(value)) return pair;
86620
- const inner = value.startsWith("[") ? value.replace(STRING_TOKEN, (quoted) => redactString(quoted, configurationOnly)) : redactString(value, configurationOnly);
86621
- return inner === value ? pair : `${prefix}${inner}`;
86622
- }
86623
- if (value.startsWith("[")) return `${prefix}${value.replace(STRING_TOKEN, maskQuoted)}`;
86624
- return `${prefix}${/^["']/.test(value) ? maskQuoted(value) : `"${mask(value)}"`}`;
86625
- }
86626
- function redactConfigurationForDiagnostics(text5) {
86627
- return redactText(text5, true);
86628
- }
86629
- function redactForSharing(text5) {
86630
- return redactText(text5, false);
86631
- }
86632
- function redactText(text5, configurationOnly) {
86633
- if (!configurationOnly) {
86634
- text5 = text5.replace(JWT, mask).replace(GOOGLE_API_KEY, mask).replace(BEARER, (match, scheme) => `${scheme} ${mask(match)}`);
86635
- }
86636
- const redacted = text5.replace(
86637
- PAIR2,
86638
- (pair, prefix, quotedName, bareName, value) => redactPair(pair, prefix, quotedName, bareName, value, configurationOnly)
86639
- ).replace(QUERY_PAIR, (pair, prefix, name3, value) => {
86640
- const decodedName = decodeOrSelf(name3);
86641
- if (decodedName === PEACH_CONFIG_QUERY_PARAM) return `${prefix}%5Bredacted%5D`;
86642
- if (!configurationOnly && SECRET_NAME.test(decodedName))
86643
- return `${prefix}${mask(value)}`;
86644
- if (!/%[0-9a-f]{2}/i.test(value)) return pair;
86645
- const decoded = decodeOrSelf(value);
86646
- const redacted2 = redactText(decoded, configurationOnly);
86647
- return redacted2 === decoded ? pair : `${prefix}${encodeURIComponent(redacted2)}`;
86648
- });
86649
- if (configurationOnly) return redacted;
86650
- return redacted.replace(
86651
- HEADER_LINE,
86652
- (line, prefix, name3, value) => SECRET_NAME.test(name3) ? `${prefix}${mask(value)}` : line
86653
- ).replace(EMAIL, mask).replace(OPAQUE_ID, mask);
86654
- }
86655
- var import_node_crypto32, SECRET_NAME, JWT, GOOGLE_API_KEY, BEARER, EMAIL, OPAQUE_ID, STRING, NUMBER, PAIR2, STRING_TOKEN, QUERY_PAIR, HEADER_LINE, MASKED, utf8;
86656
- var init_output_redaction = __esm({
86657
- "cli/output-redaction.ts"() {
86658
- "use strict";
86659
- import_node_crypto32 = require("node:crypto");
86660
- init_config();
86661
- SECRET_NAME = /^(?:[\w-]*(?:api[-_]?key|token|secret|password|passwd|authorization|cookie|signature|credential)s?|auth|sig|email|uid|[\w-]*(?:user|account|local|device|installation|client|app|project|sender|measurement|tenant)[-_]?id)$/i;
86662
- JWT = /\beyJ[\w-]{6,}\.[\w-]{6,}\.[\w-]{6,}/g;
86663
- GOOGLE_API_KEY = /\bAIza[\w-]{30,}/g;
86664
- BEARER = /\b(Bearer|Basic)\s+[\w.~+/=-]{8,}/gi;
86665
- EMAIL = /\b[\w.+-]+@[\w-]+(?:\.[\w-]+)+\b/g;
86666
- OPAQUE_ID = /\b(?=[A-Za-z0-9]*[A-Z])(?=[A-Za-z0-9]*[a-z])(?=[A-Za-z0-9]*\d)[A-Za-z0-9]{20,}\b/g;
86667
- STRING = String.raw`(?:"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*')`;
86668
- NUMBER = String.raw`-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?`;
86669
- PAIR2 = new RegExp(
86670
- String.raw`((?:"([\w-]+)"|\b([\w-]+))\s*:\s*)(${STRING}|${NUMBER}\b|\[\s*${STRING}(?:\s*,\s*${STRING})*\s*\])`,
86671
- "g"
86672
- );
86673
- STRING_TOKEN = new RegExp(STRING, "g");
86674
- QUERY_PAIR = /([?&;]([\w.%-]+)=)([^&#\s"'\\]+)/g;
86675
- HEADER_LINE = /^(\s*([\w-]+)\s*:\s+)(\S.*)$/gm;
86676
- MASKED = /^<redacted:[0-9a-f]{4}>$/;
86677
- utf8 = new TextDecoder("utf-8", { fatal: true });
86678
- }
86679
- });
86680
-
86681
86780
  // cli/command-registry.ts
86682
86781
  var NODE_COMMAND_NAMES, BROWSER_FAMILIES, registrations, RNX_COMMAND_NAMES, RNX_NODE_COMMAND_NAMES;
86683
86782
  var init_command_registry = __esm({