@swmansion/argent 0.16.1-next.4 → 0.16.1-next.6

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.
@@ -122123,6 +122123,20 @@ function normalizeWsUrl(wsUrl, port) {
122123
122123
  return url2.toString();
122124
122124
  }
122125
122125
 
122126
+ // ../tool-server/src/utils/debugger/device-alias.ts
122127
+ var logicalIdToConnectId = /* @__PURE__ */ new Map();
122128
+ function rememberDeviceAlias(logicalDeviceId, connectDeviceId) {
122129
+ if (!logicalDeviceId || logicalDeviceId === connectDeviceId) return;
122130
+ logicalIdToConnectId.set(logicalDeviceId, connectDeviceId);
122131
+ }
122132
+ function canonicalDeviceId(deviceId) {
122133
+ if (!deviceId) return deviceId;
122134
+ return logicalIdToConnectId.get(deviceId) ?? deviceId;
122135
+ }
122136
+ function forgetDeviceAlias(logicalDeviceId) {
122137
+ if (logicalDeviceId) logicalIdToConnectId.delete(logicalDeviceId);
122138
+ }
122139
+
122126
122140
  // ../tool-server/src/utils/debugger/source-resolver.ts
122127
122141
  var fs18 = __toESM(require("node:fs/promises"));
122128
122142
  var path17 = __toESM(require("node:path"));
@@ -122541,6 +122555,7 @@ var jsRuntimeDebuggerBlueprint = {
122541
122555
  consoleEvents,
122542
122556
  consoleSocketUrl: consoleServer.url
122543
122557
  };
122558
+ rememberDeviceAlias(api.logicalDeviceId, deviceId);
122544
122559
  const events = new TypedEventEmitter();
122545
122560
  cdp.events.on("disconnected", (error52) => {
122546
122561
  events.emit(
@@ -122556,6 +122571,7 @@ var jsRuntimeDebuggerBlueprint = {
122556
122571
  return {
122557
122572
  api,
122558
122573
  dispose: async () => {
122574
+ forgetDeviceAlias(api.logicalDeviceId);
122559
122575
  await consoleServer.close();
122560
122576
  logWriter.close();
122561
122577
  await cdp.disconnect();
@@ -133858,18 +133874,19 @@ var RN_ONLY_TOOL_CAPABILITY = {
133858
133874
  android: { emulator: true, device: true, unknown: true }
133859
133875
  };
133860
133876
  function debuggerServiceRef(params) {
133861
- if (params.device_id && params.device_id.startsWith(CHROMIUM_ID_PREFIX)) {
133862
- const device = resolveDevice(params.device_id);
133877
+ const deviceId = canonicalDeviceId(params.device_id);
133878
+ if (deviceId && deviceId.startsWith(CHROMIUM_ID_PREFIX)) {
133879
+ const device = resolveDevice(deviceId);
133863
133880
  return chromiumJsRuntimeDebuggerRef(device);
133864
133881
  }
133865
- return `JsRuntimeDebugger:${params.port}:${params.device_id}`;
133882
+ return `JsRuntimeDebugger:${params.port}:${deviceId}`;
133866
133883
  }
133867
133884
 
133868
133885
  // ../tool-server/src/tools/debugger/debugger-connect.ts
133869
133886
  var zodSchema29 = external_exports.object({
133870
133887
  port: external_exports.coerce.number().default(8081).describe("Metro server port (ignored for Chromium \u2014 its CDP port is encoded in device_id)"),
133871
133888
  device_id: external_exports.string().describe(
133872
- "Device id: iOS simulator UDID, Android logicalDeviceId returned by Metro, Vega serial (amazon-...), or Chromium device id (chromium-cdp-<port>) from list-devices. When a logicalDeviceId is returned, forward it as device_id to all subsequent debugger-* calls to pin them to this device; when none is returned (Vega), keep passing the id you connected with."
133889
+ "Device id from list-devices: iOS simulator UDID, Android serial, Vega serial (amazon-...), or Chromium device id (chromium-cdp-<port>). Pass this SAME id as device_id to every subsequent debugger-* call to pin them to this device. The returned logicalDeviceId is informational (Metro's own per-connection handle, absent on Vega); you do not switch to it \u2014 forwarding it still resolves here, but the list-devices id is the stable one."
133873
133890
  )
133874
133891
  });
133875
133892
  var debuggerConnectTool = {
@@ -133902,7 +133919,7 @@ init_zod();
133902
133919
  var zodSchema30 = external_exports.object({
133903
133920
  port: external_exports.coerce.number().default(8081).describe("Metro server port (ignored for Chromium)"),
133904
133921
  device_id: external_exports.string().describe(
133905
- "Device id from debugger-connect (iOS simulator UDID, Android logicalDeviceId, Vega serial, or Chromium device id)."
133922
+ "Device id from list-devices \u2014 the SAME id you passed to debugger-connect (iOS simulator UDID, Android serial, Vega serial, or Chromium device id). The logicalDeviceId debugger-connect returns also resolves here, but prefer the stable list-devices id."
133906
133923
  )
133907
133924
  });
133908
133925
  var debuggerStatusTool = {
@@ -133937,7 +133954,7 @@ init_zod();
133937
133954
  var zodSchema31 = external_exports.object({
133938
133955
  port: external_exports.coerce.number().default(8081).describe("Metro server port (ignored for Chromium)"),
133939
133956
  device_id: external_exports.string().describe(
133940
- "Device id from debugger-connect (iOS simulator UDID, Android logicalDeviceId, Vega serial, or Chromium device id)."
133957
+ "Device id from list-devices \u2014 the SAME id you passed to debugger-connect (iOS simulator UDID, Android serial, Vega serial, or Chromium device id). The logicalDeviceId debugger-connect returns also resolves here, but prefer the stable list-devices id."
133941
133958
  ),
133942
133959
  expression: external_exports.string().describe("JavaScript expression to evaluate in the app runtime")
133943
133960
  });
@@ -133968,7 +133985,7 @@ init_src();
133968
133985
  var zodSchema32 = external_exports.object({
133969
133986
  port: external_exports.coerce.number().default(8081).describe("Metro server port"),
133970
133987
  device_id: external_exports.string().describe(
133971
- "Device logicalDeviceId from debugger-connect (iOS simulator UDID or Android logicalDeviceId)."
133988
+ "Device id from list-devices \u2014 the SAME id you passed to debugger-connect (iOS simulator UDID or Android serial)."
133972
133989
  )
133973
133990
  });
133974
133991
  var debuggerReloadMetroTool = {
@@ -133983,7 +134000,7 @@ Use when you want to apply code changes or reset JS state. Returns { reloaded, p
133983
134000
  // want that on Chromium later, it deserves its own tool.
133984
134001
  capability: RN_ONLY_TOOL_CAPABILITY,
133985
134002
  services: (params) => ({
133986
- debugger: `JsRuntimeDebugger:${params.port}:${params.device_id}`
134003
+ debugger: `JsRuntimeDebugger:${params.port}:${canonicalDeviceId(params.device_id)}`
133987
134004
  }),
133988
134005
  async execute(services, _params) {
133989
134006
  const api = services.debugger;
@@ -134786,7 +134803,7 @@ function buildTextTree(data, opts) {
134786
134803
  var zodSchema33 = external_exports.object({
134787
134804
  port: external_exports.coerce.number().default(8081).describe("Metro server port"),
134788
134805
  device_id: external_exports.string().describe(
134789
- "Device logicalDeviceId from debugger-connect (iOS simulator UDID or Android logicalDeviceId)."
134806
+ "Device id from list-devices \u2014 the SAME id you passed to debugger-connect (iOS simulator UDID or Android serial)."
134790
134807
  ),
134791
134808
  onScreenOnly: external_exports.boolean().default(true).describe(
134792
134809
  "When true (default), only components visible on screen are returned. Set to false to include all mounted components including those scrolled off-screen. Useful when you need to understand the full page structure."
@@ -134825,7 +134842,7 @@ Use when you need tap coordinates for a React Native UI element. Returns a compa
134825
134842
  // for DOM-tree discovery on Chromium.
134826
134843
  capability: RN_ONLY_TOOL_CAPABILITY,
134827
134844
  services: (params) => ({
134828
- debugger: `JsRuntimeDebugger:${params.port}:${params.device_id}`
134845
+ debugger: `JsRuntimeDebugger:${params.port}:${canonicalDeviceId(params.device_id)}`
134829
134846
  }),
134830
134847
  async execute(services, params) {
134831
134848
  const api = services.debugger;
@@ -134853,7 +134870,7 @@ Use when you need tap coordinates for a React Native UI element. Returns a compa
134853
134870
  const deviceLine = [
134854
134871
  `device: ${api.deviceName}`,
134855
134872
  `app: ${api.appName}`,
134856
- ...api.logicalDeviceId ? [`udid: ${api.logicalDeviceId}`] : []
134873
+ ...api.logicalDeviceId ? [`logicalDeviceId: ${api.logicalDeviceId}`] : []
134857
134874
  ].join(" | ");
134858
134875
  return `[${deviceLine}]
134859
134876
  ${tree}`;
@@ -135293,7 +135310,7 @@ function filterInspectItems(items, includeSkipped = false) {
135293
135310
  var zodSchema34 = external_exports.object({
135294
135311
  port: external_exports.coerce.number().default(8081).describe("Metro server port"),
135295
135312
  device_id: external_exports.string().describe(
135296
- "Device logicalDeviceId from debugger-connect (iOS simulator UDID or Android logicalDeviceId)."
135313
+ "Device id from list-devices \u2014 the SAME id you passed to debugger-connect (iOS simulator UDID or Android serial)."
135297
135314
  ),
135298
135315
  x: external_exports.coerce.number().describe("Logical X coordinate on device screen"),
135299
135316
  y: external_exports.coerce.number().describe("Logical Y coordinate on device screen"),
@@ -135330,7 +135347,7 @@ Use when you need the source file and line for a component at a tap coordinate.
135330
135347
  // out of scope for this port.
135331
135348
  capability: RN_ONLY_TOOL_CAPABILITY,
135332
135349
  services: (params) => ({
135333
- debugger: `JsRuntimeDebugger:${params.port}:${params.device_id}`
135350
+ debugger: `JsRuntimeDebugger:${params.port}:${canonicalDeviceId(params.device_id)}`
135334
135351
  }),
135335
135352
  async execute(services, params) {
135336
135353
  const api = services.debugger;
@@ -135427,7 +135444,7 @@ init_zod();
135427
135444
  var zodSchema35 = external_exports.object({
135428
135445
  port: external_exports.coerce.number().default(8081).describe("Metro server port (ignored for Chromium)"),
135429
135446
  device_id: external_exports.string().describe(
135430
- "Device id from debugger-connect (iOS simulator UDID, Android logicalDeviceId, Vega serial, or Chromium device id)."
135447
+ "Device id from list-devices \u2014 the SAME id you passed to debugger-connect (iOS simulator UDID, Android serial, Vega serial, or Chromium device id). The logicalDeviceId debugger-connect returns also resolves here, but prefer the stable list-devices id."
135431
135448
  )
135432
135449
  });
135433
135450
  var debuggerLogRegistryTool = {
@@ -135515,7 +135532,9 @@ ${lines.join("\n")}`;
135515
135532
  }
135516
135533
  var zodSchema36 = external_exports.object({
135517
135534
  port: external_exports.coerce.number().default(8081).describe("Metro server port (RN only; ignored on Chromium)"),
135518
- device_id: external_exports.string().describe("Device UDID (logicalDeviceId)."),
135535
+ device_id: external_exports.string().describe(
135536
+ "Device id from list-devices (iOS simulator UDID or Android serial) \u2014 the same id used with debugger-connect."
135537
+ ),
135519
135538
  pageIndex: external_exports.union([external_exports.coerce.number().int().nonnegative(), external_exports.literal("latest")]).default("latest").describe(
135520
135539
  'Page index (0-based) or "latest" for the most recent page. Each page contains up to 50 entries.'
135521
135540
  )
@@ -135537,7 +135556,7 @@ Fails if the app is not connected (RN) or the device is not reachable (Chromium)
135537
135556
  if (device.platform === "chromium") {
135538
135557
  return { chromium: chromiumCdpRef(device) };
135539
135558
  }
135540
- return { inspector: `NetworkInspector:${params.port}:${params.device_id}` };
135559
+ return { inspector: `NetworkInspector:${params.port}:${canonicalDeviceId(params.device_id)}` };
135541
135560
  },
135542
135561
  async execute(services, params) {
135543
135562
  if (resolveDevice(params.device_id).platform === "chromium") {
@@ -135601,7 +135620,9 @@ function redactHeaders(headers) {
135601
135620
  var MAX_BODY_SIZE = 1e3;
135602
135621
  var zodSchema37 = external_exports.object({
135603
135622
  port: external_exports.coerce.number().default(8081).describe("Metro server port"),
135604
- device_id: external_exports.string().describe("Device UDID (logicalDeviceId)."),
135623
+ device_id: external_exports.string().describe(
135624
+ "Device id from list-devices (iOS simulator UDID or Android serial) \u2014 the same id used with debugger-connect."
135625
+ ),
135605
135626
  requestId: external_exports.string().describe("The requestId from view-network-logs to get full details for"),
135606
135627
  includeBody: external_exports.coerce.boolean().default(true).describe("Whether to include the response body (if captured). Defaults to true.")
135607
135628
  });
@@ -135620,7 +135641,7 @@ Returns an error message string if the requestId is not found \u2014 use view-ne
135620
135641
  if (device.platform === "chromium") {
135621
135642
  return { chromium: chromiumCdpRef(device) };
135622
135643
  }
135623
- return { inspector: `NetworkInspector:${params.port}:${params.device_id}` };
135644
+ return { inspector: `NetworkInspector:${params.port}:${canonicalDeviceId(params.device_id)}` };
135624
135645
  },
135625
135646
  async execute(services, params) {
135626
135647
  if (resolveDevice(params.device_id).platform === "chromium") {
@@ -136179,7 +136200,7 @@ var NO_RENDERERS_ATTACHED_ERROR = "React DevTools hook is present but no React r
136179
136200
  var zodSchema40 = external_exports.object({
136180
136201
  port: external_exports.coerce.number().default(8081).describe("Metro server port"),
136181
136202
  device_id: external_exports.string().describe(
136182
- "Device logicalDeviceId from debugger-connect (iOS simulator UDID or Android logicalDeviceId)."
136203
+ "Device id from list-devices \u2014 the SAME id you passed to debugger-connect (iOS simulator UDID or Android serial)."
136183
136204
  ),
136184
136205
  sample_interval_us: external_exports.coerce.number().int().positive().default(100).describe("CPU sampling interval in microseconds (default 100)"),
136185
136206
  force: external_exports.boolean().default(false).describe(
@@ -136210,8 +136231,9 @@ Fails if the Hermes runtime is not reachable or the Metro CDP connection cannot
136210
136231
  capability: RN_ONLY_TOOL_CAPABILITY,
136211
136232
  services: () => ({}),
136212
136233
  async execute(_services, params) {
136213
- const jsdUrn = `${JS_RUNTIME_DEBUGGER_NAMESPACE}:${params.port}:${params.device_id}`;
136214
- const psUrn = `${REACT_PROFILER_SESSION_NAMESPACE}:${params.port}:${params.device_id}`;
136234
+ const deviceId = canonicalDeviceId(params.device_id);
136235
+ const jsdUrn = `${JS_RUNTIME_DEBUGGER_NAMESPACE}:${params.port}:${deviceId}`;
136236
+ const psUrn = `${REACT_PROFILER_SESSION_NAMESPACE}:${params.port}:${deviceId}`;
136215
136237
  const ignore = () => {
136216
136238
  };
136217
136239
  async function disposeAndWait() {
@@ -136478,7 +136500,7 @@ async function readCommitTree(path36) {
136478
136500
  var zodSchema41 = external_exports.object({
136479
136501
  port: external_exports.coerce.number().default(8081).describe("Metro server port"),
136480
136502
  device_id: external_exports.string().describe(
136481
- "Device logicalDeviceId from debugger-connect (iOS simulator UDID or Android logicalDeviceId)."
136503
+ "Device id from list-devices \u2014 the SAME id you passed to debugger-connect (iOS simulator UDID or Android serial)."
136482
136504
  )
136483
136505
  });
136484
136506
  function normalizeChangeDescription(raw) {
@@ -136564,7 +136586,7 @@ Fails if no active profiling session exists or the CDP connection was lost durin
136564
136586
  capability: RN_ONLY_TOOL_CAPABILITY,
136565
136587
  services: () => ({}),
136566
136588
  async execute(_services, params) {
136567
- const psUrn = `${REACT_PROFILER_SESSION_NAMESPACE}:${params.port}:${params.device_id}`;
136589
+ const psUrn = `${REACT_PROFILER_SESSION_NAMESPACE}:${params.port}:${canonicalDeviceId(params.device_id)}`;
136568
136590
  const snapshot = registry2.getSnapshot();
136569
136591
  const entry = snapshot.services.get(psUrn);
136570
136592
  if (!entry || entry.state !== "RUNNING" /* RUNNING */) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.16.1-next.4",
3
+ "version": "0.16.1-next.6",
4
4
  "description": "MCP server for iOS Simulator and Android Emulator control",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {