@swmansion/argent 0.34.1-next.16 → 0.34.1-next.17

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
@@ -10782,6 +10782,8 @@ var FAILURE_CODES = {
10782
10782
  MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
10783
10783
  MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
10784
10784
  MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
10785
+ /** The app's loaded Argent library lacks support for the requested operation. */
10786
+ MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
10785
10787
  KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
10786
10788
  KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
10787
10789
  KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
@@ -36080,7 +36082,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
36080
36082
  var SESSION_ID2 = randomUUID5();
36081
36083
  function readCliVersion() {
36082
36084
  if (true) {
36083
- return "0.34.1-next.15";
36085
+ return "0.34.1-next.17";
36084
36086
  }
36085
36087
  return "0.0.0";
36086
36088
  }
package/dist/client.js CHANGED
@@ -9355,6 +9355,8 @@ var FAILURE_CODES = {
9355
9355
  MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
9356
9356
  MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
9357
9357
  MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
9358
+ /** The app's loaded Argent library lacks support for the requested operation. */
9359
+ MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
9358
9360
  KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
9359
9361
  KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
9360
9362
  KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
@@ -16005,6 +16005,8 @@ var FAILURE_CODES = {
16005
16005
  MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
16006
16006
  MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
16007
16007
  MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
16008
+ /** The app's loaded Argent library lacks support for the requested operation. */
16009
+ MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
16008
16010
  KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
16009
16011
  KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
16010
16012
  KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
@@ -16879,7 +16881,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16879
16881
  var SESSION_ID = randomUUID4();
16880
16882
  function readCliVersion() {
16881
16883
  if (true) {
16882
- return "0.34.1-next.15";
16884
+ return "0.34.1-next.17";
16883
16885
  }
16884
16886
  return "0.0.0";
16885
16887
  }
@@ -26065,6 +26065,8 @@ var FAILURE_CODES = {
26065
26065
  MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
26066
26066
  MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
26067
26067
  MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
26068
+ /** The app's loaded Argent library lacks support for the requested operation. */
26069
+ MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
26068
26070
  KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
26069
26071
  KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
26070
26072
  KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
@@ -439,6 +439,8 @@ export interface ArgentToolArgs {
439
439
  clickCount?: number;
440
440
  /** Mouse button, Mac app only: "right" is a right-click, for example to open a context menu; any other device refuses it. Default "left". */
441
441
  button?: "left" | "right";
442
+ /** Keys held throughout a click or multi-click gesture. Mac apps only. An empty list leaves the click unmodified. */
443
+ modifiers?: Array<"control" | "option" | "shift" | "command">;
442
444
  };
443
445
  keyboard: {
444
446
  /** Target device id from `list-devices` (iOS UDID, Android serial, Vega serial, HarmonyOS id, Mac app id, or Chromium id). */
@@ -1825,6 +1825,8 @@ var init_failure_codes = __esm({
1825
1825
  MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
1826
1826
  MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
1827
1827
  MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
1828
+ /** The app's loaded Argent library lacks support for the requested operation. */
1829
+ MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
1828
1830
  KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
1829
1831
  KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
1830
1832
  KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
@@ -101343,7 +101345,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
101343
101345
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
101344
101346
  function readCliVersion() {
101345
101347
  if (true) {
101346
- return "0.34.1-next.15";
101348
+ return "0.34.1-next.17";
101347
101349
  }
101348
101350
  return "0.0.0";
101349
101351
  }
@@ -142890,9 +142892,21 @@ async function macosMouse(app, event2) {
142890
142892
  );
142891
142893
  }
142892
142894
  async function macosClick(app, x, y, opts = {}) {
142893
- await macosMouse(app, { type: "move", x, y });
142895
+ const modifiers = opts.modifiers?.length ? [...new Set(opts.modifiers)] : void 0;
142896
+ const moved = await app.call(
142897
+ "Input.mouse",
142898
+ insideMaxEdges({ type: "move", x, y, modifiers })
142899
+ );
142900
+ if (modifiers && !Array.isArray(moved?.modifiers)) {
142901
+ throw macosFailure(
142902
+ `The argent library running in ${app.bundleId} is older than this argent and cannot hold modifier keys, so nothing was clicked. Restart the app with restart-app to load the current library, then tap again.`,
142903
+ FAILURE_CODES.MACOS_APP_LIBRARY_OUTDATED,
142904
+ "macos_click_modifiers",
142905
+ "unsupported"
142906
+ );
142907
+ }
142894
142908
  for (let i = 1; i <= (opts.clickCount ?? 1); i++) {
142895
- const event2 = { x, y, button: opts.button, clickCount: i };
142909
+ const event2 = { x, y, button: opts.button, clickCount: i, modifiers };
142896
142910
  await macosMouse(app, { ...event2, type: "down" });
142897
142911
  await macosMouse(app, { ...event2, type: "up" });
142898
142912
  }
@@ -155598,12 +155612,18 @@ async function assertChromiumWindowVisible(chromium, action) {
155598
155612
  // ../tool-server/src/tools/gesture-tap/index.ts
155599
155613
  init_device_info();
155600
155614
  init_capability();
155615
+
155616
+ // ../tool-server/src/utils/macos-modifiers.ts
155617
+ var MACOS_MODIFIERS = ["control", "option", "shift", "command"];
155618
+
155619
+ // ../tool-server/src/tools/gesture-tap/index.ts
155601
155620
  var sleep4 = (ms) => new Promise((r) => setTimeout(r, ms));
155602
155621
  function tapDescription(params, tense) {
155603
155622
  const count2 = params.clickCount ?? 1;
155604
155623
  const action = count2 === 1 ? tense === "present" ? "Tapping" : "Tapped" : count2 === 2 ? tense === "present" ? "Double-tapping" : "Double-tapped" : `${tense === "present" ? "Tapping" : "Tapped"} ${count2} times`;
155605
155624
  const button = params.button === "right" ? " with the right button" : "";
155606
- return `${action} at (${Math.round(params.x * 100)}%, ${Math.round(params.y * 100)}%)${button}`;
155625
+ const modifiers = params.modifiers?.length ? ` holding ${[...new Set(params.modifiers)].join("+")}` : "";
155626
+ return `${action} at (${Math.round(params.x * 100)}%, ${Math.round(params.y * 100)}%)${button}${modifiers}`;
155607
155627
  }
155608
155628
  var capability10 = {
155609
155629
  apple: { simulator: true, device: true },
@@ -155667,11 +155687,15 @@ var zodSchema18 = external_exports.object({
155667
155687
  ),
155668
155688
  button: external_exports.enum(["left", "right"]).optional().describe(
155669
155689
  'Mouse button, Mac app only: "right" is a right-click, for example to open a context menu; any other device refuses it. Default "left".'
155690
+ ).meta({ [FLAG_META_KEY]: MACOS_APPS_FLAG }),
155691
+ modifiers: external_exports.array(external_exports.enum(MACOS_MODIFIERS)).max(MACOS_MODIFIERS.length).optional().describe(
155692
+ "Keys held throughout a click or multi-click gesture. Mac apps only. An empty list leaves the click unmodified."
155670
155693
  ).meta({ [FLAG_META_KEY]: MACOS_APPS_FLAG })
155671
155694
  });
155672
155695
  var gestureTapTool = {
155673
155696
  id: "gesture-tap",
155674
- description: `Press the device screen (iOS simulator or physical device, Android emulator, <flag:harmonyos>HarmonyOS device, </flag:harmonyos><flag:macos-apps>Mac app, </flag:macos-apps>or Chromium app) at a point given as fractions of the screen width and height (not pixels): a Down event followed by an Up event at the same spot.<flag:macos-apps> On a Mac app it is a click, and x/y are fractions of the area describe reports, not of the window.</flag:macos-apps>
155697
+ description: `Press the device screen (iOS simulator or physical device, Android emulator, <flag:harmonyos>HarmonyOS device, </flag:harmonyos><flag:macos-apps>Mac app, </flag:macos-apps>or Chromium app) at a point given as fractions of the screen width and height (not pixels): a Down event followed by an Up event at the same spot.<flag:macos-apps> On a Mac app it is a click, and x/y are fractions of the area describe reports, not of the window.
155698
+ If a modifier click returns \`MACOS_APP_LIBRARY_OUTDATED\`, the tool stopped before clicking. Run \`restart-app\` to reload the library, then retry. If the error persists, use an Argent build with modifier-click support.</flag:macos-apps>
155675
155699
  Use when tapping a button, link, or any tappable element on the screen.
155676
155700
  Returns { tapped: true, timestampMs }. On physical iOS, reactivated: true = app was re-fronted; re-describe. Fails if the device backend (simulator-server / emulator / Chromium CDP<flag:harmonyos> / \`hdc\`</flag:harmonyos>) is unreachable.
155677
155701
  Before tapping, take the coordinates from \`describe\` on every platform (on Chromium it walks the DOM<flag:harmonyos>, on HarmonyOS it reads the \`uitest\` layout dump</flag:harmonyos>). More information in \`argent-device-interact\` skill`,
@@ -155680,7 +155704,7 @@ Before tapping, take the coordinates from \`describe\` on every platform (on Chr
155680
155704
  // A physical iPhone's first call waits out the runner build, past the MCP fetch timeout,
155681
155705
  // whose abort replays the call: the gesture would land once per replay.
155682
155706
  longRunning: true,
155683
- searchHint: "tap press button element device simulator emulator chromium<flag:macos-apps> mac</flag:macos-apps> touch down up click<flag:macos-apps> right-click context menu</flag:macos-apps>",
155707
+ searchHint: "tap press button element device simulator emulator chromium<flag:macos-apps> mac</flag:macos-apps> touch down up click<flag:macos-apps> right-click context menu modifier command shift option control cmd-click shift-click multiple selection</flag:macos-apps>",
155684
155708
  interaction: {
155685
155709
  startedMsg: ({ params }) => tapDescription(params, "present"),
155686
155710
  completedMsg: ({ params }) => tapDescription(params, "past"),
@@ -155692,7 +155716,7 @@ Before tapping, take the coordinates from \`describe\` on every platform (on Chr
155692
155716
  if (device.platform === "macos") {
155693
155717
  return macosAppServices(device);
155694
155718
  }
155695
- if (params.button === "right") return {};
155719
+ if (params.button === "right" || params.modifiers?.length) return {};
155696
155720
  if (device.platform === "chromium") {
155697
155721
  return { chromium: chromiumCdpRef(device) };
155698
155722
  }
@@ -155708,7 +155732,11 @@ Before tapping, take the coordinates from \`describe\` on every platform (on Chr
155708
155732
  const clickCount = params.clickCount ?? 1;
155709
155733
  if (device.platform === "macos") {
155710
155734
  const app = requireMacosApp(services, "gesture-tap", device);
155711
- await macosClick(app, params.x, params.y, { clickCount, button: params.button });
155735
+ await macosClick(app, params.x, params.y, {
155736
+ clickCount,
155737
+ button: params.button,
155738
+ modifiers: params.modifiers
155739
+ });
155712
155740
  return { tapped: true, timestampMs };
155713
155741
  }
155714
155742
  if (params.button === "right") {
@@ -155720,6 +155748,15 @@ Before tapping, take the coordinates from \`describe\` on every platform (on Chr
155720
155748
  )
155721
155749
  );
155722
155750
  }
155751
+ if (params.modifiers?.length) {
155752
+ const refusal = device.platform === "chromium" ? `<flag:macos-apps>, which argent sends only to a Mac app</flag:macos-apps>: argent does not support modifier keys in a tap on a chromium app yet.` : `<flag:macos-apps>, which only a Mac app takes</flag:macos-apps>: ${device.platform} ${device.kind} takes no modifier keys in a tap.`;
155753
+ throw new InvalidToolInputError(
155754
+ renderFlagGated(
155755
+ `gesture-tap modifiers hold keyboard keys through a mouse click${refusal}`,
155756
+ isFlagOffered
155757
+ )
155758
+ );
155759
+ }
155723
155760
  if (device.platform === "chromium") {
155724
155761
  const chromium = services.chromium;
155725
155762
  await assertChromiumWindowVisible(chromium, "tap");
@@ -159010,7 +159047,7 @@ One screenshot and element tree are captured after the whole sequence, not per s
159010
159047
  On a TV target (Apple TV / Android TV / Vega) use tv-remote for remote presses and keyboard for text.
159011
159048
 
159012
159049
  Allowed tools, their args (? = optional) and targets. Positions and distances are 0\u20131 fractions of the screen (window on Chromium), not pixels; angles are in degrees, durations in ms.
159013
- gesture-tap: x, y, clickCount?<flag:macos-apps>, button? "left"|"right" (macos)</flag:macos-apps> [ios/android/chromium<flag:harmonyos>/harmony</flag:harmonyos><flag:macos-apps>/macos</flag:macos-apps>]
159050
+ gesture-tap: x, y, clickCount?<flag:macos-apps>, button? "left"|"right" (macos), modifiers? array of "control"|"option"|"shift"|"command" (macos)</flag:macos-apps> [ios/android/chromium<flag:harmonyos>/harmony</flag:harmonyos><flag:macos-apps>/macos</flag:macos-apps>]
159014
159051
  gesture-swipe: fromX, fromY, toX, toY, durationMs?, momentum? [ios/android<flag:harmonyos>/harmony</flag:harmonyos>]
159015
159052
  gesture-scroll: x, y, deltaX?, deltaY? (signed; positive scrolls down), durationMs? [chromium<flag:macos-apps>/macos</flag:macos-apps>]
159016
159053
  gesture-drag: fromX, fromY, toX, toY, durationMs?, momentum? [chromium<flag:macos-apps>/macos</flag:macos-apps>]
@@ -176276,12 +176313,15 @@ function toYamlStep(step) {
176276
176313
  }
176277
176314
  case "tap": {
176278
176315
  const target = targetToYaml(step);
176279
- if (step.times === void 0 && step.button === void 0) return { tap: target };
176316
+ if (step.times === void 0 && step.button === void 0 && step.modifiers === void 0) {
176317
+ return { tap: target };
176318
+ }
176280
176319
  return {
176281
176320
  tap: {
176282
176321
  on: target,
176283
176322
  ...step.times !== void 0 ? { times: step.times } : {},
176284
- ...step.button !== void 0 ? { button: step.button } : {}
176323
+ ...step.button !== void 0 ? { button: step.button } : {},
176324
+ ...step.modifiers !== void 0 ? { modifiers: [...step.modifiers] } : {}
176285
176325
  }
176286
176326
  };
176287
176327
  }
@@ -176912,6 +176952,15 @@ function parseTapButton(raw, entry) {
176912
176952
  if (raw !== "right") badEntry(entry, "tap.button must be left or right");
176913
176953
  return "right";
176914
176954
  }
176955
+ function parseTapModifiers(raw, entry) {
176956
+ if (raw === void 0) return void 0;
176957
+ const names = MACOS_MODIFIERS;
176958
+ if (!Array.isArray(raw) || !raw.every((m) => typeof m === "string" && names.includes(m))) {
176959
+ badEntry(entry, `tap.modifiers must be a list of ${MACOS_MODIFIERS.join(", ")}`);
176960
+ }
176961
+ const held = MACOS_MODIFIERS.filter((m) => raw.includes(m));
176962
+ return held.length > 0 ? held : void 0;
176963
+ }
176915
176964
  function hasSelectorField(obj) {
176916
176965
  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);
176917
176966
  }
@@ -176941,7 +176990,7 @@ function parseTarget(raw, where) {
176941
176990
  }
176942
176991
  function parseTap(body, entry) {
176943
176992
  const obj = body !== null && typeof body === "object" ? body : {};
176944
- if (obj.on !== void 0 || obj.times !== void 0 || obj.button !== void 0) {
176993
+ if (obj.on !== void 0 || obj.times !== void 0 || obj.button !== void 0 || obj.modifiers !== void 0) {
176945
176994
  if (hasSelectorField(obj)) {
176946
176995
  badEntry(
176947
176996
  entry,
@@ -176954,13 +177003,15 @@ function parseTap(body, entry) {
176954
177003
  "the tap options form takes a nested point \u2014 e.g. tap: { on: { x: 0.5, y: 0.5 }, times: 2 }"
176955
177004
  );
176956
177005
  }
176957
- if (!Object.keys(obj).every((k) => k === "on" || k === "times" || k === "button")) {
176958
- badEntry(entry, "the tap options form accepts only { on, times, button }");
177006
+ if (!Object.keys(obj).every(
177007
+ (k) => k === "on" || k === "times" || k === "button" || k === "modifiers"
177008
+ )) {
177009
+ badEntry(entry, "the tap options form accepts only { on, times, button, modifiers }");
176959
177010
  }
176960
177011
  if (obj.on === void 0) {
176961
177012
  badEntry(
176962
177013
  entry,
176963
- 'tap with times or button needs a target - e.g. tap: { on: "Photo", times: 2 }'
177014
+ 'tap with times, button or modifiers needs a target - e.g. tap: { on: "Photo", times: 2 }'
176964
177015
  );
176965
177016
  }
176966
177017
  const step = { kind: "tap", ...parseTarget(obj.on, "tap.on") };
@@ -176968,6 +177019,8 @@ function parseTap(body, entry) {
176968
177019
  if (times !== void 0) step.times = times;
176969
177020
  const button = parseTapButton(obj.button, entry);
176970
177021
  if (button !== void 0) step.button = button;
177022
+ const modifiers = parseTapModifiers(obj.modifiers, entry);
177023
+ if (modifiers !== void 0) step.modifiers = modifiers;
176971
177024
  return step;
176972
177025
  }
176973
177026
  return { kind: "tap", ...parseTarget(body, "tap") };
@@ -177321,7 +177374,7 @@ function* argFields(value, where, seen = /* @__PURE__ */ new Set()) {
177321
177374
  }
177322
177375
  function gestureTargetPath(step) {
177323
177376
  if (step.kind === "pinch" || step.kind === "rotate") return { path: `${step.kind}.on` };
177324
- const option = step.kind === "tap" ? step.times ?? step.button : step.duration;
177377
+ const option = step.kind === "tap" ? step.times ?? step.button ?? step.modifiers : step.duration;
177325
177378
  if (option !== void 0) return { path: `${step.kind}.on` };
177326
177379
  return { path: step.kind, alt: `${step.kind}.on` };
177327
177380
  }
@@ -179507,6 +179560,16 @@ async function runDirective(env, step) {
179507
179560
  )
179508
179561
  };
179509
179562
  }
179563
+ if (step.kind === "tap" && step.modifiers !== void 0 && env.device.platform !== "macos") {
179564
+ const platform = env.device.platform;
179565
+ return {
179566
+ ok: false,
179567
+ reason: renderFlagGated(
179568
+ platform === "chromium" ? `tap with modifiers holds keyboard keys through a mouse click<flag:macos-apps>, which argent sends only to a Mac app</flag:macos-apps>; argent does not support it on chromium yet` : `tap with modifiers holds keyboard keys through a mouse click<flag:macos-apps>, which only a Mac app takes</flag:macos-apps>; ${platform} takes none`,
179569
+ isFlagOffered
179570
+ )
179571
+ };
179572
+ }
179510
179573
  if (step.kind === "idle" && !supportsFlowTree(env.device.platform)) {
179511
179574
  return {
179512
179575
  ok: false,
@@ -179598,7 +179661,8 @@ async function runTap(env, target) {
179598
179661
  const sent = await invokeOnDevice(env, "gesture-tap", {
179599
179662
  ...resolved.point,
179600
179663
  ...target.times !== void 0 ? { clickCount: target.times } : {},
179601
- ...target.button !== void 0 ? { button: target.button } : {}
179664
+ ...target.button !== void 0 ? { button: target.button } : {},
179665
+ ...target.modifiers !== void 0 ? { modifiers: target.modifiers } : {}
179602
179666
  });
179603
179667
  return { ok: true, ...warnedBy(resolved.warning, toolWarning(sent)) };
179604
179668
  }
@@ -180692,8 +180756,9 @@ var POINT_GESTURE_STEP = {
180692
180756
  const target = step.selector ? yamlSelectorLabel(step.selector) : `(${step.x}, ${step.y})`;
180693
180757
  const times = step.kind === "tap" && step.times !== void 0 && step.times > 1 ? ` \xD7${step.times}` : "";
180694
180758
  const button = step.kind === "tap" && step.button === "right" ? " (right button)" : "";
180759
+ const keys = step.kind === "tap" && step.modifiers !== void 0 ? ` holding ${step.modifiers.join("+")}` : "";
180695
180760
  const held = step.kind === "long-press" && step.duration !== void 0 ? ` for ${step.duration}ms` : "";
180696
- return `${target}${times}${button}${held}`;
180761
+ return `${target}${times}${button}${keys}${held}`;
180697
180762
  },
180698
180763
  target: (step) => {
180699
180764
  if (step.selector) return selectorLabel(step.selector);
@@ -181522,10 +181587,18 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
181522
181587
  const cc = args.clickCount;
181523
181588
  const tapTimes = isTap && typeof cc === "number" && Number.isInteger(cc) && cc >= 2 && cc <= 10 ? { times: cc } : {};
181524
181589
  const tapButton = isTap && args.button === "right" ? { button: "right" } : {};
181590
+ const heldKeys = Array.isArray(args.modifiers) ? MACOS_MODIFIERS.filter((m) => args.modifiers.includes(m)) : [];
181591
+ const tapModifiers = isTap && heldKeys.length > 0 ? { modifiers: heldKeys } : {};
181525
181592
  let step;
181526
181593
  let warning;
181527
181594
  if (captured?.selector) {
181528
- step = { kind: "tap", selector: captured.selector, ...tapTimes, ...tapButton };
181595
+ step = {
181596
+ kind: "tap",
181597
+ selector: captured.selector,
181598
+ ...tapTimes,
181599
+ ...tapButton,
181600
+ ...tapModifiers
181601
+ };
181529
181602
  warning = captured.warning;
181530
181603
  } else if (isTap) {
181531
181604
  step = {
@@ -181533,7 +181606,8 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
181533
181606
  x: args.x,
181534
181607
  y: args.y,
181535
181608
  ...tapTimes,
181536
- ...tapButton
181609
+ ...tapButton,
181610
+ ...tapModifiers
181537
181611
  };
181538
181612
  warning = captured?.warning;
181539
181613
  } else if (isLaunch) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.34.1-next.16",
3
+ "version": "0.34.1-next.17",
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",
@@ -23,6 +23,7 @@ description: Drive a native Mac app (AppKit, SwiftUI, react-native-macos, Mac Ca
23
23
  - Swipe or drag: `gesture-drag`. Long press: `gesture-drag` with the same start and end point. Scroll: `gesture-scroll`.
24
24
  - Zoom or rotate: `gesture-pinch` and `gesture-rotate` fail; use the app's own controls or shortcuts.
25
25
  - After a right-click (`gesture-tap` with `button: "right"`), the returned tree lists the menu items; a plain `gesture-tap` on one chooses it (the menu can stay in the tree for a moment while it closes). `keyboard` `escape` closes the menu; `enter` chooses nothing after a right-click, so tap the item.
26
+ - For a Command-click or Shift-click, pass `modifiers` in the `gesture-tap` call. Check the returned tree for the expected selection.
26
27
  - No hover: a tooltip is out of reach.
27
28
  - `open-url`: the URL goes to the running app. A custom scheme must be one the app declares; `http` and `https` go to the app, not the browser; a `file:` URL opens that document in the app.
28
29
  - A SwiftUI `DisclosureGroup` opens only at its chevron, near the left end of its frame: a tap at the centre passes and does nothing. Tap along the left end in steps of about 0.008 until its `value` changes.
@@ -2,5 +2,5 @@
2
2
 
3
3
  - Record the launch as a `restart-app` step, then write it as `launch: { macos: <bundle id> }` (keep `{ app, args }` if the recorder wrote args) so the runner picks the Mac app and starts it. Otherwise run with `--platform macos` or the device id: without them the runner never picks a Mac app.
4
4
  - A `swipe` is a mouse drag, a `long-press` a press and hold. `pinch` and `rotate` fail.
5
- - A right-click is `tap: { on: <selector>, button: right }`.
5
+ - A right-click is `tap: { on: <selector>, button: right }`. For a Command-click, write `tap: { on: <selector>, modifiers: [command] }`. The recorder preserves `modifiers` from `gesture-tap` so replay holds the same keys.
6
6
  - A file panel is a `tool: file-panel` step, a menu command a `tool: menu-bar` step (`args: { action: choose, path: [Edit, Select All] }`). Gate a branch with `when: { platform: macos }`.