@swmansion/argent 0.34.1-next.28 → 0.34.1-next.29

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
@@ -36172,7 +36172,7 @@ function isCi(env = process.env) {
36172
36172
  var SESSION_ID2 = randomUUID5();
36173
36173
  function readCliVersion() {
36174
36174
  if (true) {
36175
- return "0.34.1-next.28";
36175
+ return "0.34.1-next.29";
36176
36176
  }
36177
36177
  return "0.0.0";
36178
36178
  }
@@ -16925,7 +16925,7 @@ function isCi(env = process.env) {
16925
16925
  var SESSION_ID = randomUUID4();
16926
16926
  function readCliVersion() {
16927
16927
  if (true) {
16928
- return "0.34.1-next.28";
16928
+ return "0.34.1-next.29";
16929
16929
  }
16930
16930
  return "0.0.0";
16931
16931
  }
@@ -338,6 +338,8 @@ export interface ArgentToolArgs {
338
338
  "gesture-custom": {
339
339
  /** Target device id from `list-devices` (iOS UDID or Android serial). */
340
340
  udid: string;
341
+ /** Starting edge in upright screen coordinates for a single-finger system gesture on a local iOS simulator. */
342
+ edge?: "top" | "right" | "bottom" | "left";
341
343
  /** Touch events, dispatched in order. */
342
344
  events: Array<{
343
345
  /** Touch event type */
@@ -101405,7 +101405,7 @@ function isCi(env = process.env) {
101405
101405
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
101406
101406
  function readCliVersion() {
101407
101407
  if (true) {
101408
- return "0.34.1-next.28";
101408
+ return "0.34.1-next.29";
101409
101409
  }
101410
101410
  return "0.0.0";
101411
101411
  }
@@ -124445,6 +124445,11 @@ function inNativeCoordinates() {
124445
124445
  }
124446
124446
 
124447
124447
  // ../tool-server/src/utils/ui-orientation.ts
124448
+ var screenEdges = ["top", "right", "bottom", "left"];
124449
+ function uiEdgeToNative(edge, orientation) {
124450
+ const turns = { portrait: 0, landscapeRight: 1, portraitUpsideDown: 2, landscapeLeft: 3 };
124451
+ return screenEdges[(screenEdges.indexOf(edge) + turns[orientation]) % 4];
124452
+ }
124448
124453
  function uiPointToNative(p, orientation) {
124449
124454
  switch (orientation) {
124450
124455
  case "landscapeRight":
@@ -124527,6 +124532,7 @@ var NO_IMAGE_ERROR = /no image to export/i;
124527
124532
  var FIRST_FRAME_WAIT_MS = 6e3;
124528
124533
  var FIRST_FRAME_POLL_MS = 250;
124529
124534
  var COMMAND_ACK_TIMEOUT_MS = 5e3;
124535
+ var EDGE_DOWN_ACK_TIMEOUT_MS = 35e3;
124530
124536
  var connections = /* @__PURE__ */ new Map();
124531
124537
  var cmdId = 0;
124532
124538
  function pendingIdNamedBy(conn, message) {
@@ -124632,6 +124638,7 @@ async function sendCommand(api, cmd) {
124632
124638
  const warning = turnWarning !== void 0 && screenWarning !== void 0 ? `${screenWarning} ${turnWarning}` : screenWarning ?? turnWarning;
124633
124639
  const id = String(++cmdId);
124634
124640
  const payload = JSON.stringify({ id, ...targeted });
124641
+ const ackTimeoutMs = cmdName === "edgeTouch" && cmd.type === "Down" ? EDGE_DOWN_ACK_TIMEOUT_MS : COMMAND_ACK_TIMEOUT_MS;
124635
124642
  await new Promise((resolve20, reject) => {
124636
124643
  let done = false;
124637
124644
  const settle3 = (err) => {
@@ -124645,7 +124652,7 @@ async function sendCommand(api, cmd) {
124645
124652
  const timer = setTimeout(
124646
124653
  () => settleAndDropConnection(
124647
124654
  new FailureError(
124648
- `simulator-server did not acknowledge the '${cmdName}' command within ${COMMAND_ACK_TIMEOUT_MS}ms. The command may not have reached the device \u2014 the simulator may be wedged or the simulator-server unresponsive.`,
124655
+ `simulator-server did not acknowledge the '${cmdName}' command within ${ackTimeoutMs}ms. The command may not have reached the device \u2014 the simulator may be wedged or the simulator-server unresponsive.`,
124649
124656
  {
124650
124657
  error_code: FAILURE_CODES.SIMULATOR_COMMAND_ACK_TIMEOUT,
124651
124658
  failure_stage: "simulator_command_ack",
@@ -124656,7 +124663,7 @@ async function sendCommand(api, cmd) {
124656
124663
  }
124657
124664
  )
124658
124665
  ),
124659
- COMMAND_ACK_TIMEOUT_MS
124666
+ ackTimeoutMs
124660
124667
  );
124661
124668
  timer.unref?.();
124662
124669
  const settleAndDropConnection = (err) => {
@@ -124675,7 +124682,7 @@ async function sendCommand(api, cmd) {
124675
124682
  }
124676
124683
  var gestureTurns = /* @__PURE__ */ new WeakMap();
124677
124684
  async function withNativeTouchSpace(api, cmd) {
124678
- if (cmd.cmd !== "touch" || !api.deviceId || inNativeCoordinates() || !isIosSimulator(resolveDevice(api.deviceId))) {
124685
+ if (cmd.cmd !== "touch" && cmd.cmd !== "edgeTouch" || !api.deviceId || inNativeCoordinates() || !isIosSimulator(resolveDevice(api.deviceId))) {
124679
124686
  return { cmd };
124680
124687
  }
124681
124688
  let orientation;
@@ -124694,6 +124701,7 @@ async function withNativeTouchSpace(api, cmd) {
124694
124701
  if (!isTurned(orientation)) return { cmd, ...warning !== void 0 ? { warning } : {} };
124695
124702
  const turned = { ...cmd };
124696
124703
  const first = uiPointToNative({ x: cmd.x, y: cmd.y }, orientation);
124704
+ if (cmd.cmd === "edgeTouch") turned.edge = uiEdgeToNative(cmd.edge, orientation);
124697
124705
  turned.x = first.x;
124698
124706
  turned.y = first.y;
124699
124707
  const sx = cmd.second_x;
@@ -124708,7 +124716,7 @@ async function withNativeTouchSpace(api, cmd) {
124708
124716
  var gestureScreens = /* @__PURE__ */ new WeakMap();
124709
124717
  async function withActiveScreen(api, cmd) {
124710
124718
  if (!api.display?.foldable || cmd.screen !== void 0) return { cmd };
124711
- if (cmd.cmd !== "touch") return { cmd };
124719
+ if (cmd.cmd !== "touch" && cmd.cmd !== "edgeTouch") return { cmd };
124712
124720
  const udid = api.deviceId ?? "";
124713
124721
  let screen = cmd.type !== "Down" ? gestureScreens.get(api) : void 0;
124714
124722
  let warning;
@@ -157252,17 +157260,33 @@ var eventSchema = external_exports.object({
157252
157260
  });
157253
157261
  var zodSchema22 = external_exports.object({
157254
157262
  udid: external_exports.string().describe("Target device id from `list-devices` (iOS UDID or Android serial)."),
157263
+ edge: external_exports.enum(screenEdges).optional().describe(
157264
+ "Starting edge in upright screen coordinates for a single-finger system gesture on a local iOS simulator."
157265
+ ),
157255
157266
  events: external_exports.array(eventSchema).describe("Touch events, dispatched in order."),
157256
157267
  interpolate: external_exports.number().optional().describe(
157257
157268
  "Number of Move events to insert between each pair of consecutive events, linearly interpolating both x,y and x2,y2 and splitting the delay evenly, for a smooth gesture. Default: no interpolation."
157258
157269
  )
157259
157270
  });
157271
+ function validateEdge(params, device) {
157272
+ if (params.edge === void 0) return;
157273
+ if (device.platform !== "ios" || device.kind !== "simulator") {
157274
+ throw new InvalidToolInputError("System-edge gestures require a local iOS simulator.");
157275
+ }
157276
+ const events = params.events;
157277
+ if (events[0]?.type !== "Down" || events.at(-1)?.type !== "Up" || events.slice(1, -1).some((e) => e.type !== "Move") || events.some((e) => e.x2 !== void 0 || e.y2 !== void 0)) {
157278
+ throw new InvalidToolInputError(
157279
+ "A system-edge gesture takes one finger: Down, any Moves, then Up."
157280
+ );
157281
+ }
157282
+ }
157260
157283
  var gestureCustomTool = {
157261
157284
  id: "gesture-custom",
157262
157285
  description: `Send a sequence of touch events for complex gestures.
157263
157286
  Use for: long press, drag-and-drop, custom scroll, pinch (second touch point).
157264
157287
  For simple taps use the gesture-tap tool. For straight-line scrolling use the gesture-swipe tool.<flag:macos-apps> Not supported on a Mac app: use gesture-tap, gesture-drag and gesture-scroll there.</flag:macos-apps>
157265
157288
  For pinch gestures use gesture-pinch. For rotation gestures use gesture-rotate.
157289
+ On a local iOS simulator, set edge to the starting side for a system gesture. To move a full-screen app into Split View on an open Duo, set edge:"bottom". In one continuous contact move from bottom center to center, pause there, drag to the requested side, and release. See the device-interact foldables reference for coordinates and timing.
157266
157290
  All x/y values are fractions of the screen width/height (not pixels).
157267
157291
  Physical iOS: a Down, any Moves, then an Up; x2/y2 adds a second finger. A plain Down then Up: same point = press-hold, other point = drag (Up delayMs = rest before the move); one Move at the Down point between them = long-press pickup (Move delayMs = hold, Up delayMs = move time). Any other train plays as timed paths, each event waiting its delayMs, and needs the app drawn in portrait.
157268
157292
  Returns { events: number } with the total count of events dispatched. On physical iOS, reactivated: true = app was re-fronted; re-describe. Fails if the target device is not booted or an event type is invalid.
@@ -157295,6 +157319,7 @@ Example pinch-to-zoom (with interpolate:10 for smoothness):
157295
157319
  // Declare the runner only for a train execute can play. A rejected train must not pay a runner cold start.
157296
157320
  services: (params) => {
157297
157321
  const device = resolveDevice(params.udid);
157322
+ validateEdge(params, device);
157298
157323
  if (isIosPhysicalDevice(device)) {
157299
157324
  return planIosDeviceGesture(params.events).kind !== "unsupported" ? { iosDeviceRunner: iosDeviceRunnerRef(device) } : {};
157300
157325
  }
@@ -157302,6 +157327,7 @@ Example pinch-to-zoom (with interpolate:10 for smoothness):
157302
157327
  },
157303
157328
  async execute(services, params) {
157304
157329
  const device = resolveDevice(params.udid);
157330
+ validateEdge(params, device);
157305
157331
  if (isIosPhysicalDevice(device)) {
157306
157332
  return runOnIosDevice(
157307
157333
  services.iosDeviceRunner,
@@ -157313,17 +157339,31 @@ Example pinch-to-zoom (with interpolate:10 for smoothness):
157313
157339
  const api = services.simulatorServer;
157314
157340
  const events = params.interpolate && params.interpolate > 0 ? interpolateEvents(params.events, params.interpolate) : params.events;
157315
157341
  let warning;
157316
- for (const event2 of events) {
157317
- await sleep8(event2.delayMs ?? 16);
157318
- const sent = await sendCommand(api, {
157319
- cmd: "touch",
157320
- type: event2.type,
157321
- x: event2.x,
157322
- y: event2.y,
157323
- second_x: event2.x2 ?? null,
157324
- second_y: event2.y2 ?? null
157325
- });
157326
- warning ??= sent.warning;
157342
+ let edgeContact;
157343
+ try {
157344
+ for (const event2 of events) {
157345
+ await sleep8(event2.delayMs ?? 16);
157346
+ const sent = await sendCommand(api, {
157347
+ ...params.edge ? { cmd: "edgeTouch", edge: params.edge } : { cmd: "touch", second_x: event2.x2 ?? null, second_y: event2.y2 ?? null },
157348
+ type: event2.type,
157349
+ x: event2.x,
157350
+ y: event2.y
157351
+ });
157352
+ if (params.edge) edgeContact = event2.type === "Up" ? void 0 : event2;
157353
+ warning ??= sent.warning;
157354
+ }
157355
+ } catch (error63) {
157356
+ if (edgeContact) {
157357
+ await sendCommand(api, {
157358
+ cmd: "edgeTouch",
157359
+ edge: params.edge,
157360
+ type: "Up",
157361
+ x: edgeContact.x,
157362
+ y: edgeContact.y
157363
+ }).catch(() => {
157364
+ });
157365
+ }
157366
+ throw error63;
157327
157367
  }
157328
157368
  return { events: events.length, ...warning !== void 0 ? { warning } : {} };
157329
157369
  }
@@ -159592,11 +159632,12 @@ var foldTool = {
159592
159632
  Use when you must see or test an app in a different posture. \`list-devices\` marks foldable devices with \`foldable: true\`. To turn a device without a fold, use \`rotate\`.
159593
159633
  All tools use the active panel (the panel that shows the UI), also after a fold made outside argent. The coordinates and the screenshot size change with the panel. Before you tap, read the element tree in this result or run \`describe\` again.
159594
159634
  iOS: unfolded, the UI is landscape, as on a rotated iPhone. A fold between two angles that are not closed or open can keep the current panel. To change panels, fold to closed or open.
159635
+ To move a full-screen app onto either half of the open iPhone Duo, use \`gesture-custom\` with \`edge: "bottom"\`. Drag up, pause at center, then drag sideways and release in one contact.
159595
159636
  iOS returns { activeScreen, screen: { id, panel, width, height }, posture?, hingeAngle, warning? }. screen names the active panel and gives its size in pixels. posture is set only at 0\xB0, 120\xB0 and 180\xB0. warning is set when argent cannot find the active panel, or when the device did not change to the expected panel.
159596
159637
  Android returns { posture?, deviceState, hingeAngle?, warning? }. deviceState is the state Android committed (CLOSED, HALF_OPENED, OPENED), and posture is the matching preset. A lock screen the fold raises is dismissed; warning is set when it cannot be, or when a lock screen is showing or the screen is off after the fold. On a generic foldable AVD, closed shows only the left part of the display and describe frames do not match tap coordinates; use a Pixel Fold AVD to test the cover panel.
159597
159638
  Fails if the device is not foldable, is a remote simulator or a physical Android device.`,
159598
159639
  zodSchema: zodSchema28,
159599
- searchHint: "fold unfold hinge foldable duo posture open closed half-open panel screen",
159640
+ searchHint: "fold unfold hinge foldable duo posture open closed half-open panel screen split view",
159600
159641
  interaction: {
159601
159642
  startedMsg: ({ params }) => `Folding device to ${targetLabel2(params)}`,
159602
159643
  completedMsg: ({ params, result }) => "activeScreen" in result ? `Folded device to ${targetLabel2(params)}; it renders to screen ${result.activeScreen} (${result.screen.panel})` : `Folded device to ${targetLabel2(params)}; it is in device state ${result.deviceState}`,
@@ -159860,7 +159901,7 @@ Allowed tools, their args (? = optional) and targets. Positions and distances ar
159860
159901
  gesture-swipe: fromX, fromY, toX, toY, durationMs?, momentum? [ios/android<flag:harmonyos>/harmony</flag:harmonyos>]
159861
159902
  gesture-scroll: x, y, deltaX?, deltaY? (signed; positive scrolls down), durationMs? [chromium<flag:macos-apps>/macos</flag:macos-apps>]
159862
159903
  gesture-drag: fromX, fromY, toX, toY, durationMs?, momentum? [chromium<flag:macos-apps>/macos</flag:macos-apps>]
159863
- gesture-custom: events: [{ type: "Down"|"Move"|"Up", x, y, x2?, y2?, delayMs? }], interpolate? [ios/android]
159904
+ gesture-custom: events: [{ type: "Down"|"Move"|"Up", x, y, x2?, y2?, delayMs? }], interpolate?, edge? (local iOS simulator system gesture) [ios/android]
159864
159905
  gesture-pinch: centerX, centerY, startDistance, endDistance, endCenterX?, endCenterY?, angle?, durationMs? [ios/android<flag:harmonyos>/harmony</flag:harmonyos>]
159865
159906
  gesture-rotate: centerX, centerY, startAngle, endAngle, radius (or radiusX + radiusY), durationMs? [ios/android]
159866
159907
  button: button: "home"|"back"|"power"|"volumeUp"|"volumeDown"|"appSwitch"|"actionButton" [ios/android<flag:harmonyos>; harmony: home/back/power</flag:harmonyos>]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.34.1-next.28",
3
+ "version": "0.34.1-next.29",
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",
@@ -6,3 +6,25 @@ Read this for a device `list-devices` marks `foldable: true`: a foldable iOS sim
6
6
  - Fold between gestures, not during one. A gesture stays on the panel where it started.
7
7
  - iOS: if argent cannot find the active panel, it uses the cover panel and sets `warning` (a screenshot-diff summary gets a `panel:` line). Take a screenshot to see what the device shows, then do the check the warning names.
8
8
  - Android: on a closed generic foldable AVD, tap only full-width rows; test the cover panel on a Pixel Fold AVD.
9
+
10
+ ## Move a full-screen app into Split View on iPhone Duo
11
+
12
+ Start with the Duo open in landscape and the app full screen. If needed, use `fold` to open the Duo and `launch-app` to open the app.
13
+
14
+ Call `gesture-custom` once with the Duo UDID and these parameters to move the app to the **left**. The `edge` field tells iOS that the touch starts a system gesture. Keep the finger down through the pause and the sideways drag.
15
+
16
+ ```json
17
+ {
18
+ "edge": "bottom",
19
+ "interpolate": 12,
20
+ "events": [
21
+ { "type": "Down", "x": 0.5, "y": 1 },
22
+ { "type": "Move", "x": 0.5, "y": 0.5, "delayMs": 280 },
23
+ { "type": "Move", "x": 0.5, "y": 0.5, "delayMs": 300 },
24
+ { "type": "Move", "x": 0.14, "y": 0.5, "delayMs": 320 },
25
+ { "type": "Up", "x": 0.14, "y": 0.5, "delayMs": 200 }
26
+ ]
27
+ }
28
+ ```
29
+
30
+ For the **right**, change both final x coordinates to `0.86`. Check the screenshot for the app on the requested side and the Home Screen on the other. Stop here if the user asked for one app at half width.