@swmansion/argent 0.34.1-next.43 → 0.34.1-next.44

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
@@ -36259,7 +36259,7 @@ function isCi(env = process.env) {
36259
36259
  var SESSION_ID2 = randomUUID5();
36260
36260
  function readCliVersion() {
36261
36261
  if (true) {
36262
- return "0.34.1-next.43";
36262
+ return "0.34.1-next.44";
36263
36263
  }
36264
36264
  return "0.0.0";
36265
36265
  }
@@ -16945,7 +16945,7 @@ function isCi(env = process.env) {
16945
16945
  var SESSION_ID = randomUUID4();
16946
16946
  function readCliVersion() {
16947
16947
  if (true) {
16948
- return "0.34.1-next.43";
16948
+ return "0.34.1-next.44";
16949
16949
  }
16950
16950
  return "0.0.0";
16951
16951
  }
@@ -38,6 +38,7 @@
38
38
  </BuildAction>
39
39
  <TestAction
40
40
  buildConfiguration = "Debug"
41
+ preferredScreenCaptureFormat = "screenshots"
41
42
  selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
42
43
  selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43
44
  shouldUseLaunchSchemeArgsEnv = "YES">
@@ -112,6 +112,9 @@ final class ArgentRunnerSession: XCTestCase {
112
112
  finishLock.unlock()
113
113
 
114
114
  let server = RunnerHTTPServer(
115
+ tunnelAddress: ProcessInfo.processInfo.environment["ARGENT_RUNNER_ADDRESS"].flatMap {
116
+ $0.isEmpty ? nil : $0
117
+ },
115
118
  dispatch: { [weak self] body, deliver in
116
119
  self?.dispatch(body: body, deliver: deliver)
117
120
  },
@@ -4,10 +4,8 @@ import Network
4
4
  /// Minimal single-purpose HTTP/1.1 endpoint on NWListener: each connection
5
5
  /// carries one POSTed JSON command and receives one JSON reply, then closes.
6
6
  ///
7
- /// The listener is unauthenticated, so it binds loopback-only. The host
8
- /// reaches the runner through a usbmux forwarded stream that terminates on
9
- /// the device's own loopback. Bodies are opaque bytes handed to the
10
- /// dispatch closure.
7
+ /// USB uses a loopback listener. A CoreDevice connection binds only the
8
+ /// device's tunnel IPv6 address. Access follows the transport's host-level trust.
11
9
  final class RunnerHTTPServer {
12
10
  struct Reply {
13
11
  let status: Int
@@ -35,25 +33,39 @@ final class RunnerHTTPServer {
35
33
  /// interface is unavailable). Carries the failure description.
36
34
  private let onListenerFailure: (String) -> Void
37
35
  private var listener: NWListener?
36
+ private let tunnelAddress: String?
38
37
 
39
38
  init(
39
+ tunnelAddress: String? = nil,
40
40
  dispatch: @escaping (Data, @escaping (Reply) -> Void) -> Void,
41
41
  onFinish: @escaping () -> Void,
42
42
  onListenerFailure: @escaping (String) -> Void
43
43
  ) {
44
+ self.tunnelAddress = tunnelAddress
44
45
  self.dispatch = dispatch
45
46
  self.onFinish = onFinish
46
47
  self.onListenerFailure = onListenerFailure
47
48
  }
48
49
 
49
- /// Starts listening on loopback, on the given port or a system-assigned
50
+ /// Starts listening on the selected interface, on the given port or a system-assigned
50
51
  /// one when the port is 0.
51
52
  func start(port: UInt16) throws {
52
- // Restrict to the loopback interface rather than pinning a 127.0.0.1
53
- // endpoint. The interface restriction admits either address family and
54
- // keeps port-0 auto-assignment and the .port readback working.
55
53
  let parameters = NWParameters.tcp
56
- parameters.requiredInterfaceType = .loopback
54
+ if let address = tunnelAddress {
55
+ guard let ipv6 = IPv6Address(address),
56
+ let prefix = ipv6.rawValue.first, prefix & 0xfe == 0xfc
57
+ else {
58
+ throw NSError(domain: "ArgentRunner", code: 1, userInfo: [
59
+ NSLocalizedDescriptionKey: "Expected a CoreDevice tunnel IPv6 address"
60
+ ])
61
+ }
62
+ // Bind the tunnel only, never Wi-Fi or a wildcard address.
63
+ parameters.requiredLocalEndpoint = .hostPort(
64
+ host: NWEndpoint.Host(address), port: NWEndpoint.Port(rawValue: port)!
65
+ )
66
+ } else {
67
+ parameters.requiredInterfaceType = .loopback
68
+ }
57
69
  let listener: NWListener
58
70
 
59
71
  if port > 0, let nwPort = NWEndpoint.Port(rawValue: port) {
@@ -53933,12 +53933,12 @@ var require_wrappy = __commonJS({
53933
53933
  var require_once = __commonJS({
53934
53934
  "../../node_modules/once/once.js"(exports2, module2) {
53935
53935
  var wrappy = require_wrappy();
53936
- module2.exports = wrappy(once4);
53936
+ module2.exports = wrappy(once5);
53937
53937
  module2.exports.strict = wrappy(onceStrict);
53938
- once4.proto = once4(function() {
53938
+ once5.proto = once5(function() {
53939
53939
  Object.defineProperty(Function.prototype, "once", {
53940
53940
  value: function() {
53941
- return once4(this);
53941
+ return once5(this);
53942
53942
  },
53943
53943
  configurable: true
53944
53944
  });
@@ -53949,7 +53949,7 @@ var require_once = __commonJS({
53949
53949
  configurable: true
53950
53950
  });
53951
53951
  });
53952
- function once4(fn) {
53952
+ function once5(fn) {
53953
53953
  var f = function() {
53954
53954
  if (f.called) return f.value;
53955
53955
  f.called = true;
@@ -55034,7 +55034,7 @@ var require_application = __commonJS({
55034
55034
  var compileQueryParser = require_utils3().compileQueryParser;
55035
55035
  var compileTrust = require_utils3().compileTrust;
55036
55036
  var resolve21 = require("node:path").resolve;
55037
- var once4 = require_once();
55037
+ var once5 = require_once();
55038
55038
  var Router2 = require_router();
55039
55039
  var slice = Array.prototype.slice;
55040
55040
  var flatten = Array.prototype.flat;
@@ -55264,7 +55264,7 @@ var require_application = __commonJS({
55264
55264
  var server = http6.createServer(this);
55265
55265
  var args = slice.call(arguments);
55266
55266
  if (typeof args[args.length - 1] === "function") {
55267
- var done = args[args.length - 1] = once4(args[args.length - 1]);
55267
+ var done = args[args.length - 1] = once5(args[args.length - 1]);
55268
55268
  server.once("error", done);
55269
55269
  }
55270
55270
  return server.listen.apply(server, args);
@@ -82373,7 +82373,7 @@ var require_websocket = __commonJS({
82373
82373
  var EventEmitter2 = require("events");
82374
82374
  var https = require("https");
82375
82375
  var http6 = require("http");
82376
- var net10 = require("net");
82376
+ var net11 = require("net");
82377
82377
  var tls = require("tls");
82378
82378
  var { randomBytes: randomBytes3, createHash: createHash9 } = require("crypto");
82379
82379
  var { Duplex, Readable: Readable2 } = require("stream");
@@ -83130,12 +83130,12 @@ var require_websocket = __commonJS({
83130
83130
  }
83131
83131
  function netConnect(options) {
83132
83132
  options.path = options.socketPath;
83133
- return net10.connect(options);
83133
+ return net11.connect(options);
83134
83134
  }
83135
83135
  function tlsConnect(options) {
83136
83136
  options.path = void 0;
83137
83137
  if (!options.servername && options.servername !== "") {
83138
- options.servername = net10.isIP(options.host) ? "" : options.host;
83138
+ options.servername = net11.isIP(options.host) ? "" : options.host;
83139
83139
  }
83140
83140
  return tls.connect(options);
83141
83141
  }
@@ -88390,7 +88390,7 @@ var require_inflight = __commonJS({
88390
88390
  "../../node_modules/inflight/inflight.js"(exports2, module2) {
88391
88391
  var wrappy = require_wrappy();
88392
88392
  var reqs = /* @__PURE__ */ Object.create(null);
88393
- var once4 = require_once();
88393
+ var once5 = require_once();
88394
88394
  module2.exports = wrappy(inflight);
88395
88395
  function inflight(key2, cb) {
88396
88396
  if (reqs[key2]) {
@@ -88402,7 +88402,7 @@ var require_inflight = __commonJS({
88402
88402
  }
88403
88403
  }
88404
88404
  function makeres(key2) {
88405
- return once4(function RES() {
88405
+ return once5(function RES() {
88406
88406
  var cbs = reqs[key2];
88407
88407
  var len = cbs.length;
88408
88408
  var args = slice(arguments);
@@ -88453,7 +88453,7 @@ var require_glob = __commonJS({
88453
88453
  var util = require("util");
88454
88454
  var childrenIgnored = common.childrenIgnored;
88455
88455
  var isIgnored = common.isIgnored;
88456
- var once4 = require_once();
88456
+ var once5 = require_once();
88457
88457
  function glob(pattern, options, cb) {
88458
88458
  if (typeof options === "function") cb = options, options = {};
88459
88459
  if (!options) options = {};
@@ -88510,7 +88510,7 @@ var require_glob = __commonJS({
88510
88510
  var n = this.minimatch.set.length;
88511
88511
  this.matches = new Array(n);
88512
88512
  if (typeof cb === "function") {
88513
- cb = once4(cb);
88513
+ cb = once5(cb);
88514
88514
  this.on("error", cb);
88515
88515
  this.on("end", function(matches2) {
88516
88516
  cb(null, matches2);
@@ -101443,7 +101443,7 @@ function isCi(env = process.env) {
101443
101443
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
101444
101444
  function readCliVersion() {
101445
101445
  if (true) {
101446
- return "0.34.1-next.43";
101446
+ return "0.34.1-next.44";
101447
101447
  }
101448
101448
  return "0.0.0";
101449
101449
  }
@@ -126796,6 +126796,7 @@ var fs25 = __toESM(require("node:fs/promises"));
126796
126796
  var os7 = __toESM(require("node:os"));
126797
126797
  var path21 = __toESM(require("node:path"));
126798
126798
  var import_node_crypto8 = require("node:crypto");
126799
+ var import_node_net = require("node:net");
126799
126800
  init_src2();
126800
126801
 
126801
126802
  // ../tool-server/src/utils/ios-device/usbmux-protocol.ts
@@ -127241,6 +127242,10 @@ async function launchApp(udid, bundleId, opts = {}) {
127241
127242
  }
127242
127243
  await runDevicectl(args, `launch ${bundleId}`, { bundleId });
127243
127244
  }
127245
+ function coreDeviceTunnelAddress(connection) {
127246
+ const address = connection?.tunnelIPAddress;
127247
+ return connection?.transportType === "localNetwork" && connection.tunnelState === "connected" && typeof address === "string" && (0, import_node_net.isIPv6)(address) && /^f[cd]/i.test(address) ? address : null;
127248
+ }
127244
127249
  async function deviceInfoDetails(udid, opts = {}) {
127245
127250
  const timeoutSeconds = opts.timeoutSeconds ?? 10;
127246
127251
  const { json: json2 } = await runDevicectl(
@@ -127252,11 +127257,10 @@ async function deviceInfoDetails(udid, opts = {}) {
127252
127257
  const conn = payload?.result?.connectionProperties ?? payload?.result?.device?.connectionProperties;
127253
127258
  return {
127254
127259
  transportType: conn?.transportType ?? null,
127255
- tunnelState: conn?.tunnelState ?? null
127260
+ tunnelState: conn?.tunnelState ?? null,
127261
+ tunnelAddress: coreDeviceTunnelAddress(conn)
127256
127262
  };
127257
127263
  }
127258
- var READY_MEMO_TTL_MS = 5e3;
127259
- var readyMemo = /* @__PURE__ */ new Map();
127260
127264
  function readyFailureSignal(error_kind) {
127261
127265
  return {
127262
127266
  error_code: FAILURE_CODES.IOS_DEVICECTL_COMMAND_FAILED,
@@ -127267,11 +127271,18 @@ function readyFailureSignal(error_kind) {
127267
127271
  };
127268
127272
  }
127269
127273
  async function ensureDeviceReady(udid) {
127270
- const at = readyMemo.get(udid);
127271
- if (at != null && Date.now() - at < READY_MEMO_TTL_MS) {
127272
- return;
127273
- }
127274
127274
  const info = await deviceInfoDetails(udid, { timeoutSeconds: 15 });
127275
+ if (info.tunnelAddress) {
127276
+ return info.tunnelAddress;
127277
+ }
127278
+ if (info.transportType === "localNetwork") {
127279
+ throw withFailureSignal(
127280
+ new IosDeviceControlError("The device has no connected CoreDevice IPv6 tunnel", {
127281
+ hint: "Keep the device unlocked and connected in Xcode, then retry."
127282
+ }),
127283
+ readyFailureSignal("network")
127284
+ );
127285
+ }
127275
127286
  if (info.transportType != null && info.transportType !== "wired") {
127276
127287
  throw withFailureSignal(
127277
127288
  new IosDeviceControlError(`Device transport is ${info.transportType}, not wired`, {
@@ -127288,7 +127299,7 @@ async function ensureDeviceReady(udid) {
127288
127299
  readyFailureSignal("network")
127289
127300
  );
127290
127301
  }
127291
- readyMemo.set(udid, Date.now());
127302
+ return null;
127292
127303
  }
127293
127304
 
127294
127305
  // ../tool-server/src/tools/devices/list-devices.ts
@@ -130353,7 +130364,7 @@ Call this at the start of a session to pick a target id ('udid' for iOS<flag:har
130353
130364
  Returns { devices, avds } where each device carries a 'platform' discriminator ('ios', 'android', 'chromium', <flag:harmonyos>'harmony', </flag:harmonyos>or 'vega'); 'avds' lists Android AVDs bootable via boot-device. A Vega VVD is listed under 'devices' whether running or stopped (state 'running'/'stopped'); start a stopped one with boot-device using its 'vvdImage'.
130354
130365
  <flag:harmonyos>HarmonyOS entries carry a 'kind': 'device' is a target connected over \`hdc\` (a phone on USB, or a booted emulator) and is what the interaction tools drive; 'emulator' is a DevEco Studio instance, running or not, and is what boot-device starts. A running emulator appears under both, exactly as a running Android AVD appears in both 'avds' and the device list. Instance state is 'running'/'stopped'; connected-target state is 'Connected'/'Offline'.
130355
130366
  </flag:harmonyos>Android entries also carry a 'kind' ('emulator' for a local AVD, 'device' for a physical phone on USB / wireless adb). Physical phones use the same interaction tools as emulators and need no boot-device (just connect the phone with USB debugging authorised).
130356
- Physical iPhones appear as iOS entries with kind 'device' (no iPads); no boot-device. State 'connected' = cabled and usable; 'paired' = not reachable over USB, never auto-bound.
130367
+ Physical iPhones appear as iOS entries with kind 'device' (no iPads); no boot-device. State 'connected' = reachable over USB or the network (a network phone's tunnel comes up on first use); 'paired' = remembered but unreachable, never auto-bound.
130357
130368
  TV targets are tagged with runtimeKind 'tv' (Apple TV simulators, Android TV / leanback devices). They are focus-driven, not touch-driven: use \`describe\` to read focus, \`tv-remote\` for remote presses, and \`keyboard\` to type, rather than the coordinate/gesture tools.
130358
130369
  iOS simulators from an additional CoreSimulator device set (the 'ios.additionalDeviceSets' configuration, e.g. devices created by Radon IDE) are tagged with their 'deviceSet' path; the same tools drive them by udid, but they run headless (no Simulator.app window).
130359
130370
  A foldable iOS simulator (the iPhone Duo) or Android emulator (and its AVD) has 'foldable: true'; use the \`fold\` tool to fold or unfold it.
@@ -130451,7 +130462,7 @@ Chromium apps are discovered by probing CDP debugging ports (default 9222; exten
130451
130462
  kind: "device",
130452
130463
  udid: d.udid,
130453
130464
  name: d.name,
130454
- state: d.transportType === "wired" ? "connected" : "paired",
130465
+ state: d.transportType === "wired" || d.transportType === "localNetwork" ? "connected" : "paired",
130455
130466
  runtime: d.osVersion ? `iOS ${d.osVersion} (physical device)` : "iOS (physical device)",
130456
130467
  model: d.model,
130457
130468
  developerModeEnabled: d.developerModeEnabled,
@@ -136616,7 +136627,12 @@ async function launchRunner(opts) {
136616
136627
  ],
136617
136628
  {
136618
136629
  detached: true,
136619
- stdio: ["ignore", logFd, logFd]
136630
+ stdio: ["ignore", logFd, logFd],
136631
+ env: {
136632
+ ...process.env,
136633
+ // Xcode strips TEST_RUNNER_ before passing this non-secret address to XCTest.
136634
+ TEST_RUNNER_ARGENT_RUNNER_ADDRESS: opts.tunnelAddress ?? ""
136635
+ }
136620
136636
  }
136621
136637
  );
136622
136638
  child.unref();
@@ -136722,12 +136738,16 @@ async function killStaleRunnersForDevice(udid, listProcesses = listProcessTable)
136722
136738
  // ../tool-server/src/blueprints/ios-device-runner.ts
136723
136739
  var fs38 = __toESM(require("node:fs/promises"));
136724
136740
 
136741
+ // ../tool-server/src/utils/ios-device/runner-route.ts
136742
+ var import_node_net3 = __toESM(require("node:net"));
136743
+ var import_node_events4 = require("node:events");
136744
+
136725
136745
  // ../tool-server/src/utils/ios-device/runner-http.ts
136726
136746
  var import_node_http3 = __toESM(require("node:http"));
136727
136747
 
136728
136748
  // ../tool-server/src/utils/ios-device/usbmux.ts
136729
136749
  var import_node_events3 = require("node:events");
136730
- var import_node_net = __toESM(require("node:net"));
136750
+ var import_node_net2 = __toESM(require("node:net"));
136731
136751
  var USBMUXD_SOCKET_PATH = "/var/run/usbmuxd";
136732
136752
  var USBMUX_DEFAULT_TIMEOUT_MS = 5e3;
136733
136753
  var USBMUX_RESULT_OK = 0;
@@ -136803,7 +136823,7 @@ async function connectToDevicePort(socketPath, udid, deviceId, port, deadline) {
136803
136823
  async function connectToUsbmuxd(socketPath, deadline) {
136804
136824
  const timeoutMs = deadline.remainingMs();
136805
136825
  requireTimeRemaining(timeoutMs, "connect to usbmuxd");
136806
- const socket = import_node_net.default.createConnection(socketPath);
136826
+ const socket = import_node_net2.default.createConnection(socketPath);
136807
136827
  const abort = new AbortController();
136808
136828
  const timer = setTimeout(() => {
136809
136829
  abort.abort(
@@ -137035,17 +137055,25 @@ function parseRunnerResponseBody(statusCode, body) {
137035
137055
  var READ_ONLY_MAX_ATTEMPTS = 3;
137036
137056
  var RETRY_BASE_DELAY_MS = 300;
137037
137057
  var RETRY_MAX_DELAY_MS = 2e3;
137038
- function createUsbmuxCommandSender(options = {}) {
137039
- const sendViaUsbmux = options.sendViaUsbmux ?? defaultSendViaUsbmux;
137058
+ var TUNNEL_CONNECT_TIMEOUT_MS = 5e3;
137059
+ var TunnelConnectError = class extends IosDeviceTransportError {
137060
+ };
137061
+ function createRunnerCommandSender(options = {}) {
137062
+ const tunnelAddress = options.tunnelAddress;
137063
+ const send = tunnelAddress ? (_udid, port, body, deadline) => postRunnerCommand({
137064
+ socketFactory: () => openTunnelSocket(tunnelAddress, port, deadline),
137065
+ body,
137066
+ deadline
137067
+ }) : options.sendViaUsbmux ?? defaultSendViaUsbmux;
137040
137068
  return {
137041
137069
  sendCommand: async (udid, port, body, sendOptions2) => {
137042
137070
  if (!sendOptions2.readOnly) {
137043
- return sendViaUsbmux(udid, port, body, createDeadline(sendOptions2.timeoutMs));
137071
+ return send(udid, port, body, createDeadline(sendOptions2.timeoutMs));
137044
137072
  }
137045
137073
  let lastError;
137046
137074
  for (let attempt = 1; attempt <= READ_ONLY_MAX_ATTEMPTS; attempt += 1) {
137047
137075
  try {
137048
- return await sendViaUsbmux(udid, port, body, createDeadline(sendOptions2.timeoutMs));
137076
+ return await send(udid, port, body, createDeadline(sendOptions2.timeoutMs));
137049
137077
  } catch (error63) {
137050
137078
  lastError = error63;
137051
137079
  const retryable = isIosDeviceTransportError(error63) && error63.retryable;
@@ -137059,6 +137087,32 @@ function createUsbmuxCommandSender(options = {}) {
137059
137087
  }
137060
137088
  };
137061
137089
  }
137090
+ async function openTunnelSocket(address, port, deadline) {
137091
+ const timeoutMs = Math.min(deadline.remainingMs(), TUNNEL_CONNECT_TIMEOUT_MS);
137092
+ if (timeoutMs <= 0) {
137093
+ throw new IosDeviceTransportError("timeout", "CoreDevice connection deadline elapsed", {
137094
+ retryable: true
137095
+ });
137096
+ }
137097
+ const socket = import_node_net3.default.createConnection({ host: address, port, family: 6 });
137098
+ const signal = AbortSignal.timeout(timeoutMs);
137099
+ try {
137100
+ await (0, import_node_events4.once)(socket, "connect", { signal });
137101
+ socket.pause();
137102
+ return socket;
137103
+ } catch (error63) {
137104
+ socket.destroy();
137105
+ throw new TunnelConnectError(
137106
+ signal.aborted ? "timeout" : "runner-not-listening",
137107
+ "Cannot connect to the runner through the CoreDevice tunnel",
137108
+ {
137109
+ retryable: true,
137110
+ hint: "Keep the device unlocked and connected in Xcode or through its fleet provider, then retry.",
137111
+ cause: error63
137112
+ }
137113
+ );
137114
+ }
137115
+ }
137062
137116
  function defaultSendViaUsbmux(udid, port, body, deadline) {
137063
137117
  return postRunnerCommand({
137064
137118
  socketFactory: () => openUsbmuxRunnerSocket({ udid, port, timeoutMs: deadline.remainingMs() }),
@@ -137428,11 +137482,12 @@ function iosDeviceRunnerRef(device) {
137428
137482
  }
137429
137483
  var RUNNER_READY_TIMEOUT_MS = 12e4;
137430
137484
  var RUNNER_CLEAN_EXIT_TIMEOUT_MS = 1e4;
137431
- async function startRunner(udid, artifact) {
137485
+ async function startRunner(udid, artifact, tunnelAddress) {
137432
137486
  const launched = await launchRunner({
137433
137487
  udid,
137434
137488
  xctestrunPath: artifact.xctestrunPath,
137435
- derivedDataPath: artifact.derivedDataPath
137489
+ derivedDataPath: artifact.derivedDataPath,
137490
+ ...tunnelAddress ? { tunnelAddress } : {}
137436
137491
  });
137437
137492
  let onExit;
137438
137493
  const exited = new Promise((_resolve, reject) => {
@@ -137451,7 +137506,7 @@ async function startRunner(udid, artifact) {
137451
137506
  client2 = createRunnerClient({
137452
137507
  udid,
137453
137508
  port,
137454
- send: createUsbmuxCommandSender().sendCommand
137509
+ send: createRunnerCommandSender({ tunnelAddress }).sendCommand
137455
137510
  });
137456
137511
  await Promise.race([
137457
137512
  waitForRunnerReady(client2, { timeoutMs: Math.max(1, expiresAt - Date.now()) }),
@@ -137486,7 +137541,7 @@ async function startRunner(udid, artifact) {
137486
137541
  client: client2
137487
137542
  };
137488
137543
  }
137489
- async function buildAndStartRunner(udid, signing) {
137544
+ async function buildAndStartRunner(udid, signing, tunnelAddress) {
137490
137545
  let artifact;
137491
137546
  try {
137492
137547
  artifact = await ensureRunnerArtifact(signing);
@@ -137496,13 +137551,14 @@ async function buildAndStartRunner(udid, signing) {
137496
137551
  artifact = await ensureRunnerArtifact(signing, { destinationUdid: udid, force: true });
137497
137552
  }
137498
137553
  try {
137499
- return await startRunner(udid, artifact);
137554
+ return await startRunner(udid, artifact, tunnelAddress);
137500
137555
  } catch (error63) {
137501
137556
  const logText = error63.runnerLogText ?? "";
137502
137557
  if (!isProfileMissingDeviceFailure(logText) && !isProfileExpiredFailure(logText)) throw error63;
137503
137558
  return await startRunner(
137504
137559
  udid,
137505
- await ensureRunnerArtifact(signing, { destinationUdid: udid, force: true })
137560
+ await ensureRunnerArtifact(signing, { destinationUdid: udid, force: true }),
137561
+ tunnelAddress
137506
137562
  );
137507
137563
  }
137508
137564
  }
@@ -137528,9 +137584,13 @@ var iosDeviceRunnerBlueprint = {
137528
137584
  const release2 = reserveInteractionRunner(udid);
137529
137585
  let runner;
137530
137586
  try {
137531
- await ensureDeviceReady(udid);
137587
+ const tunnelAddress = await ensureDeviceReady(udid);
137532
137588
  await killStaleRunnersForDevice(udid);
137533
- runner = await buildAndStartRunner(udid, await resolveRunnerSigningConfig(udid));
137589
+ runner = await buildAndStartRunner(
137590
+ udid,
137591
+ await resolveRunnerSigningConfig(udid),
137592
+ tunnelAddress
137593
+ );
137534
137594
  } catch (error63) {
137535
137595
  release2();
137536
137596
  throw error63;
@@ -137600,7 +137660,7 @@ var iosDeviceRunnerBlueprint = {
137600
137660
  };
137601
137661
  },
137602
137662
  recoverable(error63) {
137603
- return isRunnerExitedError(error63) || isRunnerWedgedError(error63);
137663
+ return isRunnerExitedError(error63) || isRunnerWedgedError(error63) || error63 instanceof TunnelConnectError;
137604
137664
  }
137605
137665
  };
137606
137666
 
@@ -145445,9 +145505,9 @@ init_src2();
145445
145505
 
145446
145506
  // ../tool-server/src/blueprints/macos-app.ts
145447
145507
  var import_node_child_process30 = require("node:child_process");
145448
- var import_node_events4 = require("node:events");
145508
+ var import_node_events5 = require("node:events");
145449
145509
  var fs39 = __toESM(require("node:fs"));
145450
- var net7 = __toESM(require("node:net"));
145510
+ var net8 = __toESM(require("node:net"));
145451
145511
  var os15 = __toESM(require("node:os"));
145452
145512
  var path33 = __toESM(require("node:path"));
145453
145513
  init_src2();
@@ -145879,9 +145939,9 @@ async function helperPid(child, executable) {
145879
145939
  let signal;
145880
145940
  try {
145881
145941
  [[code, signal]] = await Promise.all([
145882
- (0, import_node_events4.once)(child, "exit"),
145883
- (0, import_node_events4.once)(child.stdout, "close"),
145884
- (0, import_node_events4.once)(child.stderr, "close")
145942
+ (0, import_node_events5.once)(child, "exit"),
145943
+ (0, import_node_events5.once)(child.stdout, "close"),
145944
+ (0, import_node_events5.once)(child.stderr, "close")
145885
145945
  ]);
145886
145946
  } catch (err) {
145887
145947
  throw helperLaunchFailure(executable, errorMessage2(err), err);
@@ -145967,7 +146027,7 @@ function createMacosAppApi(bundleId) {
145967
146027
  );
145968
146028
  }
145969
146029
  const ch = new LibraryChannel(
145970
- net7.createConnection(app.listenSocket),
146030
+ net8.createConnection(app.listenSocket),
145971
146031
  bundleId,
145972
146032
  app.pid,
145973
146033
  recordNetworkEvent
@@ -146255,7 +146315,7 @@ function createMacosAppApi(bundleId) {
146255
146315
  }
146256
146316
  );
146257
146317
  try {
146258
- await (0, import_node_events4.once)(helper, "spawn");
146318
+ await (0, import_node_events5.once)(helper, "spawn");
146259
146319
  } catch (err) {
146260
146320
  throw helperLaunchFailure(info.executable, errorMessage2(err), err);
146261
146321
  }
@@ -149696,7 +149756,7 @@ init_src();
149696
149756
  // ../tool-server/src/blueprints/android-network-inspector.ts
149697
149757
  var import_node_crypto13 = require("node:crypto");
149698
149758
  var fs41 = __toESM(require("node:fs"));
149699
- var net8 = __toESM(require("node:net"));
149759
+ var net9 = __toESM(require("node:net"));
149700
149760
  var path35 = __toESM(require("node:path"));
149701
149761
  init_src2();
149702
149762
  init_adb();
@@ -150246,7 +150306,7 @@ function createInspector(serial, packageName, initialMetroPort) {
150246
150306
  }
150247
150307
  function listen2() {
150248
150308
  return new Promise((resolve21, reject) => {
150249
- const srv = net8.createServer(serveAgent);
150309
+ const srv = net9.createServer(serveAgent);
150250
150310
  srv.once("error", reject);
150251
150311
  srv.listen(0, "127.0.0.1", () => {
150252
150312
  srv.off("error", reject);
@@ -155053,10 +155113,10 @@ function electronGuiChildEnv(overrides = {}) {
155053
155113
  }
155054
155114
 
155055
155115
  // ../tool-server/src/utils/free-port.ts
155056
- var net9 = __toESM(require("node:net"));
155116
+ var net10 = __toESM(require("node:net"));
155057
155117
  async function pickFreePort() {
155058
155118
  return new Promise((resolve21, reject) => {
155059
- const srv = net9.createServer();
155119
+ const srv = net10.createServer();
155060
155120
  srv.unref();
155061
155121
  srv.on("error", reject);
155062
155122
  srv.listen(0, "127.0.0.1", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.34.1-next.43",
3
+ "version": "0.34.1-next.44",
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",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-ios-device-interact
3
- description: Drive a physical iPhone through argent. Use when a physical iPhone is involved (a list-devices iOS entry with kind "device") and ONLY then; never for a simulator. For cable, trust, or signing problems read argent-ios-device-setup.
3
+ description: Drive a physical iPhone through argent. Use when a physical iPhone is involved (a list-devices iOS entry with kind "device") and ONLY then; never for a simulator. For connection, trust, or signing problems read argent-ios-device-setup.
4
4
  ---
5
5
 
6
6
  # Physical iPhone interaction
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-ios-device-setup
3
- description: Set up a cabled physical iPhone for argent. Use when a physical iPhone is involved (a list-devices iOS entry with kind "device") and ONLY then; never for a simulator.
3
+ description: Set up a physical iPhone over USB or a connected CoreDevice tunnel for argent. Use when a physical iPhone is involved (a list-devices iOS entry with kind "device") and ONLY then; never for a simulator.
4
4
  ---
5
5
 
6
6
  # Physical iPhone setup
@@ -9,7 +9,7 @@ Read this only for a physical iPhone. Simulators use `argent-ios-simulator-setup
9
9
 
10
10
  ## First run
11
11
 
12
- 1. Cable the phone, unlock it, keep the screen awake, and turn on Developer Mode (Settings > Privacy & Security > Developer Mode). `list-devices` must show it `connected`.
12
+ 1. Connect the phone in Xcode through USB or a CoreDevice network tunnel. Unlock it, keep the screen awake, and enable Developer Mode (Settings > Privacy & Security > Developer Mode). `list-devices` must show it `connected`; `paired` means unreachable. A network phone's tunnel comes up on its first call. A fleet provider must expose the CoreDevice tunnel to this Mac.
13
13
  2. `launch-app` only registers the app. The first `describe`, gesture or `screenshot` builds, signs and starts the on-device runner: minutes cold, tens of seconds from cache or after a tool-server restart. Build cap 15 min, runner ready 120 s.
14
14
  3. On the first install the phone asks to trust the developer (Settings > General > VPN & Device Management), and an **Argent Runner** app appears on the home screen. Tell the user it is argent's automation runner and must stay installed.
15
15
 
@@ -17,4 +17,6 @@ Read this only for a physical iPhone. Simulators use `argent-ios-simulator-setup
17
17
 
18
18
  Signing needs no configuration: the first call on a phone names the team it picked; `ARGENT_IOS_TEAM_ID` in the tool-server environment overrides it. Errors name their fix (cable, lock, trust, signing, a stuck runner): apply it and retry the same call. A failed build quotes xcodebuild's own `error:` lines.
19
19
 
20
+ For a network device, a missing tunnel requires reconnecting in Xcode or through its fleet provider. If the runner stops answering on its tunnel, Argent restarts it on the current address and retries the call once.
21
+
20
22
  Then read `argent-ios-device-interact`.