peachsim 0.1.2408 → 0.1.2409

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 (92) hide show
  1. package/cli/cloud-client.ts +8 -3
  2. package/cli/command-agent.ts +122 -0
  3. package/cli/ws-bridge.ts +4 -1
  4. package/dist-lib/agent-daemon-client.cjs +1 -1
  5. package/dist-lib/agent-events.cjs +1 -1
  6. package/dist-lib/attached-projects.cjs +1 -1
  7. package/dist-lib/auth/shared-session.cjs +1 -1
  8. package/dist-lib/backend-origin.cjs +1 -1
  9. package/dist-lib/beta.cjs +1 -1
  10. package/dist-lib/beta.mjs +1 -1
  11. package/dist-lib/bridge-constants.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.mjs +1 -1
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +1 -1
  16. package/dist-lib/bundle-channel.cjs +9 -7
  17. package/dist-lib/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +1 -1
  19. package/dist-lib/cloud-contract.cjs +20 -1
  20. package/dist-lib/cloud-contract.mjs +18 -1
  21. package/dist-lib/cloud-test-args.cjs +1 -1
  22. package/dist-lib/cloud-test-args.mjs +1 -1
  23. package/dist-lib/cloud.cjs +1 -1
  24. package/dist-lib/cloud.mjs +1 -1
  25. package/dist-lib/config.cjs +1 -1
  26. package/dist-lib/config.mjs +1 -1
  27. package/dist-lib/detox/index.cjs +1630 -1513
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/expo-swift-bundle.cjs +7 -5
  30. package/dist-lib/expo-swift-metadata.cjs +1 -1
  31. package/dist-lib/expo-swift-metadata.mjs +1 -1
  32. package/dist-lib/home-paths.cjs +1 -1
  33. package/dist-lib/host/bridge-host.cjs +43 -7
  34. package/dist-lib/host/fetch-proxy-handler.cjs +4 -4
  35. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  37. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  38. package/dist-lib/host/websocket-proxy.cjs +1 -1
  39. package/dist-lib/index.cjs +391 -271
  40. package/dist-lib/jump-to-source-babel.cjs +1 -1
  41. package/dist-lib/jump-to-source-native.cjs +1 -1
  42. package/dist-lib/kotlin-host.cjs +1 -1
  43. package/dist-lib/menu.cjs +1 -1
  44. package/dist-lib/menu.mjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  47. package/dist-lib/metro-production-bundle.cjs +1 -1
  48. package/dist-lib/metro-production-bundle.mjs +1 -1
  49. package/dist-lib/metro.cjs +4 -4
  50. package/dist-lib/native-app-identity-project.cjs +2 -2
  51. package/dist-lib/native-app-identity-project.mjs +2 -2
  52. package/dist-lib/native-app-identity.cjs +1 -1
  53. package/dist-lib/native-app-identity.mjs +1 -1
  54. package/dist-lib/native-firebase-metadata.cjs +1 -1
  55. package/dist-lib/native-firebase-metadata.mjs +1 -1
  56. package/dist-lib/pdfium-raster.cjs +1 -1
  57. package/dist-lib/pdfium-raster.mjs +1 -1
  58. package/dist-lib/plist.cjs +1 -1
  59. package/dist-lib/plist.mjs +1 -1
  60. package/dist-lib/profiles.cjs +1 -1
  61. package/dist-lib/public-brand.cjs +1 -1
  62. package/dist-lib/public-origins-lib-esm.json +24 -24
  63. package/dist-lib/public-origins-lib.json +67 -58
  64. package/dist-lib/react-native-host-modules.cjs +1 -1
  65. package/dist-lib/react-native-host-modules.mjs +1 -1
  66. package/dist-lib/reap-browser.cjs +1 -1
  67. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  68. package/dist-lib/sdk.cjs +1 -1
  69. package/dist-lib/sdk.mjs +1 -1
  70. package/dist-lib/skills.cjs +837 -720
  71. package/dist-lib/swift-compile.cjs +4 -3
  72. package/dist-lib/swift-compile.mjs +4 -3
  73. package/dist-lib/swift-package.cjs +1 -1
  74. package/dist-lib/swift-package.mjs +1 -1
  75. package/dist-lib/swift-submit.cjs +1 -1
  76. package/dist-lib/swift-submit.mjs +1 -1
  77. package/dist-lib/swift-toolchain.cjs +1 -1
  78. package/dist-lib/swift.cjs +1 -1
  79. package/dist-lib/vite-swift.cjs +18 -4
  80. package/dist-lib/vite.cjs +4 -4
  81. package/dist-lib/worklet-executable.cjs +1 -1
  82. package/dist-lib/worklet-executable.mjs +1 -1
  83. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
  84. package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
  85. package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +7 -0
  86. package/kotlin/sdk.tar.gz +0 -0
  87. package/package.json +1 -1
  88. package/runtime-companion.json +1 -1
  89. package/src/bridge-contract.ts +4 -0
  90. package/src/cloud-contract.ts +30 -0
  91. package/src/swift-packages.ts +1 -0
  92. package/src/swift-shared-sdk.ts +2 -1
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2408 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2409 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
@@ -30376,12 +30376,12 @@ function runtimeVersionHostname(version2) {
30376
30376
  if (!labels) throw new Error(`invalid Peach runtime version: ${version2}`);
30377
30377
  return `${labels.join(".")}${RUNTIME_VERSION_HOSTNAME_SUFFIX}`;
30378
30378
  }
30379
- function isRuntimeVersionHostname(hostname) {
30380
- return hostname.toLowerCase().endsWith(RUNTIME_VERSION_HOSTNAME_SUFFIX);
30379
+ function isRuntimeVersionHostname(hostname2) {
30380
+ return hostname2.toLowerCase().endsWith(RUNTIME_VERSION_HOSTNAME_SUFFIX);
30381
30381
  }
30382
- function runtimeVersionFromHostname(hostname) {
30383
- if (!isRuntimeVersionHostname(hostname)) return null;
30384
- const labels = hostname.slice(0, -RUNTIME_VERSION_HOSTNAME_SUFFIX.length).split(".");
30382
+ function runtimeVersionFromHostname(hostname2) {
30383
+ if (!isRuntimeVersionHostname(hostname2)) return null;
30384
+ const labels = hostname2.slice(0, -RUNTIME_VERSION_HOSTNAME_SUFFIX.length).split(".");
30385
30385
  if (labels.length === 0 || labels.some((label) => !/^[0-9a-f]{1,60}$/i.test(label))) {
30386
30386
  return null;
30387
30387
  }
@@ -30399,9 +30399,9 @@ function resolveInstalledRuntimeRoot(version2) {
30399
30399
  if (!import_fs.default.existsSync(import_path.default.join(dir, "index.html"))) return null;
30400
30400
  return dir;
30401
30401
  }
30402
- function resolveRuntimeRootForHostname(hostname) {
30403
- if (!isRuntimeVersionHostname(hostname)) return resolveActiveRuntimeRoot();
30404
- const version2 = runtimeVersionFromHostname(hostname);
30402
+ function resolveRuntimeRootForHostname(hostname2) {
30403
+ if (!isRuntimeVersionHostname(hostname2)) return resolveActiveRuntimeRoot();
30404
+ const version2 = runtimeVersionFromHostname(hostname2);
30405
30405
  return version2 ? resolveInstalledRuntimeRoot(version2) : null;
30406
30406
  }
30407
30407
  function sendFileWithRanges(req, res, filePath, total, headers) {
@@ -31115,8 +31115,8 @@ function swiftNativeTargetsRefusal(value) {
31115
31115
  const products = field2("productHeaders");
31116
31116
  const inputPath = (value2) => typeof value2 === "string" && value2.startsWith(`${SWIFT_NATIVE_INPUT_ROOT}/`) && isSwiftResourcePath(value2.slice(SWIFT_NATIVE_INPUT_ROOT.length + 1));
31117
31117
  const deployment = field2("deploymentTarget");
31118
- const targetName = field2("name");
31119
- if (typeof targetName !== "string" || targetName.length === 0 || targetName.length > 4096 || targetName.includes("\0") || targetName.includes("/") || targetName.includes("\\") || targetName === "." || targetName === "..")
31118
+ const targetName2 = field2("name");
31119
+ if (typeof targetName2 !== "string" || targetName2.length === 0 || targetName2.length > 4096 || targetName2.includes("\0") || targetName2.includes("/") || targetName2.includes("\\") || targetName2 === "." || targetName2 === "..")
31120
31120
  return at("name");
31121
31121
  if (!(deployment === null || typeof deployment === "string" && /^\d+(?:\.\d+){0,2}$/.test(deployment)))
31122
31122
  return at("deploymentTarget");
@@ -33722,8 +33722,8 @@ function collectNitroSources(options, nativeSourceKeys, sourceRoot) {
33722
33722
  }
33723
33723
  return deps;
33724
33724
  };
33725
- const admitTextualIncludes = (root, targetName, targetObj, searchRoots) => {
33726
- const prefix = `${targetPath(targetName)}/upstream/`;
33725
+ const admitTextualIncludes = (root, targetName2, targetObj, searchRoots) => {
33726
+ const prefix = `${targetPath(targetName2)}/upstream/`;
33727
33727
  const queue2 = Object.keys(result.files).filter((key2) => key2.startsWith(prefix));
33728
33728
  const scanned = /* @__PURE__ */ new Set();
33729
33729
  const excludes = new Set(targetObj.exclude ?? []);
@@ -33782,22 +33782,22 @@ function collectNitroSources(options, nativeSourceKeys, sourceRoot) {
33782
33782
  for (const node of allModules) {
33783
33783
  const module2 = node.provider;
33784
33784
  const config = node.config;
33785
- const targetName = nitroProviderTarget(module2);
33786
- const targetObj = nodeTargets.get(targetName);
33785
+ const targetName2 = nitroProviderTarget(module2);
33786
+ const targetObj = nodeTargets.get(targetName2);
33787
33787
  const podName = node.podspec.podName ?? config.swiftModule ?? module2.name;
33788
33788
  const searchRoots = node.podspec.headerSearchPaths;
33789
33789
  for (const dir of searchRoots) searchRootDirs.add(dir);
33790
- const implementationHeaders = import_node_fs21.default.existsSync(import_node_path17.default.join(module2.root, "cpp")) ? collect(module2.root, "cpp", targetName, podName) : /* @__PURE__ */ new Map();
33790
+ const implementationHeaders = import_node_fs21.default.existsSync(import_node_path17.default.join(module2.root, "cpp")) ? collect(module2.root, "cpp", targetName2, podName) : /* @__PURE__ */ new Map();
33791
33791
  for (const dir of searchRoots.filter(
33792
33792
  (dir2) => dir2 !== "cpp" && !dir2.startsWith("cpp/") && dir2 !== "ios" && !dir2.startsWith("ios/") && !searchRoots.some((other) => other !== dir2 && dir2.startsWith(`${other}/`))
33793
33793
  )) {
33794
- collect(module2.root, dir, targetName, podName);
33794
+ collect(module2.root, dir, targetName2, podName);
33795
33795
  }
33796
33796
  if (import_node_fs21.default.existsSync(import_node_path17.default.join(module2.root, "ios"))) {
33797
33797
  const iosCollected = collect(
33798
33798
  module2.root,
33799
33799
  "ios",
33800
- targetName,
33800
+ targetName2,
33801
33801
  podName,
33802
33802
  /* @__PURE__ */ new Set(["Tests"]),
33803
33803
  () => true,
@@ -33805,24 +33805,24 @@ function collectNitroSources(options, nativeSourceKeys, sourceRoot) {
33805
33805
  );
33806
33806
  if (config.swiftModule) {
33807
33807
  const objcHeaders = [...iosCollected.entries()].filter(
33808
- ([name3, original]) => name3.endsWith(".h") && Object.hasOwn(result.files, `${targetPath(targetName)}/include/${name3}`) && /(?:@(?:interface|protocol)\b|\b(?:NS_(?:ENUM|OPTIONS)|FOUNDATION_EXPORT)\b)/.test(
33808
+ ([name3, original]) => name3.endsWith(".h") && Object.hasOwn(result.files, `${targetPath(targetName2)}/include/${name3}`) && /(?:@(?:interface|protocol)\b|\b(?:NS_(?:ENUM|OPTIONS)|FOUNDATION_EXPORT)\b)/.test(
33809
33809
  result.files[original] ?? ""
33810
33810
  )
33811
33811
  ).map(([name3]) => name3);
33812
- if (objcHeaders.length > 0) iosObjcHeadersByTarget.set(targetName, objcHeaders);
33812
+ if (objcHeaders.length > 0) iosObjcHeadersByTarget.set(targetName2, objcHeaders);
33813
33813
  }
33814
33814
  }
33815
- admitTextualIncludes(module2.root, targetName, targetObj, searchRoots);
33815
+ admitTextualIncludes(module2.root, targetName2, targetObj, searchRoots);
33816
33816
  const viewsDir = import_node_path17.default.join(module2.root, "nitrogen/generated/shared/c++/views");
33817
33817
  const viewHeaders = import_node_fs21.default.existsSync(viewsDir) ? import_node_fs21.default.readdirSync(viewsDir).filter((file) => /\.(?:h|hh|hpp|hxx)$/.test(file)) : [];
33818
- const upstreamPrefix = `${targetPath(targetName)}/upstream/`;
33818
+ const upstreamPrefix = `${targetPath(targetName2)}/upstream/`;
33819
33819
  const needsViews = viewHeaders.length > 0 && Object.entries(result.files).some(
33820
33820
  ([key2, text6]) => (key2.startsWith(`${upstreamPrefix}cpp/`) || key2.startsWith(`${upstreamPrefix}ios/`)) && viewHeaders.some((header) => text6.includes(header))
33821
33821
  );
33822
33822
  collect(
33823
33823
  module2.root,
33824
33824
  "nitrogen/generated/shared/c++",
33825
- targetName,
33825
+ targetName2,
33826
33826
  podName,
33827
33827
  needsViews ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set(["views"])
33828
33828
  );
@@ -33833,7 +33833,7 @@ function collectNitroSources(options, nativeSourceKeys, sourceRoot) {
33833
33833
  `${module2.root}: missing C++ implementation header ${entry.implementation}.hpp`
33834
33834
  );
33835
33835
  }
33836
- collect(module2.root, "nitrogen/generated/ios", targetName, podName);
33836
+ collect(module2.root, "nitrogen/generated/ios", targetName2, podName);
33837
33837
  if (config.swiftModule) {
33838
33838
  const companionDeps = collectCompanionPods(node);
33839
33839
  const peerModuleDeps = node.peerRoots.flatMap((peerRoot) => {
@@ -33844,7 +33844,7 @@ function collectNitroSources(options, nativeSourceKeys, sourceRoot) {
33844
33844
  ];
33845
33845
  });
33846
33846
  const packageSwift = target(config.swiftModule, [
33847
- targetName,
33847
+ targetName2,
33848
33848
  "NitroModules",
33849
33849
  .../* @__PURE__ */ new Set([...peerModuleDeps, ...companionDeps])
33850
33850
  ]);
@@ -33870,7 +33870,7 @@ function collectNitroSources(options, nativeSourceKeys, sourceRoot) {
33870
33870
  );
33871
33871
  add2(
33872
33872
  `${targetPath(config.swiftModule)}/PeachNitroExports.swift`,
33873
- `@_exported import ${targetName}
33873
+ `@_exported import ${targetName2}
33874
33874
  `
33875
33875
  );
33876
33876
  }
@@ -33878,21 +33878,21 @@ function collectNitroSources(options, nativeSourceKeys, sourceRoot) {
33878
33878
  const dependencyHeader = nitroDependencyReader(reactNative.version, reactNative.root);
33879
33879
  const admitted = /* @__PURE__ */ new Set();
33880
33880
  const dependencyTrees = /* @__PURE__ */ new Set();
33881
- const scan3 = (targetName, text6, includer) => {
33881
+ const scan3 = (targetName2, text6, includer) => {
33882
33882
  for (const [, quote, name3] of text6.matchAll(
33883
33883
  /^\s*#\s*include\s*([<"])([^>"\n]+)[>"]/gm
33884
33884
  )) {
33885
33885
  const relative6 = quote === '"' && includer ? [import_node_path17.default.posix.normalize(import_node_path17.default.posix.join(import_node_path17.default.posix.dirname(includer), name3))] : [];
33886
- for (const include of [...relative6, name3]) if (admit(targetName, include)) break;
33886
+ for (const include of [...relative6, name3]) if (admit(targetName2, include)) break;
33887
33887
  }
33888
33888
  };
33889
- const admit = (targetName, include) => {
33890
- const key2 = `${targetName}\0${include}`;
33889
+ const admit = (targetName2, include) => {
33890
+ const key2 = `${targetName2}\0${include}`;
33891
33891
  if (admitted.has(key2)) return true;
33892
33892
  const header = dependencyHeader(include);
33893
33893
  if (!header) return false;
33894
33894
  admitted.add(key2);
33895
- const original = `${targetPath(targetName)}/include/${include}`;
33895
+ const original = `${targetPath(targetName2)}/include/${include}`;
33896
33896
  add2(original, header.text);
33897
33897
  result.sources.push({
33898
33898
  file: original,
@@ -33900,8 +33900,8 @@ function collectNitroSources(options, nativeSourceKeys, sourceRoot) {
33900
33900
  sha256: header.sha256,
33901
33901
  ...header.derivation && { derivation: header.derivation }
33902
33902
  });
33903
- scan3(targetName, header.text, include);
33904
- const tree2 = `${targetName}\0${header.name}`;
33903
+ scan3(targetName2, header.text, include);
33904
+ const tree2 = `${targetName2}\0${header.name}`;
33905
33905
  if (!dependencyTrees.has(tree2)) {
33906
33906
  dependencyTrees.add(tree2);
33907
33907
  for (const name3 of nitroDependencyIncludes(
@@ -33909,15 +33909,15 @@ function collectNitroSources(options, nativeSourceKeys, sourceRoot) {
33909
33909
  reactNative.root,
33910
33910
  header.name
33911
33911
  ))
33912
- admit(targetName, name3);
33912
+ admit(targetName2, name3);
33913
33913
  }
33914
33914
  return true;
33915
33915
  };
33916
33916
  for (const node of allModules) {
33917
- const targetName = nitroProviderTarget(node.provider);
33917
+ const targetName2 = nitroProviderTarget(node.provider);
33918
33918
  for (const [file, text6] of Object.entries(result.files))
33919
- if (file.startsWith(`${targetPath(targetName)}/upstream/`))
33920
- scan3(targetName, text6, null);
33919
+ if (file.startsWith(`${targetPath(targetName2)}/upstream/`))
33920
+ scan3(targetName2, text6, null);
33921
33921
  }
33922
33922
  add2(
33923
33923
  `${targetPath(jsiTarget)}/include/module.modulemap`,
@@ -34030,11 +34030,11 @@ function collectNitroSources(options, nativeSourceKeys, sourceRoot) {
34030
34030
  for (const node of allModules) {
34031
34031
  const module2 = node.provider;
34032
34032
  const config = node.config;
34033
- const targetName = nitroProviderTarget(module2);
34034
- const iosObjcHeaders = iosObjcHeadersByTarget.get(targetName) ?? [];
34033
+ const targetName2 = nitroProviderTarget(module2);
34034
+ const iosObjcHeaders = iosObjcHeadersByTarget.get(targetName2) ?? [];
34035
34035
  if (iosObjcHeaders.length > 0) {
34036
34036
  add2(
34037
- `${targetPath(targetName)}/include/PeachPodObjCUmbrella.h`,
34037
+ `${targetPath(targetName2)}/include/PeachPodObjCUmbrella.h`,
34038
34038
  [
34039
34039
  "#pragma once",
34040
34040
  "#ifdef __OBJC__",
@@ -34052,8 +34052,8 @@ function collectNitroSources(options, nativeSourceKeys, sourceRoot) {
34052
34052
  ...iosObjcHeaders.length > 0 ? ['header "PeachPodObjCUmbrella.h"'] : []
34053
34053
  ];
34054
34054
  add2(
34055
- `${targetPath(targetName)}/include/module.modulemap`,
34056
- `module ${targetName} { ${modulemapHeaders.length > 0 ? `${modulemapHeaders.join(" ")} ` : ""}export * }
34055
+ `${targetPath(targetName2)}/include/module.modulemap`,
34056
+ `module ${targetName2} { ${modulemapHeaders.length > 0 ? `${modulemapHeaders.join(" ")} ` : ""}export * }
34057
34057
  `
34058
34058
  );
34059
34059
  if (!node.registered) continue;
@@ -34066,7 +34066,7 @@ function collectNitroSources(options, nativeSourceKeys, sourceRoot) {
34066
34066
  extern "C" void ${registration.symbol}();
34067
34067
  `);
34068
34068
  add2(
34069
- `${targetPath(targetName)}/PeachNitroRegistration.cpp`,
34069
+ `${targetPath(targetName2)}/PeachNitroRegistration.cpp`,
34070
34070
  [
34071
34071
  '#include "PeachNitroRegistration.hpp"',
34072
34072
  "#include <NitroModules/HybridObjectRegistry.hpp>",
@@ -36464,24 +36464,24 @@ var init_app_config = __esm({
36464
36464
  });
36465
36465
 
36466
36466
  // src/backend-origin.ts
36467
- function normalizeHostname(hostname) {
36468
- return hostname.replace(/^\[|\]$/g, "").toLowerCase();
36467
+ function normalizeHostname(hostname2) {
36468
+ return hostname2.replace(/^\[|\]$/g, "").toLowerCase();
36469
36469
  }
36470
- function buildLoopbackProbeBaseUrl(protocol, hostname, port) {
36471
- const normalizedHostname = normalizeHostname(hostname);
36470
+ function buildLoopbackProbeBaseUrl(protocol, hostname2, port) {
36471
+ const normalizedHostname = normalizeHostname(hostname2);
36472
36472
  const urlHost = normalizedHostname.includes(":") ? `[${normalizedHostname}]` : normalizedHostname;
36473
36473
  return `${protocol}//${urlHost}:${port}`;
36474
36474
  }
36475
- function isLoopbackHost(hostname) {
36476
- const normalized = normalizeHostname(hostname);
36475
+ function isLoopbackHost(hostname2) {
36476
+ const normalized = normalizeHostname(hostname2);
36477
36477
  return normalized === "localhost" || normalized.endsWith(".localhost") || normalized === "0.0.0.0" || normalized === "::1" || /^127(?:\.\d{1,3}){3}$/.test(normalized);
36478
36478
  }
36479
36479
  function isTrustedBridgeRequest(headers) {
36480
36480
  const origin = headers.origin;
36481
36481
  if (origin === void 0) return true;
36482
36482
  try {
36483
- const { hostname, host: host2 } = new NativeURL(String(origin));
36484
- return isLoopbackHost(hostname) || [headers.host, headers[":authority"], headers["x-forwarded-host"]].some(
36483
+ const { hostname: hostname2, host: host2 } = new NativeURL(String(origin));
36484
+ return isLoopbackHost(hostname2) || [headers.host, headers[":authority"], headers["x-forwarded-host"]].some(
36485
36485
  (value) => typeof value === "string" && value.toLowerCase() === host2
36486
36486
  );
36487
36487
  } catch {
@@ -36500,8 +36500,8 @@ function buildBrowserAssetProxyUrl(targetUrl) {
36500
36500
  const proxyPath = isLoopbackHost(new NativeURL(targetUrl).hostname) ? "/__bundle-proxy" : "/__fetch-proxy";
36501
36501
  return `${proxyPath}?url=${encodeURIComponent(targetUrl)}`;
36502
36502
  }
36503
- function isContrastBackendHost(hostname) {
36504
- const normalized = normalizeHostname(hostname);
36503
+ function isContrastBackendHost(hostname2) {
36504
+ const normalized = normalizeHostname(hostname2);
36505
36505
  return isLoopbackHost(normalized) || normalized === "contrast.dev" || normalized.endsWith(".contrast.dev") || normalized === "peachsim.com" || normalized === "www.peachsim.com" || normalized === PEACHSIM_NATIVE_HOST;
36506
36506
  }
36507
36507
  function resolveContrastBackendOrigin(currentOrigin, search) {
@@ -37397,14 +37397,14 @@ function canonicalLabel(label, from) {
37397
37397
  const { repo, pkg } = splitLabel(from);
37398
37398
  return `${repo ? `@@${repo}` : ""}//${pkg}:${label.replace(/^:/, "")}`;
37399
37399
  }
37400
- function readBazelAppTarget(buildFile, targetName, configurationName, options = {}) {
37401
- if (!targetName)
37400
+ function readBazelAppTarget(buildFile, targetName2, configurationName, options = {}) {
37401
+ if (!targetName2)
37402
37402
  throw new Error(
37403
37403
  `${buildFile}: pass --target with the ios_application the bazel package builds`
37404
37404
  );
37405
37405
  const root = import_node_fs31.default.realpathSync.native(workspaceRoot(import_node_fs31.default.realpathSync.native(buildFile)));
37406
37406
  const pkg = import_node_path27.default.relative(root, import_node_path27.default.dirname(import_node_fs31.default.realpathSync.native(buildFile)));
37407
- const label = `//${pkg.split(import_node_path27.default.sep).join("/")}:${targetName}`;
37407
+ const label = `//${pkg.split(import_node_path27.default.sep).join("/")}:${targetName2}`;
37408
37408
  const configuration = configurationName ?? "Debug";
37409
37409
  const graph = bazelGraph(root, label, configuration);
37410
37410
  const files2 = new BazelFiles(graph, root);
@@ -37640,7 +37640,7 @@ ${published3.map(
37640
37640
  const appModule = {
37641
37641
  ...named,
37642
37642
  id: idOf(graph.app),
37643
- name: targetName,
37643
+ name: targetName2,
37644
37644
  targetIdentity: graph.app.label,
37645
37645
  targetDependencies: [
37646
37646
  ...new Set(appParts.flatMap(({ module: module2 }) => module2.targetDependencies))
@@ -37929,7 +37929,7 @@ ${published3.map(
37929
37929
  {
37930
37930
  id: appModule.id,
37931
37931
  sourceTarget: appModule.moduleName,
37932
- productName: `${targetName}.app`,
37932
+ productName: `${targetName2}.app`,
37933
37933
  productType: "com.apple.product-type.application",
37934
37934
  installName: null,
37935
37935
  buildVersion: { platform: "iphonesimulator", minimumOS, sdk: null },
@@ -37973,7 +37973,7 @@ ${published3.map(
37973
37973
  binaryFrameworks,
37974
37974
  sdkFrameworks,
37975
37975
  packageResolved: [],
37976
- appTargets: [targetName],
37976
+ appTargets: [targetName2],
37977
37977
  configuration,
37978
37978
  settings: (key2) => key2 === "PRODUCT_MODULE_NAME" ? appModule.moduleName : key2 === "IPHONEOS_DEPLOYMENT_TARGET" ? minimumOS : key2 === "PRODUCT_BUNDLE_IDENTIFIER" ? graph.app.attrs.get("bundle_id")?.value ?? "" : "",
37979
37979
  cocoapods: null
@@ -39240,7 +39240,7 @@ function parseBuildSettings(block2) {
39240
39240
  }
39241
39241
  return settings;
39242
39242
  }
39243
- function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
39243
+ function appTargetReleaseSettings(pbxproj, targetName2, infoPlistRelativePath) {
39244
39244
  const configurationPattern = /\/\* (Release|Debug) \*\/ = \{/g;
39245
39245
  const candidates = [];
39246
39246
  let match;
@@ -39261,7 +39261,7 @@ function appTargetReleaseSettings(pbxproj, targetName, infoPlistRelativePath) {
39261
39261
  const normalized = plist6.replace(/^"|"$/g, "");
39262
39262
  return normalized === infoPlistRelativePath || infoPlistRelativePath.endsWith(`/${normalized}`) || normalized.endsWith(`/${infoPlistRelativePath}`);
39263
39263
  };
39264
- const named = (settings) => resolveBuildSetting(settings.PRODUCT_NAME ?? "", settings) === targetName;
39264
+ const named = (settings) => resolveBuildSetting(settings.PRODUCT_NAME ?? "", settings) === targetName2;
39265
39265
  return candidates.find(
39266
39266
  (candidate) => candidate.name === "Release" && plistMatch(candidate.settings)
39267
39267
  )?.settings ?? candidates.find(
@@ -39305,31 +39305,31 @@ function nativeAppIdentityFromIos(files2, parseInfoPlist, iosTarget, resourceUri
39305
39305
  applicationTargetNames.add(match[1]);
39306
39306
  }
39307
39307
  }
39308
- let targetName = null;
39308
+ let targetName2 = null;
39309
39309
  if (iosTarget) {
39310
39310
  if (applicationTargetNames.has(iosTarget)) {
39311
- targetName = iosTarget;
39311
+ targetName2 = iosTarget;
39312
39312
  } else {
39313
39313
  return null;
39314
39314
  }
39315
39315
  } else if (applicationTargetNames.size === 1) {
39316
- targetName = [...applicationTargetNames][0];
39316
+ targetName2 = [...applicationTargetNames][0];
39317
39317
  } else if (applicationTargetNames.size > 1) {
39318
39318
  const delegateTargets = Object.keys(files2).filter((path148) => !path148.includes("/Pods/")).map((path148) => path148.match(APP_DELEGATE_PATH_RE)?.[1]).filter(
39319
39319
  (name3) => typeof name3 === "string" && applicationTargetNames.has(name3)
39320
39320
  );
39321
39321
  if (delegateTargets.length === 1) {
39322
- targetName = delegateTargets[0];
39322
+ targetName2 = delegateTargets[0];
39323
39323
  } else {
39324
39324
  return null;
39325
39325
  }
39326
39326
  } else {
39327
39327
  return null;
39328
39328
  }
39329
- const selectedTarget = targets.find((t) => t.name === targetName);
39329
+ const selectedTarget = targets.find((t) => t.name === targetName2);
39330
39330
  const settings = {
39331
- TARGET_NAME: targetName,
39332
- PRODUCT_NAME: targetName
39331
+ TARGET_NAME: targetName2,
39332
+ PRODUCT_NAME: targetName2
39333
39333
  };
39334
39334
  for (const obj of Object.values(objects)) {
39335
39335
  if (isRecord(obj) && obj.isa === "PBXProject" && typeof obj.buildConfigurationList === "string") {
@@ -39365,8 +39365,8 @@ function nativeAppIdentityFromIos(files2, parseInfoPlist, iosTarget, resourceUri
39365
39365
  } else {
39366
39366
  const legacy2 = appTargetReleaseSettings(
39367
39367
  pbxproj,
39368
- targetName,
39369
- `${targetName}/Info.plist`
39368
+ targetName2,
39369
+ `${targetName2}/Info.plist`
39370
39370
  );
39371
39371
  if (legacy2) Object.assign(settings, legacy2);
39372
39372
  }
@@ -39377,7 +39377,7 @@ function nativeAppIdentityFromIos(files2, parseInfoPlist, iosTarget, resourceUri
39377
39377
  plist6 = files2[`ios/${normalized}`] ?? files2[normalized] ?? Object.entries(files2).find(([k]) => k.endsWith(`/${normalized}`))?.[1];
39378
39378
  }
39379
39379
  if (!plist6) {
39380
- plist6 = files2[`ios/${targetName}/Info.plist`] ?? files2[`${targetName}/Info.plist`] ?? Object.entries(files2).find(([k]) => k.endsWith(`/${targetName}/Info.plist`))?.[1];
39380
+ plist6 = files2[`ios/${targetName2}/Info.plist`] ?? files2[`${targetName2}/Info.plist`] ?? Object.entries(files2).find(([k]) => k.endsWith(`/${targetName2}/Info.plist`))?.[1];
39381
39381
  }
39382
39382
  if (!plist6) return null;
39383
39383
  const bundleIdentifier = identityFieldFrom(
@@ -39401,7 +39401,7 @@ function nativeAppIdentityFromIos(files2, parseInfoPlist, iosTarget, resourceUri
39401
39401
  settings,
39402
39402
  plistString(plist6, "CFBundleName"),
39403
39403
  settings.PRODUCT_NAME
39404
- ) ?? resolvedIdentityField(resolveBuildSetting(settings.PRODUCT_NAME ?? "", settings)) ?? resolvedIdentityField(targetName);
39404
+ ) ?? resolvedIdentityField(resolveBuildSetting(settings.PRODUCT_NAME ?? "", settings)) ?? resolvedIdentityField(targetName2);
39405
39405
  if (!bundleName) return null;
39406
39406
  const applicationName = identityFieldFrom(settings, plistString(plist6, "CFBundleDisplayName"), void 0) ?? bundleName;
39407
39407
  const dictionary2 = parseInfoPlist(plist6);
@@ -39567,7 +39567,7 @@ function nativeAppIdentityFromIos(files2, parseInfoPlist, iosTarget, resourceUri
39567
39567
  }
39568
39568
  const rootModuleName = readRootModuleName(
39569
39569
  Object.entries(files2).filter(
39570
- ([path148]) => !path148.includes("/Pods/") && (/(?:^|\/)(?:ios\/)?AppDelegate\.(?:swift|mm|m)$/.test(path148) || path148.match(APP_DELEGATE_PATH_RE)?.[1] === targetName)
39570
+ ([path148]) => !path148.includes("/Pods/") && (/(?:^|\/)(?:ios\/)?AppDelegate\.(?:swift|mm|m)$/.test(path148) || path148.match(APP_DELEGATE_PATH_RE)?.[1] === targetName2)
39571
39571
  ).map(([, source]) => source)
39572
39572
  );
39573
39573
  return {
@@ -49739,7 +49739,7 @@ function swiftSharedSdkViewOptions(moduleRoot, distribution, toolchainBin, sdk2)
49739
49739
  const overlayFiles = (0, import_node_fs44.readdirSync)(overlay, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => import_node_path41.default.join(entry.parentPath, entry.name)).sort();
49740
49740
  const key2 = JSON.stringify([
49741
49741
  // bump the recipe when the transformation changes; bundling changes function text.
49742
- "v24",
49742
+ "v25",
49743
49743
  [...WEAKEN_FOUNDATION_SYMS],
49744
49744
  toolchainBin,
49745
49745
  sdk2,
@@ -49799,6 +49799,7 @@ function swiftSharedSdkViewOptions(moduleRoot, distribution, toolchainBin, sdk2)
49799
49799
  "objc/NSObject.h",
49800
49800
  "ObjectiveC.apinotes",
49801
49801
  "net/if.h",
49802
+ "netinet/tcp.h",
49802
49803
  "notify.h",
49803
49804
  "notify.modulemap",
49804
49805
  "module.modulemap",
@@ -52280,9 +52281,9 @@ function pruneSwiftWasmLink(directory2, toolchainBin, moduleRoot, staticClangTar
52280
52281
  const sLive = liveSegs.get(obj);
52281
52282
  const dLive = liveDataSyms.get(obj);
52282
52283
  const tLive = liveTypes.get(obj);
52283
- const targetName = obj.symNames[r.rs] ?? "";
52284
+ const targetName2 = obj.symNames[r.rs] ?? "";
52284
52285
  if (segName === "swift5_type_metadata") {
52285
- const raw2 = targetName.startsWith(".Lgot.") ? targetName.slice(6) : targetName;
52286
+ const raw2 = targetName2.startsWith(".Lgot.") ? targetName2.slice(6) : targetName2;
52286
52287
  if (raw2.endsWith("Mn")) {
52287
52288
  const pref = raw2.slice(0, -2);
52288
52289
  if (obj.typePrefixesInObj.has(pref)) return tLive.has(pref);
@@ -63368,7 +63369,7 @@ int EXUpdatesApplyBSDiffPatch(const char * _Nonnull oldFilePath,
63368
63369
  REACTOR_FLAG = '"-Xclang-linker", "-mexec-model=reactor",\n';
63369
63370
  MULTI_MANIFEST_VERSION = 71;
63370
63371
  SWIFT_HEADER_PRODUCTS_TARGET = "PeachHeaderProducts";
63371
- compilerSourceDigest = true ? "36b1496faf39a688e5ab3ee63bdab89a3afde2b9c6355443c3162f4b1e3b9144" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
63372
+ compilerSourceDigest = true ? "d287f3ad479477c70004707c1336f37c9baeb81aef1880544a5ca236e088ca16" : swiftCompilerSourceDigest(__sootsim_import_meta_dirname);
63372
63373
  nativeCxxCompilerFlags = ["-fno-cxx-modules"];
63373
63374
  cFlagArray = (flags) => JSON.stringify(withoutGlogModuleMap(flags));
63374
63375
  cxxFlagArray = (flags) => JSON.stringify([...nativeCxxCompilerFlags, ...withoutGlogModuleMap(flags)]);
@@ -65324,10 +65325,10 @@ function readXcodeJsonProject(xcodeproj, source) {
65324
65325
  phases.set(`id:${phaseId}`, phaseId);
65325
65326
  }
65326
65327
  }
65327
- const phaseFiles = (reference, targetName) => {
65328
+ const phaseFiles = (reference, targetName2) => {
65328
65329
  const value = text5(reference);
65329
65330
  if (value === void 0) return null;
65330
- const key2 = value.startsWith("id:") || !targetName ? value : `${targetName}/${value}`;
65331
+ const key2 = value.startsWith("id:") || !targetName2 ? value : `${targetName2}/${value}`;
65331
65332
  const phase = objects[phases.get(key2) ?? ""];
65332
65333
  return phase && typeof phase === "object" && !Array.isArray(phase) && Array.isArray(phase.files) ? phase.files : null;
65333
65334
  };
@@ -65992,7 +65993,7 @@ function fileListEntries(file, absolute) {
65992
65993
  }
65993
65994
  function targetMembers(ref, settings, options, settingKeys, projectInputs) {
65994
65995
  const { project: project2, target, id: targetId } = ref;
65995
- const targetName = str(target.name) ?? targetId;
65996
+ const targetName2 = str(target.name) ?? targetId;
65996
65997
  const sources = /* @__PURE__ */ new Set();
65997
65998
  const allSources = /* @__PURE__ */ new Set();
65998
65999
  const headers = /* @__PURE__ */ new Set();
@@ -66065,7 +66066,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
66065
66066
  for (const { file } of lists)
66066
66067
  if (!import_node_fs64.default.existsSync(file))
66067
66068
  throw new Error(
66068
- `${targetName}: Run Script "${script}" missing file list ${file}`
66069
+ `${targetName2}: Run Script "${script}" missing file list ${file}`
66069
66070
  );
66070
66071
  const env = {
66071
66072
  ...process.env,
@@ -66161,7 +66162,7 @@ function targetMembers(ref, settings, options, settingKeys, projectInputs) {
66161
66162
  const output2 = error instanceof Error ? `${error.message}
66162
66163
  ${"stdout" in error ? String(error.stdout) : ""}${"stderr" in error ? String(error.stderr) : ""}` : String(error);
66163
66164
  throw new Error(
66164
- `${targetName}: Run Script "${script}" failed preparing generated outputs:
66165
+ `${targetName2}: Run Script "${script}" failed preparing generated outputs:
66165
66166
  ${output2}`
66166
66167
  );
66167
66168
  }
@@ -66170,7 +66171,7 @@ ${output2}`
66170
66171
  );
66171
66172
  if (missing2.length > 0)
66172
66173
  throw new Error(
66173
- `${targetName}: Run Script "${script}" did not produce ${missing2.join(", ")}`
66174
+ `${targetName2}: Run Script "${script}" did not produce ${missing2.join(", ")}`
66174
66175
  );
66175
66176
  preparedSourcePhases.set(key2, stamp);
66176
66177
  preparedXcodePhase(
@@ -66202,7 +66203,7 @@ ${output2}`
66202
66203
  if (options.requireSources === false) return;
66203
66204
  const script = scriptForOutput.get(import_node_path62.default.normalize(file));
66204
66205
  throw new Error(
66205
- script ? `${targetName}: missing generated source ${file} (Run Script "${script}" declares it in outputPaths; run the script or check in its output)` : `${targetName}: missing source ${file}`
66206
+ script ? `${targetName2}: missing generated source ${file} (Run Script "${script}" declares it in outputPaths; run the script or check in its output)` : `${targetName2}: missing source ${file}`
66206
66207
  );
66207
66208
  }
66208
66209
  allSources.add(file);
@@ -66225,7 +66226,7 @@ ${output2}`
66225
66226
  );
66226
66227
  if (runtimeInterfaceFiles.length > 0)
66227
66228
  throw new Error(
66228
- `${targetName}: Interface Builder compilation requires macOS and Xcode`
66229
+ `${targetName2}: Interface Builder compilation requires macOS and Xcode`
66229
66230
  );
66230
66231
  for (const file of interfaceFiles) resources.delete(file);
66231
66232
  interfaceFiles.length = 0;
@@ -66241,7 +66242,7 @@ ${output2}`
66241
66242
  import_node_path62.default.basename(file, import_node_path62.default.extname(file)) + extension
66242
66243
  );
66243
66244
  if (interfaceOutputs.has(output2))
66244
- throw new Error(`${targetName}: duplicate Interface Builder output ${output2}`);
66245
+ throw new Error(`${targetName2}: duplicate Interface Builder output ${output2}`);
66245
66246
  interfaceOutputs.add(output2);
66246
66247
  const args = [
66247
66248
  "ibtool",
@@ -66283,7 +66284,7 @@ ${output2}`
66283
66284
  );
66284
66285
  if (definitions.length > 0 && process.platform !== "darwin")
66285
66286
  throw new Error(
66286
- `${targetName}: intent definition code generation requires macOS and Xcode`
66287
+ `${targetName2}: intent definition code generation requires macOS and Xcode`
66287
66288
  );
66288
66289
  for (const definition2 of definitions) {
66289
66290
  const configuredLanguage = settings("INTENTS_CODEGEN_LANGUAGE");
@@ -66568,8 +66569,8 @@ function readXcodeScheme(xcodeprojOrWorkspace, scheme) {
66568
66569
  if (!name3) {
66569
66570
  const declared = (project2 ? [project2] : projects2).flatMap(
66570
66571
  (candidate) => projectTargets(candidate).flatMap((ref) => {
66571
- const targetName = str(ref.target.name);
66572
- return targetName ? [targetName] : [];
66572
+ const targetName2 = str(ref.target.name);
66573
+ return targetName2 ? [targetName2] : [];
66573
66574
  })
66574
66575
  );
66575
66576
  throw new Error(
@@ -66671,9 +66672,9 @@ async function resolveXcodeSwiftPackages(input, signal, target, configuration) {
66671
66672
  );
66672
66673
  }
66673
66674
  }
66674
- function readXcodeAppTarget(input, targetName, configurationName, options = {}) {
66675
+ function readXcodeAppTarget(input, targetName2, configurationName, options = {}) {
66675
66676
  if (isBazelPackage(input))
66676
- return readBazelAppTarget(input, targetName, configurationName, options);
66677
+ return readBazelAppTarget(input, targetName2, configurationName, options);
66677
66678
  const xcodeprojOrWorkspace = import_node_fs64.default.realpathSync.native(input);
66678
66679
  const workspace = xcodeprojOrWorkspace.endsWith(".xcworkspace") ? xcodeprojOrWorkspace : null;
66679
66680
  const { listed, projects: projects2, projectAt, cocoapods } = workspaceProjects(
@@ -66682,18 +66683,18 @@ function readXcodeAppTarget(input, targetName, configurationName, options = {})
66682
66683
  );
66683
66684
  const allTargets = projects2.flatMap(projectTargets);
66684
66685
  const appTargets = allTargets.filter(
66685
- (ref) => isIosAppTarget(ref, options) || targetName !== void 0 && ref.target.name === targetName && ref.target.productType === APP_EXTENSION
66686
+ (ref) => isIosAppTarget(ref, options) || targetName2 !== void 0 && ref.target.name === targetName2 && ref.target.productType === APP_EXTENSION
66686
66687
  );
66687
66688
  const appTargetNames = appTargets.map((ref) => str(ref.target.name) ?? ref.id);
66688
66689
  const container = import_node_path62.default.basename(xcodeprojOrWorkspace);
66689
- const named = targetName ? appTargets.filter((ref) => ref.target.name === targetName) : appTargets;
66690
+ const named = targetName2 ? appTargets.filter((ref) => ref.target.name === targetName2) : appTargets;
66690
66691
  if (named.length !== 1) {
66691
66692
  if (appTargets.length === 0)
66692
66693
  throw new Error(
66693
66694
  `${container} has no application targets; open a project or workspace that contains one`
66694
66695
  );
66695
66696
  throw new Error(
66696
- targetName && named.length === 0 ? `${container} has no application target ${targetName}; it has ${appTargetNames.join(", ") || "none"}` : targetName ? `${container} has ${named.length} application targets named ${targetName}; open its .xcodeproj` : `${container} has ${appTargetNames.length} application targets (${appTargetNames.join(", ")}); pass --target`
66697
+ targetName2 && named.length === 0 ? `${container} has no application target ${targetName2}; it has ${appTargetNames.join(", ") || "none"}` : targetName2 ? `${container} has ${named.length} application targets named ${targetName2}; open its .xcodeproj` : `${container} has ${appTargetNames.length} application targets (${appTargetNames.join(", ")}); pass --target`
66697
66698
  );
66698
66699
  }
66699
66700
  const app = named[0];
@@ -70099,7 +70100,7 @@ var init_swift_standin_digest = __esm({
70099
70100
  STANDIN_DIGEST_ENTRYPOINTS = ["swift-standins.ts", "swift-objc-compile.ts"];
70100
70101
  SPECIFIER = /from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
70101
70102
  standinSourceDigest = (srcDir = __sootsim_import_meta_dirname) => sourceClosureDigest(srcDir, STANDIN_DIGEST_ENTRYPOINTS);
70102
- STANDIN_SOURCE_DIGEST = true ? "80b89d414ee068d747a0859811608daad7d3c46ca66f7bf589cc5c82b820de93" : standinSourceDigest();
70103
+ STANDIN_SOURCE_DIGEST = true ? "f2b2c9a5d56b4cc06d8934ce5600587dcf7893acdf17158203975d997dbd387e" : standinSourceDigest();
70103
70104
  }
70104
70105
  });
70105
70106
 
@@ -70594,7 +70595,7 @@ __export(expo_native_prebuilt_exports, {
70594
70595
  servedExpoSwift: () => servedExpoSwift
70595
70596
  });
70596
70597
  function expoNativeCompilerDigestValue() {
70597
- return true ? "3860d02e968c4e679b7669066efdc2302ff559ff6014934ad88d4fad7996909d" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
70598
+ return true ? "07e205f69ed280a405ff8ed7b8e6259e8752f107f8768d265a02d97d85bafdee" : expoNativeCompilerDigest(__sootsim_import_meta_dirname);
70598
70599
  }
70599
70600
  function readSources(value) {
70600
70601
  const sources = isRecord(value) ? value.sources : null;
@@ -71732,6 +71733,7 @@ async function fetchCheckout(checkouts, identity2, pin2, signal) {
71732
71733
  }
71733
71734
  function fetchedCheckout(checkouts, identity2, pin2) {
71734
71735
  const dir = import_node_path77.default.join(checkouts, identity2);
71736
+ if (preparedSwiftPin(checkouts, identity2, pin2.location, pin2.revision)) return dir;
71735
71737
  const head = import_node_path77.default.join(dir, ".git", "HEAD");
71736
71738
  if (!verified.has(checkoutKey(dir, pin2)) || !import_node_fs79.default.existsSync(head) || import_node_fs79.default.readFileSync(head, "utf8").trim() !== pin2.revision)
71737
71739
  throw new Error(
@@ -84776,12 +84778,12 @@ async function collectTurboSources(options) {
84776
84778
  )
84777
84779
  )
84778
84780
  );
84779
- const original = (targetName, label, root, relative6, compiled = true) => {
84781
+ const original = (targetName2, label, root, relative6, compiled = true) => {
84780
84782
  const staged = relative6.replace(
84781
84783
  /(^|\/)main(\.(?:c|cc|cpp|cxx|m|mm))$/,
84782
84784
  "$1main.library$2"
84783
84785
  );
84784
- const key2 = `${targetPath(targetName)}/upstream/${label}/${staged}`;
84786
+ const key2 = `${targetPath(targetName2)}/upstream/${label}/${staged}`;
84785
84787
  if (UNIT.test(relative6) || OBJC2.test(relative6))
84786
84788
  (compiled ? compiledSources : textualSources).add(key2);
84787
84789
  if (Object.hasOwn(result.files, key2)) return key2;
@@ -84790,24 +84792,24 @@ async function collectTurboSources(options) {
84790
84792
  if (installed2?.flags.length) {
84791
84793
  let prefixHeader = null;
84792
84794
  if (installed2.prefixHeader) {
84793
- prefixHeader = `${targetPath(targetName)}/${import_node_path93.default.basename(installed2.prefixHeader)}`;
84795
+ prefixHeader = `${targetPath(targetName2)}/${import_node_path93.default.basename(installed2.prefixHeader)}`;
84794
84796
  add2(prefixHeader, import_node_fs96.default.readFileSync(installed2.prefixHeader, "utf8"));
84795
84797
  }
84796
84798
  result.nativeTargets ??= [];
84797
- let native = result.nativeTargets.find(({ name: name3 }) => name3 === targetName);
84799
+ let native = result.nativeTargets.find(({ name: name3 }) => name3 === targetName2);
84798
84800
  if (!native) {
84799
84801
  native = {
84800
- name: targetName,
84802
+ name: targetName2,
84801
84803
  deploymentTarget: null,
84802
84804
  headers: [],
84803
- publicHeaders: targetName === TURBO_CORE_TARGET ? [
84804
- `${targetPath(targetName)}/${TURBO_CORE_PUBLIC_HEADERS}/${TURBO_ENTRY_HEADER}`
84805
+ publicHeaders: targetName2 === TURBO_CORE_TARGET ? [
84806
+ `${targetPath(targetName2)}/${TURBO_CORE_PUBLIC_HEADERS}/${TURBO_ENTRY_HEADER}`
84805
84807
  ] : [],
84806
84808
  flattensPublicHeaders: false,
84807
84809
  bridgingHeader: null,
84808
84810
  prefixHeader,
84809
84811
  headerSearchPaths: [
84810
- `${targetPath(targetName)}/${targetName === TURBO_CORE_TARGET ? TURBO_CORE_PUBLIC_HEADERS : "include"}`
84812
+ `${targetPath(targetName2)}/${targetName2 === TURBO_CORE_TARGET ? TURBO_CORE_PUBLIC_HEADERS : "include"}`
84811
84813
  ],
84812
84814
  userHeaderSearchPaths: [],
84813
84815
  frameworkSearchPaths: [],
@@ -84835,7 +84837,7 @@ async function collectTurboSources(options) {
84835
84837
  throw new Error(`TurboModule source is not UTF-8: ${disk}`);
84836
84838
  add2(key2, text6);
84837
84839
  result.sources.push({ file: key2, source: disk, sha256: sha2564(bytes) });
84838
- pending2.push({ key: key2, targetName, label, root, relative: relative6 });
84840
+ pending2.push({ key: key2, targetName: targetName2, label, root, relative: relative6 });
84839
84841
  return key2;
84840
84842
  };
84841
84843
  const pending2 = [];
@@ -85190,9 +85192,9 @@ async function collectTurboSources(options) {
85190
85192
  const unregisteredObjcClasses = /* @__PURE__ */ new Set();
85191
85193
  const deferredDepUnits = [];
85192
85194
  for (const provider of providers) {
85193
- const targetName = providerTarget(provider.info.name);
85195
+ const targetName2 = providerTarget(provider.info.name);
85194
85196
  const label = provider.info.name;
85195
- const providerTargetInput = target(targetName, [
85197
+ const providerTargetInput = target(targetName2, [
85196
85198
  TURBO_CORE_TARGET
85197
85199
  ]);
85198
85200
  result.targets.push(providerTargetInput);
@@ -85210,11 +85212,11 @@ async function collectTurboSources(options) {
85210
85212
  if (provider.providerFabric) {
85211
85213
  fabric = true;
85212
85214
  fabricPackages.add(provider.name);
85213
- fabricTarget ??= { targetName, label, root: provider.root };
85215
+ fabricTarget ??= { targetName: targetName2, label, root: provider.root };
85214
85216
  }
85215
85217
  if (pod.installed?.library) {
85216
85218
  result.libraries ??= {};
85217
- result.libraries[targetName] = import_node_fs96.default.readFileSync(pod.installed.library).toString("base64");
85219
+ result.libraries[targetName2] = import_node_fs96.default.readFileSync(pod.installed.library).toString("base64");
85218
85220
  }
85219
85221
  const files2 = podFiles(pod).filter((file) => {
85220
85222
  if (!provider.reactModulesOnly || HEADER5.test(file)) return true;
@@ -85227,10 +85229,10 @@ async function collectTurboSources(options) {
85227
85229
  if (paper.length > 0) {
85228
85230
  fabric = true;
85229
85231
  paperClasses.push(...paper);
85230
- paperTarget ??= { targetName, label, root: provider.root };
85232
+ paperTarget ??= { targetName: targetName2, label, root: provider.root };
85231
85233
  }
85232
85234
  const headers = /* @__PURE__ */ new Map();
85233
- podHeaders.set(targetName, {
85235
+ podHeaders.set(targetName2, {
85234
85236
  headers,
85235
85237
  label,
85236
85238
  root,
@@ -85543,33 +85545,33 @@ async function collectTurboSources(options) {
85543
85545
  );
85544
85546
  if (filtered !== source) {
85545
85547
  if (definedFacebookReactComponentNames(filtered).size === 0) continue;
85546
- const key2 = original(targetName, "ReactCodegen", generated, file);
85548
+ const key2 = original(targetName2, "ReactCodegen", generated, file);
85547
85549
  result.files[key2] = filtered;
85548
85550
  continue;
85549
85551
  }
85550
85552
  }
85551
85553
  }
85552
- original(targetName, "ReactCodegen", generated, file);
85554
+ original(targetName2, "ReactCodegen", generated, file);
85553
85555
  }
85554
85556
  }
85555
85557
  }
85556
- for (const file of sources) original(targetName, label, root, file);
85558
+ for (const file of sources) original(targetName2, label, root, file);
85557
85559
  for (const unit2 of depUnits) {
85558
85560
  if (!unit2.companionHeader) {
85559
85561
  result.externalPodSources.push({
85560
85562
  moduleName: unit2.moduleName,
85561
- file: original(targetName, unit2.label, unit2.root, unit2.relative)
85563
+ file: original(targetName2, unit2.label, unit2.root, unit2.relative)
85562
85564
  });
85563
85565
  } else {
85564
- deferredDepUnits.push({ targetName, ...unit2 });
85566
+ deferredDepUnits.push({ targetName: targetName2, ...unit2 });
85565
85567
  }
85566
85568
  }
85567
85569
  const declared = [];
85568
85570
  for (const [count, { file, load: load2 }] of loads.entries()) {
85569
- const symbol2 = `peach_turbo_load_${targetName}_${count}`;
85571
+ const symbol2 = `peach_turbo_load_${targetName2}_${count}`;
85570
85572
  declared.push(symbol2);
85571
- result.loads.push({ symbol: symbol2, target: targetName });
85572
- const unit2 = `${targetPath(targetName)}/PeachTurboLoad${count}.cpp`;
85573
+ result.loads.push({ symbol: symbol2, target: targetName2 });
85574
+ const unit2 = `${targetPath(targetName2)}/PeachTurboLoad${count}.cpp`;
85573
85575
  add2(
85574
85576
  unit2,
85575
85577
  [
@@ -85581,21 +85583,21 @@ async function collectTurboSources(options) {
85581
85583
  ].join("\n")
85582
85584
  );
85583
85585
  scanText(
85584
- { key: unit2, targetName, label, root, relative: file },
85586
+ { key: unit2, targetName: targetName2, label, root, relative: file },
85585
85587
  result.files[unit2]
85586
85588
  );
85587
85589
  }
85588
85590
  add2(
85589
- `${targetPath(targetName)}/include/PeachTurboLoad.hpp`,
85591
+ `${targetPath(targetName2)}/include/PeachTurboLoad.hpp`,
85590
85592
  `#pragma once
85591
85593
  ${declared.map((symbol2) => `extern "C" void ${symbol2}();
85592
85594
  `).join("")}`
85593
85595
  );
85594
85596
  add2(
85595
- `${targetPath(targetName)}/include/module.modulemap`,
85596
- `module ${targetName} { header "PeachTurboLoad.hpp"${swiftSources.length > 0 || depSwiftPods.length > 0 ? publicHeaders.map((file) => {
85597
- const source = original(targetName, label, root, file);
85598
- return ` header ${JSON.stringify(import_node_path93.default.posix.relative(`${targetPath(targetName)}/include`, source))}`;
85597
+ `${targetPath(targetName2)}/include/module.modulemap`,
85598
+ `module ${targetName2} { header "PeachTurboLoad.hpp"${swiftSources.length > 0 || depSwiftPods.length > 0 ? publicHeaders.map((file) => {
85599
+ const source = original(targetName2, label, root, file);
85600
+ return ` header ${JSON.stringify(import_node_path93.default.posix.relative(`${targetPath(targetName2)}/include`, source))}`;
85599
85601
  }).join("") : ""} export * }
85600
85602
  `
85601
85603
  );
@@ -93563,7 +93565,7 @@ var init_nitro_superset = __esm({
93563
93565
  init_nitroContract();
93564
93566
  init_swift_standin_digest();
93565
93567
  NITRO_SUPERSET_ENTRY_NAME = "superset";
93566
- NITRO_COMPILER_DIGEST = true ? "46fa7b8faaa964fe0011aec30ae6215d5249f6c1668cc19a35082c35738917cb" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
93568
+ NITRO_COMPILER_DIGEST = true ? "69eced6dbfe31f0e81808ff7cd7eb781e3ed61b284e528afaa6cf96ac2d2b871" : nitroCompilerSourceDigest(__sootsim_import_meta_dirname, STANDIN_SOURCE_DIGEST2);
93567
93569
  nitroSupersetLock = parseLock(nitro_superset_lock_default);
93568
93570
  nitroSupersetKey = (inputs) => nativeEntryKey({ ...inputs, compiler: NITRO_COMPILER_DIGEST });
93569
93571
  published2 = /* @__PURE__ */ new Map();
@@ -94255,7 +94257,7 @@ var init_one_sdk_bundle = __esm({
94255
94257
  var runtime_companion_default;
94256
94258
  var init_runtime_companion = __esm({
94257
94259
  "runtime-companion.json"() {
94258
- runtime_companion_default = { abi: 1, sha256: "7e162f525497b8964ff8f7274ce8219416ec01ac8fc6986a80d2df90a54c71c4", file: "node/cli-7e162f525497b8964ff8f7274ce8219416ec01ac8fc6986a80d2df90a54c71c4.cjs" };
94260
+ runtime_companion_default = { abi: 1, sha256: "f0ebf18540275693f13d5f0638e9e6e2afd2b8a2fa10c6d5c1190341feaa430b", file: "node/cli-f0ebf18540275693f13d5f0638e9e6e2afd2b8a2fa10c6d5c1190341feaa430b.cjs" };
94259
94261
  }
94260
94262
  });
94261
94263
 
@@ -95111,9 +95113,9 @@ async function probePortBundle(port, pageOrigin, options = {}) {
95111
95113
  const unresolved = buildUnresolvedTargetError(`localhost:${port}`);
95112
95114
  try {
95113
95115
  return await Promise.any(
95114
- LOOPBACK_PROBE_HOSTNAMES.map(async (hostname) => {
95116
+ LOOPBACK_PROBE_HOSTNAMES.map(async (hostname2) => {
95115
95117
  const bundle = await probeBaseUrlBundleDirect(
95116
- buildLoopbackProbeBaseUrl("http:", hostname, port),
95118
+ buildLoopbackProbeBaseUrl("http:", hostname2, port),
95117
95119
  port,
95118
95120
  pageOrigin,
95119
95121
  options
@@ -95885,21 +95887,21 @@ async function tcpPing(port, timeout = TCP_GATE_MS) {
95885
95887
  try {
95886
95888
  return await Promise.any(
95887
95889
  LOOPBACK_PROBE_HOSTNAMES.map(
95888
- (hostname) => new Promise((resolve14, reject) => {
95890
+ (hostname2) => new Promise((resolve14, reject) => {
95889
95891
  const sock = new import_net.default.Socket();
95890
95892
  let settled = false;
95891
95893
  const done = (reachable) => {
95892
95894
  if (settled) return;
95893
95895
  settled = true;
95894
95896
  sock.destroy();
95895
- if (reachable) resolve14(hostname);
95896
- else reject(new Error(`unreachable loopback host ${hostname}`));
95897
+ if (reachable) resolve14(hostname2);
95898
+ else reject(new Error(`unreachable loopback host ${hostname2}`));
95897
95899
  };
95898
95900
  sock.setTimeout(timeout);
95899
95901
  sock.once("connect", () => done(true));
95900
95902
  sock.once("timeout", () => done(false));
95901
95903
  sock.once("error", () => done(false));
95902
- sock.connect(port, hostname);
95904
+ sock.connect(port, hostname2);
95903
95905
  })
95904
95906
  )
95905
95907
  );
@@ -95907,7 +95909,7 @@ async function tcpPing(port, timeout = TCP_GATE_MS) {
95907
95909
  return null;
95908
95910
  }
95909
95911
  }
95910
- function httpGet(hostname, port, path148, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
95912
+ function httpGet(hostname2, port, path148, method = "GET", timeout = TIMEOUT_MS, headers = {}) {
95911
95913
  return new Promise((resolve14) => {
95912
95914
  let settled = false;
95913
95915
  let killing = false;
@@ -95916,7 +95918,7 @@ function httpGet(hostname, port, path148, method = "GET", timeout = TIMEOUT_MS,
95916
95918
  settled = true;
95917
95919
  resolve14(value);
95918
95920
  };
95919
- const req = import_http.default.request({ hostname, port, path: path148, method, headers }, (res) => {
95921
+ const req = import_http.default.request({ hostname: hostname2, port, path: path148, method, headers }, (res) => {
95920
95922
  let body = "";
95921
95923
  res.on("data", (c) => body += c.toString());
95922
95924
  const contentType2 = (() => {
@@ -95931,7 +95933,7 @@ function httpGet(hostname, port, path148, method = "GET", timeout = TIMEOUT_MS,
95931
95933
  statusCode: res.statusCode || 0,
95932
95934
  body,
95933
95935
  contentType: contentType2,
95934
- hostname
95936
+ hostname: hostname2
95935
95937
  })
95936
95938
  );
95937
95939
  });
@@ -95949,16 +95951,16 @@ function httpGet(hostname, port, path148, method = "GET", timeout = TIMEOUT_MS,
95949
95951
  });
95950
95952
  });
95951
95953
  }
95952
- async function probeManifest(hostname, port, timeout) {
95954
+ async function probeManifest(hostname2, port, timeout) {
95953
95955
  let deadline;
95954
95956
  try {
95955
95957
  return await Promise.race([
95956
- fetchDevManifest(buildLoopbackProbeBaseUrl("http:", hostname, port)).then(
95958
+ fetchDevManifest(buildLoopbackProbeBaseUrl("http:", hostname2, port)).then(
95957
95959
  async (res) => res ? {
95958
95960
  statusCode: res.status,
95959
95961
  body: await res.text(),
95960
95962
  contentType: res.headers.get("content-type") || "",
95961
- hostname
95963
+ hostname: hostname2
95962
95964
  } : null
95963
95965
  ),
95964
95966
  new Promise((resolve14) => {
@@ -96230,16 +96232,16 @@ function nativeBundleRoot(projectCwd) {
96230
96232
  }
96231
96233
  return "index";
96232
96234
  }
96233
- function makeResult(hostname, port, framework, owner) {
96235
+ function makeResult(hostname2, port, framework, owner) {
96234
96236
  return {
96235
96237
  port,
96236
96238
  framework,
96237
96239
  bundleUrl: withRuntimeConfig(
96238
96240
  port,
96239
- `${buildLoopbackProbeBaseUrl("http:", hostname, port)}/${nativeBundleRoot(owner.cwd)}.bundle?platform=ios&dev=true&hot=true&minify=false`,
96241
+ `${buildLoopbackProbeBaseUrl("http:", hostname2, port)}/${nativeBundleRoot(owner.cwd)}.bundle?platform=ios&dev=true&hot=true&minify=false`,
96240
96242
  owner.cwd
96241
96243
  ),
96242
- hmrUrl: `${buildLoopbackProbeBaseUrl("ws:", hostname, port)}/hot`,
96244
+ hmrUrl: `${buildLoopbackProbeBaseUrl("ws:", hostname2, port)}/hot`,
96243
96245
  lastSeen: Date.now(),
96244
96246
  ...owner
96245
96247
  };
@@ -96282,10 +96284,10 @@ function metroAssetPath(rawIcon) {
96282
96284
  function staticAssetPath(rawIcon) {
96283
96285
  return `/${rawIcon.replace(/^\.?\//, "")}`;
96284
96286
  }
96285
- async function resolveLocalIconPath(hostname, port, rawIcon) {
96287
+ async function resolveLocalIconPath(hostname2, port, rawIcon) {
96286
96288
  const candidates = [metroAssetPath(rawIcon), staticAssetPath(rawIcon)];
96287
96289
  for (const candidate of candidates) {
96288
- const res = await httpGet(hostname, port, candidate, "HEAD", ENRICH_TIMEOUT_MS);
96290
+ const res = await httpGet(hostname2, port, candidate, "HEAD", ENRICH_TIMEOUT_MS);
96289
96291
  if (res?.statusCode === 200) {
96290
96292
  localIconPathCache.set(port, candidate);
96291
96293
  invalidatePortCache(port);
@@ -96361,8 +96363,8 @@ function ensureLocalIconPathResolved(result) {
96361
96363
  if (localIconPathCache.has(result.port)) return;
96362
96364
  if (localIconProbeInFlight.has(result.port)) return;
96363
96365
  localIconProbeInFlight.add(result.port);
96364
- const hostname = normalizeHostname(new URL(result.bundleUrl).hostname);
96365
- void resolveLocalIconPath(hostname, result.port, rawIcon).finally(
96366
+ const hostname2 = normalizeHostname(new URL(result.bundleUrl).hostname);
96367
+ void resolveLocalIconPath(hostname2, result.port, rawIcon).finally(
96366
96368
  () => localIconProbeInFlight.delete(result.port)
96367
96369
  );
96368
96370
  }
@@ -96388,14 +96390,14 @@ function enrichWithManifest(result, buildIconProxyUrl) {
96388
96390
  return result;
96389
96391
  }
96390
96392
  async function fetchManifestEnrichment(result, buildIconProxyUrl) {
96391
- const hostname = normalizeHostname(new URL(result.bundleUrl).hostname);
96392
- const manifestRes = await probeManifest(hostname, result.port, ENRICH_TIMEOUT_MS);
96393
+ const hostname2 = normalizeHostname(new URL(result.bundleUrl).hostname);
96394
+ const manifestRes = await probeManifest(hostname2, result.port, ENRICH_TIMEOUT_MS);
96393
96395
  if (!manifestRes || manifestRes.statusCode !== 200) return;
96394
96396
  const parsed = applyManifest(
96395
96397
  {
96396
96398
  port: result.port,
96397
96399
  framework: "one",
96398
- bundleUrl: `${buildLoopbackProbeBaseUrl("http:", hostname, result.port)}/index.bundle`,
96400
+ bundleUrl: `${buildLoopbackProbeBaseUrl("http:", hostname2, result.port)}/index.bundle`,
96399
96401
  lastSeen: 0
96400
96402
  },
96401
96403
  manifestRes,
@@ -100873,8 +100875,8 @@ function resolveRedirectUrl(location, from) {
100873
100875
  if (!location.includes("#")) next.hash = from.hash;
100874
100876
  return next;
100875
100877
  }
100876
- function headerOverridesFor(hostname) {
100877
- const host2 = hostname.toLowerCase();
100878
+ function headerOverridesFor(hostname2) {
100879
+ const host2 = hostname2.toLowerCase();
100878
100880
  for (const override of HOST_HEADER_OVERRIDES) {
100879
100881
  if (host2 === override.hostSuffix || host2.endsWith(`.${override.hostSuffix}`)) {
100880
100882
  return override;
@@ -101203,8 +101205,8 @@ var init_hostname_resolver = __esm({
101203
101205
  });
101204
101206
 
101205
101207
  // src/host/loopback-ports.ts
101206
- function projectLoopbackPort(hostname, port) {
101207
- return isLoopbackHost(hostname) ? LOOPBACK_PORTS.get(port) ?? port : port;
101208
+ function projectLoopbackPort(hostname2, port) {
101209
+ return isLoopbackHost(hostname2) ? LOOPBACK_PORTS.get(port) ?? port : port;
101208
101210
  }
101209
101211
  function projectLoopbackUrl(value) {
101210
101212
  if (LOOPBACK_PORTS.size === 0) return value;
@@ -109053,10 +109055,11 @@ function rnxCloudScopesAllowCommand(scopes, type) {
109053
109055
  function isRnxCloudSimStatus(value) {
109054
109056
  return value === "creating" || value === "open" || value === "hibernated" || value === "deleting" || value === "deleted";
109055
109057
  }
109056
- var RNX_CLOUD_MAX_ARTIFACT_BYTES, RNX_CLOUD_DESIGN_MAX_STORAGE_BYTES, RNX_CLOUD_COMMAND_SCOPES, RNX_CLOUD_COMMAND_TYPES, RNX_CLOUD_COMMAND_TYPE_SET, RNX_CLOUD_TOKEN_SCOPES, RNX_CLOUD_ALL_COMMAND_SCOPES;
109058
+ var AGENT_IDENTITY_MAX_CHARS, RNX_CLOUD_MAX_ARTIFACT_BYTES, RNX_CLOUD_DESIGN_MAX_STORAGE_BYTES, RNX_CLOUD_COMMAND_SCOPES, RNX_CLOUD_COMMAND_TYPES, RNX_CLOUD_COMMAND_TYPE_SET, RNX_CLOUD_TOKEN_SCOPES, RNX_CLOUD_ALL_COMMAND_SCOPES;
109057
109059
  var init_cloud_contract = __esm({
109058
109060
  "src/cloud-contract.ts"() {
109059
109061
  "use strict";
109062
+ AGENT_IDENTITY_MAX_CHARS = 200;
109060
109063
  RNX_CLOUD_MAX_ARTIFACT_BYTES = 40761776;
109061
109064
  RNX_CLOUD_DESIGN_MAX_STORAGE_BYTES = 1024 * 1024;
109062
109065
  RNX_CLOUD_COMMAND_SCOPES = {
@@ -109283,6 +109286,560 @@ var init_cloud_session = __esm({
109283
109286
  }
109284
109287
  });
109285
109288
 
109289
+ // ../peach-kit/src/agent-identity.ts
109290
+ function formatLockOwner(owner) {
109291
+ const colon = owner.indexOf(":");
109292
+ if (colon <= 0) return owner.length > 24 ? `${owner.slice(0, 21)}\u2026` : owner;
109293
+ const source = owner.slice(0, colon);
109294
+ const value = owner.slice(colon + 1);
109295
+ if (source === "PEACH_CLI_IDENTITY" && value) return value;
109296
+ const short = value.length > 12 ? `${value.slice(0, 8)}\u2026` : value;
109297
+ if (source === "CLAUDE_CODE_SESSION_ID" || source === "CODEX_THREAD_ID") {
109298
+ return `agent ${short}`;
109299
+ }
109300
+ return `${source} ${short}`;
109301
+ }
109302
+ var init_agent_identity = __esm({
109303
+ "../peach-kit/src/agent-identity.ts"() {
109304
+ "use strict";
109305
+ }
109306
+ });
109307
+
109308
+ // cli/parent-pid.ts
109309
+ function getParentPid(pid) {
109310
+ if (!cached3) cached3 = build();
109311
+ try {
109312
+ return cached3(pid);
109313
+ } catch {
109314
+ return null;
109315
+ }
109316
+ }
109317
+ function getProcessComm(pid) {
109318
+ if (!cachedComm) cachedComm = buildComm();
109319
+ try {
109320
+ return cachedComm(pid);
109321
+ } catch {
109322
+ return null;
109323
+ }
109324
+ }
109325
+ function getProcessPgid(pid) {
109326
+ if (!cachedPgid) cachedPgid = buildPgid();
109327
+ try {
109328
+ return cachedPgid(pid);
109329
+ } catch {
109330
+ return null;
109331
+ }
109332
+ }
109333
+ function buildComm() {
109334
+ if (process.platform === "linux") {
109335
+ return (pid) => {
109336
+ try {
109337
+ return (0, import_fs4.readFileSync)(`/proc/${pid}/comm`, "utf8").trim() || null;
109338
+ } catch {
109339
+ return null;
109340
+ }
109341
+ };
109342
+ }
109343
+ if (process.platform === "darwin") {
109344
+ const ffi = tryBuildDarwinCommFfi();
109345
+ if (ffi) return ffi;
109346
+ return (pid) => readProcessTable2().get(pid)?.comm || null;
109347
+ }
109348
+ return () => null;
109349
+ }
109350
+ function build() {
109351
+ if (process.platform === "linux") return buildLinux();
109352
+ if (process.platform === "darwin") {
109353
+ const ffi = tryBuildDarwinFfi();
109354
+ if (ffi) return ffi;
109355
+ return (pid) => {
109356
+ const ppid = readProcessTable2().get(pid)?.ppid;
109357
+ return ppid !== void 0 && ppid > 0 ? ppid : null;
109358
+ };
109359
+ }
109360
+ return () => null;
109361
+ }
109362
+ function buildPgid() {
109363
+ if (process.platform === "linux") {
109364
+ return (pid) => {
109365
+ try {
109366
+ const raw2 = (0, import_fs4.readFileSync)(`/proc/${pid}/stat`, "utf8");
109367
+ const end = raw2.lastIndexOf(")");
109368
+ if (end < 0) return null;
109369
+ const rest = raw2.slice(end + 1).trim().split(/\s+/);
109370
+ const pgid = Number(rest[2]);
109371
+ return Number.isFinite(pgid) && pgid > 0 ? pgid : null;
109372
+ } catch {
109373
+ return null;
109374
+ }
109375
+ };
109376
+ }
109377
+ if (process.platform === "darwin") {
109378
+ const ffi = tryBuildDarwinPgidFfi();
109379
+ if (ffi) return ffi;
109380
+ return (pid) => {
109381
+ const pgid = readProcessTable2().get(pid)?.pgid;
109382
+ return pgid !== void 0 && pgid > 0 ? pgid : null;
109383
+ };
109384
+ }
109385
+ return () => null;
109386
+ }
109387
+ function readProcessTable2() {
109388
+ const now = Date.now();
109389
+ if (processTable2.readAt && now - processTable2.readAt < PROCESS_TABLE_TTL_MS) {
109390
+ return processTable2.rows;
109391
+ }
109392
+ const rows = /* @__PURE__ */ new Map();
109393
+ try {
109394
+ const out = (0, import_child_process3.execFileSync)("ps", ["-eo", "pid=,ppid=,pgid=,comm="], {
109395
+ encoding: "utf8",
109396
+ timeout: 5e3,
109397
+ maxBuffer: 8 * 1024 * 1024,
109398
+ stdio: ["ignore", "pipe", "ignore"]
109399
+ });
109400
+ for (const line of out.split("\n")) {
109401
+ const parsed = line.trim().match(/^(\d+)\s+(\d+)\s+(\d+)\s+(.*)$/);
109402
+ if (!parsed) continue;
109403
+ rows.set(Number(parsed[1]), {
109404
+ ppid: Number(parsed[2]),
109405
+ pgid: Number(parsed[3]),
109406
+ comm: (parsed[4].split("/").at(-1) ?? "").slice(0, PBI_COMM_LEN)
109407
+ });
109408
+ }
109409
+ } catch {
109410
+ }
109411
+ processTable2 = { readAt: now, rows };
109412
+ return rows;
109413
+ }
109414
+ function buildLinux() {
109415
+ return (pid) => {
109416
+ try {
109417
+ const raw2 = (0, import_fs4.readFileSync)(`/proc/${pid}/stat`, "utf8");
109418
+ const end = raw2.lastIndexOf(")");
109419
+ if (end < 0) return null;
109420
+ const rest = raw2.slice(end + 1).trim().split(/\s+/);
109421
+ const ppid = Number(rest[1]);
109422
+ return Number.isFinite(ppid) && ppid > 0 ? ppid : null;
109423
+ } catch {
109424
+ return null;
109425
+ }
109426
+ };
109427
+ }
109428
+ function tryBuildDarwinFfi() {
109429
+ if (!process.versions?.bun) return null;
109430
+ try {
109431
+ const r = (0, import_module.createRequire)(__sootsim_import_meta_url);
109432
+ const { dlopen, FFIType } = r("bun:ffi");
109433
+ const lib = dlopen("/usr/lib/libproc.dylib", {
109434
+ proc_pidinfo: {
109435
+ args: [FFIType.i32, FFIType.i32, FFIType.u64, FFIType.ptr, FFIType.i32],
109436
+ returns: FFIType.i32
109437
+ }
109438
+ });
109439
+ const buf = Buffer.alloc(PROC_BSDINFO_SIZE);
109440
+ return (pid) => {
109441
+ const ret = Number(
109442
+ lib.symbols.proc_pidinfo(pid, PROC_PIDTBSDINFO, 0n, buf, PROC_BSDINFO_SIZE)
109443
+ );
109444
+ if (ret <= 0) return null;
109445
+ const ppid = buf.readUInt32LE(PBI_PPID_OFFSET);
109446
+ return ppid > 0 ? ppid : null;
109447
+ };
109448
+ } catch {
109449
+ return null;
109450
+ }
109451
+ }
109452
+ function tryBuildDarwinCommFfi() {
109453
+ if (!process.versions?.bun) return null;
109454
+ try {
109455
+ const r = (0, import_module.createRequire)(__sootsim_import_meta_url);
109456
+ const { dlopen, FFIType } = r("bun:ffi");
109457
+ const lib = dlopen("/usr/lib/libproc.dylib", {
109458
+ proc_pidinfo: {
109459
+ args: [FFIType.i32, FFIType.i32, FFIType.u64, FFIType.ptr, FFIType.i32],
109460
+ returns: FFIType.i32
109461
+ }
109462
+ });
109463
+ const buf = Buffer.alloc(PROC_BSDINFO_SIZE);
109464
+ return (pid) => {
109465
+ const ret = Number(
109466
+ lib.symbols.proc_pidinfo(pid, PROC_PIDTBSDINFO, 0n, buf, PROC_BSDINFO_SIZE)
109467
+ );
109468
+ if (ret <= 0) return null;
109469
+ const raw2 = buf.subarray(PBI_COMM_OFFSET, PBI_COMM_OFFSET + PBI_COMM_LEN);
109470
+ const end = raw2.indexOf(0);
109471
+ const comm = raw2.subarray(0, end < 0 ? raw2.length : end).toString("utf8");
109472
+ return comm || null;
109473
+ };
109474
+ } catch {
109475
+ return null;
109476
+ }
109477
+ }
109478
+ function tryBuildDarwinPgidFfi() {
109479
+ if (!process.versions?.bun) return null;
109480
+ try {
109481
+ const r = (0, import_module.createRequire)(__sootsim_import_meta_url);
109482
+ const { dlopen, FFIType } = r("bun:ffi");
109483
+ const lib = dlopen("/usr/lib/libproc.dylib", {
109484
+ proc_pidinfo: {
109485
+ args: [FFIType.i32, FFIType.i32, FFIType.u64, FFIType.ptr, FFIType.i32],
109486
+ returns: FFIType.i32
109487
+ }
109488
+ });
109489
+ const buf = Buffer.alloc(PROC_BSDINFO_SIZE);
109490
+ return (pid) => {
109491
+ const ret = Number(
109492
+ lib.symbols.proc_pidinfo(pid, PROC_PIDTBSDINFO, 0n, buf, PROC_BSDINFO_SIZE)
109493
+ );
109494
+ if (ret <= 0) return null;
109495
+ const pgid = buf.readUInt32LE(PBI_PGID_OFFSET);
109496
+ return pgid > 0 ? pgid : null;
109497
+ };
109498
+ } catch {
109499
+ return null;
109500
+ }
109501
+ }
109502
+ var import_child_process3, import_fs4, import_module, cached3, cachedComm, cachedPgid, PROCESS_TABLE_TTL_MS, processTable2, PROC_PIDTBSDINFO, PROC_BSDINFO_SIZE, PBI_PPID_OFFSET, PBI_COMM_OFFSET, PBI_COMM_LEN, PBI_PGID_OFFSET;
109503
+ var init_parent_pid = __esm({
109504
+ "cli/parent-pid.ts"() {
109505
+ "use strict";
109506
+ import_child_process3 = require("child_process");
109507
+ import_fs4 = require("fs");
109508
+ import_module = require("module");
109509
+ cached3 = null;
109510
+ cachedComm = null;
109511
+ cachedPgid = null;
109512
+ PROCESS_TABLE_TTL_MS = 2e3;
109513
+ processTable2 = { readAt: 0, rows: /* @__PURE__ */ new Map() };
109514
+ PROC_PIDTBSDINFO = 3;
109515
+ PROC_BSDINFO_SIZE = 216;
109516
+ PBI_PPID_OFFSET = 16;
109517
+ PBI_COMM_OFFSET = 48;
109518
+ PBI_COMM_LEN = 16;
109519
+ PBI_PGID_OFFSET = 100;
109520
+ }
109521
+ });
109522
+
109523
+ // cli/current-sim.ts
109524
+ function findTopAncestor(start, maxDepth = 20) {
109525
+ let prev = start;
109526
+ let pid = getParentPid(start);
109527
+ if (!pid || pid <= 1) {
109528
+ const comm = getProcessComm(start);
109529
+ if (!comm || start < 1 || IMMORTAL_HOST_COMM_RE.test(comm)) return null;
109530
+ return start > 1 || !INIT_COMM_RE.test(comm) ? start : null;
109531
+ }
109532
+ for (let i = 0; i < maxDepth; i++) {
109533
+ const comm = getProcessComm(pid);
109534
+ if (comm && IMMORTAL_HOST_COMM_RE.test(comm)) return prev;
109535
+ const parent = getParentPid(pid);
109536
+ if (!parent || parent <= 1) {
109537
+ return comm ? pid : prev;
109538
+ }
109539
+ prev = pid;
109540
+ pid = parent;
109541
+ }
109542
+ return pid;
109543
+ }
109544
+ function getCliIdentity() {
109545
+ for (const name3 of IDENTITY_ENV_VARS) {
109546
+ const value = process.env[name3];
109547
+ if (value && value.trim()) {
109548
+ return { key: `${name3}:${value.trim()}`, source: name3, stable: true };
109549
+ }
109550
+ }
109551
+ const topPid = findTopAncestor(process.ppid);
109552
+ if (topPid) {
109553
+ return { key: `gppid-${topPid}`, source: "grand-ppid", stable: true };
109554
+ }
109555
+ return { key: `pid-${process.ppid}`, source: "ppid", stable: false };
109556
+ }
109557
+ function getCliIdentityKey() {
109558
+ return getCliIdentity().key;
109559
+ }
109560
+ function getStableOwnerPid() {
109561
+ return findTopAncestor(process.ppid);
109562
+ }
109563
+ function getOwnerProcessGroupId(owner = getStableOwnerPid()) {
109564
+ if (!owner || owner <= 1) return null;
109565
+ const pgid = getProcessPgid(owner);
109566
+ return pgid !== null && pgid > 1 ? pgid : null;
109567
+ }
109568
+ function getCurrentSimPath() {
109569
+ const envPath = process.env[CURRENT_SIM_PATH_ENV];
109570
+ if (envPath) {
109571
+ return (0, import_path4.resolve)(envPath);
109572
+ }
109573
+ const key2 = getCliIdentityKey();
109574
+ return (0, import_path4.join)((0, import_os.tmpdir)(), `peach-current-sim-${key2}.json`);
109575
+ }
109576
+ function legacyCloudCredentialDirectory(filepath) {
109577
+ return (0, import_path4.join)((0, import_path4.dirname)(filepath), `${(0, import_path4.basename)(filepath)}.credentials`);
109578
+ }
109579
+ function readCurrentTarget() {
109580
+ const filepath = getCurrentSimPath();
109581
+ (0, import_fs5.rmSync)(legacyCloudCredentialDirectory(filepath), { recursive: true, force: true });
109582
+ if (!(0, import_fs5.existsSync)(filepath)) return null;
109583
+ try {
109584
+ const parsed = JSON.parse((0, import_fs5.readFileSync)(filepath, "utf8"));
109585
+ if (parsed === null || typeof parsed !== "object") {
109586
+ (0, import_fs5.rmSync)(filepath, { force: true });
109587
+ return null;
109588
+ }
109589
+ if (Reflect.get(parsed, "pendingOpen") === true) return null;
109590
+ const version2 = Reflect.get(parsed, "version");
109591
+ const plane = Reflect.get(parsed, "plane");
109592
+ const simId = Reflect.get(parsed, "simId");
109593
+ const updatedAt = Reflect.get(parsed, "updatedAt");
109594
+ const rawPort = Reflect.get(parsed, "bridgePort");
109595
+ const bridgePort = typeof rawPort === "number" && Number.isInteger(rawPort) && rawPort > 0 ? rawPort : void 0;
109596
+ if (version2 !== 1 && version2 !== CURRENT_SIM_VERSION || version2 === CURRENT_SIM_VERSION && plane !== "local" || typeof simId !== "string" || !simId.trim() || typeof updatedAt !== "string") {
109597
+ (0, import_fs5.rmSync)(filepath, { force: true });
109598
+ return null;
109599
+ }
109600
+ const target = {
109601
+ version: CURRENT_SIM_VERSION,
109602
+ plane: "local",
109603
+ simId: simId.trim(),
109604
+ ...bridgePort === void 0 ? {} : { bridgePort },
109605
+ updatedAt
109606
+ };
109607
+ if (version2 === 1) writeSecureJsonAtomic(filepath, target, { durable: false });
109608
+ return target;
109609
+ } catch {
109610
+ (0, import_fs5.rmSync)(filepath, { force: true });
109611
+ return null;
109612
+ }
109613
+ }
109614
+ function readCurrentSimId() {
109615
+ return readCurrentTarget()?.simId ?? null;
109616
+ }
109617
+ function writeCurrentSim(simId, bridgePort) {
109618
+ const normalized = simId.trim();
109619
+ if (!normalized) return;
109620
+ writeSecureJsonAtomic(
109621
+ getCurrentSimPath(),
109622
+ {
109623
+ version: CURRENT_SIM_VERSION,
109624
+ plane: "local",
109625
+ simId: normalized,
109626
+ ...bridgePort === void 0 ? {} : { bridgePort },
109627
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
109628
+ },
109629
+ { durable: false }
109630
+ );
109631
+ }
109632
+ function saveCurrentSimId(simId, bridgePort) {
109633
+ writeCurrentSim(simId, bridgePort);
109634
+ }
109635
+ function replaceCurrentSimId(simId) {
109636
+ writeCurrentSim(simId, readCurrentTarget()?.bridgePort);
109637
+ }
109638
+ function getAgentIdPath() {
109639
+ return `${getCurrentSimPath()}.agent-id`;
109640
+ }
109641
+ function saveAgentId(agentId) {
109642
+ writeSecureJsonAtomic(getAgentIdPath(), { agentId }, { durable: false });
109643
+ }
109644
+ function readAgentId() {
109645
+ const filepath = getAgentIdPath();
109646
+ if (!(0, import_fs5.existsSync)(filepath)) return void 0;
109647
+ try {
109648
+ const parsed = JSON.parse((0, import_fs5.readFileSync)(filepath, "utf8"));
109649
+ const agentId = parsed !== null && typeof parsed === "object" ? Reflect.get(parsed, "agentId") : void 0;
109650
+ return typeof agentId === "string" && agentId.trim() ? agentId.trim() : void 0;
109651
+ } catch {
109652
+ (0, import_fs5.rmSync)(filepath, { force: true });
109653
+ return void 0;
109654
+ }
109655
+ }
109656
+ function clearCurrentSimId() {
109657
+ (0, import_fs5.rmSync)(getCurrentSimPath(), { force: true });
109658
+ }
109659
+ function markOpenPending() {
109660
+ writeSecureJsonAtomic(
109661
+ getCurrentSimPath(),
109662
+ {
109663
+ version: CURRENT_SIM_VERSION,
109664
+ plane: "local",
109665
+ pendingOpen: true,
109666
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
109667
+ },
109668
+ { durable: false }
109669
+ );
109670
+ }
109671
+ function assertNoPendingOpen() {
109672
+ if (!isOpenPending()) return;
109673
+ throw new PendingOpenError(
109674
+ "the last `peach open` did not pin a sim, so this command would land on whichever tab is connected. run `peach open` again, `peach use <sim>`, or pass --sim <id>"
109675
+ );
109676
+ }
109677
+ function isOpenPending() {
109678
+ const filepath = getCurrentSimPath();
109679
+ if (!(0, import_fs5.existsSync)(filepath)) return false;
109680
+ try {
109681
+ const parsed = JSON.parse((0, import_fs5.readFileSync)(filepath, "utf8"));
109682
+ return parsed !== null && typeof parsed === "object" && Reflect.get(parsed, "pendingOpen") === true;
109683
+ } catch {
109684
+ return false;
109685
+ }
109686
+ }
109687
+ var import_fs5, import_os, import_path4, CURRENT_SIM_VERSION, CURRENT_SIM_PATH_ENV, IDENTITY_ENV_VARS, IMMORTAL_HOST_COMM_RE, INIT_COMM_RE, readCurrentSim, PendingOpenError;
109688
+ var init_current_sim = __esm({
109689
+ "cli/current-sim.ts"() {
109690
+ "use strict";
109691
+ import_fs5 = require("fs");
109692
+ import_os = require("os");
109693
+ import_path4 = require("path");
109694
+ init_parent_pid();
109695
+ init_secure_file();
109696
+ CURRENT_SIM_VERSION = 2;
109697
+ CURRENT_SIM_PATH_ENV = "PEACH_CLI_CURRENT_SIM_PATH";
109698
+ IDENTITY_ENV_VARS = [
109699
+ "PEACH_CLI_IDENTITY",
109700
+ // explicit override — fastest path, skips all pid lookups
109701
+ "CLAUDE_CODE_SESSION_ID",
109702
+ // claude code, if ever set
109703
+ "CODEX_THREAD_ID",
109704
+ // codex / openai agent thread, stable across tool invocations
109705
+ // a Team Machine session, per agent run. its other runners set no session
109706
+ // variable of their own, and the terminal variables below are inherited from
109707
+ // whatever shell started the daemon, so every such agent would share one key.
109708
+ "TM_SESSION",
109709
+ "TERM_SESSION_ID",
109710
+ // macOS Terminal.app + iTerm2
109711
+ "ITERM_SESSION_ID",
109712
+ // iTerm2 (older variant)
109713
+ "TMUX_PANE",
109714
+ // tmux — stable per pane
109715
+ "STY",
109716
+ // GNU screen session
109717
+ "KITTY_WINDOW_ID",
109718
+ // kitty
109719
+ "WEZTERM_PANE",
109720
+ // wezterm
109721
+ "ALACRITTY_WINDOW_ID",
109722
+ // alacritty
109723
+ "WINDOWID",
109724
+ // X11 terminals
109725
+ "VSCODE_INJECTION"
109726
+ // vscode integrated terminal
109727
+ ];
109728
+ IMMORTAL_HOST_COMM_RE = /^(?:tmux|screen)|^tm$/i;
109729
+ INIT_COMM_RE = /^(?:init|systemd|launchd|tini|docker-init|dumb-init|catatonit|s6-svscan|runsvdir)$/i;
109730
+ readCurrentSim = readCurrentTarget;
109731
+ PendingOpenError = class extends Error {
109732
+ };
109733
+ }
109734
+ });
109735
+
109736
+ // cli/command-agent.ts
109737
+ function clip(text6) {
109738
+ return text6.length > AGENT_IDENTITY_MAX_CHARS ? `${text6.slice(0, AGENT_IDENTITY_MAX_CHARS - 1)}\u2026` : text6;
109739
+ }
109740
+ function targetName(target) {
109741
+ const name3 = target?.text?.trim() || target?.testID?.trim() || target?.id?.trim();
109742
+ return name3 ? name3.replace(/\s+/g, " ") : null;
109743
+ }
109744
+ function verb(action, target) {
109745
+ return target ? `${action} ${target}` : action;
109746
+ }
109747
+ function describeStep(step) {
109748
+ switch (step.type) {
109749
+ case "tap":
109750
+ return verb("Tapping", targetName(step.target));
109751
+ case "tapId":
109752
+ return verb("Tapping", step.id);
109753
+ case "doubleTap":
109754
+ return "Double tapping";
109755
+ case "longPress":
109756
+ return verb("Long pressing", targetName(step.target));
109757
+ case "drag":
109758
+ return "Dragging";
109759
+ case "pinch":
109760
+ return "Pinching";
109761
+ case "scroll":
109762
+ return verb("Scrolling", step.id);
109763
+ case "touchDown":
109764
+ case "touchMove":
109765
+ case "touchUp":
109766
+ case "touchCancel":
109767
+ return "Touching the screen";
109768
+ case "type":
109769
+ case "typeInto":
109770
+ case "setElementValue":
109771
+ return "Typing";
109772
+ case "key":
109773
+ case "keyDown":
109774
+ case "keyUp":
109775
+ return "Pressing a key";
109776
+ case "dismissKeyboard":
109777
+ case "toggleKeyboard":
109778
+ return "Using the keyboard";
109779
+ case "openUrl":
109780
+ return "Opening a link";
109781
+ case "setOrientation":
109782
+ return `Rotating to ${step.orientation}`;
109783
+ case "incrementElement":
109784
+ case "decrementElement":
109785
+ return verb("Adjusting", step.id);
109786
+ case "buttonDown":
109787
+ case "buttonUp":
109788
+ case "wait":
109789
+ case "waitFor":
109790
+ case "deviceInfo":
109791
+ case "discoverStoreKitConfig":
109792
+ case "clearStoreKitConfig":
109793
+ return null;
109794
+ }
109795
+ }
109796
+ function describeCommand(command) {
109797
+ switch (command.type) {
109798
+ case "tap":
109799
+ return verb("Tapping", targetName(command.target));
109800
+ case "longPress":
109801
+ return verb("Long pressing", targetName(command.target));
109802
+ case "keyboard":
109803
+ return command.action === "dismiss" ? "Dismissing the keyboard" : command.action === "press" || command.action === "dispatchKey" ? "Pressing a key" : "Typing";
109804
+ case "screenshot":
109805
+ return "Taking a screenshot";
109806
+ case "perform": {
109807
+ const labels = (command.steps ?? []).flatMap((step) => describeStep(step) ?? []);
109808
+ const [first] = labels;
109809
+ if (!first) return null;
109810
+ return labels.length === 1 ? first : `${first}, then ${labels.length - 1} more`;
109811
+ }
109812
+ default:
109813
+ return null;
109814
+ }
109815
+ }
109816
+ function commandAgent(command) {
109817
+ const step = describeCommand(command);
109818
+ if (!step) return void 0;
109819
+ const identity2 = getCliIdentity();
109820
+ if (!identity2.stable) return void 0;
109821
+ const machine = (0, import_os2.hostname)().split(".")[0];
109822
+ if (!machine) return void 0;
109823
+ return {
109824
+ id: clip(identity2.key),
109825
+ name: clip(
109826
+ readAgentId() ?? (process.env.PEACH_AGENT_ID?.trim() || formatLockOwner(identity2.key))
109827
+ ),
109828
+ machine: clip(machine),
109829
+ step: clip(step)
109830
+ };
109831
+ }
109832
+ var import_os2;
109833
+ var init_command_agent = __esm({
109834
+ "cli/command-agent.ts"() {
109835
+ "use strict";
109836
+ import_os2 = require("os");
109837
+ init_agent_identity();
109838
+ init_cloud_contract();
109839
+ init_current_sim();
109840
+ }
109841
+ });
109842
+
109286
109843
  // ../peach-globals/src/github-workflow-contract.ts
109287
109844
  var init_github_workflow_contract = __esm({
109288
109845
  "../peach-globals/src/github-workflow-contract.ts"() {
@@ -109301,7 +109858,7 @@ var init_github_workflow_identity = __esm({
109301
109858
  // cli/run-registry.ts
109302
109859
  function gitOutput(command, cwd) {
109303
109860
  try {
109304
- const out = (0, import_child_process3.execSync)(command, {
109861
+ const out = (0, import_child_process4.execSync)(command, {
109305
109862
  cwd,
109306
109863
  stdio: ["ignore", "pipe", "ignore"],
109307
109864
  timeout: 3e3,
@@ -109320,11 +109877,11 @@ function resolveCheckoutRepo(cwd) {
109320
109877
  );
109321
109878
  return match ? `${match[1]}/${match[2]}` : null;
109322
109879
  }
109323
- var import_child_process3;
109880
+ var import_child_process4;
109324
109881
  var init_run_registry = __esm({
109325
109882
  "cli/run-registry.ts"() {
109326
109883
  "use strict";
109327
- import_child_process3 = require("child_process");
109884
+ import_child_process4 = require("child_process");
109328
109885
  init_auth();
109329
109886
  init_github_workflow_identity();
109330
109887
  }
@@ -110500,6 +111057,7 @@ var init_cloud_client = __esm({
110500
111057
  init_public_brand();
110501
111058
  init_auth();
110502
111059
  init_cloud_session();
111060
+ init_command_agent();
110503
111061
  init_detect();
110504
111062
  init_run_registry();
110505
111063
  DEFAULT_RNX_CLOUD_ORIGIN = rnxPublicBrand.origin;
@@ -110544,10 +111102,11 @@ var init_cloud_client = __esm({
110544
111102
  plane = "cloud";
110545
111103
  async send(command, options) {
110546
111104
  const timeoutMs = options?.timeoutMs ?? this.explicitTimeoutMs ?? options?.defaultTimeoutMs;
111105
+ const agent = commandAgent(command);
110547
111106
  const body = {
110548
111107
  id: (0, import_node_crypto73.randomUUID)(),
110549
111108
  claimId: this.session.claimId,
110550
- command: cloudCommand(command)
111109
+ command: cloudCommand(agent ? { ...command, agent } : command)
110551
111110
  };
110552
111111
  let response;
110553
111112
  try {
@@ -110620,6 +111179,8 @@ var init_cloud_client = __esm({
110620
111179
  for (const [key2, value] of Object.entries(command)) {
110621
111180
  if (key2 !== "id" && key2 !== "simId") payload[key2] = value;
110622
111181
  }
111182
+ const agent = commandAgent(command);
111183
+ if (agent) payload.agent = agent;
110623
111184
  let response;
110624
111185
  try {
110625
111186
  response = await fetch(
@@ -110791,16 +111352,16 @@ function unrefTimer(timer) {
110791
111352
  timer.unref();
110792
111353
  }
110793
111354
  }
110794
- var import_child_process4, import_crypto2, import_fs4, import_http4, import_os, import_path4, import_ws2, SOOTSIM_CROSS_ORIGIN_EMBEDDER_POLICY, FORCE_CLOSE_GRACE_MS, FORCE_CLOSE_TERMINATE_MS, MAX_RETAINED_DISCONNECTS, DAEMON_HEARTBEAT_INTERVAL_MS, DEFAULT_RUNTIME_UPDATE_INTERVAL_MS, RUNTIME_UPDATE_INTERVAL_ENV, HTTP_MIME_TYPES, CAMERA_FIXTURE_ROUTE, CAMERA_FIXTURE_NAME_RE, SootSimBridgeHost;
111355
+ var import_child_process5, import_crypto2, import_fs6, import_http4, import_os3, import_path5, import_ws2, SOOTSIM_CROSS_ORIGIN_EMBEDDER_POLICY, FORCE_CLOSE_GRACE_MS, FORCE_CLOSE_TERMINATE_MS, MAX_RETAINED_DISCONNECTS, DAEMON_HEARTBEAT_INTERVAL_MS, DEFAULT_RUNTIME_UPDATE_INTERVAL_MS, RUNTIME_UPDATE_INTERVAL_ENV, HTTP_MIME_TYPES, CAMERA_FIXTURE_ROUTE, CAMERA_FIXTURE_NAME_RE, SootSimBridgeHost;
110795
111356
  var init_bridge_host = __esm({
110796
111357
  "src/host/bridge-host.ts"() {
110797
111358
  "use strict";
110798
- import_child_process4 = __toESM(require("child_process"), 1);
111359
+ import_child_process5 = __toESM(require("child_process"), 1);
110799
111360
  import_crypto2 = require("crypto");
110800
- import_fs4 = __toESM(require("fs"), 1);
111361
+ import_fs6 = __toESM(require("fs"), 1);
110801
111362
  import_http4 = require("http");
110802
- import_os = __toESM(require("os"), 1);
110803
- import_path4 = __toESM(require("path"), 1);
111363
+ import_os3 = __toESM(require("os"), 1);
111364
+ import_path5 = __toESM(require("path"), 1);
110804
111365
  import_ws2 = require("ws");
110805
111366
  init_automatic_update_policy();
110806
111367
  init_bridge_constants();
@@ -110968,7 +111529,7 @@ var init_bridge_host = __esm({
110968
111529
  async startAsync(options) {
110969
111530
  if (this.httpServer || this.wss) return this.effectivePort;
110970
111531
  const bootRuntimeDir = this.getActiveRuntime().runtimeDir;
110971
- this.bootstrapping = this.shouldWriteLockfile && (!bootRuntimeDir || !import_fs4.default.existsSync(import_path4.default.join(bootRuntimeDir, "index.html")));
111532
+ this.bootstrapping = this.shouldWriteLockfile && (!bootRuntimeDir || !import_fs6.default.existsSync(import_path5.default.join(bootRuntimeDir, "index.html")));
110972
111533
  for (let attempt = 0; attempt < this.portFallbackCount; attempt++) {
110973
111534
  const candidate = this.preferredPort === 0 ? 0 : this.preferredPort + attempt;
110974
111535
  try {
@@ -111657,10 +112218,10 @@ var init_bridge_host = __esm({
111657
112218
  return;
111658
112219
  }
111659
112220
  const root = cameraFixturesDir();
111660
- const filePath = import_path4.default.join(root, name3);
112221
+ const filePath = import_path5.default.join(root, name3);
111661
112222
  let stats;
111662
112223
  try {
111663
- stats = import_fs4.default.lstatSync(filePath);
112224
+ stats = import_fs6.default.lstatSync(filePath);
111664
112225
  } catch {
111665
112226
  res.writeHead(404, { ...cors, "Content-Type": "text/plain; charset=utf-8" });
111666
112227
  res.end("not found");
@@ -111671,7 +112232,7 @@ var init_bridge_host = __esm({
111671
112232
  res.end("forbidden");
111672
112233
  return;
111673
112234
  }
111674
- const contentType2 = HTTP_MIME_TYPES[import_path4.default.extname(filePath).toLowerCase()] || "application/octet-stream";
112235
+ const contentType2 = HTTP_MIME_TYPES[import_path5.default.extname(filePath).toLowerCase()] || "application/octet-stream";
111675
112236
  sendFileWithRanges(req, res, filePath, stats.size, {
111676
112237
  ...cors,
111677
112238
  "Content-Type": contentType2
@@ -112115,35 +112676,35 @@ var init_bridge_host = __esm({
112115
112676
  return;
112116
112677
  }
112117
112678
  }
112118
- const resolved = import_path4.default.resolve(baseDir, "." + rel);
112119
- const baseWithSep = baseDir.endsWith(import_path4.default.sep) ? baseDir : baseDir + import_path4.default.sep;
112679
+ const resolved = import_path5.default.resolve(baseDir, "." + rel);
112680
+ const baseWithSep = baseDir.endsWith(import_path5.default.sep) ? baseDir : baseDir + import_path5.default.sep;
112120
112681
  if (!resolved.startsWith(baseWithSep) && resolved !== baseDir) {
112121
112682
  res.writeHead(403);
112122
112683
  res.end("forbidden");
112123
112684
  return;
112124
112685
  }
112125
112686
  void ensureRuntimePackFor(baseDir, rel).then(
112126
- () => import_fs4.default.realpath(resolved, (realErr, realResolved) => {
112687
+ () => import_fs6.default.realpath(resolved, (realErr, realResolved) => {
112127
112688
  const servePath = realErr ? resolved : realResolved;
112128
- const servePathWithSep = servePath.endsWith(import_path4.default.sep) ? servePath : servePath + import_path4.default.sep;
112689
+ const servePathWithSep = servePath.endsWith(import_path5.default.sep) ? servePath : servePath + import_path5.default.sep;
112129
112690
  if (!realErr) {
112130
112691
  const realBaseWithSep = (() => {
112131
112692
  try {
112132
- const rb = import_fs4.default.realpathSync(baseDir);
112133
- return rb.endsWith(import_path4.default.sep) ? rb : rb + import_path4.default.sep;
112693
+ const rb = import_fs6.default.realpathSync(baseDir);
112694
+ return rb.endsWith(import_path5.default.sep) ? rb : rb + import_path5.default.sep;
112134
112695
  } catch {
112135
112696
  return baseWithSep;
112136
112697
  }
112137
112698
  })();
112138
- if (!servePathWithSep.startsWith(realBaseWithSep) && servePath + import_path4.default.sep !== realBaseWithSep) {
112699
+ if (!servePathWithSep.startsWith(realBaseWithSep) && servePath + import_path5.default.sep !== realBaseWithSep) {
112139
112700
  res.writeHead(403);
112140
112701
  res.end("forbidden");
112141
112702
  return;
112142
112703
  }
112143
112704
  }
112144
- import_fs4.default.stat(servePath, (err, stats) => {
112705
+ import_fs6.default.stat(servePath, (err, stats) => {
112145
112706
  if (err || !stats?.isFile()) {
112146
- const ext2 = import_path4.default.extname(rel).toLowerCase();
112707
+ const ext2 = import_path5.default.extname(rel).toLowerCase();
112147
112708
  if (ext2 && ext2 !== ".html") {
112148
112709
  res.writeHead(404);
112149
112710
  res.end("not found");
@@ -112154,8 +112715,8 @@ var init_bridge_host = __esm({
112154
112715
  res.end("not found");
112155
112716
  return;
112156
112717
  }
112157
- const indexPath = import_path4.default.join(baseDir, "index.html");
112158
- import_fs4.default.readFile(indexPath, (err2, data) => {
112718
+ const indexPath = import_path5.default.join(baseDir, "index.html");
112719
+ import_fs6.default.readFile(indexPath, (err2, data) => {
112159
112720
  if (err2) {
112160
112721
  res.writeHead(404);
112161
112722
  res.end("not found");
@@ -112175,7 +112736,7 @@ var init_bridge_host = __esm({
112175
112736
  });
112176
112737
  return;
112177
112738
  }
112178
- const ext = import_path4.default.extname(servePath).toLowerCase();
112739
+ const ext = import_path5.default.extname(servePath).toLowerCase();
112179
112740
  const contentType2 = HTTP_MIME_TYPES[ext] || "application/octet-stream";
112180
112741
  res.writeHead(200, {
112181
112742
  "Content-Type": contentType2,
@@ -112188,7 +112749,7 @@ var init_bridge_host = __esm({
112188
112749
  return;
112189
112750
  }
112190
112751
  if (ext === ".html") {
112191
- import_fs4.default.readFile(servePath, (readErr, data) => {
112752
+ import_fs6.default.readFile(servePath, (readErr, data) => {
112192
112753
  if (readErr) {
112193
112754
  try {
112194
112755
  res.end();
@@ -112202,7 +112763,7 @@ var init_bridge_host = __esm({
112202
112763
  });
112203
112764
  return;
112204
112765
  }
112205
- const stream = import_fs4.default.createReadStream(servePath);
112766
+ const stream = import_fs6.default.createReadStream(servePath);
112206
112767
  stream.pipe(res);
112207
112768
  stream.on("error", () => {
112208
112769
  try {
@@ -112290,7 +112851,7 @@ var init_bridge_host = __esm({
112290
112851
  chromiumQueueVerified = /* @__PURE__ */ new Map();
112291
112852
  chromiumLaunchWaiting() {
112292
112853
  const queue2 = readChromiumQueue(
112293
- { fs: import_fs4.default, os: import_os.default, path: import_path4.default, childProcess: import_child_process4.default },
112854
+ { fs: import_fs6.default, os: import_os3.default, path: import_path5.default, childProcess: import_child_process5.default },
112294
112855
  this.chromiumQueueVerified
112295
112856
  );
112296
112857
  const live = new Set(queue2.tickets);
@@ -112372,7 +112933,7 @@ var init_bridge_host = __esm({
112372
112933
  const target = `${filePath}${loc}`;
112373
112934
  const trySpawn = (cmd, args) => new Promise((resolve14) => {
112374
112935
  try {
112375
- const child = (0, import_child_process4.spawn)(cmd, args, { detached: true, stdio: "ignore" });
112936
+ const child = (0, import_child_process5.spawn)(cmd, args, { detached: true, stdio: "ignore" });
112376
112937
  let settled = false;
112377
112938
  child.on("error", () => {
112378
112939
  if (settled) return;
@@ -112927,434 +113488,6 @@ var init_cli_constants = __esm({
112927
113488
  }
112928
113489
  });
112929
113490
 
112930
- // cli/parent-pid.ts
112931
- function getParentPid(pid) {
112932
- if (!cached3) cached3 = build();
112933
- try {
112934
- return cached3(pid);
112935
- } catch {
112936
- return null;
112937
- }
112938
- }
112939
- function getProcessComm(pid) {
112940
- if (!cachedComm) cachedComm = buildComm();
112941
- try {
112942
- return cachedComm(pid);
112943
- } catch {
112944
- return null;
112945
- }
112946
- }
112947
- function getProcessPgid(pid) {
112948
- if (!cachedPgid) cachedPgid = buildPgid();
112949
- try {
112950
- return cachedPgid(pid);
112951
- } catch {
112952
- return null;
112953
- }
112954
- }
112955
- function buildComm() {
112956
- if (process.platform === "linux") {
112957
- return (pid) => {
112958
- try {
112959
- return (0, import_fs5.readFileSync)(`/proc/${pid}/comm`, "utf8").trim() || null;
112960
- } catch {
112961
- return null;
112962
- }
112963
- };
112964
- }
112965
- if (process.platform === "darwin") {
112966
- const ffi = tryBuildDarwinCommFfi();
112967
- if (ffi) return ffi;
112968
- return (pid) => readProcessTable2().get(pid)?.comm || null;
112969
- }
112970
- return () => null;
112971
- }
112972
- function build() {
112973
- if (process.platform === "linux") return buildLinux();
112974
- if (process.platform === "darwin") {
112975
- const ffi = tryBuildDarwinFfi();
112976
- if (ffi) return ffi;
112977
- return (pid) => {
112978
- const ppid = readProcessTable2().get(pid)?.ppid;
112979
- return ppid !== void 0 && ppid > 0 ? ppid : null;
112980
- };
112981
- }
112982
- return () => null;
112983
- }
112984
- function buildPgid() {
112985
- if (process.platform === "linux") {
112986
- return (pid) => {
112987
- try {
112988
- const raw2 = (0, import_fs5.readFileSync)(`/proc/${pid}/stat`, "utf8");
112989
- const end = raw2.lastIndexOf(")");
112990
- if (end < 0) return null;
112991
- const rest = raw2.slice(end + 1).trim().split(/\s+/);
112992
- const pgid = Number(rest[2]);
112993
- return Number.isFinite(pgid) && pgid > 0 ? pgid : null;
112994
- } catch {
112995
- return null;
112996
- }
112997
- };
112998
- }
112999
- if (process.platform === "darwin") {
113000
- const ffi = tryBuildDarwinPgidFfi();
113001
- if (ffi) return ffi;
113002
- return (pid) => {
113003
- const pgid = readProcessTable2().get(pid)?.pgid;
113004
- return pgid !== void 0 && pgid > 0 ? pgid : null;
113005
- };
113006
- }
113007
- return () => null;
113008
- }
113009
- function readProcessTable2() {
113010
- const now = Date.now();
113011
- if (processTable2.readAt && now - processTable2.readAt < PROCESS_TABLE_TTL_MS) {
113012
- return processTable2.rows;
113013
- }
113014
- const rows = /* @__PURE__ */ new Map();
113015
- try {
113016
- const out = (0, import_child_process5.execFileSync)("ps", ["-eo", "pid=,ppid=,pgid=,comm="], {
113017
- encoding: "utf8",
113018
- timeout: 5e3,
113019
- maxBuffer: 8 * 1024 * 1024,
113020
- stdio: ["ignore", "pipe", "ignore"]
113021
- });
113022
- for (const line of out.split("\n")) {
113023
- const parsed = line.trim().match(/^(\d+)\s+(\d+)\s+(\d+)\s+(.*)$/);
113024
- if (!parsed) continue;
113025
- rows.set(Number(parsed[1]), {
113026
- ppid: Number(parsed[2]),
113027
- pgid: Number(parsed[3]),
113028
- comm: (parsed[4].split("/").at(-1) ?? "").slice(0, PBI_COMM_LEN)
113029
- });
113030
- }
113031
- } catch {
113032
- }
113033
- processTable2 = { readAt: now, rows };
113034
- return rows;
113035
- }
113036
- function buildLinux() {
113037
- return (pid) => {
113038
- try {
113039
- const raw2 = (0, import_fs5.readFileSync)(`/proc/${pid}/stat`, "utf8");
113040
- const end = raw2.lastIndexOf(")");
113041
- if (end < 0) return null;
113042
- const rest = raw2.slice(end + 1).trim().split(/\s+/);
113043
- const ppid = Number(rest[1]);
113044
- return Number.isFinite(ppid) && ppid > 0 ? ppid : null;
113045
- } catch {
113046
- return null;
113047
- }
113048
- };
113049
- }
113050
- function tryBuildDarwinFfi() {
113051
- if (!process.versions?.bun) return null;
113052
- try {
113053
- const r = (0, import_module.createRequire)(__sootsim_import_meta_url);
113054
- const { dlopen, FFIType } = r("bun:ffi");
113055
- const lib = dlopen("/usr/lib/libproc.dylib", {
113056
- proc_pidinfo: {
113057
- args: [FFIType.i32, FFIType.i32, FFIType.u64, FFIType.ptr, FFIType.i32],
113058
- returns: FFIType.i32
113059
- }
113060
- });
113061
- const buf = Buffer.alloc(PROC_BSDINFO_SIZE);
113062
- return (pid) => {
113063
- const ret = Number(
113064
- lib.symbols.proc_pidinfo(pid, PROC_PIDTBSDINFO, 0n, buf, PROC_BSDINFO_SIZE)
113065
- );
113066
- if (ret <= 0) return null;
113067
- const ppid = buf.readUInt32LE(PBI_PPID_OFFSET);
113068
- return ppid > 0 ? ppid : null;
113069
- };
113070
- } catch {
113071
- return null;
113072
- }
113073
- }
113074
- function tryBuildDarwinCommFfi() {
113075
- if (!process.versions?.bun) return null;
113076
- try {
113077
- const r = (0, import_module.createRequire)(__sootsim_import_meta_url);
113078
- const { dlopen, FFIType } = r("bun:ffi");
113079
- const lib = dlopen("/usr/lib/libproc.dylib", {
113080
- proc_pidinfo: {
113081
- args: [FFIType.i32, FFIType.i32, FFIType.u64, FFIType.ptr, FFIType.i32],
113082
- returns: FFIType.i32
113083
- }
113084
- });
113085
- const buf = Buffer.alloc(PROC_BSDINFO_SIZE);
113086
- return (pid) => {
113087
- const ret = Number(
113088
- lib.symbols.proc_pidinfo(pid, PROC_PIDTBSDINFO, 0n, buf, PROC_BSDINFO_SIZE)
113089
- );
113090
- if (ret <= 0) return null;
113091
- const raw2 = buf.subarray(PBI_COMM_OFFSET, PBI_COMM_OFFSET + PBI_COMM_LEN);
113092
- const end = raw2.indexOf(0);
113093
- const comm = raw2.subarray(0, end < 0 ? raw2.length : end).toString("utf8");
113094
- return comm || null;
113095
- };
113096
- } catch {
113097
- return null;
113098
- }
113099
- }
113100
- function tryBuildDarwinPgidFfi() {
113101
- if (!process.versions?.bun) return null;
113102
- try {
113103
- const r = (0, import_module.createRequire)(__sootsim_import_meta_url);
113104
- const { dlopen, FFIType } = r("bun:ffi");
113105
- const lib = dlopen("/usr/lib/libproc.dylib", {
113106
- proc_pidinfo: {
113107
- args: [FFIType.i32, FFIType.i32, FFIType.u64, FFIType.ptr, FFIType.i32],
113108
- returns: FFIType.i32
113109
- }
113110
- });
113111
- const buf = Buffer.alloc(PROC_BSDINFO_SIZE);
113112
- return (pid) => {
113113
- const ret = Number(
113114
- lib.symbols.proc_pidinfo(pid, PROC_PIDTBSDINFO, 0n, buf, PROC_BSDINFO_SIZE)
113115
- );
113116
- if (ret <= 0) return null;
113117
- const pgid = buf.readUInt32LE(PBI_PGID_OFFSET);
113118
- return pgid > 0 ? pgid : null;
113119
- };
113120
- } catch {
113121
- return null;
113122
- }
113123
- }
113124
- var import_child_process5, import_fs5, import_module, cached3, cachedComm, cachedPgid, PROCESS_TABLE_TTL_MS, processTable2, PROC_PIDTBSDINFO, PROC_BSDINFO_SIZE, PBI_PPID_OFFSET, PBI_COMM_OFFSET, PBI_COMM_LEN, PBI_PGID_OFFSET;
113125
- var init_parent_pid = __esm({
113126
- "cli/parent-pid.ts"() {
113127
- "use strict";
113128
- import_child_process5 = require("child_process");
113129
- import_fs5 = require("fs");
113130
- import_module = require("module");
113131
- cached3 = null;
113132
- cachedComm = null;
113133
- cachedPgid = null;
113134
- PROCESS_TABLE_TTL_MS = 2e3;
113135
- processTable2 = { readAt: 0, rows: /* @__PURE__ */ new Map() };
113136
- PROC_PIDTBSDINFO = 3;
113137
- PROC_BSDINFO_SIZE = 216;
113138
- PBI_PPID_OFFSET = 16;
113139
- PBI_COMM_OFFSET = 48;
113140
- PBI_COMM_LEN = 16;
113141
- PBI_PGID_OFFSET = 100;
113142
- }
113143
- });
113144
-
113145
- // cli/current-sim.ts
113146
- function findTopAncestor(start, maxDepth = 20) {
113147
- let prev = start;
113148
- let pid = getParentPid(start);
113149
- if (!pid || pid <= 1) {
113150
- const comm = getProcessComm(start);
113151
- if (!comm || start < 1 || IMMORTAL_HOST_COMM_RE.test(comm)) return null;
113152
- return start > 1 || !INIT_COMM_RE.test(comm) ? start : null;
113153
- }
113154
- for (let i = 0; i < maxDepth; i++) {
113155
- const comm = getProcessComm(pid);
113156
- if (comm && IMMORTAL_HOST_COMM_RE.test(comm)) return prev;
113157
- const parent = getParentPid(pid);
113158
- if (!parent || parent <= 1) {
113159
- return comm ? pid : prev;
113160
- }
113161
- prev = pid;
113162
- pid = parent;
113163
- }
113164
- return pid;
113165
- }
113166
- function getCliIdentity() {
113167
- for (const name3 of IDENTITY_ENV_VARS) {
113168
- const value = process.env[name3];
113169
- if (value && value.trim()) {
113170
- return { key: `${name3}:${value.trim()}`, source: name3, stable: true };
113171
- }
113172
- }
113173
- const topPid = findTopAncestor(process.ppid);
113174
- if (topPid) {
113175
- return { key: `gppid-${topPid}`, source: "grand-ppid", stable: true };
113176
- }
113177
- return { key: `pid-${process.ppid}`, source: "ppid", stable: false };
113178
- }
113179
- function getCliIdentityKey() {
113180
- return getCliIdentity().key;
113181
- }
113182
- function getStableOwnerPid() {
113183
- return findTopAncestor(process.ppid);
113184
- }
113185
- function getOwnerProcessGroupId(owner = getStableOwnerPid()) {
113186
- if (!owner || owner <= 1) return null;
113187
- const pgid = getProcessPgid(owner);
113188
- return pgid !== null && pgid > 1 ? pgid : null;
113189
- }
113190
- function getCurrentSimPath() {
113191
- const envPath = process.env[CURRENT_SIM_PATH_ENV];
113192
- if (envPath) {
113193
- return (0, import_path5.resolve)(envPath);
113194
- }
113195
- const key2 = getCliIdentityKey();
113196
- return (0, import_path5.join)((0, import_os2.tmpdir)(), `peach-current-sim-${key2}.json`);
113197
- }
113198
- function legacyCloudCredentialDirectory(filepath) {
113199
- return (0, import_path5.join)((0, import_path5.dirname)(filepath), `${(0, import_path5.basename)(filepath)}.credentials`);
113200
- }
113201
- function readCurrentTarget() {
113202
- const filepath = getCurrentSimPath();
113203
- (0, import_fs6.rmSync)(legacyCloudCredentialDirectory(filepath), { recursive: true, force: true });
113204
- if (!(0, import_fs6.existsSync)(filepath)) return null;
113205
- try {
113206
- const parsed = JSON.parse((0, import_fs6.readFileSync)(filepath, "utf8"));
113207
- if (parsed === null || typeof parsed !== "object") {
113208
- (0, import_fs6.rmSync)(filepath, { force: true });
113209
- return null;
113210
- }
113211
- if (Reflect.get(parsed, "pendingOpen") === true) return null;
113212
- const version2 = Reflect.get(parsed, "version");
113213
- const plane = Reflect.get(parsed, "plane");
113214
- const simId = Reflect.get(parsed, "simId");
113215
- const updatedAt = Reflect.get(parsed, "updatedAt");
113216
- const rawPort = Reflect.get(parsed, "bridgePort");
113217
- const bridgePort = typeof rawPort === "number" && Number.isInteger(rawPort) && rawPort > 0 ? rawPort : void 0;
113218
- if (version2 !== 1 && version2 !== CURRENT_SIM_VERSION || version2 === CURRENT_SIM_VERSION && plane !== "local" || typeof simId !== "string" || !simId.trim() || typeof updatedAt !== "string") {
113219
- (0, import_fs6.rmSync)(filepath, { force: true });
113220
- return null;
113221
- }
113222
- const target = {
113223
- version: CURRENT_SIM_VERSION,
113224
- plane: "local",
113225
- simId: simId.trim(),
113226
- ...bridgePort === void 0 ? {} : { bridgePort },
113227
- updatedAt
113228
- };
113229
- if (version2 === 1) writeSecureJsonAtomic(filepath, target, { durable: false });
113230
- return target;
113231
- } catch {
113232
- (0, import_fs6.rmSync)(filepath, { force: true });
113233
- return null;
113234
- }
113235
- }
113236
- function readCurrentSimId() {
113237
- return readCurrentTarget()?.simId ?? null;
113238
- }
113239
- function writeCurrentSim(simId, bridgePort) {
113240
- const normalized = simId.trim();
113241
- if (!normalized) return;
113242
- writeSecureJsonAtomic(
113243
- getCurrentSimPath(),
113244
- {
113245
- version: CURRENT_SIM_VERSION,
113246
- plane: "local",
113247
- simId: normalized,
113248
- ...bridgePort === void 0 ? {} : { bridgePort },
113249
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
113250
- },
113251
- { durable: false }
113252
- );
113253
- }
113254
- function saveCurrentSimId(simId, bridgePort) {
113255
- writeCurrentSim(simId, bridgePort);
113256
- }
113257
- function replaceCurrentSimId(simId) {
113258
- writeCurrentSim(simId, readCurrentTarget()?.bridgePort);
113259
- }
113260
- function getAgentIdPath() {
113261
- return `${getCurrentSimPath()}.agent-id`;
113262
- }
113263
- function saveAgentId(agentId) {
113264
- writeSecureJsonAtomic(getAgentIdPath(), { agentId }, { durable: false });
113265
- }
113266
- function readAgentId() {
113267
- const filepath = getAgentIdPath();
113268
- if (!(0, import_fs6.existsSync)(filepath)) return void 0;
113269
- try {
113270
- const parsed = JSON.parse((0, import_fs6.readFileSync)(filepath, "utf8"));
113271
- const agentId = parsed !== null && typeof parsed === "object" ? Reflect.get(parsed, "agentId") : void 0;
113272
- return typeof agentId === "string" && agentId.trim() ? agentId.trim() : void 0;
113273
- } catch {
113274
- (0, import_fs6.rmSync)(filepath, { force: true });
113275
- return void 0;
113276
- }
113277
- }
113278
- function clearCurrentSimId() {
113279
- (0, import_fs6.rmSync)(getCurrentSimPath(), { force: true });
113280
- }
113281
- function markOpenPending() {
113282
- writeSecureJsonAtomic(
113283
- getCurrentSimPath(),
113284
- {
113285
- version: CURRENT_SIM_VERSION,
113286
- plane: "local",
113287
- pendingOpen: true,
113288
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
113289
- },
113290
- { durable: false }
113291
- );
113292
- }
113293
- function assertNoPendingOpen() {
113294
- if (!isOpenPending()) return;
113295
- throw new PendingOpenError(
113296
- "the last `peach open` did not pin a sim, so this command would land on whichever tab is connected. run `peach open` again, `peach use <sim>`, or pass --sim <id>"
113297
- );
113298
- }
113299
- function isOpenPending() {
113300
- const filepath = getCurrentSimPath();
113301
- if (!(0, import_fs6.existsSync)(filepath)) return false;
113302
- try {
113303
- const parsed = JSON.parse((0, import_fs6.readFileSync)(filepath, "utf8"));
113304
- return parsed !== null && typeof parsed === "object" && Reflect.get(parsed, "pendingOpen") === true;
113305
- } catch {
113306
- return false;
113307
- }
113308
- }
113309
- var import_fs6, import_os2, import_path5, CURRENT_SIM_VERSION, CURRENT_SIM_PATH_ENV, IDENTITY_ENV_VARS, IMMORTAL_HOST_COMM_RE, INIT_COMM_RE, readCurrentSim, PendingOpenError;
113310
- var init_current_sim = __esm({
113311
- "cli/current-sim.ts"() {
113312
- "use strict";
113313
- import_fs6 = require("fs");
113314
- import_os2 = require("os");
113315
- import_path5 = require("path");
113316
- init_parent_pid();
113317
- init_secure_file();
113318
- CURRENT_SIM_VERSION = 2;
113319
- CURRENT_SIM_PATH_ENV = "PEACH_CLI_CURRENT_SIM_PATH";
113320
- IDENTITY_ENV_VARS = [
113321
- "PEACH_CLI_IDENTITY",
113322
- // explicit override — fastest path, skips all pid lookups
113323
- "CLAUDE_CODE_SESSION_ID",
113324
- // claude code, if ever set
113325
- "CODEX_THREAD_ID",
113326
- // codex / openai agent thread, stable across tool invocations
113327
- // a Team Machine session, per agent run. its other runners set no session
113328
- // variable of their own, and the terminal variables below are inherited from
113329
- // whatever shell started the daemon, so every such agent would share one key.
113330
- "TM_SESSION",
113331
- "TERM_SESSION_ID",
113332
- // macOS Terminal.app + iTerm2
113333
- "ITERM_SESSION_ID",
113334
- // iTerm2 (older variant)
113335
- "TMUX_PANE",
113336
- // tmux — stable per pane
113337
- "STY",
113338
- // GNU screen session
113339
- "KITTY_WINDOW_ID",
113340
- // kitty
113341
- "WEZTERM_PANE",
113342
- // wezterm
113343
- "ALACRITTY_WINDOW_ID",
113344
- // alacritty
113345
- "WINDOWID",
113346
- // X11 terminals
113347
- "VSCODE_INJECTION"
113348
- // vscode integrated terminal
113349
- ];
113350
- IMMORTAL_HOST_COMM_RE = /^(?:tmux|screen)|^tm$/i;
113351
- INIT_COMM_RE = /^(?:init|systemd|launchd|tini|docker-init|dumb-init|catatonit|s6-svscan|runsvdir)$/i;
113352
- readCurrentSim = readCurrentTarget;
113353
- PendingOpenError = class extends Error {
113354
- };
113355
- }
113356
- });
113357
-
113358
113491
  // cli/pause-aware-timeout.ts
113359
113492
  function pausedPids() {
113360
113493
  try {
@@ -113884,12 +114017,14 @@ function createBridge(wsPort, opts = {}) {
113884
114017
  plane: "local",
113885
114018
  async send(cmd, callOpts) {
113886
114019
  const effectiveTimeoutMs = callOpts?.timeoutMs ?? (opts.explicitTimeout ? commandTimeoutMs : callOpts?.defaultTimeoutMs) ?? commandTimeoutMs;
114020
+ const agent = commandAgent(cmd);
114021
+ const sent = agent ? { ...cmd, agent } : cmd;
113887
114022
  const sendOnce = async (defaultSimId, cmdOverride) => {
113888
114023
  await ready;
113889
114024
  if (terminalError) throw terminalError;
113890
114025
  const id = nextId++;
113891
114026
  return new Promise((resolve14, reject) => {
113892
- const payload = { ...cmdOverride ?? cmd, id };
114027
+ const payload = { ...cmdOverride ?? sent, id };
113893
114028
  if (payload.simId === void 0 && defaultSimId) {
113894
114029
  payload.simId = defaultSimId;
113895
114030
  }
@@ -114240,6 +114375,7 @@ var init_ws_bridge = __esm({
114240
114375
  init_cli_constants();
114241
114376
  init_home_paths();
114242
114377
  init_cloud_client();
114378
+ init_command_agent();
114243
114379
  init_current_sim();
114244
114380
  init_pause_aware_timeout();
114245
114381
  init_run_rnx();
@@ -114414,25 +114550,6 @@ var init_src2 = __esm({
114414
114550
  }
114415
114551
  });
114416
114552
 
114417
- // ../peach-kit/src/agent-identity.ts
114418
- function formatLockOwner(owner) {
114419
- const colon = owner.indexOf(":");
114420
- if (colon <= 0) return owner.length > 24 ? `${owner.slice(0, 21)}\u2026` : owner;
114421
- const source = owner.slice(0, colon);
114422
- const value = owner.slice(colon + 1);
114423
- if (source === "PEACH_CLI_IDENTITY" && value) return value;
114424
- const short = value.length > 12 ? `${value.slice(0, 8)}\u2026` : value;
114425
- if (source === "CLAUDE_CODE_SESSION_ID" || source === "CODEX_THREAD_ID") {
114426
- return `agent ${short}`;
114427
- }
114428
- return `${source} ${short}`;
114429
- }
114430
- var init_agent_identity = __esm({
114431
- "../peach-kit/src/agent-identity.ts"() {
114432
- "use strict";
114433
- }
114434
- });
114435
-
114436
114553
  // detox/launch-permissions.ts
114437
114554
  function buildPermissionSeedScript(seed) {
114438
114555
  const inbox = JSON.stringify(PERMISSION_BOOT_SEED_STORAGE_KEY);
@@ -116543,7 +116660,7 @@ function macDesktopLaunchHome(bridgePort) {
116543
116660
  (lock) => lock.bridgePort === bridgePort && isDevBridgeLockfileFresh(lock)
116544
116661
  );
116545
116662
  const homeKey = (0, import_node_crypto76.createHash)("sha256").update(home).digest("hex");
116546
- const dir = (0, import_path7.join)((0, import_os3.tmpdir)(), "peach-desktop-launch", homeKey, String(bridgePort));
116663
+ const dir = (0, import_path7.join)((0, import_os4.tmpdir)(), "peach-desktop-launch", homeKey, String(bridgePort));
116547
116664
  (0, import_fs8.mkdirSync)(dir, { recursive: true });
116548
116665
  if ((0, import_fs8.existsSync)(home)) {
116549
116666
  for (const name3 of (0, import_fs8.readdirSync)(home)) {
@@ -116648,14 +116765,14 @@ function buildMacLaunchUrl(url, opts, nativeApp = false) {
116648
116765
  }
116649
116766
  return deepLink.toString();
116650
116767
  }
116651
- var import_child_process6, import_fs8, import_node_crypto76, import_os3, import_path7, import_url2, import_meta2, _sootsimRoot;
116768
+ var import_child_process6, import_fs8, import_node_crypto76, import_os4, import_path7, import_url2, import_meta2, _sootsimRoot;
116652
116769
  var init_desktop_companion = __esm({
116653
116770
  "cli/desktop-companion.ts"() {
116654
116771
  "use strict";
116655
116772
  import_child_process6 = require("child_process");
116656
116773
  import_fs8 = require("fs");
116657
116774
  import_node_crypto76 = require("node:crypto");
116658
- import_os3 = require("os");
116775
+ import_os4 = require("os");
116659
116776
  import_path7 = require("path");
116660
116777
  import_url2 = require("url");
116661
116778
  init_desktop_host_delivery();
@@ -117209,7 +117326,7 @@ async function launch(opts) {
117209
117326
  }
117210
117327
  }
117211
117328
  const cdpPort = requestedCdpPort ?? await freePort();
117212
- const errLog = (0, import_path8.join)((0, import_os4.tmpdir)(), playwrightHostLogName(Date.now(), process.pid));
117329
+ const errLog = (0, import_path8.join)((0, import_os5.tmpdir)(), playwrightHostLogName(Date.now(), process.pid));
117213
117330
  const connectAckFile = `${errLog}.connected`;
117214
117331
  const admittedFile = `${errLog}.admitted`;
117215
117332
  const completionFile = `${errLog}.completed`;
@@ -117279,14 +117396,14 @@ async function launch(opts) {
117279
117396
  (0, import_fs9.closeSync)(errFd);
117280
117397
  }
117281
117398
  }
117282
- var import_child_process7, import_fs9, import_net3, import_os4, import_path8, playwrightDriver;
117399
+ var import_child_process7, import_fs9, import_net3, import_os5, import_path8, playwrightDriver;
117283
117400
  var init_playwright = __esm({
117284
117401
  "cli/drivers/playwright.ts"() {
117285
117402
  "use strict";
117286
117403
  import_child_process7 = require("child_process");
117287
117404
  import_fs9 = require("fs");
117288
117405
  import_net3 = require("net");
117289
- import_os4 = require("os");
117406
+ import_os5 = require("os");
117290
117407
  import_path8 = require("path");
117291
117408
  init_bridge_constants();
117292
117409
  init_cli_version();
@@ -117709,11 +117826,11 @@ function option(flag, description, hidden) {
117709
117826
  function example(command, description, hidden) {
117710
117827
  return hidden ? { command, description, hidden } : { command, description };
117711
117828
  }
117712
- function verb(v7, description, usage, examples, notes, extras) {
117829
+ function verb2(v7, description, usage, examples, notes, extras) {
117713
117830
  return { verb: v7, description, usage, examples, notes, ...extras };
117714
117831
  }
117715
- function inspectVerbPathKey(group, verb2) {
117716
- return `${group ?? ""}:${verb2}`;
117832
+ function inspectVerbPathKey(group, verb3) {
117833
+ return `${group ?? ""}:${verb3}`;
117717
117834
  }
117718
117835
  var REDACT_OPTION, cliCommandMetas, cliCommandMetaById, cliCommandMetaByName, cliInspectVerbMetas, cliInspectVerbMetasByVerb, cliInspectVerbMetaByPath, cliInspectVerbMetaByVerb;
117719
117836
  var init_meta = __esm({
@@ -120158,7 +120275,7 @@ var init_meta = __esm({
120158
120275
  }
120159
120276
  }
120160
120277
  cliInspectVerbMetas = [
120161
- verb(
120278
+ verb2(
120162
120279
  "describe",
120163
120280
  "show visible UI elements with type, text, position, size, and style. formats the pruned visible semantic tree.",
120164
120281
  [
@@ -120206,7 +120323,7 @@ var init_meta = __esm({
120206
120323
  seeAlso: ["tree", "a11y", "find"]
120207
120324
  }
120208
120325
  ),
120209
- verb(
120326
+ verb2(
120210
120327
  "find",
120211
120328
  "unified finder (text, testid, role, type, pressable, visible, interactive-targets)",
120212
120329
  [
@@ -120261,7 +120378,7 @@ var init_meta = __esm({
120261
120378
  seeAlso: ["describe", "node", "selector"]
120262
120379
  }
120263
120380
  ),
120264
- verb(
120381
+ verb2(
120265
120382
  "count",
120266
120383
  "show total node count",
120267
120384
  ["peach get count [--json]"],
@@ -120274,7 +120391,7 @@ var init_meta = __esm({
120274
120391
  options: [option("--json", "emit { nodes: n } for scripts")]
120275
120392
  }
120276
120393
  ),
120277
- verb(
120394
+ verb2(
120278
120395
  "layout",
120279
120396
  "measure layout: bare for every visible element on the screen (box + radius/padding/fontSize), or with an id for one node",
120280
120397
  ["peach get layout [id] [--json]"],
@@ -120298,7 +120415,7 @@ var init_meta = __esm({
120298
120415
  seeAlso: ["describe", "find", "node"]
120299
120416
  }
120300
120417
  ),
120301
- verb(
120418
+ verb2(
120302
120419
  "tree",
120303
120420
  "dump the node tree",
120304
120421
  ["peach get tree [depth] [--json] [--boxes]"],
@@ -120320,7 +120437,7 @@ var init_meta = __esm({
120320
120437
  seeAlso: ["describe", "a11y", "node"]
120321
120438
  }
120322
120439
  ),
120323
- verb(
120440
+ verb2(
120324
120441
  "a11y",
120325
120442
  "dump the accessibility tree with roles and labels",
120326
120443
  ["peach get a11y [depth]"],
@@ -120333,7 +120450,7 @@ var init_meta = __esm({
120333
120450
  seeAlso: ["describe", "tree", "layout"]
120334
120451
  }
120335
120452
  ),
120336
- verb(
120453
+ verb2(
120337
120454
  "node",
120338
120455
  "resolve testID/id/text to a full node JSON",
120339
120456
  ["peach get node <matcher>"],
@@ -120346,7 +120463,7 @@ var init_meta = __esm({
120346
120463
  seeAlso: ["find", "layout"]
120347
120464
  }
120348
120465
  ),
120349
- verb(
120466
+ verb2(
120350
120467
  "tap",
120351
120468
  "tap a testID, absolute coordinates, or a node resolved from --testid / --text",
120352
120469
  [
@@ -120370,7 +120487,7 @@ var init_meta = __esm({
120370
120487
  order: 10
120371
120488
  }
120372
120489
  ),
120373
- verb(
120490
+ verb2(
120374
120491
  "double-tap",
120375
120492
  "tap the same spot twice with a short gap",
120376
120493
  [
@@ -120392,7 +120509,7 @@ var init_meta = __esm({
120392
120509
  order: 20
120393
120510
  }
120394
120511
  ),
120395
- verb(
120512
+ verb2(
120396
120513
  "tap-text",
120397
120514
  "find a node by text content and tap its center",
120398
120515
  [
@@ -120428,7 +120545,7 @@ var init_meta = __esm({
120428
120545
  order: 30
120429
120546
  }
120430
120547
  ),
120431
- verb(
120548
+ verb2(
120432
120549
  "tap-id",
120433
120550
  "alias of `tap <testid>` that always reads its argument as a testID, numeric ids included",
120434
120551
  ["peach do tap-id <id>"],
@@ -120442,7 +120559,7 @@ var init_meta = __esm({
120442
120559
  order: 40
120443
120560
  }
120444
120561
  ),
120445
- verb(
120562
+ verb2(
120446
120563
  "tap-best",
120447
120564
  "tap by query: try testID first, then visible text. one command, two strategies",
120448
120565
  ["peach do tap-best <query>"],
@@ -120462,7 +120579,7 @@ var init_meta = __esm({
120462
120579
  order: 41
120463
120580
  }
120464
120581
  ),
120465
- verb(
120582
+ verb2(
120466
120583
  "scan",
120467
120584
  "inject a synthetic barcode scan into the active expo-camera scan session",
120468
120585
  ["peach do scan <text> [--format <web-format>]"],
@@ -120485,7 +120602,7 @@ var init_meta = __esm({
120485
120602
  order: 10
120486
120603
  }
120487
120604
  ),
120488
- verb(
120605
+ verb2(
120489
120606
  "type",
120490
120607
  "type text through the iOS keyboard (requires a focused input)",
120491
120608
  ["peach do type <text>"],
@@ -120499,7 +120616,7 @@ var init_meta = __esm({
120499
120616
  order: 10
120500
120617
  }
120501
120618
  ),
120502
- verb(
120619
+ verb2(
120503
120620
  "type-into",
120504
120621
  "find an input by testID, tap to focus, then type text",
120505
120622
  ["peach do type-into <id> <text>"],
@@ -120513,7 +120630,7 @@ var init_meta = __esm({
120513
120630
  order: 20
120514
120631
  }
120515
120632
  ),
120516
- verb(
120633
+ verb2(
120517
120634
  "key",
120518
120635
  "press a special keyboard key",
120519
120636
  ["peach do key <name>"],
@@ -120527,7 +120644,7 @@ var init_meta = __esm({
120527
120644
  order: 30
120528
120645
  }
120529
120646
  ),
120530
- verb(
120647
+ verb2(
120531
120648
  "key-sequence",
120532
120649
  "press multiple visual keyboard keys in order",
120533
120650
  ["peach do key-sequence <key> [<key> ...]"],
@@ -120541,7 +120658,7 @@ var init_meta = __esm({
120541
120658
  order: 40
120542
120659
  }
120543
120660
  ),
120544
- verb(
120661
+ verb2(
120545
120662
  "keycode",
120546
120663
  "press DOM-style key codes through the visual keyboard",
120547
120664
  ["peach do keycode <code> [<code> ...]"],
@@ -120555,13 +120672,13 @@ var init_meta = __esm({
120555
120672
  order: 50
120556
120673
  }
120557
120674
  ),
120558
- verb("dismiss", "dismiss the keyboard", ["peach do dismiss"], void 0, void 0, {
120675
+ verb2("dismiss", "dismiss the keyboard", ["peach do dismiss"], void 0, void 0, {
120559
120676
  group: "do",
120560
120677
  subgroup: "text input",
120561
120678
  shortDescription: "dismiss the iOS keyboard",
120562
120679
  order: 60
120563
120680
  }),
120564
- verb(
120681
+ verb2(
120565
120682
  "scroll",
120566
120683
  "scroll a scrollview by testID",
120567
120684
  ["peach do scroll <id> <x> <y>", "peach do scroll --testid <id> <x> <y>"],
@@ -120578,7 +120695,7 @@ var init_meta = __esm({
120578
120695
  order: 10
120579
120696
  }
120580
120697
  ),
120581
- verb(
120698
+ verb2(
120582
120699
  "drag",
120583
120700
  "drag from one point to another using real PointerEvent dispatch",
120584
120701
  ["peach do drag <x1> <y1> <x2> <y2> [steps] [stepMs]"],
@@ -120592,7 +120709,7 @@ var init_meta = __esm({
120592
120709
  order: 20
120593
120710
  }
120594
120711
  ),
120595
- verb(
120712
+ verb2(
120596
120713
  "swipe",
120597
120714
  "swipe gesture (drag with fewer steps)",
120598
120715
  ["peach do swipe <x1> <y1> <x2> <y2> [steps] [stepMs]"],
@@ -120606,7 +120723,7 @@ var init_meta = __esm({
120606
120723
  order: 30
120607
120724
  }
120608
120725
  ),
120609
- verb(
120726
+ verb2(
120610
120727
  "long-press",
120611
120728
  "hold a press on a testID or at coordinates",
120612
120729
  [
@@ -120628,7 +120745,7 @@ var init_meta = __esm({
120628
120745
  order: 40
120629
120746
  }
120630
120747
  ),
120631
- verb(
120748
+ verb2(
120632
120749
  "touch",
120633
120750
  "low-level touch primitives; a pointer lives within one batch, so chain its phases with --then",
120634
120751
  ["peach do touch <down|move|up|cancel> <x> <y> [pointerId] --then touch ..."],
@@ -120646,7 +120763,7 @@ var init_meta = __esm({
120646
120763
  order: 50
120647
120764
  }
120648
120765
  ),
120649
- verb(
120766
+ verb2(
120650
120767
  "gesture",
120651
120768
  "preset gestures such as scrolls and edge swipes",
120652
120769
  ["peach do gesture <preset> [durationMs]"],
@@ -120668,7 +120785,7 @@ var init_meta = __esm({
120668
120785
  order: 60
120669
120786
  }
120670
120787
  ),
120671
- verb(
120788
+ verb2(
120672
120789
  "pinch",
120673
120790
  "two-pointer pinch helper",
120674
120791
  ["peach do pinch <x1> <y1> <x2> <y2> <x1'> <y1'> <x2'> <y2'> [steps] [stepMs]"],
@@ -120682,7 +120799,7 @@ var init_meta = __esm({
120682
120799
  order: 70
120683
120800
  }
120684
120801
  ),
120685
- verb(
120802
+ verb2(
120686
120803
  "state",
120687
120804
  "dump raw runtime state (shell, worker, keyboard, node, scroll, hit, gesture, ownership)",
120688
120805
  [
@@ -120719,7 +120836,7 @@ var init_meta = __esm({
120719
120836
  ),
120720
120837
  // `shell` is a top-level command; its help comes from the CliCommandMeta
120721
120838
  // entry above, not a verb meta. see renderCliCommandHelp dispatch.
120722
- verb(
120839
+ verb2(
120723
120840
  "js",
120724
120841
  "evaluate javascript in the browser context",
120725
120842
  ["peach debug js <expression> [--tenant]"],
@@ -120737,7 +120854,7 @@ var init_meta = __esm({
120737
120854
  seeAlso: ["state"]
120738
120855
  }
120739
120856
  ),
120740
- verb(
120857
+ verb2(
120741
120858
  "errors",
120742
120859
  "show recent console errors",
120743
120860
  ["peach get errors [n|clear] [--json]"],
@@ -120755,7 +120872,7 @@ var init_meta = __esm({
120755
120872
  seeAlso: ["warnings", "requests", "logs"]
120756
120873
  }
120757
120874
  ),
120758
- verb(
120875
+ verb2(
120759
120876
  "warnings",
120760
120877
  "show recent console warnings",
120761
120878
  ["peach get warnings [n] [--json]"],
@@ -120769,7 +120886,7 @@ var init_meta = __esm({
120769
120886
  seeAlso: ["errors", "logs"]
120770
120887
  }
120771
120888
  ),
120772
- verb(
120889
+ verb2(
120773
120890
  "requests",
120774
120891
  "show recent failed network requests",
120775
120892
  ["peach get requests [n|all n|clear] [--json]"],
@@ -120787,7 +120904,7 @@ var init_meta = __esm({
120787
120904
  seeAlso: ["errors", "network"]
120788
120905
  }
120789
120906
  ),
120790
- verb(
120907
+ verb2(
120791
120908
  "diagnosis",
120792
120909
  'composed "what just went wrong?" report',
120793
120910
  ["peach get diagnosis [--since <duration>] [--include <csv>] [--json]"],
@@ -120814,7 +120931,7 @@ var init_meta = __esm({
120814
120931
  seeAlso: ["errors", "warnings", "requests", "network"]
120815
120932
  }
120816
120933
  ),
120817
- verb(
120934
+ verb2(
120818
120935
  "animations",
120819
120936
  "list every active animation with id, kind, progress, and current value",
120820
120937
  ["peach get animations", "peach get animations --json"],
@@ -120830,7 +120947,7 @@ var init_meta = __esm({
120830
120947
  seeAlso: ["animation", "stop-animation", "state"]
120831
120948
  }
120832
120949
  ),
120833
- verb(
120950
+ verb2(
120834
120951
  "animation",
120835
120952
  "full detail for a single active animation by id",
120836
120953
  ["peach get animation <id>"],
@@ -120843,7 +120960,7 @@ var init_meta = __esm({
120843
120960
  seeAlso: ["animations", "stop-animation"]
120844
120961
  }
120845
120962
  ),
120846
- verb(
120963
+ verb2(
120847
120964
  "state",
120848
120965
  "runtime dashboard: url, active animation counts, diagnostics, shell scene",
120849
120966
  ["peach get state"],
@@ -120856,7 +120973,7 @@ var init_meta = __esm({
120856
120973
  seeAlso: ["animations", "errors", "keyboard"]
120857
120974
  }
120858
120975
  ),
120859
- verb(
120976
+ verb2(
120860
120977
  "memory",
120861
120978
  "per-worker live object counts (nodes, paragraphs, yoga nodes, pictures, raster images) + image cache + JS heaps; --watch samples over time and reports per-counter slopes",
120862
120979
  [
@@ -120888,7 +121005,7 @@ var init_meta = __esm({
120888
121005
  seeAlso: ["state", "perf"]
120889
121006
  }
120890
121007
  ),
120891
- verb(
121008
+ verb2(
120892
121009
  "stop-animation",
120893
121010
  "stop a running animation by id, or stop all active animations",
120894
121011
  ["peach do stop-animation <id|all>"],
@@ -120904,7 +121021,7 @@ var init_meta = __esm({
120904
121021
  seeAlso: ["animations", "animation"]
120905
121022
  }
120906
121023
  ),
120907
- verb(
121024
+ verb2(
120908
121025
  "trace",
120909
121026
  "opt-in trace recorders: shell animation frames or per-tick animation values",
120910
121027
  [
@@ -120926,7 +121043,7 @@ var init_meta = __esm({
120926
121043
  seeAlso: ["animations", "animation", "stop-animation"]
120927
121044
  }
120928
121045
  ),
120929
- verb(
121046
+ verb2(
120930
121047
  "image-audit",
120931
121048
  "for every image the compositor actually drew, how many source pixels it landed on each device pixel",
120932
121049
  ["peach debug image-audit [--min <ratio>] [--all] [--json]"],
@@ -120955,7 +121072,7 @@ var init_meta = __esm({
120955
121072
  seeAlso: ["screenshot", "memory"]
120956
121073
  }
120957
121074
  ),
120958
- verb(
121075
+ verb2(
120959
121076
  "snapshot",
120960
121077
  "capture a tree snapshot (layout + transform + opacity) for later diffing",
120961
121078
  ["peach debug snapshot [label]"],
@@ -120972,7 +121089,7 @@ var init_meta = __esm({
120972
121089
  seeAlso: ["snapshots", "diff", "state"]
120973
121090
  }
120974
121091
  ),
120975
- verb(
121092
+ verb2(
120976
121093
  "snapshots",
120977
121094
  "list the labels of every captured tree snapshot",
120978
121095
  ["peach debug snapshots"],
@@ -120985,7 +121102,7 @@ var init_meta = __esm({
120985
121102
  seeAlso: ["snapshot", "diff"]
120986
121103
  }
120987
121104
  ),
120988
- verb(
121105
+ verb2(
120989
121106
  "diff",
120990
121107
  "compare two captured snapshots: added / removed / changed nodes",
120991
121108
  ["peach debug diff <labelA> <labelB>"],
@@ -121003,7 +121120,7 @@ var init_meta = __esm({
121003
121120
  seeAlso: ["snapshot", "snapshots", "clear-snapshots"]
121004
121121
  }
121005
121122
  ),
121006
- verb(
121123
+ verb2(
121007
121124
  "clear-snapshots",
121008
121125
  "drop a labeled snapshot (or all snapshots if no label is given)",
121009
121126
  ["peach debug clear-snapshots [label]"],
@@ -121019,7 +121136,7 @@ var init_meta = __esm({
121019
121136
  seeAlso: ["snapshot", "snapshots", "diff"]
121020
121137
  }
121021
121138
  ),
121022
- verb(
121139
+ verb2(
121023
121140
  "find",
121024
121141
  "dump engine-internal nodes by category (e.g. all Sheet.Frame portals)",
121025
121142
  ["peach debug find sheets", "peach debug find portals"],
@@ -121042,7 +121159,7 @@ var init_meta = __esm({
121042
121159
  seeAlso: ["state", "describe"]
121043
121160
  }
121044
121161
  ),
121045
- verb(
121162
+ verb2(
121046
121163
  "record",
121047
121164
  "toggle the debug event ring buffer (off / on)",
121048
121165
  ["peach debug record [on|off]"],
@@ -121059,7 +121176,7 @@ var init_meta = __esm({
121059
121176
  seeAlso: ["recent", "clear-events"]
121060
121177
  }
121061
121178
  ),
121062
- verb(
121179
+ verb2(
121063
121180
  "recent",
121064
121181
  "tail the last N events from the debug ring buffer (optionally filtered by channel)",
121065
121182
  [
@@ -121084,7 +121201,7 @@ var init_meta = __esm({
121084
121201
  seeAlso: ["record", "clear-events"]
121085
121202
  }
121086
121203
  ),
121087
- verb(
121204
+ verb2(
121088
121205
  "clear-events",
121089
121206
  "drop everything currently in the debug event ring buffer",
121090
121207
  ["peach debug clear-events"],
@@ -121097,7 +121214,7 @@ var init_meta = __esm({
121097
121214
  seeAlso: ["record", "recent"]
121098
121215
  }
121099
121216
  ),
121100
- verb(
121217
+ verb2(
121101
121218
  "sample-color",
121102
121219
  "average the canvas color over a pixel or rect; returns hex + rgba",
121103
121220
  [
@@ -121126,7 +121243,7 @@ var init_meta = __esm({
121126
121243
  seeAlso: ["screenshot"]
121127
121244
  }
121128
121245
  ),
121129
- verb(
121246
+ verb2(
121130
121247
  "screenshot",
121131
121248
  "capture the canvas (full or a cropped area) as PNG",
121132
121249
  [
@@ -121152,7 +121269,7 @@ var init_meta = __esm({
121152
121269
  seeAlso: ["sample-color", "record"]
121153
121270
  }
121154
121271
  ),
121155
- verb(
121272
+ verb2(
121156
121273
  "url",
121157
121274
  "show the current page URL",
121158
121275
  ["peach get url [--json]"],
@@ -121165,7 +121282,7 @@ var init_meta = __esm({
121165
121282
  options: [option("--json", "emit { url } for scripts")]
121166
121283
  }
121167
121284
  ),
121168
- verb(
121285
+ verb2(
121169
121286
  "reload",
121170
121287
  "reload the page and wait for reconnection",
121171
121288
  ["peach do reload"],
@@ -121179,7 +121296,7 @@ var init_meta = __esm({
121179
121296
  order: 10
121180
121297
  }
121181
121298
  ),
121182
- verb(
121299
+ verb2(
121183
121300
  "globals",
121184
121301
  "list all __sootsim* globals available in the browser",
121185
121302
  ["peach get globals"],
@@ -121191,7 +121308,7 @@ var init_meta = __esm({
121191
121308
  shortDescription: "list available __sootsim* globals"
121192
121309
  }
121193
121310
  ),
121194
- verb(
121311
+ verb2(
121195
121312
  "sleep",
121196
121313
  "simple local pause between commands",
121197
121314
  ["peach do sleep [seconds]"],
@@ -121205,7 +121322,7 @@ var init_meta = __esm({
121205
121322
  order: 40
121206
121323
  }
121207
121324
  ),
121208
- verb(
121325
+ verb2(
121209
121326
  "wait",
121210
121327
  "wait for the current sim to reconnect",
121211
121328
  ["peach do wait [seconds]"],
@@ -121219,7 +121336,7 @@ var init_meta = __esm({
121219
121336
  order: 20
121220
121337
  }
121221
121338
  ),
121222
- verb(
121339
+ verb2(
121223
121340
  "settle",
121224
121341
  "wait until the visible layout is stable (default max 3s)",
121225
121342
  ["peach do settle [seconds] [--strict]"],
@@ -121239,7 +121356,7 @@ var init_meta = __esm({
121239
121356
  order: 30
121240
121357
  }
121241
121358
  ),
121242
- verb(
121359
+ verb2(
121243
121360
  "ready",
121244
121361
  "block until the guest app bundle is loaded and painted",
121245
121362
  ["peach wait ready [--max-ms <ms>] [--painted]"],
@@ -121266,7 +121383,7 @@ var init_meta = __esm({
121266
121383
  order: 10
121267
121384
  }
121268
121385
  ),
121269
- verb(
121386
+ verb2(
121270
121387
  "idle",
121271
121388
  "block until animations, rAF queue, and layout are all settled",
121272
121389
  ["peach wait idle [--max-ms <ms>] [--strict]"],
@@ -121283,7 +121400,7 @@ var init_meta = __esm({
121283
121400
  order: 20
121284
121401
  }
121285
121402
  ),
121286
- verb(
121403
+ verb2(
121287
121404
  "selector",
121288
121405
  "block until a node with <testid> or --text is visible with non-zero layout (or absent with --gone)",
121289
121406
  [
@@ -121326,7 +121443,7 @@ var init_meta = __esm({
121326
121443
  order: 30
121327
121444
  }
121328
121445
  ),
121329
- verb(
121446
+ verb2(
121330
121447
  "event",
121331
121448
  "block until a semantic timeline event of <kind> appears",
121332
121449
  [
@@ -121370,7 +121487,7 @@ var init_meta = __esm({
121370
121487
  order: 40
121371
121488
  }
121372
121489
  ),
121373
- verb(
121490
+ verb2(
121374
121491
  "dispatch",
121375
121492
  "dispatch a raw keyboard key (bypasses visual shift state)",
121376
121493
  ["peach do dispatch <char>"],
@@ -121384,7 +121501,7 @@ var init_meta = __esm({
121384
121501
  order: 70
121385
121502
  }
121386
121503
  ),
121387
- verb(
121504
+ verb2(
121388
121505
  "keyboard",
121389
121506
  "on-screen keyboard state (type, returnKey, autoCap, mode, shift, accessory)",
121390
121507
  ["peach get keyboard [--json]"],
@@ -121398,7 +121515,7 @@ var init_meta = __esm({
121398
121515
  seeAlso: ["type", "dismiss", "state"]
121399
121516
  }
121400
121517
  ),
121401
- verb(
121518
+ verb2(
121402
121519
  "screens",
121403
121520
  "list the current tenant route, navigation stack, active app, modal stack, and keyboard",
121404
121521
  ["peach get screens [--json]"],
@@ -121425,8 +121542,8 @@ var init_meta = __esm({
121425
121542
  cliInspectVerbMetaByPath.set(inspectVerbPathKey(meta.group, meta.verb), meta);
121426
121543
  }
121427
121544
  cliInspectVerbMetaByVerb = new Map(
121428
- Array.from(cliInspectVerbMetasByVerb, ([verb2, metas]) => [
121429
- verb2,
121545
+ Array.from(cliInspectVerbMetasByVerb, ([verb3, metas]) => [
121546
+ verb3,
121430
121547
  metas.find((meta) => !meta.group) ?? metas[0]
121431
121548
  ])
121432
121549
  );
@@ -121595,10 +121712,10 @@ function realPathOrSelf(p) {
121595
121712
  }
121596
121713
  }
121597
121714
  function macPlistPath() {
121598
- return (0, import_path9.resolve)((0, import_os5.homedir)(), "Library/LaunchAgents", `${SERVICE_LABEL_MAC}.plist`);
121715
+ return (0, import_path9.resolve)((0, import_os6.homedir)(), "Library/LaunchAgents", `${SERVICE_LABEL_MAC}.plist`);
121599
121716
  }
121600
121717
  function linuxUnitPath() {
121601
- return (0, import_path9.resolve)((0, import_os5.homedir)(), ".config/systemd/user", `${SERVICE_NAME_LINUX}.service`);
121718
+ return (0, import_path9.resolve)((0, import_os6.homedir)(), ".config/systemd/user", `${SERVICE_NAME_LINUX}.service`);
121602
121719
  }
121603
121720
  function getDaemonServiceStatus() {
121604
121721
  if (shouldSkipPersistentDaemon()) return { supported: false, installed: false };
@@ -121863,13 +121980,13 @@ async function daemonRestart() {
121863
121980
  console.error(` unsupported platform: ${process.platform}`);
121864
121981
  peachExit(1);
121865
121982
  }
121866
- var import_child_process8, import_fs10, import_os5, import_path9, SERVICE_LABEL_MAC, SERVICE_NAME_LINUX, LOG_DIR, LOG_DIR_LINUX, LSOF;
121983
+ var import_child_process8, import_fs10, import_os6, import_path9, SERVICE_LABEL_MAC, SERVICE_NAME_LINUX, LOG_DIR, LOG_DIR_LINUX, LSOF;
121867
121984
  var init_daemon = __esm({
121868
121985
  "cli/commands/daemon.ts"() {
121869
121986
  "use strict";
121870
121987
  import_child_process8 = require("child_process");
121871
121988
  import_fs10 = require("fs");
121872
- import_os5 = require("os");
121989
+ import_os6 = require("os");
121873
121990
  import_path9 = require("path");
121874
121991
  init_bridge_constants();
121875
121992
  init_desktop_host_delivery();
@@ -121882,8 +121999,8 @@ var init_daemon = __esm({
121882
121999
  init_daemon_mac_app();
121883
122000
  SERVICE_LABEL_MAC = "dev.sootsim.daemon";
121884
122001
  SERVICE_NAME_LINUX = "sootsim-daemon";
121885
- LOG_DIR = (0, import_path9.resolve)((0, import_os5.homedir)(), "Library/Logs/sootsim");
121886
- LOG_DIR_LINUX = (0, import_path9.resolve)((0, import_os5.homedir)(), ".local/state/sootsim");
122002
+ LOG_DIR = (0, import_path9.resolve)((0, import_os6.homedir)(), "Library/Logs/sootsim");
122003
+ LOG_DIR_LINUX = (0, import_path9.resolve)((0, import_os6.homedir)(), ".local/state/sootsim");
121887
122004
  LSOF = process.platform === "darwin" ? "/usr/sbin/lsof" : "lsof";
121888
122005
  }
121889
122006
  });
@@ -122087,7 +122204,7 @@ examples:
122087
122204
  }
122088
122205
  console.log();
122089
122206
  }
122090
- const workDir = (0, import_path10.join)((0, import_os6.tmpdir)(), `peach-install-${Date.now()}`);
122207
+ const workDir = (0, import_path10.join)((0, import_os7.tmpdir)(), `peach-install-${Date.now()}`);
122091
122208
  const downloadPath = (0, import_path10.join)(workDir, target.filename);
122092
122209
  let lastDraw = 0;
122093
122210
  process.stdout.write(` Downloading ${target.filename}...
@@ -122187,13 +122304,13 @@ async function installNativeHost(args, force) {
122187
122304
  console.log(" peach desktop Launch the native desktop host");
122188
122305
  console.log(" peach open <target> --driver desktop Open a demo or bundle in it");
122189
122306
  }
122190
- var import_child_process9, import_fs11, import_os6, import_path10, DOWNLOAD_BASE;
122307
+ var import_child_process9, import_fs11, import_os7, import_path10, DOWNLOAD_BASE;
122191
122308
  var init_install_desktop = __esm({
122192
122309
  "cli/commands/install-desktop.ts"() {
122193
122310
  "use strict";
122194
122311
  import_child_process9 = require("child_process");
122195
122312
  import_fs11 = require("fs");
122196
- import_os6 = require("os");
122313
+ import_os7 = require("os");
122197
122314
  import_path10 = require("path");
122198
122315
  init_desktop_host_delivery();
122199
122316
  init_home_paths();
@@ -137331,16 +137448,16 @@ async function readKotlinApp(moduleArg, options) {
137331
137448
  const name3 = element.attributes[`${ANDROID_NS}name`];
137332
137449
  if (!name3) throw new Error(`${manifestFile}: <${element.name}> has no android:name`);
137333
137450
  if (element.name === "activity") return className2(name3);
137334
- const targetName = element.attributes[`${ANDROID_NS}targetActivity`];
137451
+ const targetName2 = element.attributes[`${ANDROID_NS}targetActivity`];
137335
137452
  const activity = activities.find(
137336
- (candidate) => className2(candidate.attributes[`${ANDROID_NS}name`] ?? "") === className2(targetName ?? "")
137453
+ (candidate) => className2(candidate.attributes[`${ANDROID_NS}name`] ?? "") === className2(targetName2 ?? "")
137337
137454
  );
137338
- if (!targetName || !activity)
137455
+ if (!targetName2 || !activity)
137339
137456
  throw new Error(
137340
137457
  `${manifestFile}: activity-alias ${name3} targets no declared activity`
137341
137458
  );
137342
137459
  if (!enabled(activity)) return null;
137343
- return className2(targetName);
137460
+ return className2(targetName2);
137344
137461
  };
137345
137462
  const applicationEnabled = enabled(application);
137346
137463
  let chosen;
@@ -142345,8 +142462,8 @@ function randomInputText(step) {
142345
142462
  throw new Error("not a random input step");
142346
142463
  }
142347
142464
  }
142348
- function normalizeBareStringStep(verb2) {
142349
- switch (verb2) {
142465
+ function normalizeBareStringStep(verb3) {
142466
+ switch (verb3) {
142350
142467
  case "back":
142351
142468
  return { back: true };
142352
142469
  case "hideKeyboard":
@@ -142373,7 +142490,7 @@ function normalizeBareStringStep(verb2) {
142373
142490
  case "scrollUp":
142374
142491
  return { scroll: { direction: "UP" } };
142375
142492
  default:
142376
- return { [verb2]: true };
142493
+ return { [verb3]: true };
142377
142494
  }
142378
142495
  }
142379
142496
  function parseFlowSteps(content) {