@swmansion/argent 0.25.3-next.2 → 0.25.3-next.4

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.
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.25.3-next.2",
3
+ "version": "0.25.3-next.4",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator and Android Emulator control",
6
6
  "license": "Apache-2.0",
package/rules/argent.md CHANGED
@@ -119,7 +119,7 @@ Prompt keywords: physical iPhone, real device, on my phone, USB, hardware
119
119
 
120
120
  TAPPING, SWIPING, TYPING, GESTURES, SCREENSHOTS, SCROLLING
121
121
  Skill: `argent-device-interact`
122
- When: Performing touch interactions, typing, pressing hardware buttons, launching/restarting apps, opening URLs, rotating device, taking standalone screenshots, or verifying a visible UI code change. Phone/tablet iOS and Android simulators and emulators only: for any TV target use the TV skill below, and for a physical iPhone use the entry above.
122
+ When: Performing touch interactions, typing, pressing hardware buttons, launching/restarting apps, opening URLs, rotating or folding the device, taking standalone screenshots, or verifying a visible UI code change. Phone/tablet iOS and Android simulators and emulators only: for any TV target use the TV skill below, and for a physical iPhone use the entry above.
123
123
 
124
124
  APP PERMISSIONS (GRANT / DENY / RESET WITHOUT THE SETTINGS UI)
125
125
  Skill: `argent-settings-permissions`
@@ -101,7 +101,7 @@ Flow selectors support frame-based `within`, `after`, and `next` in every select
101
101
  - tap: { role: Switch, next: { text: Wi-Fi } } # nearest matching follower
102
102
  ```
103
103
 
104
- `within` means visual frame containment, not source-tree ancestry. Overflowing children and anchored popovers can fall outside it. `after` and `next` use top-to-bottom, left-to-right reading order. A target cannot satisfy its own `within`, `after`, or `next` anchor. The synthetic root never counts.
104
+ `within` means visual frame containment, not source-tree ancestry. Overflowing children and anchored popovers can fall outside it. `after` and `next` use top-to-bottom, left-to-right reading order as the user sees the UI. This is also true on a landscape UI, for example a rotated iPhone or an unfolded foldable. A target cannot satisfy its own `within`, `after`, or `next` anchor. The synthetic root never counts.
105
105
 
106
106
  `next` finds the nearest matching follower and skips non-matches. It can therefore reach the next row when the intended row lacks a control. Prefer a stable row container with `within`, or assert the row-local control first.
107
107
 
@@ -109,7 +109,14 @@ Scopes can combine and nest, with at most six scope keys. Use strict selectors f
109
109
 
110
110
  ## Directives
111
111
 
112
- Directives stop the flow on failure and skip later steps. The available directives are `launch`, `tap`, `long-press`, `swipe`, `type`, `scroll-to`, `pinch`, `rotate`, `await`, `assert`, `wait`, `snapshot`, `run`, `script`, `when`, `echo`, and `tool`.
112
+ Directives stop the flow on failure and skip later steps. The available directives are `launch`, `tap`, `long-press`, `swipe`, `type`, `scroll-to`, `pinch`, `rotate`, `fold`, `await`, `assert`, `wait`, `snapshot`, `run`, `script`, `when`, `echo`, and `tool`.
113
+
114
+ `fold` folds or unfolds a foldable iOS simulator. Write a posture (`fold: closed`, `fold: half-open`, `fold: open`) or an angle from 0 to 180 (`fold: 120`). The step waits until the device accepts input again. A recorded `fold` tool call becomes a `fold:` step. After a `fold` step:
115
+
116
+ - The coordinates change with the panel. Selectors resolve against a new tree.
117
+ - A `snapshot` baseline is valid only for the posture that made it.
118
+ - Unfolded, the UI is landscape. `swipe` and `scroll-to` directions and the reading order stay as the user sees the UI. Coordinates stay in the space of the `describe` frames.
119
+ - A fold between two angles that are not `closed` or `open` can keep the current panel. The step passes, and the report names the panel. To change panels, fold to `closed` or `open`.
113
120
 
114
121
  Use the launch map for cross-platform flows. A bare launch applies everywhere and becomes an app path on Chromium. The map takes `native:`, `ios:`, `android:`, `vega:`, and `chromium:`. `native:` is one id shared by iOS, Android, and Vega, and a per-platform key overrides it for that platform. `chromium:` accepts a relative or absolute app path. A launch that declares no id for the run's platform is an error, not a cue to switch platforms. A run on a remote simulator uses the `ios:` id, or the `native:` id when the map has no `ios:` key, so no flow needs a key for a remote run. On iOS, a successful launch also pins later tree reads to that app until the next raw `tool:` step, so read [The runner tree is not the discovery tree](#the-runner-tree-is-not-the-discovery-tree) when a read describes the wrong screen.
115
122
 
@@ -67,6 +67,7 @@ Common schemes: `messages://`, `settings://`, `maps://?q=<query>`, `tel://<numbe
67
67
  | Type text | `keyboard` | Every platform. Text or one named key per call, never both |
68
68
  | Paste text | `paste` | Only where a user would paste (OTP code, long link). Sim/emu only |
69
69
  | Rotate device | `rotate` | Orientation changes |
70
+ | Fold device | `fold` | Foldable iOS simulator: closed / half-open / open, or an angle |
70
71
  | Shake device | `shake` | Shake handlers (sim/emu only), Undo-typing prompt, RN dev menu |
71
72
  | Wait for UI | `await-ui-element` | Block until an element is visible/hidden/exists/contains text |
72
73
  | Wait for idle | `await-screen-idle` | Block until a non-empty screen tree stops changing |
@@ -198,6 +199,29 @@ Tap the field first so it has focus; pasting with no focused field is a silent n
198
199
 
199
200
  Values: `Portrait`, `LandscapeLeft`, `LandscapeRight`, `PortraitUpsideDown`
200
201
 
202
+ On an unfolded foldable simulator, the value sets the orientation of the device, not of the UI. `Portrait` gives a landscape UI. `LandscapeLeft` gives a portrait UI.
203
+
204
+ ### fold — Fold or unfold a foldable simulator
205
+
206
+ ```json
207
+ { "udid": "<UDID>", "posture": "open" }
208
+ ```
209
+
210
+ Give `posture` (`closed`, `half-open` or `open`) or `angle` (0–180). Do not give both.
211
+
212
+ Use `fold` only on a foldable iOS simulator. `list-devices` marks it with `foldable: true`, for example the iPhone Duo. Other devices reject the call.
213
+
214
+ Closed, the cover panel shows the UI. Half-open and open, the inner panel shows the UI. All tools use the active panel (the panel that shows the UI), also after a fold made outside argent. `fold` returns when the device accepts input again, so the next tap lands. This is also true for the next step in `run-sequence`.
215
+
216
+ Rules:
217
+
218
+ - The coordinates change with the panel. Before you tap, read the element tree in the `fold` result, or run `describe` again. Do not use frames from before the fold.
219
+ - The screenshot size changes with the panel. Keep one screenshot-diff baseline for each posture.
220
+ - Unfolded, the UI is landscape. The screenshot shows the UI turned 90 degrees, and the `describe` frames use the same axes, as on a rotated iPhone.
221
+ - A fold between two angles that are not 0 or 180 can keep the current panel. The result names the active panel. To change panels, fold to `closed` or `open`.
222
+ - Fold between gestures, not during a gesture. A gesture stays on the panel where it started.
223
+ - If argent cannot find the active panel, it uses the cover panel. The tool result then has a `warning`, and a screenshot-diff summary has a `panel:` line. Take a screenshot to see what the device shows, then do the check that the warning gives.
224
+
201
225
  ### await-ui-element — Block until a UI element reaches a state
202
226
 
203
227
  **Never poll `screenshot`/`describe` in a loop to wait for something.** Use `await-ui-element`: it blocks server-side on the same tree `describe` reads. It has no bare-timer mode by design — for a plain pause, use your own harness sleep.
@@ -284,7 +308,7 @@ Do **not** use `run-sequence` when any step depends on observing the result of a
284
308
 
285
309
  ### Allowed tools inside `run-sequence`
286
310
 
287
- `gesture-tap`, `gesture-swipe`, `gesture-scroll`, `gesture-drag`, `gesture-custom`, `gesture-pinch`, `gesture-rotate`, `button`, `keyboard`, `paste`, `rotate`, `shake`, `tv-remote`, `await-ui-element`
311
+ `gesture-tap`, `gesture-swipe`, `gesture-scroll`, `gesture-drag`, `gesture-custom`, `gesture-pinch`, `gesture-rotate`, `button`, `keyboard`, `paste`, `rotate`, `shake`, `fold`, `tv-remote`, `await-ui-element`
288
312
 
289
313
  The `udid` is shared — do **not** include it in each step's `args`. Optional `delayMs` per step (default 100ms).
290
314
 
@@ -29,7 +29,7 @@ All tools accept `port` (default 8081) AND `device_id` (the iOS Simulator UDID,
29
29
 
30
30
  One Metro port can serve multiple connected devices (e.g. two simulators on `localhost:8081`, or an iOS simulator alongside an Android emulator with `adb reverse` set up). `device_id` pins every debugger/network/profiler call to a specific device so sessions do not collide.
31
31
 
32
- With two or more devices on one Metro, `debugger-connect` refuses a udid/serial and hands back the `logicalDeviceId` to re-target with. That id then keys the session — including for teardown. **Pass it in `stop-all-simulator-servers`' `devices` alongside the device id**, or the session survives your session end holding its CDP socket, console server and log file. The teardown reports what it could not reach in `left_running`; re-call with the id it names.
32
+ With two or more devices on one Metro, `debugger-connect` refuses a udid/serial and hands back the `logicalDeviceId` to re-target with. That id then keys the session — including for teardown. **Pass it in `stop-all-simulator-servers`' `devices` alongside the device id**, or the session survives your session end holding its CDP socket, console server and log file. The teardown reports what it could not reach in `left_running`; re-call with the id it names. On an iOS simulator, also pass the simulator's `udid` to `debugger-component-tree`, so that its tap coordinates are correct when the UI is landscape.
33
33
 
34
34
  ### Connect & diagnostics
35
35
 
@@ -42,6 +42,7 @@ A recording does not stop itself before its `timeLimitSeconds` cap, so a forgott
42
42
 
43
43
  - **What can be recorded**: anything simulator-server drives — iOS simulators, Android emulators, and physical Android devices. The only length limit is `timeLimitSeconds` (max 600).
44
44
  - **The timeline is paced to a steady 30 fps**: a device only emits a frame when its screen changes, so captured frames are re-paced onto a fixed timeline rather than bunching up. With static-frame trimming off (`trimStatic: false`) that timeline is wall-clock accurate — a completely still screen still comes back as a full-length video (compressing to almost nothing) and `durationMs` matches the time you actually recorded. With trimming on (the default, see §3) still stretches past the grace window are collapsed, so `durationMs` is the trimmed video length and `wallClockMs` carries the real elapsed time.
45
+ - **One size per video**: the video keeps the size of the screen at the start of the recording. If the screen changes size, argent keeps the proportions of the new screen and adds black bars. On a foldable simulator, start the recording on the panel that you need at full size.
45
46
  - **Android**: records at the device's native resolution; secure screens (DRM, some password fields) come out black.
46
47
  - **Unsupported**: tvOS simulators, physical iPhones, Chromium apps, Vega/Fire TV, and remote (`remote:`-prefixed) simulators — none of them expose a readable frame stream. For a single still frame use `screenshot`; for a replayable interaction script use `argent-create-flow` instead of a video.
47
48
  - **ffmpeg is required**: it is the encoder, so `screen-recording-start` fails up front with an install hint if it is missing (`brew install ffmpeg` on macOS). It is resolved from `PATH` plus the usual Homebrew prefixes.