@swmansion/argent 0.24.1-next.4 → 0.24.1-next.5

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
@@ -21090,6 +21090,13 @@ var PLATFORMS = [
21090
21090
  "tvos",
21091
21091
  "android-tv"
21092
21092
  ];
21093
+ var DEVICE_KINDS = [
21094
+ "simulator",
21095
+ "emulator",
21096
+ "vvd",
21097
+ "device",
21098
+ "app"
21099
+ ];
21093
21100
  var DEBUGGER_NOT_CONNECTED_REASONS = [
21094
21101
  "metro_not_running",
21095
21102
  "no_app_connected",
@@ -21133,6 +21140,7 @@ var arrayOf = (elem, maxLen = 16) => (v) => {
21133
21140
  };
21134
21141
  var TOOL_NAME = matches(/^[a-z][a-z0-9_-]{0,63}$/, 64);
21135
21142
  var PLATFORM = oneOf(PLATFORMS);
21143
+ var DEVICE_KIND = oneOf(DEVICE_KINDS);
21136
21144
  var UUID = matches(
21137
21145
  /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,
21138
21146
  36
@@ -21276,6 +21284,7 @@ var ALLOWED = {
21276
21284
  tool: TOOL_NAME,
21277
21285
  tool_invocation_id: UUID,
21278
21286
  platform: PLATFORM,
21287
+ device_kind: DEVICE_KIND,
21279
21288
  ...AI_TELEMETRY
21280
21289
  },
21281
21290
  "tool:complete": {
@@ -21283,6 +21292,7 @@ var ALLOWED = {
21283
21292
  tool: TOOL_NAME,
21284
21293
  tool_invocation_id: UUID,
21285
21294
  platform: PLATFORM,
21295
+ device_kind: DEVICE_KIND,
21286
21296
  duration_ms: DURATION_MS,
21287
21297
  ...AI_TELEMETRY
21288
21298
  },
@@ -21291,6 +21301,7 @@ var ALLOWED = {
21291
21301
  tool: TOOL_NAME,
21292
21302
  tool_invocation_id: UUID,
21293
21303
  platform: PLATFORM,
21304
+ device_kind: DEVICE_KIND,
21294
21305
  duration_ms: DURATION_MS,
21295
21306
  // Emit side sends only names declared in the tool's zod shape, capped at 16
21296
21307
  // because arrayOf voids the whole array once it is longer.
@@ -21825,7 +21836,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
21825
21836
  var SESSION_ID2 = randomUUID5();
21826
21837
  function readCliVersion() {
21827
21838
  if (true) {
21828
- return "0.24.1-next.4";
21839
+ return "0.24.1-next.5";
21829
21840
  }
21830
21841
  return "0.0.0";
21831
21842
  }
@@ -15943,6 +15943,13 @@ var PLATFORMS = [
15943
15943
  "tvos",
15944
15944
  "android-tv"
15945
15945
  ];
15946
+ var DEVICE_KINDS = [
15947
+ "simulator",
15948
+ "emulator",
15949
+ "vvd",
15950
+ "device",
15951
+ "app"
15952
+ ];
15946
15953
  var DEBUGGER_NOT_CONNECTED_REASONS = [
15947
15954
  "metro_not_running",
15948
15955
  "no_app_connected",
@@ -15986,6 +15993,7 @@ var arrayOf = (elem, maxLen = 16) => (v) => {
15986
15993
  };
15987
15994
  var TOOL_NAME = matches(/^[a-z][a-z0-9_-]{0,63}$/, 64);
15988
15995
  var PLATFORM = oneOf(PLATFORMS);
15996
+ var DEVICE_KIND = oneOf(DEVICE_KINDS);
15989
15997
  var UUID = matches(
15990
15998
  /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,
15991
15999
  36
@@ -16129,6 +16137,7 @@ var ALLOWED = {
16129
16137
  tool: TOOL_NAME,
16130
16138
  tool_invocation_id: UUID,
16131
16139
  platform: PLATFORM,
16140
+ device_kind: DEVICE_KIND,
16132
16141
  ...AI_TELEMETRY
16133
16142
  },
16134
16143
  "tool:complete": {
@@ -16136,6 +16145,7 @@ var ALLOWED = {
16136
16145
  tool: TOOL_NAME,
16137
16146
  tool_invocation_id: UUID,
16138
16147
  platform: PLATFORM,
16148
+ device_kind: DEVICE_KIND,
16139
16149
  duration_ms: DURATION_MS,
16140
16150
  ...AI_TELEMETRY
16141
16151
  },
@@ -16144,6 +16154,7 @@ var ALLOWED = {
16144
16154
  tool: TOOL_NAME,
16145
16155
  tool_invocation_id: UUID,
16146
16156
  platform: PLATFORM,
16157
+ device_kind: DEVICE_KIND,
16147
16158
  duration_ms: DURATION_MS,
16148
16159
  // Emit side sends only names declared in the tool's zod shape, capped at 16
16149
16160
  // because arrayOf voids the whole array once it is longer.
@@ -16678,7 +16689,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16678
16689
  var SESSION_ID = randomUUID4();
16679
16690
  function readCliVersion() {
16680
16691
  if (true) {
16681
- return "0.24.1-next.4";
16692
+ return "0.24.1-next.5";
16682
16693
  }
16683
16694
  return "0.0.0";
16684
16695
  }
@@ -17588,6 +17588,13 @@ var PLATFORMS = [
17588
17588
  "tvos",
17589
17589
  "android-tv"
17590
17590
  ];
17591
+ var DEVICE_KINDS = [
17592
+ "simulator",
17593
+ "emulator",
17594
+ "vvd",
17595
+ "device",
17596
+ "app"
17597
+ ];
17591
17598
  var DEBUGGER_NOT_CONNECTED_REASONS = [
17592
17599
  "metro_not_running",
17593
17600
  "no_app_connected",
@@ -17652,6 +17659,7 @@ var arrayOf = (elem, maxLen = 16) => (v) => {
17652
17659
  };
17653
17660
  var TOOL_NAME = matches(/^[a-z][a-z0-9_-]{0,63}$/, 64);
17654
17661
  var PLATFORM = oneOf(PLATFORMS);
17662
+ var DEVICE_KIND = oneOf(DEVICE_KINDS);
17655
17663
  var UUID = matches(
17656
17664
  /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,
17657
17665
  36
@@ -17795,6 +17803,7 @@ var ALLOWED = {
17795
17803
  tool: TOOL_NAME,
17796
17804
  tool_invocation_id: UUID,
17797
17805
  platform: PLATFORM,
17806
+ device_kind: DEVICE_KIND,
17798
17807
  ...AI_TELEMETRY
17799
17808
  },
17800
17809
  "tool:complete": {
@@ -17802,6 +17811,7 @@ var ALLOWED = {
17802
17811
  tool: TOOL_NAME,
17803
17812
  tool_invocation_id: UUID,
17804
17813
  platform: PLATFORM,
17814
+ device_kind: DEVICE_KIND,
17805
17815
  duration_ms: DURATION_MS,
17806
17816
  ...AI_TELEMETRY
17807
17817
  },
@@ -17810,6 +17820,7 @@ var ALLOWED = {
17810
17820
  tool: TOOL_NAME,
17811
17821
  tool_invocation_id: UUID,
17812
17822
  platform: PLATFORM,
17823
+ device_kind: DEVICE_KIND,
17813
17824
  duration_ms: DURATION_MS,
17814
17825
  // Emit side sends only names declared in the tool's zod shape, capped at 16
17815
17826
  // because arrayOf voids the whole array once it is longer.
@@ -93873,6 +93873,13 @@ var PLATFORMS = [
93873
93873
  "tvos",
93874
93874
  "android-tv"
93875
93875
  ];
93876
+ var DEVICE_KINDS = [
93877
+ "simulator",
93878
+ "emulator",
93879
+ "vvd",
93880
+ "device",
93881
+ "app"
93882
+ ];
93876
93883
  var DEBUGGER_NOT_CONNECTED_REASONS = [
93877
93884
  "metro_not_running",
93878
93885
  "no_app_connected",
@@ -93921,6 +93928,7 @@ var arrayOf = (elem, maxLen = 16) => (v) => {
93921
93928
  };
93922
93929
  var TOOL_NAME = matches(/^[a-z][a-z0-9_-]{0,63}$/, 64);
93923
93930
  var PLATFORM = oneOf(PLATFORMS);
93931
+ var DEVICE_KIND = oneOf(DEVICE_KINDS);
93924
93932
  var UUID = matches(
93925
93933
  /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,
93926
93934
  36
@@ -94064,6 +94072,7 @@ var ALLOWED = {
94064
94072
  tool: TOOL_NAME,
94065
94073
  tool_invocation_id: UUID,
94066
94074
  platform: PLATFORM,
94075
+ device_kind: DEVICE_KIND,
94067
94076
  ...AI_TELEMETRY
94068
94077
  },
94069
94078
  "tool:complete": {
@@ -94071,6 +94080,7 @@ var ALLOWED = {
94071
94080
  tool: TOOL_NAME,
94072
94081
  tool_invocation_id: UUID,
94073
94082
  platform: PLATFORM,
94083
+ device_kind: DEVICE_KIND,
94074
94084
  duration_ms: DURATION_MS,
94075
94085
  ...AI_TELEMETRY
94076
94086
  },
@@ -94079,6 +94089,7 @@ var ALLOWED = {
94079
94089
  tool: TOOL_NAME,
94080
94090
  tool_invocation_id: UUID,
94081
94091
  platform: PLATFORM,
94092
+ device_kind: DEVICE_KIND,
94082
94093
  duration_ms: DURATION_MS,
94083
94094
  // Emit side sends only names declared in the tool's zod shape, capped at 16
94084
94095
  // because arrayOf voids the whole array once it is longer.
@@ -94613,7 +94624,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
94613
94624
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
94614
94625
  function readCliVersion() {
94615
94626
  if (true) {
94616
- return "0.24.1-next.4";
94627
+ return "0.24.1-next.5";
94617
94628
  }
94618
94629
  return "0.0.0";
94619
94630
  }
@@ -95208,6 +95219,7 @@ function attachRegistryTelemetry(registry2) {
95208
95219
  tool_invocation_id: toolInvocationId,
95209
95220
  ...meta3.device_provider ? { device_provider: meta3.device_provider } : {},
95210
95221
  ...meta3.platform ? { platform: meta3.platform } : {},
95222
+ ...meta3.device_kind ? { device_kind: meta3.device_kind } : {},
95211
95223
  ...aiTelemetryFromMeta(meta3)
95212
95224
  });
95213
95225
  };
@@ -95218,6 +95230,7 @@ function attachRegistryTelemetry(registry2) {
95218
95230
  tool_invocation_id: toolInvocationId,
95219
95231
  ...meta3.device_provider ? { device_provider: meta3.device_provider } : {},
95220
95232
  ...meta3.platform ? { platform: meta3.platform } : {},
95233
+ ...meta3.device_kind ? { device_kind: meta3.device_kind } : {},
95221
95234
  duration_ms: durationMs,
95222
95235
  ...aiTelemetryFromMeta(meta3)
95223
95236
  });
@@ -95235,6 +95248,7 @@ function attachRegistryTelemetry(registry2) {
95235
95248
  tool_invocation_id: toolInvocationId,
95236
95249
  ...meta3.device_provider ? { device_provider: meta3.device_provider } : {},
95237
95250
  ...meta3.platform ? { platform: meta3.platform } : {},
95251
+ ...meta3.device_kind ? { device_kind: meta3.device_kind } : {},
95238
95252
  duration_ms: durationMs,
95239
95253
  ...signal,
95240
95254
  ...aiTelemetryFromMeta(meta3)
@@ -107873,6 +107887,7 @@ init_device_info();
107873
107887
 
107874
107888
  // ../tool-server/src/utils/telemetry-platform.ts
107875
107889
  init_device_info();
107890
+ init_external_devices();
107876
107891
  init_adb();
107877
107892
  function refineTvPlatform(basePlatform, deviceId) {
107878
107893
  if (basePlatform === "ios" && getCachedSimulatorRuntimeKind(deviceId) === "tv") {
@@ -107883,8 +107898,23 @@ function refineTvPlatform(basePlatform, deviceId) {
107883
107898
  }
107884
107899
  return basePlatform;
107885
107900
  }
107901
+ var ANDROID_USB_SERIAL = /^(?=.*\d)(?=.*[A-Za-z])[A-Za-z0-9]{6,20}$/;
107902
+ var ANDROID_TCP_SERIAL = /^(?:\d{1,3}\.){3}\d{1,3}:\d{1,5}$/;
107903
+ function telemetryDeviceKind(device, nativeId) {
107904
+ if (device.kind === "unknown") return void 0;
107905
+ if (device.platform !== "android" || device.kind !== "device") return device.kind;
107906
+ if (consolePortFromAdbSerial(nativeId) !== null) return "emulator";
107907
+ if (ANDROID_USB_SERIAL.test(nativeId) || ANDROID_TCP_SERIAL.test(nativeId)) return "device";
107908
+ return void 0;
107909
+ }
107910
+ function attributeDeviceForTelemetry(deviceId) {
107911
+ const device = resolveDevice(deviceId);
107912
+ const platform = refineTvPlatform(device.platform, deviceId);
107913
+ const device_kind = telemetryDeviceKind(device, externalNativeId(deviceId));
107914
+ return device_kind ? { platform, device_kind } : { platform };
107915
+ }
107886
107916
  function classifyDeviceForTelemetry(deviceId) {
107887
- return refineTvPlatform(classifyDevice(deviceId), deviceId);
107917
+ return attributeDeviceForTelemetry(deviceId).platform;
107888
107918
  }
107889
107919
 
107890
107920
  // ../tool-server/src/utils/device-shutdown.ts
@@ -114304,11 +114334,15 @@ function targetsIosPhysicalDevice(data) {
114304
114334
  const deviceArg = extractDeviceArg(data) ?? flowDevice;
114305
114335
  return deviceArg !== null && isIosPhysicalDevice(resolveDevice(deviceArg));
114306
114336
  }
114307
- function inferPlatform(deviceId) {
114337
+ function inferDeviceAttribution(deviceId) {
114308
114338
  if (!deviceId) return null;
114309
114339
  try {
114310
114340
  const canonical = canonicalDeviceId(deviceId) ?? deviceId;
114311
- return refineTvPlatform(resolveDevice(canonical).platform, canonical);
114341
+ const attribution = attributeDeviceForTelemetry(canonical);
114342
+ if (attribution.device_kind && isLogicalKeyedDevice(canonical)) {
114343
+ return { platform: attribution.platform };
114344
+ }
114345
+ return attribution;
114312
114346
  } catch {
114313
114347
  return null;
114314
114348
  }
@@ -114327,30 +114361,33 @@ function extractAiTelemetryMeta(req) {
114327
114361
  function extractInvocationMeta(hasCapability, data, aiMeta) {
114328
114362
  const meta3 = { ...aiMeta };
114329
114363
  if (hasCapability && data && typeof data === "object") {
114330
- const platform = platformFromArgs(data);
114331
- if (platform) meta3.platform = platform;
114364
+ const attribution = deviceAttributionFromArgs(data);
114365
+ if (attribution) Object.assign(meta3, attribution);
114332
114366
  }
114333
114367
  const deviceArg = extractDeviceArg(data);
114334
114368
  const provider = deviceArg ? externalProviderLabel(deviceArg) : void 0;
114335
114369
  if (provider) meta3.device_provider = provider;
114336
114370
  return Object.keys(meta3).length > 0 ? meta3 : null;
114337
114371
  }
114338
- function platformFromArgs(data) {
114372
+ function deviceAttributionFromArgs(data) {
114339
114373
  if (!data || typeof data !== "object") return null;
114340
114374
  const deviceArg = extractDeviceArg(data);
114341
- if (deviceArg) return inferPlatform(deviceArg) ?? null;
114342
- if (typeof data.avdName === "string") return "android";
114375
+ if (deviceArg) return inferDeviceAttribution(deviceArg);
114376
+ if (typeof data.avdName === "string") {
114377
+ return { platform: "android" };
114378
+ }
114343
114379
  return null;
114344
114380
  }
114345
114381
  function deriveChildInvocationMeta(parentMeta, childArgs) {
114346
- const childPlatform = platformFromArgs(childArgs);
114382
+ const childAttribution = deviceAttributionFromArgs(childArgs);
114383
+ if (!childAttribution) return parentMeta;
114347
114384
  const childDeviceArg = extractDeviceArg(childArgs);
114348
114385
  const childProvider = childDeviceArg ? externalProviderLabel(childDeviceArg) : void 0;
114349
- if (!childPlatform && !childProvider) return parentMeta;
114386
+ const { platform: _p, device_kind: _k, device_provider: _d, ...inherited } = parentMeta;
114350
114387
  return {
114351
- ...parentMeta,
114388
+ ...inherited,
114352
114389
  ...childProvider ? { device_provider: childProvider } : {},
114353
- ...childPlatform ? { platform: childPlatform } : {}
114390
+ ...childAttribution
114354
114391
  };
114355
114392
  }
114356
114393
  var LOOPBACK_HOSTNAMES = ["127.0.0.1", "localhost", "::1"];
@@ -114593,12 +114630,12 @@ function createHttpApp(registry2, options) {
114593
114630
  if (!options?.recordFailure) return;
114594
114631
  const failedDeviceArg = extractDeviceArg(parsedDataForMeta);
114595
114632
  const provider = failedDeviceArg ? externalProviderLabel(failedDeviceArg) : void 0;
114596
- const platform = inferPlatform(failedDeviceArg);
114633
+ const attribution = inferDeviceAttribution(failedDeviceArg);
114597
114634
  options.recordFailure(
114598
114635
  name,
114599
114636
  {
114600
114637
  ...provider ? { device_provider: provider } : {},
114601
- ...platform ? { platform } : {},
114638
+ ...attribution,
114602
114639
  ...extraMeta?.invalid_params?.length ? { invalid_params: extraMeta.invalid_params } : {},
114603
114640
  ...aiMeta
114604
114641
  },
@@ -155346,6 +155383,7 @@ function start() {
155346
155383
  tool: toolId,
155347
155384
  ...meta3.device_provider ? { device_provider: meta3.device_provider } : {},
155348
155385
  ...meta3.platform ? { platform: meta3.platform } : {},
155386
+ ...meta3.device_kind ? { device_kind: meta3.device_kind } : {},
155349
155387
  ...meta3.invalid_params?.length ? { invalid_params: meta3.invalid_params } : {},
155350
155388
  duration_ms: durationMs,
155351
155389
  ...signal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.24.1-next.4",
3
+ "version": "0.24.1-next.5",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator and Android Emulator control",
6
6
  "license": "Apache-2.0",