@swmansion/argent 0.34.1-next.34 → 0.34.1-next.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli-cmds.mjs CHANGED
@@ -36256,7 +36256,7 @@ function isCi(env = process.env) {
36256
36256
  var SESSION_ID2 = randomUUID5();
36257
36257
  function readCliVersion() {
36258
36258
  if (true) {
36259
- return "0.34.1-next.34";
36259
+ return "0.34.1-next.35";
36260
36260
  }
36261
36261
  return "0.0.0";
36262
36262
  }
@@ -16942,7 +16942,7 @@ function isCi(env = process.env) {
16942
16942
  var SESSION_ID = randomUUID4();
16943
16943
  function readCliVersion() {
16944
16944
  if (true) {
16945
- return "0.34.1-next.34";
16945
+ return "0.34.1-next.35";
16946
16946
  }
16947
16947
  return "0.0.0";
16948
16948
  }
@@ -101440,7 +101440,7 @@ function isCi(env = process.env) {
101440
101440
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
101441
101441
  function readCliVersion() {
101442
101442
  if (true) {
101443
- return "0.34.1-next.34";
101443
+ return "0.34.1-next.35";
101444
101444
  }
101445
101445
  return "0.0.0";
101446
101446
  }
@@ -151244,6 +151244,7 @@ init_external_devices();
151244
151244
  var import_node_crypto13 = require("node:crypto");
151245
151245
  init_src2();
151246
151246
  init_device_info();
151247
+ init_external_devices();
151247
151248
  init_macos_app_kind();
151248
151249
  function deviceKey2(target) {
151249
151250
  const logicalId = target.reactNative?.logicalDeviceId;
@@ -151275,14 +151276,37 @@ function describeDevice(target) {
151275
151276
  if (macBundleId) return `Mac app ${macBundleId} (${logicalId})`;
151276
151277
  return logicalId ? `${target.deviceName ?? "unknown"} (${logicalId})` : `${target.deviceName ?? "unknown"} (legacy inspector \u2014 no logicalDeviceId)`;
151277
151278
  }
151278
- function macosAppTargets(pool, bundleId, port) {
151279
- const own2 = pool.filter((t) => macosAppBundleIdOf(t)?.toLowerCase() === bundleId.toLowerCase());
151280
- if (own2.length) return own2;
151279
+ function metroDevices(pool) {
151281
151280
  const devices2 = /* @__PURE__ */ new Map();
151282
151281
  for (const t of pool) {
151283
151282
  const key2 = deviceKey2(t);
151284
151283
  if (key2 && !devices2.has(key2)) devices2.set(key2, describeDevice(t));
151285
151284
  }
151285
+ return devices2;
151286
+ }
151287
+ function targetsOfOnlyDeviceNamed(pool, name) {
151288
+ if (name === void 0) return void 0;
151289
+ const named = pool.filter((t) => t.deviceName === name);
151290
+ return new Set(named.map(deviceKey2)).size === 1 ? named : void 0;
151291
+ }
151292
+ function nameMetroLists(simulatorName) {
151293
+ return simulatorName.split("&")[0].replaceAll("+", " ");
151294
+ }
151295
+ async function simulatorNameOnSharedMetro(deviceId, targets) {
151296
+ if (isExternalId(deviceId)) return void 0;
151297
+ const device = resolveDevice(deviceId);
151298
+ if (device.platform !== "ios" || device.kind !== "simulator") return void 0;
151299
+ if (metroDevices(targets).size < 2) return void 0;
151300
+ const simulators = await listIosSimulators().catch(() => []);
151301
+ const booted = simulators.filter((sim) => sim.state === "Booted");
151302
+ const name = booted.find((sim) => sim.udid === deviceId)?.name;
151303
+ if (name === void 0 || nameMetroLists(name) !== name) return void 0;
151304
+ return booted.filter((sim) => nameMetroLists(sim.name) === name).length === 1 ? name : void 0;
151305
+ }
151306
+ function macosAppTargets(pool, bundleId, port) {
151307
+ const own2 = pool.filter((t) => macosAppBundleIdOf(t)?.toLowerCase() === bundleId.toLowerCase());
151308
+ if (own2.length) return own2;
151309
+ const devices2 = metroDevices(pool);
151286
151310
  const catalyst = trackedMacosAppKind(bundleId) === "catalyst";
151287
151311
  const noVendorId = catalyst && !trackedMacosAppVendorId(bundleId) ? `argent does not know the identifierForVendor of the Mac Catalyst app ${bundleId}, which React Native puts in the runtime's id: argent's library reports it when argent starts the app, and the library of this start did not. Run restart-app, then retry; if this message stays, update argent. ` : "";
151288
151312
  throw new FailureError(
@@ -151310,14 +151334,14 @@ function selectTarget(targets, port, options) {
151310
151334
  } else if (typeof options?.deviceId === "string" && options.deviceId) {
151311
151335
  const deviceId = options.deviceId;
151312
151336
  const filtered = candidates.filter((t) => t.reactNative?.logicalDeviceId === deviceId);
151337
+ const simulatorName = typeof options.simulatorName === "string" ? options.simulatorName : void 0;
151338
+ const sameName = targetsOfOnlyDeviceNamed(pool, simulatorName);
151313
151339
  if (filtered.length) {
151314
151340
  candidates = filtered;
151341
+ } else if (sameName) {
151342
+ candidates = sameName;
151315
151343
  } else {
151316
- const distinctDevices = /* @__PURE__ */ new Map();
151317
- for (const t of pool) {
151318
- const key2 = deviceKey2(t);
151319
- if (key2 && !distinctDevices.has(key2)) distinctDevices.set(key2, describeDevice(t));
151320
- }
151344
+ const distinctDevices = metroDevices(pool);
151321
151345
  if (distinctDevices.size > 1) {
151322
151346
  const listed = [...distinctDevices.values()].join(", ");
151323
151347
  throw new FailureError(
@@ -151751,7 +151775,8 @@ var jsRuntimeDebuggerBlueprint = {
151751
151775
  });
151752
151776
  const selected = selectTarget(metro.targets, port, {
151753
151777
  ...options,
151754
- deviceId
151778
+ deviceId,
151779
+ simulatorName: await simulatorNameOnSharedMetro(deviceId, metro.targets)
151755
151780
  });
151756
151781
  const onPublishedBundler = publishedMetroPort(deviceId, port) === void 0;
151757
151782
  const proxied = onPublishedBundler ? externalJsDebuggerUrl(deviceId) : void 0;
@@ -180507,7 +180532,7 @@ function createStopAllSimulatorServersTool(registry2) {
180507
180532
  id: "stop-all-simulator-servers",
180508
180533
  description: `Stop the services a device owns - simulator-server processes (iOS + Android), native devtools, the iOS accessibility service, TV-control daemons, Chromium CDP sessions, screen recordings, native profiler sessions, Android native network capture (started by native-network-logs), and JS-runtime debugger sessions along with the network inspectors and React profiler sessions that ride on them - freeing their spawned processes, sockets and ports. Call this when the user asks to clean up or ends the session, or when a skill tells you to recycle a device's services mid-flow - not just because a task finished, since the next task reuses these services and would start cold again. To end only the native network capture of one app, call native-network-logs with stop: true instead.
180509
180534
  PASS \`devices\` with the device ids this session used: one tool-server serves every agent, subagent and CLI call using this argent install, and an unscoped call tears down THEIR devices too. Omit \`devices\` only when a machine-wide cleanup is what you actually want. An EMPTY array stops nothing; it does not ask for the machine-wide sweep.
180510
- A JS-runtime debugger session is keyed by the id you called \`debugger-connect\` with. On a Metro serving two or more devices that id is not a udid or serial - connect refuses those and tells you to re-target with the \`logicalDeviceId\` it returns - so a scope built from \`list-devices\` ids cannot reach that session. Pass any such \`logicalDeviceId\` in \`devices\` ALONGSIDE the device id.
180535
+ A JS-runtime debugger session is keyed by the id you called \`debugger-connect\` with. On a Metro serving two or more devices that id can be a \`logicalDeviceId\`: connect refuses a serial, or a simulator udid it cannot match to one Metro device by name, and tells you to re-target with the \`logicalDeviceId\` it returns. A scope built from \`list-devices\` ids cannot reach that session. Pass any such \`logicalDeviceId\` in \`devices\` ALONGSIDE the device id.
180511
180536
  Returns { stopped }: the URNs of the live services that were shut down; empty means nothing was still running. { unmatched }, present only when a supplied id owns no service here, lists those ids, so a typo or a device NAME passed instead of an id does not read as a clean machine. It is NOT proof the id is wrong: a Vega device you only booted and drove with the remote registers no service and lands here, as does any device this session never started anything on. { left_running } lists the URNs of live debugger sessions (and the network inspectors / React profiler sessions riding on them) whose id no device scope can name; re-call with the id after each URN's \`<namespace>:<port>:\` prefix to reap them. { aborted: true } means the request was cancelled part-way: the rest was left untouched and \`unmatched\` / \`left_running\` were not computed.
180512
180537
  Fails if the input has an unknown key (e.g. \`udids\` instead of \`devices\`); otherwise it always succeeds, and reaping nothing is a result, not a failure.`,
180513
180538
  zodSchema: zodSchema66,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.34.1-next.34",
3
+ "version": "0.34.1-next.35",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
6
6
  "license": "Apache-2.0",
@@ -14,7 +14,7 @@ Physical iPhone: not supported; every `debugger-*` tool rejects `kind: "device"`
14
14
 
15
15
  ## 2. Tools
16
16
 
17
- Pass the same `device_id`, the id from `list-devices`, to every call. With two or more devices on one Metro, `debugger-connect` refuses a udid or serial and returns a `logicalDeviceId`: use that as `device_id` from then on, and include it in `stop-all-simulator-servers`' `devices` at teardown, or the debugger session outlives yours.
17
+ Pass the same `device_id`, the id from `list-devices`, to every call. With two or more devices on one Metro, `debugger-connect` refuses a serial, or a simulator udid it cannot match to one Metro device by name, and returns a `logicalDeviceId`: use that as `device_id` from then on, and include it in `stop-all-simulator-servers`' `devices` at teardown, or the debugger session outlives yours.
18
18
 
19
19
  | Tool | Use for |
20
20
  | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |