@swmansion/argent 0.35.1-next.70 → 0.35.1-next.72

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
@@ -38904,7 +38904,7 @@ function isCi(env = process.env) {
38904
38904
  var SESSION_ID2 = randomUUID5();
38905
38905
  function readCliVersion() {
38906
38906
  if (true) {
38907
- return "0.35.1-next.69";
38907
+ return "0.35.1-next.72";
38908
38908
  }
38909
38909
  return "0.0.0";
38910
38910
  }
@@ -17136,7 +17136,7 @@ function isCi(env = process.env) {
17136
17136
  var SESSION_ID = randomUUID4();
17137
17137
  function readCliVersion() {
17138
17138
  if (true) {
17139
- return "0.35.1-next.69";
17139
+ return "0.35.1-next.72";
17140
17140
  }
17141
17141
  return "0.0.0";
17142
17142
  }
@@ -38468,7 +38468,7 @@ async function startMcpServer(options) {
38468
38468
  const autoDescribeOn = autoDescribeEnabled();
38469
38469
  const whatsNewOn = whatsNewEnabled();
38470
38470
  const installedVersion = getInstalledVersion();
38471
- const highlightsVersion = true ? "0.35.1-next.69" : installedVersion;
38471
+ const highlightsVersion = true ? "0.35.1-next.72" : installedVersion;
38472
38472
  const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
38473
38473
  const trees = createTreeMemory();
38474
38474
  const screenshots = createScreenshotMemory();
@@ -73314,7 +73314,7 @@ function isCi(env = process.env) {
73314
73314
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
73315
73315
  function readCliVersion() {
73316
73316
  if (true) {
73317
- return "0.35.1-next.69";
73317
+ return "0.35.1-next.72";
73318
73318
  }
73319
73319
  return "0.0.0";
73320
73320
  }
@@ -75771,14 +75771,14 @@ function adbCommandPrefix(env) {
75771
75771
  }
75772
75772
 
75773
75773
  // ../tool-server/src/utils/keyed-lock.ts
75774
- async function withKeyedLock(locks, key2, fn) {
75775
- const previous = locks.get(key2) ?? Promise.resolve();
75774
+ async function withKeyedLock(locks2, key2, fn) {
75775
+ const previous = locks2.get(key2) ?? Promise.resolve();
75776
75776
  const run2 = previous.then(() => fn());
75777
- const held = run2.catch(() => {
75777
+ const held2 = run2.catch(() => {
75778
75778
  });
75779
- locks.set(key2, held);
75780
- void held.then(() => {
75781
- if (locks.get(key2) === held) locks.delete(key2);
75779
+ locks2.set(key2, held2);
75780
+ void held2.then(() => {
75781
+ if (locks2.get(key2) === held2) locks2.delete(key2);
75782
75782
  });
75783
75783
  return run2;
75784
75784
  }
@@ -76681,16 +76681,16 @@ async function leaseWithin(config2, deadline, signal, timeout, force) {
76681
76681
  if (timeout.aborted && !closing) return null;
76682
76682
  throw err;
76683
76683
  }
76684
- const held = leasesOf(config2)[0];
76684
+ const held2 = leasesOf(config2)[0];
76685
76685
  if (!access11.granted) {
76686
76686
  if (access11.keyRefused) return null;
76687
- if (!held) {
76687
+ if (!held2) {
76688
76688
  if (access11.denied) return null;
76689
76689
  throw unreachable("check this API key's Android access");
76690
76690
  }
76691
76691
  if (force) throw access11.denied ? accessDenied() : unreachable("lease a fresh emulator");
76692
- if (await answers(held, signal)) return reuse(held);
76693
- throw notAnswering(held);
76692
+ if (await answers(held2, signal)) return reuse(held2);
76693
+ throw notAnswering(held2);
76694
76694
  }
76695
76695
  const granted = access11;
76696
76696
  const key2 = cloudAndroidConfigKey(config2);
@@ -78178,10 +78178,10 @@ async function requireRecordingSession(projectRoot, name) {
78178
78178
  );
78179
78179
  }
78180
78180
  const asked = getFlowPath(projectRoot, name);
78181
- const held = getFlowPath(session.projectRoot, session.name);
78182
- if (asked !== held) {
78181
+ const held2 = getFlowPath(session.projectRoot, session.name);
78182
+ if (asked !== held2) {
78183
78183
  throw new FailureError(
78184
- `Recording of "${name}" in ${projectRoot} is not registered under that spelling \u2014 ${held} and ${asked} are the same file on this filesystem (a symlink, or a case-insensitive volume), and the live take on it is registered as "${session.name}" in ${session.projectRoot}. If that is your own recording spelled another way, re-address it exactly as you passed it to e2e-start-recording \u2014 the take is intact and still recording. If it is another caller's, their e2e-start-recording truncated yours; record under a name that resolves to its own file rather than restarting here, which would destroy their take in turn.`,
78184
+ `Recording of "${name}" in ${projectRoot} is not registered under that spelling \u2014 ${held2} and ${asked} are the same file on this filesystem (a symlink, or a case-insensitive volume), and the live take on it is registered as "${session.name}" in ${session.projectRoot}. If that is your own recording spelled another way, re-address it exactly as you passed it to e2e-start-recording \u2014 the take is intact and still recording. If it is another caller's, their e2e-start-recording truncated yours; record under a name that resolves to its own file rather than restarting here, which would destroy their take in turn.`,
78185
78185
  {
78186
78186
  error_code: FAILURE_CODES.FLOW_NO_ACTIVE_RECORDING,
78187
78187
  failure_stage: "flow_recording_key_aliased",
@@ -79199,8 +79199,8 @@ function parseTapModifiers(raw, entry) {
79199
79199
  if (!Array.isArray(raw) || !raw.every((m) => typeof m === "string" && names.includes(m))) {
79200
79200
  badEntry(entry, `tap.modifiers must be a list of ${MACOS_MODIFIERS.join(", ")}`);
79201
79201
  }
79202
- const held = MACOS_MODIFIERS.filter((m) => raw.includes(m));
79203
- return held.length > 0 ? held : void 0;
79202
+ const held2 = MACOS_MODIFIERS.filter((m) => raw.includes(m));
79203
+ return held2.length > 0 ? held2 : void 0;
79204
79204
  }
79205
79205
  function hasSelectorField(obj) {
79206
79206
  return obj.text !== void 0 || obj.id !== void 0 || obj.identifier !== void 0 || obj.role !== void 0 || obj.any !== void 0 || SELECTOR_RELATIONS.some((relation) => obj[relation] !== void 0);
@@ -91437,22 +91437,22 @@ var Publisher = class {
91437
91437
  if (!live.has(path78))
91438
91438
  refused.delete(path78);
91439
91439
  }
91440
- const held = new Map(active);
91440
+ const held2 = new Map(active);
91441
91441
  for (const [suffix, producer] of active) {
91442
91442
  if (updated.get(suffix) === producer)
91443
91443
  continue;
91444
91444
  await withdraw(suffix);
91445
- held.delete(suffix);
91445
+ held2.delete(suffix);
91446
91446
  }
91447
91447
  for (const [suffix, producer] of updated) {
91448
91448
  if (active.get(suffix) === producer)
91449
91449
  continue;
91450
91450
  if (this.#offerable(join26(prefix, suffix), refused)) {
91451
91451
  if (await advertise2(suffix))
91452
- held.set(suffix, producer);
91452
+ held2.set(suffix, producer);
91453
91453
  }
91454
91454
  }
91455
- active = held;
91455
+ active = held2;
91456
91456
  const outstanding = [...updated].some(([suffix, producer]) => active.get(suffix) !== producer && this.#pending(join26(prefix, suffix), refused));
91457
91457
  retry = outstanding ? Math.min(retry ? retry * 2 : RETRY_BASE, RETRY_MAX) : 0;
91458
91458
  const next = await (retry ? Promise.race([changed, stream.reader.closed, retryAfter(retry).then(() => broadcasts)]) : Promise.race([changed, stream.reader.closed]));
@@ -91519,13 +91519,13 @@ var Publisher = class {
91519
91519
  await this.#advertise(path78, requests, refused);
91520
91520
  }
91521
91521
  }
91522
- const held = /* @__PURE__ */ new Map();
91522
+ const held2 = /* @__PURE__ */ new Map();
91523
91523
  for (const path78 of requests.keys()) {
91524
91524
  const producer = updated.get(path78);
91525
91525
  if (producer)
91526
- held.set(path78, producer);
91526
+ held2.set(path78, producer);
91527
91527
  }
91528
- active = held;
91528
+ active = held2;
91529
91529
  const outstanding = [...updated].some(([path78, producer]) => active.get(path78) !== producer && this.#pending(path78, refused));
91530
91530
  retry = outstanding ? Math.min(retry ? retry * 2 : RETRY_BASE, RETRY_MAX) : 0;
91531
91531
  const next = await (retry ? Promise.race([changed, retryAfter(retry).then(() => broadcasts)]) : changed);
@@ -100396,6 +100396,109 @@ function captureOnDemandDropped(deviceId, endpoint) {
100396
100396
  if (server?.endpoint === endpoint) server.onDemand = false;
100397
100397
  }
100398
100398
 
100399
+ // ../tool-server/src/utils/held-touch.ts
100400
+ var HELD_TOUCH_TIMEOUT_MS = 3e4;
100401
+ var HELD_TOUCH_RETRY_MS = 5e3;
100402
+ var HELD_TOUCH_TIMER_ATTEMPTS = 3;
100403
+ var held = /* @__PURE__ */ new Map();
100404
+ var disposedOwners = /* @__PURE__ */ new WeakSet();
100405
+ function isDisposed(owner) {
100406
+ return typeof owner === "object" && owner !== null && disposedOwners.has(owner);
100407
+ }
100408
+ var locks = /* @__PURE__ */ new Map();
100409
+ async function withTouchLock(deviceId, fn) {
100410
+ const previous = locks.get(deviceId) ?? Promise.resolve();
100411
+ let unlock;
100412
+ const mine = new Promise((resolve24) => unlock = resolve24);
100413
+ const tail = previous.then(() => mine);
100414
+ locks.set(deviceId, tail);
100415
+ await previous;
100416
+ try {
100417
+ return await fn();
100418
+ } finally {
100419
+ unlock();
100420
+ if (locks.get(deviceId) === tail) locks.delete(deviceId);
100421
+ }
100422
+ }
100423
+ function armTimer(deviceId, entry, delayMs) {
100424
+ entry.timer = setTimeout(() => {
100425
+ entry.timer = void 0;
100426
+ void withTouchLock(deviceId, async () => {
100427
+ if (held.get(deviceId) !== entry) return;
100428
+ if (isDisposed(entry.owner)) {
100429
+ forget(deviceId, entry);
100430
+ return;
100431
+ }
100432
+ try {
100433
+ await entry.release();
100434
+ } catch {
100435
+ entry.timerFailures += 1;
100436
+ if (held.get(deviceId) === entry && entry.timerFailures < HELD_TOUCH_TIMER_ATTEMPTS) {
100437
+ armTimer(deviceId, entry, HELD_TOUCH_RETRY_MS);
100438
+ }
100439
+ return;
100440
+ }
100441
+ forget(deviceId, entry);
100442
+ });
100443
+ }, delayMs);
100444
+ entry.timer.unref?.();
100445
+ }
100446
+ function forget(deviceId, entry) {
100447
+ if (entry.timer) clearTimeout(entry.timer);
100448
+ entry.timer = void 0;
100449
+ if (held.get(deviceId) === entry) held.delete(deviceId);
100450
+ }
100451
+ function holdTouch(deviceId, touch2) {
100452
+ const previous = held.get(deviceId);
100453
+ if (previous) forget(deviceId, previous);
100454
+ if (isDisposed(touch2.owner)) return;
100455
+ const entry = {
100456
+ contact: touch2.contact,
100457
+ release: touch2.release,
100458
+ owner: touch2.owner,
100459
+ timerFailures: 0
100460
+ };
100461
+ held.set(deviceId, entry);
100462
+ armTimer(deviceId, entry, HELD_TOUCH_TIMEOUT_MS);
100463
+ }
100464
+ function peekHeldTouch(deviceId) {
100465
+ const entry = held.get(deviceId);
100466
+ if (!entry) return void 0;
100467
+ return { contact: entry.contact, release: entry.release, owner: entry.owner };
100468
+ }
100469
+ function forgetHeldTouch(deviceId) {
100470
+ const entry = held.get(deviceId);
100471
+ if (entry) forget(deviceId, entry);
100472
+ }
100473
+ async function releaseHeldTouch(deviceId) {
100474
+ const entry = held.get(deviceId);
100475
+ if (!entry) return;
100476
+ if (isDisposed(entry.owner)) {
100477
+ forget(deviceId, entry);
100478
+ return;
100479
+ }
100480
+ try {
100481
+ await entry.release();
100482
+ } catch (error63) {
100483
+ if (error63 instanceof Error) {
100484
+ error63.message = `Could not lift the finger an earlier gesture-custom call left down, so the new touch was not sent: ${error63.message}`;
100485
+ }
100486
+ throw error63;
100487
+ }
100488
+ forget(deviceId, entry);
100489
+ }
100490
+ async function discardHeldTouch(deviceId, owner) {
100491
+ if (typeof owner === "object" && owner !== null) disposedOwners.add(owner);
100492
+ if (held.get(deviceId)?.owner !== owner) return;
100493
+ await withTouchLock(deviceId, async () => {
100494
+ const entry = held.get(deviceId);
100495
+ if (!entry || entry.owner !== owner) return;
100496
+ await entry.release().catch(() => {
100497
+ });
100498
+ forget(deviceId, entry);
100499
+ });
100500
+ }
100501
+
100399
100502
  // ../tool-server/src/utils/foldable.ts
100400
100503
  var import_node_child_process17 = require("node:child_process");
100401
100504
  var fs23 = __toESM(require("node:fs"));
@@ -100845,9 +100948,9 @@ function pendingIdNamedBy(conn, message) {
100845
100948
  return void 0;
100846
100949
  }
100847
100950
  function releaseHeldKeys(conn) {
100848
- const held = conn.heldKeys.splice(0).reverse();
100951
+ const held2 = conn.heldKeys.splice(0).reverse();
100849
100952
  if (conn.ws.readyState !== wrapper_default.OPEN) return;
100850
- for (const code of held) {
100953
+ for (const code of held2) {
100851
100954
  conn.ws.send(JSON.stringify({ id: String(++cmdId), cmd: "key", code, direction: "Up" }));
100852
100955
  }
100853
100956
  }
@@ -100941,6 +101044,16 @@ function getOrCreateConnection(api) {
100941
101044
  return conn;
100942
101045
  }
100943
101046
  async function sendCommand(api, cmd, options = {}) {
101047
+ const deviceId = api.deviceId;
101048
+ if ((cmd.cmd === "touch" || cmd.cmd === "edgeTouch") && cmd.type === "Down" && deviceId && !options.touchLockHeld) {
101049
+ return withTouchLock(deviceId, async () => {
101050
+ await releaseHeldTouch(deviceId);
101051
+ return sendCommandUnlocked(api, cmd, options);
101052
+ });
101053
+ }
101054
+ return sendCommandUnlocked(api, cmd, options);
101055
+ }
101056
+ async function sendCommandUnlocked(api, cmd, options) {
100944
101057
  const cmdName = typeof cmd.cmd === "string" ? cmd.cmd : "unknown";
100945
101058
  if ((cmd.cmd === "rotate" || cmd.cmd === "button") && api.deviceId) {
100946
101059
  forgetUiOrientation(api.deviceId);
@@ -104611,6 +104724,15 @@ function withCaptureOnDemand(deviceId, instance) {
104611
104724
  }
104612
104725
  };
104613
104726
  }
104727
+ function withHeldTouchTeardown(deviceId, instance) {
104728
+ return {
104729
+ ...instance,
104730
+ dispose: async () => {
104731
+ await discardHeldTouch(deviceId, instance.api);
104732
+ await instance.dispose();
104733
+ }
104734
+ };
104735
+ }
104614
104736
  var simulatorServerBlueprint = {
104615
104737
  namespace: SIMULATOR_SERVER_NAMESPACE,
104616
104738
  getURN(device) {
@@ -104655,10 +104777,13 @@ var simulatorServerBlueprint = {
104655
104777
  }
104656
104778
  const claim2 = externalClaimForAnyId(device.id);
104657
104779
  if (claim2) {
104658
- return withCaptureOnDemand(device.id, await buildAttachedInstance(device, claim2));
104780
+ return withHeldTouchTeardown(
104781
+ device.id,
104782
+ withCaptureOnDemand(device.id, await buildAttachedInstance(device, claim2))
104783
+ );
104659
104784
  }
104660
104785
  if (device.platform === "ios-remote") {
104661
- return buildRemoteInstance(device);
104786
+ return withHeldTouchTeardown(device.id, await buildRemoteInstance(device));
104662
104787
  }
104663
104788
  if (device.platform === "ios") {
104664
104789
  if (await isTvOsSimulator(device.id)) {
@@ -104731,7 +104856,7 @@ var simulatorServerBlueprint = {
104731
104856
  events
104732
104857
  };
104733
104858
  await attachFoldableDisplay(instance.api, device);
104734
- return withCaptureOnDemand(device.id, instance);
104859
+ return withHeldTouchTeardown(device.id, withCaptureOnDemand(device.id, instance));
104735
104860
  }
104736
104861
  };
104737
104862
 
@@ -114604,11 +114729,11 @@ var androidChromeCdpBlueprint = {
114604
114729
  throw err;
114605
114730
  }
114606
114731
  };
114607
- const locks = /* @__PURE__ */ new Map();
114732
+ const locks2 = /* @__PURE__ */ new Map();
114608
114733
  const api = {
114609
- readVisibleTab: (pkg) => withKeyedLock(locks, serial, () => readVisibleTab(pkg))
114734
+ readVisibleTab: (pkg) => withKeyedLock(locks2, serial, () => readVisibleTab(pkg))
114610
114735
  };
114611
- const dispose = () => withKeyedLock(locks, serial, async () => {
114736
+ const dispose = () => withKeyedLock(locks2, serial, async () => {
114612
114737
  dropTab();
114613
114738
  for (const { port } of forwards.values()) await removeForward(port);
114614
114739
  forwards.clear();
@@ -114759,7 +114884,7 @@ async function describeAndroid(registry2, serial, _bundleId, isTv) {
114759
114884
  const ref = androidDevtoolsRef(device);
114760
114885
  const devtools = await registry2.resolveService(ref.urn, ref.options);
114761
114886
  const [{ xml }, size2] = await Promise.all([
114762
- devtools.getHierarchy(),
114887
+ devtools.getHierarchy({ clearCache: true }),
114763
114888
  devtools.getScreenSize()
114764
114889
  ]);
114765
114890
  const capture2 = (x) => ({
@@ -114768,7 +114893,7 @@ async function describeAndroid(registry2, serial, _bundleId, isTv) {
114768
114893
  });
114769
114894
  const read2 = await awaitWebViewPublished(
114770
114895
  capture2(xml),
114771
- async () => capture2((await devtools.getHierarchy()).xml),
114896
+ async () => capture2((await devtools.getHierarchy({ clearCache: true })).xml),
114772
114897
  size2,
114773
114898
  readTab
114774
114899
  );
@@ -124843,8 +124968,8 @@ function createMacosAppApi(bundleId) {
124843
124968
  ch = await ensureChannel();
124844
124969
  const before = await ch.request("Window.list", {}, TERMINATE_GRACE_MS).catch(() => null);
124845
124970
  const shown = shownPrompts(before);
124846
- const held = heldQuits.get(bundleId);
124847
- unanswered = held?.pid === app.pid ? shown.find((w) => !held.openBefore.has(w.number)) : void 0;
124971
+ const held2 = heldQuits.get(bundleId);
124972
+ unanswered = held2?.pid === app.pid ? shown.find((w) => !held2.openBefore.has(w.number)) : void 0;
124848
124973
  if (!unanswered) {
124849
124974
  open5 = new Set(shown.map((w) => w.number));
124850
124975
  await ch.request("Application.terminate", {}, 2e3);
@@ -129897,12 +130022,12 @@ function createInspector(serial, packageName, initialMetroPort) {
129897
130022
  });
129898
130023
  bodies.set(cacheKey2, fetched);
129899
130024
  while (bodies.size > MAX_CACHED_BODIES) bodies.delete(bodies.keys().next().value);
129900
- const forget = () => {
130025
+ const forget2 = () => {
129901
130026
  if (bodies.get(cacheKey2) === fetched) bodies.delete(cacheKey2);
129902
130027
  };
129903
130028
  fetched.then((body) => {
129904
- if (sending2 && !body.available) forget();
129905
- }, forget);
130029
+ if (sending2 && !body.available) forget2();
130030
+ }, forget2);
129906
130031
  return fetched;
129907
130032
  }
129908
130033
  function failOrphans(running) {
@@ -130600,9 +130725,9 @@ var ShapedSocket = class extends import_node_stream2.Duplex {
130600
130725
  if (this.readRequestLine(chunk)) this.sendHeldRequest();
130601
130726
  }
130602
130727
  sendHeldRequest() {
130603
- const held = Buffer.concat(this.heldRequest);
130728
+ const held2 = Buffer.concat(this.heldRequest);
130604
130729
  this.heldRequest = [];
130605
- this.sendUpload(held);
130730
+ this.sendUpload(held2);
130606
130731
  }
130607
130732
  sendUpload(chunk) {
130608
130733
  this.uploadsSending++;
@@ -131015,7 +131140,7 @@ var androidNetworkShaperBlueprint = {
131015
131140
  async factory(_deps, serial) {
131016
131141
  let metroPort2 = 0;
131017
131142
  let proxyOnDevice = false;
131018
- const locks = /* @__PURE__ */ new Map();
131143
+ const locks2 = /* @__PURE__ */ new Map();
131019
131144
  const proxy = await startShapingProxy({
131020
131145
  resolveTarget: (host, port) => resolveDeviceTarget(serial, host, port),
131021
131146
  bypass: (host, port) => port === metroPort2 && (host === EMULATOR_HOST_ALIAS || isLoopback(host))
@@ -131026,19 +131151,19 @@ var androidNetworkShaperBlueprint = {
131026
131151
  proxyOnDevice = false;
131027
131152
  };
131028
131153
  const api = {
131029
- throttle: (conditions, port) => withKeyedLock(locks, serial, async () => {
131154
+ throttle: (conditions, port) => withKeyedLock(locks2, serial, async () => {
131030
131155
  metroPort2 = port;
131031
131156
  proxy.setConditions(conditions);
131032
131157
  proxyOnDevice = true;
131033
131158
  await setArgentProxy(serial, proxy.port);
131034
131159
  }),
131035
- clear: () => withKeyedLock(locks, serial, clear)
131160
+ clear: () => withKeyedLock(locks2, serial, clear)
131036
131161
  };
131037
131162
  const removeProxyOnStop = async () => {
131038
131163
  if (proxyOnDevice) await clear();
131039
131164
  };
131040
131165
  const dispose = async () => {
131041
- await withKeyedLock(locks, serial, removeProxyOnStop).catch((err) => {
131166
+ await withKeyedLock(locks2, serial, removeProxyOnStop).catch((err) => {
131042
131167
  process.stderr.write(
131043
131168
  `[${ANDROID_NETWORK_SHAPER_NAMESPACE}:${serial}] could not remove the proxy: ${String(err)}
131044
131169
  `
@@ -131484,7 +131609,7 @@ function withCaptureLock(udid, bundleId, fn) {
131484
131609
  }
131485
131610
  async function withCaptureSweep(devices2, wait, fn) {
131486
131611
  const covered = devices2 && new Set(devices2.map(lockDevice));
131487
- const underWay = [...captureLocks].filter(([key2]) => !covered || covered.has(key2.slice(0, key2.lastIndexOf(":")))).map(([, held]) => held);
131612
+ const underWay = [...captureLocks].filter(([key2]) => !covered || covered.has(key2.slice(0, key2.lastIndexOf(":")))).map(([, held2]) => held2);
131488
131613
  let end;
131489
131614
  const sweep = { devices: covered, done: new Promise((resolve24) => end = resolve24) };
131490
131615
  captureSweeps.add(sweep);
@@ -132385,9 +132510,9 @@ async function androidDevices(serials, marker, awaitSerials, waitSerials) {
132385
132510
  let graceOver = false;
132386
132511
  let grace;
132387
132512
  const settle3 = () => {
132388
- const held = heldSerials(answers2);
132513
+ const held2 = heldSerials(answers2);
132389
132514
  const waitingOn = listed.filter(
132390
- (serial) => !answers2.has(serial) && (!graceOver || awaited.includes(serial)) && !held.some((found2) => anotherDevice(serial, found2))
132515
+ (serial) => !answers2.has(serial) && (!graceOver || awaited.includes(serial)) && !held2.some((found2) => anotherDevice(serial, found2))
132391
132516
  );
132392
132517
  if (waitingOn.length === 0) {
132393
132518
  clearTimeout(grace);
@@ -134408,8 +134533,8 @@ function forgetJsCapture(device, bundleId) {
134408
134533
  }
134409
134534
  function setJsCapture(payload, capture) {
134410
134535
  forgetJsCapture(splitPayload(payload).device, capture.bundleId);
134411
- const held = storedPayload(payload);
134412
- if (held !== void 0) jsCaptures.delete(held);
134536
+ const held2 = storedPayload(payload);
134537
+ if (held2 !== void 0) jsCaptures.delete(held2);
134413
134538
  const unavailable3 = unavailablePayload(payload);
134414
134539
  if (unavailable3 !== void 0) jsUnavailable.delete(unavailable3);
134415
134540
  jsCaptures.set(payload, capture);
@@ -134422,8 +134547,8 @@ function unavailablePayload(payload) {
134422
134547
  });
134423
134548
  }
134424
134549
  function setJsUnavailable(payload, bundleId, reason2) {
134425
- const held = unavailablePayload(payload);
134426
- if (held !== void 0) jsUnavailable.delete(held);
134550
+ const held2 = unavailablePayload(payload);
134551
+ if (held2 !== void 0) jsUnavailable.delete(held2);
134427
134552
  jsUnavailable.set(payload, { bundleId, reason: reason2 });
134428
134553
  }
134429
134554
  function jsUnavailableOn(payload) {
@@ -141376,6 +141501,16 @@ var capability14 = {
141376
141501
  android: { emulator: true, device: true, unknown: true }
141377
141502
  };
141378
141503
  var SAME_POINT_EPSILON = 5e-3;
141504
+ function liftCommand(event2) {
141505
+ return {
141506
+ cmd: "touch",
141507
+ type: "Up",
141508
+ x: event2.x,
141509
+ y: event2.y,
141510
+ second_x: event2.x2 ?? null,
141511
+ second_y: event2.y2 ?? null
141512
+ };
141513
+ }
141379
141514
  function samePoint(a, b) {
141380
141515
  return Math.abs(a.x - b.x) <= SAME_POINT_EPSILON && Math.abs(a.y - b.y) <= SAME_POINT_EPSILON;
141381
141516
  }
@@ -141385,7 +141520,7 @@ function planIosDeviceGesture(events) {
141385
141520
  if (down === void 0 || up === void 0 || events.length < 2 || down.type !== "Down" || up.type !== "Up" || events.slice(1, -1).some((event2) => event2.type !== "Move")) {
141386
141521
  return {
141387
141522
  kind: "unsupported",
141388
- reason: "gesture-custom on a physical iOS device takes a Down, any number of Moves, then an Up (a second finger rides along as x2/y2 on those events)."
141523
+ reason: "gesture-custom on a physical iOS device takes a Down, any number of Moves, then an Up (a second finger rides along as x2/y2 on those events). Leaving a finger down between calls works only on a simulator or emulator."
141389
141524
  };
141390
141525
  }
141391
141526
  const twoFingers = events.some((e) => e.x2 !== void 0 || e.y2 !== void 0);
@@ -141464,8 +141599,9 @@ var gestureCustomTool = {
141464
141599
  description: `Send a custom sequence of normalized [0,1] touch events.
141465
141600
  Use when you need long-press, drag-and-drop, edge/system gestures (\`edge\` on local iOS sim), or multi-waypoint/two-finger paths. Prefer \`gesture-tap\`, \`gesture-swipe\`, \`gesture-pinch\`, or \`gesture-rotate\` for standard gestures.<flag:macos-apps> Not supported on Mac apps (use \`gesture-tap\`, \`gesture-drag\`, \`gesture-scroll\`).</flag:macos-apps>
141466
141601
  Physical iOS: Down, optional Moves, then Up (\`x2\`/\`y2\` = second finger). Plain Down then Up: same point = press-hold, other point = drag (\`Up delayMs\` = rest before move); one Move at Down point between them = long-press pickup (\`Move delayMs\` = hold, \`Up delayMs\` = move time); any other train plays as timed paths (each waiting its \`delayMs\`, portrait required).
141602
+ Simulator/emulator: a train that ends without Up leaves the finger down and returns \`{ held: true }\`, so \`screenshot\`/\`describe\` can observe a pressed state; the next call continues it (start with Move or Up), and any new Down first lifts it. Argent lifts a held finger after 30 seconds. Not with \`edge\` or on physical iOS.
141467
141603
  Example long-press + drag: \`[{"type":"Down","x":0.5,"y":0.6},{"type":"Move","x":0.5,"y":0.6,"delayMs":800},{"type":"Up","x":0.5,"y":0.3,"delayMs":500}]\`.
141468
- Returns \`{ events, reactivated? }\` (on physical iOS, \`reactivated: true\` means re-describe). Fails if device is not booted or events are invalid.`,
141604
+ Returns \`{ events, held?, reactivated? }\` (on physical iOS, \`reactivated: true\` means re-describe). Fails if device is not booted or events are invalid.`,
141469
141605
  zodSchema: zodSchema23,
141470
141606
  interaction: {
141471
141607
  startedMsg: () => "Performing custom gesture",
@@ -141498,36 +141634,64 @@ Returns \`{ events, reactivated? }\` (on physical iOS, \`reactivated: true\` mea
141498
141634
  }
141499
141635
  const api = services.simulatorServer;
141500
141636
  const events = params.interpolate && params.interpolate > 0 ? interpolateEvents(params.events, params.interpolate) : params.events;
141501
- let warning;
141502
- let edgeContact;
141503
- try {
141504
- for (const event2 of events) {
141505
- await sleep8(event2.delayMs ?? 16);
141506
- const sent = await sendCommand(api, {
141507
- ...params.edge ? { cmd: "edgeTouch", edge: params.edge } : { cmd: "touch", second_x: event2.x2 ?? null, second_y: event2.y2 ?? null },
141637
+ return withTouchLock(device.id, () => playTrain(api, device.id, params.edge, events));
141638
+ }
141639
+ };
141640
+ async function playTrain(api, deviceId, edge, events) {
141641
+ let contact;
141642
+ if (events[0]?.type === "Down") {
141643
+ await releaseHeldTouch(deviceId);
141644
+ } else {
141645
+ contact = peekHeldTouch(deviceId)?.contact;
141646
+ }
141647
+ const lift = (at) => sendCommand(
141648
+ api,
141649
+ edge ? { cmd: "edgeTouch", edge, type: "Up", x: at.x, y: at.y } : liftCommand(at),
141650
+ { touchLockHeld: true }
141651
+ );
141652
+ let warning;
141653
+ try {
141654
+ for (const event2 of events) {
141655
+ await sleep8(event2.delayMs ?? 16);
141656
+ const sent = await sendCommand(
141657
+ api,
141658
+ {
141659
+ ...edge ? { cmd: "edgeTouch", edge } : { cmd: "touch", second_x: event2.x2 ?? null, second_y: event2.y2 ?? null },
141508
141660
  type: event2.type,
141509
141661
  x: event2.x,
141510
141662
  y: event2.y
141511
- });
141512
- if (params.edge) edgeContact = event2.type === "Up" ? void 0 : event2;
141513
- warning ??= sent.warning;
141514
- }
141515
- } catch (error63) {
141516
- if (edgeContact) {
141517
- await sendCommand(api, {
141518
- cmd: "edgeTouch",
141519
- edge: params.edge,
141520
- type: "Up",
141521
- x: edgeContact.x,
141522
- y: edgeContact.y
141523
- }).catch(() => {
141524
- });
141663
+ },
141664
+ { touchLockHeld: true }
141665
+ );
141666
+ if (event2.type === "Up") {
141667
+ forgetHeldTouch(deviceId);
141668
+ contact = void 0;
141669
+ } else {
141670
+ contact = event2;
141525
141671
  }
141526
- throw error63;
141672
+ warning ??= sent.warning;
141527
141673
  }
141528
- return { events: events.length, ...warning !== void 0 ? { warning } : {} };
141674
+ } catch (error63) {
141675
+ if (contact) {
141676
+ const last = contact;
141677
+ await lift(last).then(
141678
+ () => forgetHeldTouch(deviceId),
141679
+ () => holdTouch(deviceId, { contact: last, release: () => lift(last), owner: api })
141680
+ );
141681
+ }
141682
+ throw error63;
141529
141683
  }
141530
- };
141684
+ if (contact) {
141685
+ const last = contact;
141686
+ holdTouch(deviceId, { contact: last, release: () => lift(last), owner: api });
141687
+ return {
141688
+ events: events.length,
141689
+ held: true,
141690
+ ...warning !== void 0 ? { warning } : {}
141691
+ };
141692
+ }
141693
+ return { events: events.length, ...warning !== void 0 ? { warning } : {} };
141694
+ }
141531
141695
 
141532
141696
  // ../tool-server/src/tools/gesture-pinch/index.ts
141533
141697
  init_zod();
@@ -142323,8 +142487,8 @@ async function typeWithReadback(registry2, device, text, type) {
142323
142487
  function judgeTree(nodes, typedInto, text) {
142324
142488
  const focused = focusedInput(nodes);
142325
142489
  if (!focused || !sameInput(focused, typedInto)) return "moved";
142326
- const held = heldText(focused);
142327
- return held !== void 0 && holdsTyped(text, held) ? "holds" : void 0;
142490
+ const held2 = heldText(focused);
142491
+ return held2 !== void 0 && holdsTyped(text, held2) ? "holds" : void 0;
142328
142492
  }
142329
142493
  var SECURE_TEXT_FIELD = 50;
142330
142494
  var TEXT_INPUT_TYPES = /* @__PURE__ */ new Set([
@@ -142353,18 +142517,18 @@ function sameInput(a, b) {
142353
142517
  const smaller = Math.min(p.width * p.height, q.width * q.height);
142354
142518
  return width * height >= smaller / 2;
142355
142519
  }
142356
- function holdsTyped(typed, held) {
142520
+ function holdsTyped(typed, held2) {
142357
142521
  const a = plainPunctuation(typed);
142358
- const b = plainPunctuation(held);
142522
+ const b = plainPunctuation(held2);
142359
142523
  return a === b || capitalizedByIos(a, b);
142360
142524
  }
142361
142525
  function plainPunctuation(text) {
142362
142526
  return text.replace(/‹[\u00A0\u202F]?|[\u00A0\u202F]?›/gu, "'").replace(/«[\u00A0\u202F]?|[\u00A0\u202F]?»/gu, '"').replace(/[‘’‚‛]/gu, "'").replace(/[“”„‟]/gu, '"').replace(/--|–/gu, "\u2014");
142363
142527
  }
142364
142528
  var WORD_OPENER = /[\s"'([{¿¡]/u;
142365
- function capitalizedByIos(typed, held) {
142529
+ function capitalizedByIos(typed, held2) {
142366
142530
  const a = Array.from(typed);
142367
- const b = Array.from(held);
142531
+ const b = Array.from(held2);
142368
142532
  if (a.length !== b.length) return false;
142369
142533
  let changed = false;
142370
142534
  for (let i = 0; i < a.length; i++) {
@@ -149828,9 +149992,9 @@ function unknownBody(reason2, final = false) {
149828
149992
  return { kind: "unknown", reason: reason2, final };
149829
149993
  }
149830
149994
  function nativeBody(store, record2, kind) {
149831
- const held = store?.record(record2.id);
149832
- if (!store || !held) return Promise.resolve(unknownBody(CAPTURE_ENDED));
149833
- return nativeBodyText(held, store, kind).catch((err) => unknownBody(errorMessage4(err)));
149995
+ const held2 = store?.record(record2.id);
149996
+ if (!store || !held2) return Promise.resolve(unknownBody(CAPTURE_ENDED));
149997
+ return nativeBodyText(held2, store, kind).catch((err) => unknownBody(errorMessage4(err)));
149834
149998
  }
149835
149999
  var CAPTURE_ENDED = "its capture ended after the start (stop-all-simulator-servers, a stop of the device's services, or a tool-server restart); call network-capture-start again";
149836
150000
  var SWEEP_UNDER_WAY = "stop-all-simulator-servers or the tool-server's exit is ending the app's capture";
@@ -168525,8 +168689,8 @@ function normalizeFrame4(rect, screenW, screenH) {
168525
168689
  function projectIosNode(node2, screenW, screenH, quotedLabel) {
168526
168690
  const skip = node2.hidden === true || node2.alpha !== void 0 && node2.alpha < 0.01;
168527
168691
  const role = roleFromClassName(node2.className);
168528
- const held = role === IOS_TEXT_INPUT_ROLE && node2.value !== node2.label ? node2.value : void 0;
168529
- const value = quotedLabel && held !== void 0 ? WITHHELD_INPUT_TEXT : held;
168692
+ const held2 = role === IOS_TEXT_INPUT_ROLE && node2.value !== node2.label ? node2.value : void 0;
168693
+ const value = quotedLabel && held2 !== void 0 ? WITHHELD_INPUT_TEXT : held2;
168530
168694
  const label = quotedLabel && node2.label !== void 0 ? quotedLabel(node2.label) : node2.label;
168531
168695
  const win = node2.screenFrame ?? node2.windowFrame;
168532
168696
  const rect = win ? { x: win.x, y: win.y, w: win.width, h: win.height } : null;
@@ -170755,8 +170919,8 @@ var POINT_GESTURE_STEP = {
170755
170919
  const times = step.kind === "tap" && step.times !== void 0 && step.times > 1 ? ` \xD7${step.times}` : "";
170756
170920
  const button = step.kind === "tap" && step.button === "right" ? " (right button)" : "";
170757
170921
  const keys = step.kind === "tap" && step.modifiers !== void 0 ? ` holding ${step.modifiers.join("+")}` : "";
170758
- const held = step.kind === "long-press" && step.duration !== void 0 ? ` for ${step.duration}ms` : "";
170759
- return `${target}${times}${button}${keys}${held}`;
170922
+ const held2 = step.kind === "long-press" && step.duration !== void 0 ? ` for ${step.duration}ms` : "";
170923
+ return `${target}${times}${button}${keys}${held2}`;
170760
170924
  },
170761
170925
  target: (step) => {
170762
170926
  if (step.selector) return selectorLabel(step.selector);
@@ -178485,18 +178649,18 @@ var F12 = 63247;
178485
178649
  var MODIFIER_ORDER = ["command", "shift", "option", "control", "function"];
178486
178650
  var MODIFIER_LABEL = { function: "fn" };
178487
178651
  function shortcut(key2, modifiers = []) {
178488
- const held = new Set(modifiers);
178652
+ const held2 = new Set(modifiers);
178489
178653
  const code = key2.codePointAt(0) ?? 0;
178490
178654
  let name = key2;
178491
178655
  if (/^[A-Z]$/.test(key2)) {
178492
- held.add("shift");
178656
+ held2.add("shift");
178493
178657
  name = key2.toLowerCase();
178494
178658
  } else if (key2.length === 1 && NAMED_KEYS2[code]) {
178495
178659
  name = NAMED_KEYS2[code];
178496
178660
  } else if (key2.length === 1 && code >= F1 && code <= F12) {
178497
178661
  name = `f${code - F1 + 1}`;
178498
178662
  }
178499
- const names = MODIFIER_ORDER.filter((m) => held.has(m)).map((m) => MODIFIER_LABEL[m] ?? m);
178663
+ const names = MODIFIER_ORDER.filter((m) => held2.has(m)).map((m) => MODIFIER_LABEL[m] ?? m);
178500
178664
  return [...names, name].join("+");
178501
178665
  }
178502
178666
  function renderMenus(items, depth, lines) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.35.1-next.70",
3
+ "version": "0.35.1-next.72",
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",
@@ -98,5 +98,5 @@
98
98
  "vitest": "^5.0.5",
99
99
  "yaml": "^2.9.1"
100
100
  },
101
- "gitHead": "1078d7b34ec708de5ce0e65ab9a1e4b751ba56ab"
101
+ "gitHead": "8933d7f63ffb48738c7c4d1407fdd93389c25fe2"
102
102
  }