@swmansion/argent 0.35.1-next.14 → 0.35.1-next.16

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.
@@ -72957,7 +72957,7 @@ function isCi(env = process.env) {
72957
72957
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
72958
72958
  function readCliVersion() {
72959
72959
  if (true) {
72960
- return "0.35.1-next.13";
72960
+ return "0.35.1-next.16";
72961
72961
  }
72962
72962
  return "0.0.0";
72963
72963
  }
@@ -101760,11 +101760,11 @@ function scheduleGroupSigkill(pid, graceMs, opts) {
101760
101760
  }
101761
101761
  async function pollPidsUntilGone(pids, opts) {
101762
101762
  const isAlive2 = opts.isAlive ?? pidIsAlive;
101763
- const sleep20 = opts.sleep ?? ((ms3) => new Promise((resolve21) => setTimeout(resolve21, ms3)));
101763
+ const sleep21 = opts.sleep ?? ((ms3) => new Promise((resolve21) => setTimeout(resolve21, ms3)));
101764
101764
  const maxPolls = Math.max(1, Math.ceil(opts.timeoutMs / opts.pollIntervalMs));
101765
101765
  let remaining = pids.filter((pid) => isAlive2(pid));
101766
101766
  for (let poll = 0; poll < maxPolls && remaining.length > 0; poll += 1) {
101767
- await sleep20(opts.pollIntervalMs);
101767
+ await sleep21(opts.pollIntervalMs);
101768
101768
  remaining = remaining.filter((pid) => isAlive2(pid));
101769
101769
  }
101770
101770
  return remaining;
@@ -106124,14 +106124,8 @@ function externalShadowIds(external) {
106124
106124
  var zodSchema2 = external_exports.object({});
106125
106125
  var listDevicesTool = {
106126
106126
  id: "list-devices",
106127
- description: `List the targets argent can drive or start: iOS simulators and iPhones, Android emulators, AVDs and phones, Chromium (CDP) apps, Vega (Fire TV) devices, <flag:harmonyos>HarmonyOS phones and emulators, </flag:harmonyos><flag:macos-apps>Mac apps argent started, </flag:macos-apps>and iOS simulators hosted on Argent Cloud.
106128
- Returns { devices, notes? }. Each device has a 'platform', a 'kind' and a 'state'. Pass its 'udid' (iOS<flag:harmonyos>, HarmonyOS</flag:harmonyos>), 'serial' (Android, Vega) or 'id' (Chromium<flag:macos-apps>, Mac app</flag:macos-apps>) to the other tools. Ready devices come first.
106129
- Start a stopped device with boot-device: an iOS simulator by 'udid', an Android AVD (kind 'avd', no serial until it runs) by 'avdName', a Vega VVD by 'vvdImage'. A physical phone (kind 'device') needs no boot; use one only when the user asks for it. A physical iPhone is usable only in state 'connected'.
106130
- <flag:harmonyos>HarmonyOS kind 'device' is an \`hdc\` target that the tools drive; kind 'emulator' is a DevEco Studio instance that boot-device starts, and a running one is listed as both.
106131
- </flag:harmonyos>platform 'ios-remote' is an iOS simulator hosted on Argent Cloud, usable from Linux too (https://argent.swmansion.com/cloud/); drive it with the same tools by its 'remote:' udid. A 'deviceSet' simulator (e.g. from Radon IDE) runs headless.
106132
- runtimeKind 'tv' marks a focus-driven TV target: use describe, tv-remote and keyboard, not gestures. 'foldable: true' marks a device the fold tool folds.
106133
- Chromium apps are found on CDP port 9222 (more via ARGENT_CHROMIUM_PORTS); boot-device with electronAppPath launches one.
106134
- 'notes' says which platform this machine cannot reach and what would change that; tell the user when their task needs that platform.`,
106127
+ description: `List available targets (ready devices first): iOS simulators/iPhones, Android emulators/AVDs/phones, Chromium apps, Vega devices, <flag:harmonyos>HarmonyOS, </flag:harmonyos><flag:macos-apps>Mac apps, </flag:macos-apps>and Argent Cloud simulators (\`ios-remote\`).
106128
+ Use when starting a session to discover target ids. Returns { devices, notes? }. Pass a ready device's \`udid\`, \`serial\`, or \`id\` to other tools; start stopped targets via \`boot-device\`. Use physical phones (\`kind: 'device'\`) only when asked. \`runtimeKind: 'tv'\` uses \`tv-remote\`, not gestures. Fails if device discovery errors; surface \`notes\` if a needed platform is unavailable.`,
106135
106129
  zodSchema: zodSchema2,
106136
106130
  alwaysLoad: true,
106137
106131
  searchHint: "list devices simulators emulators avd serial udid ios android chromium vega <flag:harmonyos>harmony harmonyos </flag:harmonyos>app fire tv session start",
@@ -114386,10 +114380,11 @@ async function injectAndroidText(serial, text) {
114386
114380
  });
114387
114381
  }
114388
114382
  }
114389
- async function injectAndroidKeycode(serial, keycode) {
114390
- await adbShell(serial, `input keyevent ${keycode}`, { timeoutMs: ADB_INPUT_TIMEOUT_MS });
114383
+ async function injectAndroidKeycode(serial, keycode, repeat = 1) {
114384
+ const keycodes = Array(repeat).fill(keycode).join(" ");
114385
+ await adbShell(serial, `input keyevent ${keycodes}`, { timeoutMs: ADB_INPUT_TIMEOUT_MS });
114391
114386
  }
114392
- async function injectAndroidNamedKey(serial, name) {
114387
+ async function injectAndroidNamedKey(serial, name, repeat = 1) {
114393
114388
  const lower = name.toLowerCase();
114394
114389
  const keycode = Object.hasOwn(ANDROID_NAMED_KEYCODES, lower) ? ANDROID_NAMED_KEYCODES[lower] : void 0;
114395
114390
  if (keycode == null) {
@@ -114402,7 +114397,7 @@ async function injectAndroidNamedKey(serial, name) {
114402
114397
  }
114403
114398
  );
114404
114399
  }
114405
- await injectAndroidKeycode(serial, keycode);
114400
+ await injectAndroidKeycode(serial, keycode, repeat);
114406
114401
  }
114407
114402
 
114408
114403
  // ../tool-server/src/blueprints/android-tv-control.ts
@@ -124090,28 +124085,18 @@ function timeoutNote(params, lastTree, fetchError, lastData) {
124090
124085
  return appendDiagnostics(base, lastData);
124091
124086
  }
124092
124087
  var zodSchema3 = external_exports.object({
124093
- udid: external_exports.string().min(1).describe(
124094
- "Target device id from `list-devices` (iOS UDID, Android serial, Vega serial, <flag:harmonyos>HarmonyOS id, </flag:harmonyos><flag:macos-apps>Mac app id, </flag:macos-apps>or Chromium id)."
124095
- ),
124088
+ udid: external_exports.string().min(1).describe("Target device id from `list-devices`."),
124096
124089
  condition: external_exports.enum(["exists", "visible", "hidden", "text"]).describe(
124097
- "What to wait for. `exists`: the selector matches an element anywhere in the tree. `visible`: it matches one with a non-zero on-screen frame. `hidden`: it matches nothing, or only a zero-area element (e.g. a spinner that went away). `text`: the first visible match in reading order (topmost, then leftmost; the first match overall if none is visible) contains expectedText, or equals it with textMatch `equals`. Only that match is checked, so if a loose selector hits several elements, narrow it to the one holding the text.<flag:macos-apps> On a Mac app, a match in an open menu comes first, then one in an alert, sheet or popover, then one in the window.</flag:macos-apps>"
124090
+ "`exists`: in tree; `visible`: non-zero on-screen frame; `hidden`: absent or zero-area; `text`: first visible match in reading order matches `expectedText`.<flag:macos-apps> On a Mac app, open menus match before alerts/sheets and the window.</flag:macos-apps>"
124098
124091
  ),
124099
124092
  selector: selectorSchema.describe(
124100
- "Element to match. Give at least one field; every given field must match."
124101
- ),
124102
- expectedText: external_exports.string().min(1).optional().describe(
124103
- "Required for condition `text`: the string the checked match must contain or equal (see `textMatch`)."
124104
- ),
124105
- textMatch: external_exports.enum(["contains", "equals"]).optional().describe(
124106
- "For condition `text`: how expectedText is compared. `contains` (default) is a case-insensitive substring; `equals` is a case-insensitive full-string match."
124093
+ "Element matcher (at least one field; all given fields must match)."
124107
124094
  ),
124108
- bundleId: external_exports.string().optional().describe(
124109
- "iOS app bundle id, passed to the describe fallback (see `describe`). Ignored on every other platform, including physical iOS."
124110
- ),
124111
- timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(
124112
- `Max time to wait for the condition before giving up (default ${DEFAULT_TIMEOUT_MS3}).`
124113
- ),
124114
- pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(`How often to re-check the tree (default ${DEFAULT_POLL_INTERVAL_MS}).`)
124095
+ expectedText: external_exports.string().min(1).optional().describe("Required for `text`: expected substring or full string (see `textMatch`)."),
124096
+ textMatch: external_exports.enum(["contains", "equals"]).optional().describe("Case-insensitive match mode for `text`: `contains` (default) or `equals`."),
124097
+ bundleId: external_exports.string().optional().describe("iOS simulator only: fallback bundle id for `describe`."),
124098
+ timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(`Timeout in ms (default ${DEFAULT_TIMEOUT_MS3}).`),
124099
+ pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(`Poll interval in ms (default ${DEFAULT_POLL_INTERVAL_MS}).`)
124115
124100
  }).strict().refine((p) => p.condition !== "text" || p.expectedText !== void 0, {
124116
124101
  message: "condition `text` requires expectedText",
124117
124102
  path: ["expectedText"]
@@ -124141,9 +124126,8 @@ function createAwaitUiElementTool(registry2) {
124141
124126
  }
124142
124127
  return {
124143
124128
  id: AWAIT_UI_ELEMENT_TOOL_ID,
124144
- description: `Block until a UI element reaches an expected state or the timeout elapses, so you don't have to poll screenshot/describe yourself. It polls the same tree as \`describe\`.
124145
- Use when the next step needs an element that appears or disappears asynchronously, e.g. after a tap or navigation, or before tapping something that loads late.
124146
- Returns { success: boolean, elapsed: number, note?, cause? }. If the condition does not hold by the timeout, it returns success=false, and that is not always a verdict on the condition: \`cause\` says which it was: \`unmet\` (the tree was read and the condition was false there), \`unreadable\` (no trustworthy read, so nothing was judged) or \`cancelled\`. \`note\` describes what was seen. Only \`unmet\` licenses rewriting the check.<flag:harmonyos> A \`note\` on success=true can also say the tree was read off a suspended HarmonyOS panel, which is not the live screen.</flag:harmonyos>`,
124129
+ description: `Block server-side until a UI element matches \`condition\` on the \`describe\` tree or times out (never poll screenshot/describe manually).
124130
+ Use when waiting for UI to appear, disappear, or update after an action. Returns { success, elapsed, note?, cause? }. On timeout (\`success: false\`), \`cause\` is \`unmet\` (live tree read and condition false; \`note\` says what was seen), \`unreadable\` (blind/failed read), or \`cancelled\`; only \`unmet\` licenses rewriting the check.<flag:harmonyos> A \`note\` on success=true can also say the tree was read off a suspended HarmonyOS panel, which is not the live screen.</flag:harmonyos> Fails if the target backend is unreachable.`,
124147
124131
  zodSchema: zodSchema3,
124148
124132
  alwaysLoad: true,
124149
124133
  searchHint: "wait await poll until visible hidden exists text appears disappears timeout element condition settle",
@@ -135214,72 +135198,60 @@ var capability2 = {
135214
135198
  };
135215
135199
  var zodSchema11 = external_exports.object({
135216
135200
  udid: external_exports.string().optional().describe(
135217
- "iOS: simulator UDID to boot (from `list-devices`).<flag:macos-apps> A Mac app id (`macos-app-<bundle id>`) starts that app again from its last path.</flag:macos-apps>"
135201
+ "iOS simulator UDID from `list-devices`.<flag:macos-apps> Or Mac app id (`macos-app-<bundle id>`) to relaunch from its last path.</flag:macos-apps>"
135218
135202
  ),
135219
135203
  avdName: external_exports.string().optional().describe(
135220
- "Android: AVD to start, the `avdName` of a `list-devices` entry with kind 'avd'. A running emulator of it is reused when it fits the call: see `readOnly` and `port`."
135221
- ),
135222
- vvdImage: external_exports.string().optional().describe(
135223
- "Vega (Fire TV): VVD image to boot: the `vvdImage` of a Vega device from `list-devices` (e.g. `tv`)."
135204
+ "Android AVD name (`kind: 'avd'` from `list-devices`). Reuses a compatible running emulator."
135224
135205
  ),
135206
+ vvdImage: external_exports.string().optional().describe("Vega (Fire TV) VVD image name from `list-devices` (e.g. `tv`)."),
135225
135207
  harmonyInstance: external_exports.string().optional().describe(
135226
- 'HarmonyOS: emulator instance to start: the `name` of a `kind: "emulator"` device from `list-devices` (e.g. `Phone_1`); the `harmony-emulator-<name>` id that entry reports as its `udid` is accepted too.'
135208
+ "HarmonyOS emulator instance name or `harmony-emulator-<name>` id from `list-devices`."
135227
135209
  ).meta({ [FLAG_META_KEY]: HARMONY_FLAG }),
135228
135210
  bootTimeoutMs: external_exports.number().int().min(3e4).max(9e5).optional().describe(
135229
- "Android/Vega<flag:harmonyos>/HarmonyOS</flag:harmonyos>: overall budget for the boot sequence. Default 480000 (8 min) on Android, 120000 (2 min) on Vega<flag:harmonyos>, 180000 (3 min) on HarmonyOS, where with `force` it spans the shutdown as well as the boot</flag:harmonyos>."
135211
+ "Overall boot budget in ms (Android default 480000, Vega 120000<flag:harmonyos>, HarmonyOS 180000</flag:harmonyos>).<flag:harmonyos> On HarmonyOS with `force`, this spans shutdown too.</flag:harmonyos>"
135230
135212
  ),
135231
135213
  force: external_exports.boolean().optional().describe(
135232
- "Shut down and re-boot the device even if already running.<flag:harmonyos> On HarmonyOS it is also what ties an already-running instance to its `hdc` connect key: without it the instance is left alone and its key stays unresolved (`list-devices` lists the keys, but not which instance each belongs to).</flag:harmonyos><flag:macos-apps> On a Mac app it quits and restarts the app, also a copy of the same build running without the argent library: that copy loses its unsaved changes. When the app argent runs answers the quit with a save prompt, the call fails and the app keeps running. Force never quits a copy of another build (another .app path).</flag:macos-apps> Ignored for Electron, which always spawns a fresh process."
135214
+ "Shut down and reboot even if already running.<flag:harmonyos> On HarmonyOS, also ties a running instance to its `hdc` connect key.</flag:harmonyos><flag:macos-apps> On a Mac app, quits and restarts the same .app build, including a copy running without the argent library (losing its unsaved changes); fails if the app shows a save prompt.</flag:macos-apps> Ignored for Electron."
135233
135215
  ),
135234
135216
  sound: external_exports.boolean().optional().describe(
135235
- "Android only (argent never mutes other platforms): boot the emulator with audio output enabled. Defaults to false, so several agent-driven emulators don't all play sound on the host; pass `true` when the task involves playing, hearing, or testing audio. Takes effect at boot: if the emulator is already running muted, add `force: true`. The first boot after toggling is a slower cold boot (the snapshot was saved in the other audio mode). The `boot-sound` argent flag flips this default to true."
135217
+ "Android only: enable emulator audio (default false, or `boot-sound` flag). Pair with `force: true` to toggle a running emulator."
135236
135218
  ),
135237
135219
  guestVulkan: external_exports.boolean().optional().describe(
135238
- "Android on a macOS host only: boot the emulator with guest Vulkan. Defaults to false: guest Vulkan crashes Chrome's GPU process, which breaks Chrome and Custom Tab sign-in flows. Without it apps find no Vulkan device, although the guest still lists the Vulkan features, so a Vulkan-only renderer such as WebGPU (react-native-wgpu) draws nothing; pass `true` to test one. Takes effect at boot: an emulator already running in the other mode is reused with a `note`, and `force: true` reboots it. A boot snapshot saved in the other mode can't be reused, so the first boot after toggling is a slower cold boot. The `ARGENT_EMULATOR_GUEST_VULKAN` env var flips this default to true. Ignored on other hosts and platforms."
135220
+ "Android on a macOS host only: enable guest Vulkan (default false; true needed for WebGPU/Vulkan renderers, may crash Chrome GPU). Pair with `force: true` to toggle."
135239
135221
  ),
135240
135222
  readOnly: external_exports.boolean().optional().describe(
135241
- "Android only: boot the emulator with `-read-only`, so that several emulators can run one AVD at once, for example one per agent. Defaults to false. A read-only emulator saves no snapshot and loses its changes when it exits, so the AVD and its quickboot snapshot stay as they were. The emulator runs an AVD either writable once or read-only any number of times, never both, so the boot fails while the AVD runs writable, and a writable boot fails while the AVD runs in any instance it cannot reuse. A read-only boot reuses only a running read-only emulator. Ignored on other platforms."
135223
+ "Android only: boot `-read-only` (default false) to run multiple concurrent instances of one AVD without saving snapshot changes."
135242
135224
  ),
135243
135225
  // The range is checked on the Android path only (`androidPortError`): off
135244
135226
  // Android the key is ignored, so an agent echoing a Chromium `port` such as
135245
135227
  // 9222 must not fail validation.
135246
135228
  port: external_exports.number().int().optional().describe(
135247
- "Android only: the emulator's console port, an even number from 5554 to 5584 (`emulator -port`), the range adb finds emulators in; its serial is `emulator-<port>`. Without it the emulator takes the first free port from 5554 up, as Android Studio does. The gRPC server Argent needs for screenshots and gestures goes on the port plus 3000, which must be free too. Given a port, the tool reuses only the emulator on that port and fails if another emulator holds it, or if this AVD runs there writable on a read-only boot and `force` is not set. A read-only emulator started with `-port` belongs to the calls that give that port: a call without `port` never reuses or shuts it down. Where the process list cannot be read (Windows, or a failed `ps`), Argent knows only the pinned emulators it booted itself, so a writable call without `port` can reuse, or with `force` shut down, one that someone else pinned. A writable one is still reused, or with `force` shut down, by a writable call without `port`, since the AVD runs one writable emulator at a time. `force` shuts nothing down when another emulator of the AVD would still block the boot. Ignored on other platforms."
135229
+ "Android only: emulator console port (even, 5554\u20135584; serial `emulator-<port>`, gRPC on port+3000). Defaults to first free port."
135248
135230
  ),
135249
135231
  prepareOnly: external_exports.boolean().optional().describe(
135250
- "Local iOS simulator only: apply accessibility preferences and leave the simulator shut down for a pool manager to boot. Requires Shutdown state. Cannot be combined with force: true."
135232
+ "Local iOS simulator only: apply accessibility prefs to a Shutdown simulator without booting. Cannot combine with `force: true`."
135251
135233
  ),
135252
135234
  headless: external_exports.boolean().optional().describe(
135253
- "iOS only: boot the simulator core WITHOUT opening its GUI window (Simulator.app, or Device Hub on Xcode 27+). The device still streams via simulator-server. The `ARGENT_SIMULATOR_NO_WINDOW` env var (1/true/yes) forces this host-wide."
135235
+ "iOS only: boot simulator core without opening Simulator.app (`ARGENT_SIMULATOR_NO_WINDOW=1` forces host-wide)."
135254
135236
  ),
135255
135237
  electronAppPath: external_exports.string().optional().describe(
135256
- "Electron: path to the Electron app to launch. Either a packaged .app bundle / executable, or a project directory whose package.json points the Electron binary at the entry script."
135238
+ "Electron: path to `.app` bundle, executable, or project directory with `package.json`."
135257
135239
  ),
135258
135240
  electronPort: external_exports.number().int().min(1024).max(65535).optional().describe(
135259
- "Electron-only: CDP remote-debugging port to expose. Defaults to a free port; the resulting device id is `chromium-cdp-<port>`."
135241
+ "Electron only: CDP remote-debugging port (default: free port; id `chromium-cdp-<port>`)."
135260
135242
  ),
135261
- electronArgs: external_exports.array(external_exports.string()).optional().describe(
135262
- "Electron-only: extra CLI arguments forwarded to the Electron binary after the app path."
135263
- ),
135264
- macosAppPath: external_exports.string().optional().describe(
135265
- "Mac app: path to the .app bundle to start with the argent library; its device id is `macos-app-<bundle id>`. An exported or notarized Release build with the hardened runtime cannot be driven without extra entitlements; a hardened Debug build needs the step the error names."
135266
- ).meta({ [FLAG_META_KEY]: MACOS_APPS_FLAG }),
135267
- macosAppArgs: external_exports.array(external_exports.string()).optional().describe(
135268
- "Mac app only: arguments for the app executable. Omitted, the app starts with none, also when an earlier start had some."
135269
- ).meta({ [FLAG_META_KEY]: MACOS_APPS_FLAG })
135243
+ electronArgs: external_exports.array(external_exports.string()).optional().describe("Electron only: extra CLI args forwarded to the Electron binary."),
135244
+ macosAppPath: external_exports.string().optional().describe("Mac app: path to `.app` bundle (id `macos-app-<bundle id>`).").meta({ [FLAG_META_KEY]: MACOS_APPS_FLAG }),
135245
+ macosAppArgs: external_exports.array(external_exports.string()).optional().describe("Mac app only: launch arguments (omitted = none).").meta({ [FLAG_META_KEY]: MACOS_APPS_FLAG })
135270
135246
  });
135271
135247
  function createBootDeviceTool(registry2) {
135272
135248
  return {
135273
135249
  id: "boot-device",
135274
135250
  // Boots routinely run past the 30s MCP fetch timeout.
135275
135251
  longRunning: true,
135276
- description: `Start an iOS simulator, launch an Android emulator, start a Vega (Fire TV) Virtual Device, <flag:harmonyos>start a HarmonyOS emulator, </flag:harmonyos><flag:macos-apps>launch a built Mac app, </flag:macos-apps>or spawn an Electron app and wait until it is ready to accept interactions.
135277
- Pass exactly one of 'udid', 'avdName', 'vvdImage', <flag:harmonyos>'harmonyInstance', </flag:harmonyos><flag:macos-apps>'macosAppPath', </flag:macos-apps>or 'electronAppPath'; it picks the platform.
135278
- Use when starting a session, once you have picked a target.
135279
- Returns a tagged payload: { platform: 'ios', udid, booted, note? } or { platform: 'android', serial, avdName, booted, note? } or { platform: 'vega', serial, vvdImage, booted } or <flag:harmonyos>{ platform: 'harmony', udid, instanceName, booted, note? } or </flag:harmonyos>{ platform: 'chromium', id, port, pid, booted } (an Electron app boots as a Chromium/CDP device).<flag:macos-apps>
135280
- Mac apps return platform 'macos' and kind 'catalyst' or 'app'. Pass the returned id as udid to interaction tools. Follow the note when present.</flag:macos-apps>
135281
- On Android the tool hot-boots from the AVD's default_boot snapshot when usable and falls back to a slower cold boot otherwise. Vega starts the single SDK-managed VVD (~10s). If an Android/Electron boot stage fails, the tool terminates the device it spawned so the next retry starts clean.<flag:harmonyos>
135282
- HarmonyOS hands the instance to DevEco Studio's Emulator manager, then waits for it to register with 'hdc' and returns its connect key as 'udid', the id the interaction tools drive. The manager reports no readiness signal and never names a port. When the key could not be resolved, the payload names the instance instead, and a 'note' is present whenever the boot left something unproven: no key and why, or a key that is not yet answering or could not be checked against the instance. Huawei serves the emulator images only within mainland China, so a host outside it usually has no instance to start; one that already has an image is started like any other.</flag:harmonyos>`,
135252
+ description: `Start a target device or app and wait until ready: iOS simulator, Android emulator, Vega VVD, <flag:harmonyos>HarmonyOS emulator, </flag:harmonyos><flag:macos-apps>Mac app, </flag:macos-apps>or Electron app.
135253
+ Use when starting a stopped target; pass exactly one target key (\`udid\`, \`avdName\`, \`vvdImage\`, <flag:harmonyos>\`harmonyInstance\`, </flag:harmonyos><flag:macos-apps>\`macosAppPath\`, </flag:macos-apps>or \`electronAppPath\`).
135254
+ Returns a platform-tagged payload with the target id (\`udid\` / \`serial\` / \`id\`), \`booted\`, and optional \`note\`.<flag:harmonyos> HarmonyOS starts the instance via DevEco Studio's Emulator manager and waits for its \`hdc\` connect key as \`udid\` (images are served only in mainland China; \`note\` explains any unproven key/readiness).</flag:harmonyos> Fails if the target is missing or cannot boot (failed Android/Electron spawns are cleaned up automatically).`,
135283
135255
  zodSchema: zodSchema11,
135284
135256
  alwaysLoad: true,
135285
135257
  searchHint: "boot start launch simulator emulator avd device session ios android vega vvd firetv <flag:harmonyos>harmony harmonyos deveco </flag:harmonyos>cold hot",
@@ -136015,17 +135987,13 @@ var capability3 = {
136015
135987
  macos: { app: true, catalyst: true }
136016
135988
  };
136017
135989
  var zodSchema12 = external_exports.object({
136018
- udid: external_exports.string().min(1).describe(
136019
- "Target device id from `list-devices` (iOS UDID, Android serial, <flag:harmonyos>HarmonyOS id, </flag:harmonyos><flag:macos-apps>Mac app id, </flag:macos-apps>or Chromium id)."
136020
- ),
135990
+ udid: external_exports.string().min(1).describe("Target device id from `list-devices`."),
136021
135991
  bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
136022
- "App identifier. iOS: bundle id. Android: package name from build.gradle `applicationId`. Vega (Fire TV): the interactive component app id from manifest.toml (e.g. com.example.app.main). <flag:harmonyos>HarmonyOS: bundle name as listed by `bm dump -a` (e.g. com.huawei.hmos.calculator). </flag:harmonyos>Chromium: any tag matching the pattern.<flag:macos-apps> Mac app: the bundle id in the device id.</flag:macos-apps>"
136023
- ),
136024
- activity: external_exports.string().regex(ACTIVITY_PATTERN, "activity may only contain letters, digits, '.', '_', '-' and '/'").optional().describe(
136025
- "Android-only: fully-qualified Activity name (e.g. `.MainActivity` or `com.example/com.example.MainActivity`). If omitted, the app's default launcher activity is used."
135992
+ "App identifier (iOS<flag:macos-apps>/Mac app</flag:macos-apps> bundle id, Android package name, Vega interactive component app id from manifest.toml e.g. `com.example.app.main`,<flag:harmonyos> HarmonyOS bundle name from `bm dump -a`,</flag:harmonyos> or Chromium tag)."
136026
135993
  ),
135994
+ activity: external_exports.string().regex(ACTIVITY_PATTERN, "activity may only contain letters, digits, '.', '_', '-' and '/'").optional().describe("Android only: Activity name (default: launcher activity)."),
136027
135995
  launchArgs: external_exports.array(external_exports.string()).optional().describe(
136028
- 'Apple simulators<flag:macos-apps>, Mac apps</flag:macos-apps> and physical iPhones: arguments passed to the app process at launch, e.g. `["-FeatureFlag", "YES"]` to override UserDefaults. A running app is relaunched to apply them<flag:macos-apps>, except a Mac app: use restart-app for that. Omitted on a Mac app, a stopped app gets the arguments of its last start</flag:macos-apps>. The call fails, launching nothing, if terminating it does not finish within 15s on a local iOS simulator, or fails for a reason other than the app not running on a remote one.'
135996
+ 'Apple targets only: process launch args, e.g. `["-FeatureFlag", "YES"]`. Relaunches running simulators/phones to apply.'
136029
135997
  )
136030
135998
  });
136031
135999
  function createLaunchAppTool(registry2) {
@@ -136033,14 +136001,11 @@ function createLaunchAppTool(registry2) {
136033
136001
  id: "launch-app",
136034
136002
  // Android's device probes plus `am start -W` can outlast the 30s MCP fetch timeout.
136035
136003
  longRunning: true,
136036
- description: `Open an installed app, or confirm the running renderer (Chromium).<flag:macos-apps> On a Mac app it starts the app in the background when it does not run, and leaves a running app as it is.</flag:macos-apps>
136037
- Use when starting any app; prefer this over tapping home-screen / launcher icons. Also prepares the native-devtools injection before the app starts (iOS and Apple TV).
136038
- Returns { launched, bundleId, <flag:macos-apps>kind?, appPath?, args?, </flag:macos-apps>note?, networkCapture? }. Fails if the app is not installed on the target device (iOS / Android<flag:harmonyos> / HarmonyOS</flag:harmonyos>). On a physical iPhone this registers the app every other tool acts on; com.apple.springboard and com.apple.Spotlight register without launching. note warns when runner signing is not ready. If Argent started native capture, networkCapture reports whether it followed the launch or was stopped. This note applies to Android and local iOS simulators.<flag:macos-apps>
136039
- For Mac apps, kind is 'catalyst' or 'app'. Check appPath and args to confirm the build and arguments in use. The note can report an already running app or a missing window.</flag:macos-apps>
136040
- For Chromium, the app is already running behind a CDP port; this call simply refreshes the cached viewport and acknowledges the bundleId tag. To change the visible route, use \`open-url\`.
136041
-
136042
- Common iOS bundle ids: com.apple.MobileSMS, com.apple.mobilesafari, com.apple.Preferences, com.apple.Maps, com.apple.mobileslideshow (Photos), com.apple.MobileAddressBook
136043
- Common Android packages: com.android.settings, com.android.chrome, com.google.android.apps.maps, com.google.android.gm, com.android.vending, com.google.android.dialer, com.google.android.apps.messaging`,
136004
+ description: `Open an installed app, or refresh a Chromium target (use \`open-url\` to navigate Chromium).<flag:macos-apps> On a Mac app, starts it in the background if stopped.</flag:macos-apps> Also prepares native-devtools injection on iOS/tvOS and registers the active app on physical iPhones (\`com.apple.springboard\` registers without launching so \`describe\` can read system dialogs).
136005
+ Use when starting an app; prefer this over tapping home-screen icons.
136006
+ Returns { launched, bundleId, <flag:macos-apps>kind?, appPath?, args?, </flag:macos-apps>note?, networkCapture? }. Fails if the app is not installed.
136007
+ Common iOS ids: com.apple.Preferences, com.apple.mobilesafari, com.apple.MobileSMS, com.apple.Maps, com.apple.mobileslideshow, com.apple.MobileAddressBook.
136008
+ Common Android packages: com.android.settings, com.android.chrome, com.google.android.apps.maps.`,
136044
136009
  zodSchema: zodSchema12,
136045
136010
  alwaysLoad: true,
136046
136011
  searchHint: "open start app bundle id package simulator emulator chromium vega launch tvos apple tv fire tv",
@@ -136316,28 +136281,20 @@ var capability4 = {
136316
136281
  macos: { app: true, catalyst: true }
136317
136282
  };
136318
136283
  var zodSchema13 = external_exports.object({
136319
- udid: external_exports.string().min(1).describe(
136320
- "Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps><flag:harmonyos>, HarmonyOS id,</flag:harmonyos> or Android serial)."
136321
- ),
136284
+ udid: external_exports.string().min(1).describe("Target device id from `list-devices`."),
136322
136285
  bundleId: external_exports.string().min(1).regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
136323
- "App identifier. iOS: bundle id. Android: package name. Vega: interactive component app id.<flag:harmonyos> HarmonyOS: bundle name.</flag:harmonyos><flag:macos-apps> Mac app: the bundle id in the device id.</flag:macos-apps>"
136324
- ),
136325
- activity: external_exports.string().regex(ACTIVITY_PATTERN2, "activity may only contain letters, digits, '.', '_', '-' and '/'").optional().describe(
136326
- "Android-only: relaunch a non-launcher Activity (e.g. `.SettingsActivity` or `com.example/com.example.SettingsActivity`). If omitted, the app's default launcher activity is used."
136286
+ "App identifier (iOS<flag:macos-apps>/Mac app</flag:macos-apps> bundle id, Android package name, Vega interactive component app id<flag:harmonyos>, or HarmonyOS bundle name</flag:harmonyos>)."
136327
136287
  ),
136328
- launchArgs: external_exports.array(external_exports.string()).optional().describe(
136329
- 'Apple simulators<flag:macos-apps>, Mac apps</flag:macos-apps> and physical iPhones: arguments passed to the app process at launch, e.g. `["-FeatureFlag", "YES"]` to override UserDefaults.<flag:macos-apps> Omitted on a Mac app, the app gets the arguments of its last start.</flag:macos-apps>'
136330
- )
136288
+ activity: external_exports.string().regex(ACTIVITY_PATTERN2, "activity may only contain letters, digits, '.', '_', '-' and '/'").optional().describe("Android only: Activity name to relaunch (default: launcher activity)."),
136289
+ launchArgs: external_exports.array(external_exports.string()).optional().describe('Apple targets only: process launch args, e.g. `["-FeatureFlag", "YES"]`.')
136331
136290
  });
136332
136291
  function createRestartAppTool(registry2) {
136333
136292
  return {
136334
136293
  id: "restart-app",
136335
136294
  // Android's device probes, force-stop and `am start -W` can outlast the 30s MCP fetch timeout.
136336
136295
  longRunning: true,
136337
- description: `Terminate then relaunch an app on iOS, Android, <flag:harmonyos>HarmonyOS, </flag:harmonyos><flag:macos-apps>macOS, </flag:macos-apps>or Vega.
136338
- Use when you need a clean in-memory state without a full reinstall. The relaunch also refreshes the native-devtools injection (iOS and Apple TV).<flag:macos-apps> On a Mac app it quits the app and starts the same .app again in the background.</flag:macos-apps>
136339
- Returns { restarted, bundleId, <flag:macos-apps>kind?, appPath?, args?, note?, </flag:macos-apps>networkCapture? }. If Argent started native capture, networkCapture reports whether it followed the launch or was stopped. This note applies to Android and local iOS simulators. Fails if the app is not installed, on a local iOS simulator if terminating it does not finish within 15s, or on a remote simulator if terminating it fails for a reason other than the app not running.<flag:macos-apps>
136340
- For Mac apps, kind is 'catalyst' or 'app'. Check appPath and args to confirm the restarted build and arguments. Check note for warnings such as a force-quit or no window.</flag:macos-apps>`,
136296
+ description: `Terminate and relaunch an app (also refreshes native-devtools injection on iOS/tvOS).<flag:macos-apps> On a Mac app, quits and restarts the same .app in the background.</flag:macos-apps>
136297
+ Use when you need a clean in-memory app state without reinstalling. Returns { restarted, bundleId, <flag:macos-apps>kind?, appPath?, args?, note?, </flag:macos-apps>networkCapture? }. Fails if the app is not installed or fails to terminate.`,
136341
136298
  zodSchema: zodSchema13,
136342
136299
  alwaysLoad: true,
136343
136300
  searchHint: "terminate relaunch restart reset app bundle id package simulator emulator vega tvos fire tv<flag:harmonyos> harmony harmonyos</flag:harmonyos>",
@@ -137914,28 +137871,23 @@ async function downscalePngInPlace(file2, scale, signal) {
137914
137871
  });
137915
137872
  }
137916
137873
  var zodSchema18 = external_exports.object({
137917
- udid: external_exports.string().describe(
137918
- "Target device id from `list-devices` (iOS UDID, Android serial, Apple TV UDID, Vega serial, <flag:harmonyos>HarmonyOS id, </flag:harmonyos><flag:macos-apps>Mac app id, </flag:macos-apps>or Chromium id)."
137919
- ),
137874
+ udid: external_exports.string().describe("Target device id from `list-devices`."),
137920
137875
  rotation: external_exports.enum(["Portrait", "LandscapeLeft", "LandscapeRight", "PortraitUpsideDown"]).optional().describe(
137921
- "Orientation override for the screenshot (on Chromium it rotates the captured image). Rarely needed: on Android and iOS simulators the capture already follows the UI's orientation, the space describe frames and gesture coordinates use, and an override can make the image disagree with them. <flag:harmonyos>Rejected on HarmonyOS, which captures the display in its current orientation and has no override. </flag:harmonyos>Ignored on physical iPhones."
137876
+ "Orientation override (rarely needed; captures already follow UI orientation).<flag:harmonyos> Rejected on HarmonyOS (captures display in current orientation).</flag:harmonyos> Ignored on physical iPhones."
137922
137877
  ),
137923
137878
  scale: external_exports.number().min(0.01).max(1).optional().describe(
137924
- "Scale factor. Defaults to ARGENT_SCREENSHOT_SCALE env var, or 0.25 if unset for iOS/Android<flag:harmonyos>/HarmonyOS</flag:harmonyos>. On a local Apple TV simulator, an Android TV or Vega, with neither set, the capture is downscaled to a 576 px long side (0.15 of a 4K capture). On Chromium the default is 1.0 (no downscale); pass <1 to opt in. Downscaling on Chromium requires the optional `sharp` dependency.<flag:macos-apps> On a Mac app the default is one pixel per window point, downscaled to a 768 px long side for a larger window.</flag:macos-apps>"
137879
+ "Scale factor (default 0.25 on iOS/Android<flag:harmonyos>/HarmonyOS</flag:harmonyos> or `ARGENT_SCREENSHOT_SCALE`, 576px long side on TV, 1.0 on Chromium<flag:macos-apps>, <=768px on Mac</flag:macos-apps>)."
137925
137880
  ),
137926
137881
  includeImageInContext: external_exports.boolean().optional().default(true).describe(
137927
- "Set false only when capturing a full-resolution PNG (scale: 1.0) to save as a baseline/current for screenshot-diff. The file is still written, but the image bytes are not attached to the agent context."
137882
+ "Set false only when saving a full-res (`scale: 1.0`) baseline/current for `screenshot-diff`."
137928
137883
  ),
137929
- downscaler: external_exports.enum(["lanczos3", "box", "bilinear", "nearest"]).optional().describe(
137930
- "Downscaling algorithm when scale<1 on Chromium. Defaults to lanczos3 (highest quality). Ignored on every other platform."
137931
- )
137884
+ downscaler: external_exports.enum(["lanczos3", "box", "bilinear", "nearest"]).optional().describe("Chromium only: downscaler when scale < 1 (default lanczos3).")
137932
137885
  });
137933
137886
  function createScreenshotTool(registry2) {
137934
137887
  return {
137935
137888
  id: "screenshot",
137936
- description: `Capture a PNG of the device screen (iOS simulator or physical device, Android emulator, Apple TV simulator, Vega, <flag:harmonyos>HarmonyOS device, </flag:harmonyos><flag:macos-apps>the window of a Mac app, </flag:macos-apps>or Chromium app). Returns { image }, the PNG file.
137937
- Use when you need a baseline image before an interaction or the screen state after a delay. Gestures, key presses and app launches already attach a screenshot to their result.
137938
- Fails if the capture backend (simulator-server, emulator, Chromium CDP<flag:harmonyos> or \`hdc\`</flag:harmonyos>) cannot be reached for this device.`,
137889
+ description: `Capture a PNG screenshot of the device screen.
137890
+ Use when you need a baseline image or the screen state after a delay (interaction tools already attach a screenshot). Returns { image }. Fails if the capture backend is unreachable.`,
137939
137891
  zodSchema: zodSchema18,
137940
137892
  alwaysLoad: true,
137941
137893
  searchHint: "device simulator emulator chromium screen image capture baseline tvos apple tv",
@@ -138144,28 +138096,19 @@ async function tapHarmony(connectKey, x, y, clickCount, signal) {
138144
138096
  );
138145
138097
  }
138146
138098
  var zodSchema19 = external_exports.object({
138147
- udid: external_exports.string().describe(
138148
- "Target device id from `list-devices` (iOS UDID, Android serial, <flag:harmonyos>HarmonyOS id, </flag:harmonyos><flag:macos-apps>Mac app id, </flag:macos-apps>or Chromium id)."
138149
- ),
138150
- x: external_exports.number().min(0).max(1).describe("Horizontal position: 0 = left edge, 1 = right edge."),
138151
- y: external_exports.number().min(0).max(1).describe("Vertical position: 0 = top edge, 1 = bottom edge."),
138099
+ udid: external_exports.string().describe("Target device id from `list-devices`."),
138100
+ x: external_exports.number().min(0).max(1).describe("Horizontal screen fraction [0,1]."),
138101
+ y: external_exports.number().min(0).max(1).describe("Vertical screen fraction [0,1]."),
138152
138102
  clickCount: external_exports.number().int().min(1).max(10).optional().describe(
138153
- "Number of taps/clicks dispatched as ONE gesture inside the OS double-tap window (2 = double-tap / double-click), which two separate tap calls cannot guarantee. On physical iOS, higher counts loop single taps, which a double-tap recognizer may pair.<flag:harmonyos> On HarmonyOS they land as separate taps.</flag:harmonyos> Default 1."
138103
+ "Tap/click count as one OS gesture (2 = double-tap; default 1). On physical iOS, higher counts loop single taps, which a double-tap recognizer may pair."
138154
138104
  ),
138155
- button: external_exports.enum(["left", "right"]).optional().describe(
138156
- 'Mouse button, Mac app only: "right" is a right-click, for example to open a context menu; any other device refuses it. Default "left".'
138157
- ).meta({ [FLAG_META_KEY]: MACOS_APPS_FLAG }),
138158
- modifiers: external_exports.array(external_exports.enum(MACOS_MODIFIERS)).max(MACOS_MODIFIERS.length).optional().describe(
138159
- "Keys held throughout a click or multi-click gesture. Mac apps only. An empty list leaves the click unmodified."
138160
- ).meta({ [FLAG_META_KEY]: MACOS_APPS_FLAG })
138105
+ button: external_exports.enum(["left", "right"]).optional().describe('Mac app only: mouse button ("left" default, or "right").').meta({ [FLAG_META_KEY]: MACOS_APPS_FLAG }),
138106
+ modifiers: external_exports.array(external_exports.enum(MACOS_MODIFIERS)).max(MACOS_MODIFIERS.length).optional().describe("Mac app only: modifier keys held during click.").meta({ [FLAG_META_KEY]: MACOS_APPS_FLAG })
138161
138107
  });
138162
138108
  var gestureTapTool = {
138163
138109
  id: "gesture-tap",
138164
- 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.
138165
- 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>
138166
- Use when tapping a button, link, or any tappable element on the screen.
138167
- 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.
138168
- 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`,
138110
+ description: `Press (tap, or click on Chromium<flag:macos-apps>/Mac</flag:macos-apps>) at normalized [0,1] coordinates taken from \`describe\`.
138111
+ Use when tapping a button, link, or control. Returns { tapped: true, timestampMs, reactivated?, warning? } (on physical iOS, \`reactivated: true\` means re-fronted; re-describe). Fails if the device backend is unreachable.`,
138169
138112
  zodSchema: zodSchema19,
138170
138113
  alwaysLoad: true,
138171
138114
  // A physical iPhone's first call waits out the runner build, past the MCP fetch timeout,
@@ -138286,20 +138229,16 @@ var capability11 = {
138286
138229
  harmony: { device: true }
138287
138230
  };
138288
138231
  var zodSchema20 = external_exports.object({
138289
- udid: external_exports.string().describe(
138290
- "Target device id from `list-devices` (iOS UDID<flag:harmonyos>, HarmonyOS id,</flag:harmonyos> or Android serial)."
138291
- ),
138292
- fromX: external_exports.number().min(0).max(1).describe("Start x."),
138293
- fromY: external_exports.number().min(0).max(1).describe("Start y."),
138294
- toX: external_exports.number().min(0).max(1).describe("End x."),
138295
- toY: external_exports.number().min(0).max(1).describe("End y."),
138232
+ udid: external_exports.string().describe("Target device id from `list-devices`."),
138233
+ fromX: external_exports.number().min(0).max(1).describe("Start x [0,1]."),
138234
+ fromY: external_exports.number().min(0).max(1).describe("Start y [0,1]."),
138235
+ toX: external_exports.number().min(0).max(1).describe("End x [0,1]."),
138236
+ toY: external_exports.number().min(0).max(1).describe("End y [0,1]."),
138296
138237
  durationMs: external_exports.number().max(MAX_DURATION_MS, {
138297
138238
  message: `durationMs must be at most ${MAX_DURATION_MS} (10s): every frame is a real 16ms sleep with the finger held down, so a larger value is that many milliseconds of wall clock spent holding a touch the device cannot shake off.`
138298
- }).optional().describe(
138299
- "Total gesture duration in milliseconds (default 300); the finger stays down this long. Below ~32ms the whole travel lands in one or two frames, which the OS flings as hard as any flick."
138300
- ),
138239
+ }).optional().describe("Swipe duration in ms (default 300)."),
138301
138240
  momentum: external_exports.boolean().optional().describe(
138302
- `Whether the swipe releases with momentum; default true (a natural flinging swipe). false eases the finger into the end point so the OS applies little to no fling and the content stops where the finger lifts: use it when you need a deterministic scroll distance, e.g. in scroll-to-element loops. false needs durationMs >= ${MOMENTUM_FREE_MIN_DURATION_MS} and is rejected below that; near ${MOMENTUM_FREE_MIN_DURATION_MS} it can still land short or fling, so keep the default 300.`
138241
+ `Default true (flinging swipe). Set false to ease out with no fling for deterministic scroll distance (requires durationMs >= ${MOMENTUM_FREE_MIN_DURATION_MS}).`
138303
138242
  ),
138304
138243
  // `momentum`'s shipped spelling, with the opposite polarity. Declared so this
138305
138244
  // non-strict object refuses it instead of stripping it and flinging - the exact
@@ -138320,13 +138259,9 @@ var gestureSwipeTool = {
138320
138259
  id: "gesture-swipe",
138321
138260
  // Never interpolate into this description: extract-tools scans it statically,
138322
138261
  // so a `${}` in it drops the tool out of the scan.
138323
- description: `Execute a smooth swipe / drag touch gesture between two points on the device (iOS simulator or physical device, <flag:harmonyos>HarmonyOS device, </flag:harmonyos>or Android emulator). All from/to positions are fractions of screen width/height (not pixels), same as gesture-tap.
138324
- Generates interpolated Move events for a natural feel (~60fps)<flag:harmonyos>; HarmonyOS takes the whole gesture in one call and interpolates it on-device</flag:harmonyos>.
138325
- Swipe up (fromY > toY) to scroll content down.
138326
- Use when you need to scroll a list, dismiss a modal, drag an element, or navigate between pages. Not supported on Chromium; use gesture-scroll there instead.<flag:macos-apps> Not supported on a Mac app; use gesture-scroll or gesture-drag there.</flag:macos-apps>
138327
- Physical iOS: an edge gesture (back-swipe) needs fromX 0 exactly; durationMs sets drag speed, not time; momentum:false only rests 300ms at the end and does not damp.<flag:harmonyos>
138328
- HarmonyOS: durationMs sets drag speed, clamped to uitest's 200-40000 px/s, so a short slow swipe ends early and a long fast one runs late.</flag:harmonyos>
138329
- Returns { swiped: true, timestampMs }. On physical iOS, reactivated: true = app was re-fronted; re-describe. Fails if the simulator-server / emulator backend<flag:harmonyos>, or \`hdc\` on HarmonyOS,</flag:harmonyos> is not reachable for the given device.`,
138262
+ description: `Execute a swipe/drag between two normalized [0,1] points on touch devices (swipe up, fromY > toY, to scroll down).
138263
+ Use when scrolling a list, dismissing a modal, or swiping between pages (not Chromium<flag:macos-apps>/Mac</flag:macos-apps>: use \`gesture-scroll\` / \`gesture-drag\`). Returns { swiped: true, timestampMs, reactivated?, warning? }. Fails if the touch backend is unreachable.
138264
+ Physical iOS: an edge gesture (back-swipe) needs \`fromX: 0\` exactly; \`durationMs\` sets drag speed, not time; \`momentum: false\` only rests 300ms at the end and does not damp.<flag:harmonyos> HarmonyOS: \`durationMs\` sets drag speed, clamped to 200\u201340000 px/s.</flag:harmonyos>`,
138330
138265
  zodSchema: zodSchema20,
138331
138266
  alwaysLoad: true,
138332
138267
  // A physical iPhone's first call waits out the runner build, past the MCP fetch timeout,
@@ -139549,7 +139484,11 @@ async function typeSimulatorServer(registry2, device, params) {
139549
139484
  }
139550
139485
  );
139551
139486
  }
139552
- await pressKeyCode(namedKeyCode);
139487
+ const count2 = params.repeat ?? 1;
139488
+ for (let i = 0; i < count2; i++) {
139489
+ await pressKeyCode(namedKeyCode);
139490
+ if (i < count2 - 1) await sleep10(delay3);
139491
+ }
139553
139492
  }
139554
139493
  return { typed: params.text ?? params.key ?? "", keys: keysPressed };
139555
139494
  }
@@ -139765,15 +139704,20 @@ function makeIosDeviceImpl(registry2) {
139765
139704
  reactivated ||= typed.reactivated;
139766
139705
  keys += params.text.length;
139767
139706
  }
139707
+ const count2 = params.repeat ?? 1;
139768
139708
  if (key2 === "enter") {
139769
- const pressed = await mapNotFocused(pressKeyboardReturn(api, bundleId));
139770
- reactivated ||= pressed.reactivated;
139771
- keys += 1;
139709
+ for (let i = 0; i < count2; i++) {
139710
+ const pressed = await mapNotFocused(pressKeyboardReturn(api, bundleId));
139711
+ reactivated ||= pressed.reactivated;
139712
+ keys += 1;
139713
+ }
139772
139714
  }
139773
139715
  if (key2 === "backspace") {
139774
- const pressed = await mapNotFocused(pressKeyboardDelete(api, bundleId));
139775
- reactivated ||= pressed.reactivated;
139776
- keys += 1;
139716
+ for (let i = 0; i < count2; i++) {
139717
+ const pressed = await mapNotFocused(pressKeyboardDelete(api, bundleId));
139718
+ reactivated ||= pressed.reactivated;
139719
+ keys += 1;
139720
+ }
139777
139721
  }
139778
139722
  return {
139779
139723
  typed: params.text ?? params.key ?? "",
@@ -139793,8 +139737,9 @@ async function typeAndroidPhone(device, params) {
139793
139737
  keysPressed += params.text.length;
139794
139738
  }
139795
139739
  if (params.key) {
139796
- await injectAndroidNamedKey(device.id, params.key);
139797
- keysPressed++;
139740
+ const count2 = params.repeat ?? 1;
139741
+ await injectAndroidNamedKey(device.id, params.key, count2);
139742
+ keysPressed += count2;
139798
139743
  }
139799
139744
  return { typed: params.text ?? params.key ?? "", keys: keysPressed };
139800
139745
  }
@@ -139922,22 +139867,26 @@ async function runChromium(api, params) {
139922
139867
  }
139923
139868
  );
139924
139869
  }
139925
- await api.dispatchKeyEvent({
139926
- type: "keyDown",
139927
- // Chromium needs carriage-return text for Enter's default form submission.
139928
- ...named.key === "Enter" ? { text: "\r" } : {},
139929
- key: named.key,
139930
- code: named.code,
139931
- windowsVirtualKeyCode: named.windowsVirtualKeyCode
139932
- });
139933
- await sleep11(delay3);
139934
- await api.dispatchKeyEvent({
139935
- type: "keyUp",
139936
- key: named.key,
139937
- code: named.code,
139938
- windowsVirtualKeyCode: named.windowsVirtualKeyCode
139939
- });
139940
- keysPressed++;
139870
+ const count2 = params.repeat ?? 1;
139871
+ for (let i = 0; i < count2; i++) {
139872
+ await api.dispatchKeyEvent({
139873
+ type: "keyDown",
139874
+ // Chromium needs carriage-return text for Enter's default form submission.
139875
+ ...named.key === "Enter" ? { text: "\r" } : {},
139876
+ key: named.key,
139877
+ code: named.code,
139878
+ windowsVirtualKeyCode: named.windowsVirtualKeyCode
139879
+ });
139880
+ await sleep11(delay3);
139881
+ await api.dispatchKeyEvent({
139882
+ type: "keyUp",
139883
+ key: named.key,
139884
+ code: named.code,
139885
+ windowsVirtualKeyCode: named.windowsVirtualKeyCode
139886
+ });
139887
+ keysPressed++;
139888
+ if (i < count2 - 1) await sleep11(delay3);
139889
+ }
139941
139890
  }
139942
139891
  return { typed: params.text ?? params.key ?? "", keys: keysPressed };
139943
139892
  }
@@ -139952,6 +139901,7 @@ function makeChromiumImpl(registry2) {
139952
139901
  }
139953
139902
 
139954
139903
  // ../tool-server/src/tools/keyboard/platforms/macos.ts
139904
+ var sleep12 = (ms3) => new Promise((r) => setTimeout(r, ms3));
139955
139905
  function makeMacosImpl(registry2) {
139956
139906
  return {
139957
139907
  handler: async (_services, params, device) => {
@@ -139961,8 +139911,13 @@ function makeMacosImpl(registry2) {
139961
139911
  return { typed: params.text, keys };
139962
139912
  }
139963
139913
  if (params.key) {
139964
- await macosPressKey(app, params.key);
139965
- return { typed: params.key, keys: 1 };
139914
+ const count2 = params.repeat ?? 1;
139915
+ const delay3 = params.delayMs ?? 50;
139916
+ for (let i = 0; i < count2; i++) {
139917
+ await macosPressKey(app, params.key);
139918
+ if (i < count2 - 1) await sleep12(delay3);
139919
+ }
139920
+ return { typed: params.key, keys: count2 };
139966
139921
  }
139967
139922
  return { typed: "", keys: 0 };
139968
139923
  }
@@ -140072,8 +140027,11 @@ async function runVega2(params) {
140072
140027
  keysPressed += [...params.text].length;
140073
140028
  }
140074
140029
  if (params.key) {
140075
- await injectVegaNamedKey(params.key);
140076
- keysPressed++;
140030
+ const count2 = params.repeat ?? 1;
140031
+ for (let i = 0; i < count2; i++) {
140032
+ await injectVegaNamedKey(params.key);
140033
+ keysPressed++;
140034
+ }
140077
140035
  }
140078
140036
  return { typed: params.text ?? params.key ?? "", keys: keysPressed };
140079
140037
  }
@@ -140162,8 +140120,11 @@ async function typeHarmony(connectKey, params, signal) {
140162
140120
  keysPressed += [...params.text].length;
140163
140121
  }
140164
140122
  if (keycode !== null) {
140165
- await ui.keyEvent(String(keycode));
140166
- keysPressed++;
140123
+ const count2 = params.repeat ?? 1;
140124
+ for (let i = 0; i < count2; i++) {
140125
+ await ui.keyEvent(String(keycode));
140126
+ keysPressed++;
140127
+ }
140167
140128
  }
140168
140129
  },
140169
140130
  signal
@@ -140186,17 +140147,18 @@ var capability18 = {
140186
140147
  macos: { app: true, catalyst: true }
140187
140148
  };
140188
140149
  var zodSchema27 = external_exports.object({
140189
- udid: external_exports.string().describe(
140190
- "Target device id from `list-devices` (iOS UDID, Android serial, Vega serial, <flag:harmonyos>HarmonyOS id, </flag:harmonyos><flag:macos-apps>Mac app id, </flag:macos-apps>or Chromium id)."
140191
- ),
140150
+ udid: external_exports.string().describe("Target device id from `list-devices`."),
140192
140151
  text: external_exports.string().optional().describe(
140193
- 'Text to type character by character; handles uppercase, digits and common punctuation. Cannot be combined with `key`: to type and then press a key, send two `keyboard` steps in one `run-sequence` ({ text: "hello" } then { key: "enter" }). To type a credential without its plaintext ever entering your context, use a secret placeholder `{{secret:<NAME>}}`, e.g. "{{secret:APP_PASSWORD}}", alone or inside longer text. It is resolved on the machine running the tool-server, from the first source that defines the name: the `ARGENT_SECRET_<NAME>` environment variable, `.argent/secrets.env` in the project, the project\'s `.env.local` / `.env` (only their `ARGENT_SECRET_`-prefixed keys), then `~/.argent/secrets.env`. Nothing else on the host is reachable. Over a link with the `forward-secrets` flag on, the client\'s own sources are checked first. The result echoes the placeholder, never the value, and the auto-screenshot after typing is skipped. To submit after a secret, put both steps in ONE `run-sequence`: that keeps the skip covering the Enter, which a second bare `keyboard` call would not. If the secret is not set, the failure lists the available names and the sources it checked; ask the user to add it to one of them (a secrets file applies immediately, an env var needs a restart). NEVER ask the user to paste the secret value into the conversation.'
140152
+ "Text to type. Cannot be combined with `key` (use two steps in `run-sequence` to type then press enter). Supports `{{secret:<NAME>}}` placeholders resolved server-side from `ARGENT_SECRET_<NAME>` / `.argent/secrets.env` (auto-screenshot is skipped; combine with submit in one `run-sequence` to keep the skip; never ask the user for plaintext)."
140194
140153
  ),
140195
140154
  key: external_exports.string().optional().describe(
140196
- "Named key to press: enter, escape, backspace, tab, space, arrow-up, arrow-down, arrow-left, arrow-right, f1-f12. Cannot be combined with `text`; to do both, send two `keyboard` steps in one `run-sequence`. Not supported on Apple TV / Android TV; move focus with `tv-remote` (up/down/left/right) instead. Physical iOS: only `enter` and `backspace`.<flag:harmonyos> HarmonyOS: only enter (return), backspace (delete), space, arrow-left and arrow-right; any other key fails with 400 KEYBOARD_KEY_UNSUPPORTED.</flag:harmonyos><flag:macos-apps> Mac app: also delete (forward delete), home, end, page-up, page-down, and shortcuts with modifiers joined by + (command, shift, option, control), e.g. command+a.</flag:macos-apps>"
140155
+ "Named key. Cannot be combined with `text` (use two steps in `run-sequence`). Values: enter, escape, backspace, tab, space, arrow-up, arrow-down, arrow-left, arrow-right, f1-f12. Not supported on Apple TV / Android TV (use `tv-remote`). Physical iOS: enter/backspace only.<flag:harmonyos> HarmonyOS: enter, backspace, space, arrow-left/right.</flag:harmonyos><flag:macos-apps> Mac app: also delete (forward delete), home, end, page-up/down, and modifier shortcuts (e.g. command+a).</flag:macos-apps>"
140156
+ ),
140157
+ repeat: external_exports.number().int().min(1).max(100).optional().describe(
140158
+ 'Press `key` this many times in one call, e.g. `{ key: "backspace", repeat: 12 }`. Only valid with `key`.'
140197
140159
  ),
140198
140160
  delayMs: external_exports.number().optional().describe(
140199
- "Delay in ms between key presses (default 50). Ignored on Android phones/tablets, <flag:harmonyos>HarmonyOS, </flag:harmonyos>Vega, Apple TV / Android TV and physical iOS, which type the whole string in one shot or at their own cadence."
140161
+ "Delay in ms between key presses (default 50; ignored on platforms that type in one shot)."
140200
140162
  )
140201
140163
  });
140202
140164
  function createKeyboardTool(registry2) {
@@ -140214,12 +140176,9 @@ function createKeyboardTool(registry2) {
140214
140176
  });
140215
140177
  return {
140216
140178
  id: "keyboard",
140217
- description: `Type text or press special keys on the device (iOS simulator, Android emulator or device, <flag:harmonyos>HarmonyOS device, </flag:harmonyos>Chromium app, <flag:macos-apps>Mac app, </flag:macos-apps>Vega Virtual Device, or Apple TV / Android TV) using keyboard events.
140218
- Use when you need to enter text or trigger a named key such as enter, escape, or arrow keys. On Vega and Apple TV / Android TV, prefer the remote tools for D-pad navigation; focus a text field with \`tv-remote\` first (e.g. a search or login box), then type into it with keyboard.
140219
- Tap the field first: with no focus the text is dropped and the call still succeeds.
140220
- Returns { typed: string, keys: number }. On physical iOS, reactivated: true = app was re-fronted; re-describe. On an iOS simulator, when the focused field was empty before typing, the field is read back: verified: true = it holds the typed text, though iOS may have capitalized the first letter of a word or curled a quote; no verified = the field was not checked: it held text before typing, the text has a Return or Tab, focus moved to another field while typing, or the field could not be read in time (the app busy, the accessibility service missing or slow); verified: false comes with a warning (keys dropped or repeated, or the app or iOS changed the text), so read the field before submitting. Fails if an unsupported key name is provided (rejected before anything is sent) or if the device's input backend is not reachable.
140221
- A failure is not rolled back. Un-typeable text is rejected mid-string on the iOS simulator and Chromium, leaving the characters before it in the field (Android, <flag:harmonyos>HarmonyOS, </flag:harmonyos>Vega and TV targets check the whole string up front).<flag:macos-apps> A Mac app types any character.</flag:macos-apps> A transport failure partway also leaves the text already sent. On a retry, read the field's actual contents; do not assume it is unchanged.
140222
- React Native: after typing, the next tap outside the field may only close the keyboard. If only the keyboard closed, tap again; where the field submits on return, \`key: "enter"\` avoids the extra tap.`,
140179
+ description: `Type text or press a named key on the focused field (tap or focus the field first; with no focus input is silently dropped).
140180
+ Use when entering text or triggering named keys (enter, escape, backspace, arrows).
140181
+ Returns { typed, keys, verified?, warning?, reactivated? }. Fails if an unsupported key is passed or the input backend is unreachable (partial typing is not rolled back; re-read before retrying). On iOS simulators, typing into an empty field verifies readback (\`verified: false\` warns). React Native: after typing, the next tap outside may only close the keyboard (tap again if so); where the field submits on return, \`key: "enter"\` avoids the extra tap.`,
140223
140182
  zodSchema: zodSchema27,
140224
140183
  alwaysLoad: true,
140225
140184
  searchHint: "type text keyboard input named key enter escape arrow tv vega fire tv <flag:harmonyos>harmony harmonyos </flag:harmonyos>search field hid leanback",
@@ -140232,11 +140191,16 @@ React Native: after typing, the next tap outside the field may only close the ke
140232
140191
  // rejects (text+key, `{ key: "" }`), while `completedMsg` runs only after
140233
140192
  // a success and sees neither. Both see the empty request, a no-op.
140234
140193
  startedMsg: ({ params }) => {
140235
- if (params.text === void 0) return "Pressing a key";
140194
+ if (params.text === void 0) {
140195
+ return (params.repeat ?? 1) > 1 ? `Pressing a key ${params.repeat} times` : "Pressing a key";
140196
+ }
140236
140197
  if (params.key === void 0) return "Entering text";
140237
140198
  return "Entering text and pressing a key";
140238
140199
  },
140239
- completedMsg: ({ params }) => params.text === void 0 ? "Pressed a key" : "Entered text",
140200
+ completedMsg: ({ params }) => {
140201
+ if (params.text !== void 0) return "Entered text";
140202
+ return (params.repeat ?? 1) > 1 ? `Pressed a key ${params.repeat} times` : "Pressed a key";
140203
+ },
140240
140204
  failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to use keyboard: ${failureSignal2.error_code}`
140241
140205
  },
140242
140206
  capability: capability18,
@@ -140280,6 +140244,14 @@ React Native: after typing, the next tap outside the field may only close the ke
140280
140244
  }
140281
140245
  );
140282
140246
  }
140247
+ if (params.repeat !== void 0 && params.key === void 0) {
140248
+ throw new InvalidToolInputError(
140249
+ '`repeat` only applies to `key`, not `text` or an empty request \u2014 nothing was typed. Pass a named `key` (e.g. { key: "backspace", repeat: 5 }), or omit `repeat`.',
140250
+ {
140251
+ failure_stage: "keyboard_repeat_without_key"
140252
+ }
140253
+ );
140254
+ }
140283
140255
  if (params.text === void 0) return dispatch(services, params, options);
140284
140256
  const { text, secrets } = resolveSecretPlaceholders(params.text, {
140285
140257
  clientSecrets: options?.clientSecrets
@@ -140313,7 +140285,7 @@ init_capability();
140313
140285
  var LEFT_GUI_KEYCODE = 227;
140314
140286
  var V_KEYCODE = charToKeyPress("v").keyCode;
140315
140287
  var CHORD_STEP_MS = 50;
140316
- var sleep12 = (ms3) => new Promise((r) => setTimeout(r, ms3));
140288
+ var sleep13 = (ms3) => new Promise((r) => setTimeout(r, ms3));
140317
140289
  var typesAsText = (char) => !"\n\r ".includes(char) && !!charToKeyPress(char);
140318
140290
  function rejectTv(device) {
140319
140291
  throw new UnsupportedOperationError(
@@ -140339,13 +140311,13 @@ async function pasteSimulator(registry2, device, api, params) {
140339
140311
  return { pasted: true, via: "keyboard" };
140340
140312
  }
140341
140313
  await api.pressKey("Down", LEFT_GUI_KEYCODE);
140342
- await sleep12(CHORD_STEP_MS);
140314
+ await sleep13(CHORD_STEP_MS);
140343
140315
  await api.pressKey("Down", V_KEYCODE);
140344
- await sleep12(CHORD_STEP_MS);
140316
+ await sleep13(CHORD_STEP_MS);
140345
140317
  await api.pressKey("Up", V_KEYCODE);
140346
- await sleep12(CHORD_STEP_MS);
140318
+ await sleep13(CHORD_STEP_MS);
140347
140319
  await api.pressKey("Up", LEFT_GUI_KEYCODE);
140348
- await sleep12(CHORD_STEP_MS);
140320
+ await sleep13(CHORD_STEP_MS);
140349
140321
  return { pasted: true };
140350
140322
  }
140351
140323
  function makeIosImpl4(registry2) {
@@ -140757,7 +140729,7 @@ async function prepareHostWindowShake(target) {
140757
140729
  var execFileAsync36 = (0, import_node_util37.promisify)(import_node_child_process48.execFile);
140758
140730
  var SHAKE_NOTIFICATION = "com.apple.UIKit.SimulatorShake";
140759
140731
  var SHAKE_INTERVAL_MS = 400;
140760
- var sleep13 = (ms3) => new Promise((r) => setTimeout(r, ms3));
140732
+ var sleep14 = (ms3) => new Promise((r) => setTimeout(r, ms3));
140761
140733
  var NOTIFYUTIL_ARGV = ["notifyutil", "-p", SHAKE_NOTIFICATION];
140762
140734
  function rejectTv2(toolId, device) {
140763
140735
  throw new UnsupportedOperationError(
@@ -140793,7 +140765,7 @@ var iosImpl4 = {
140793
140765
  const args = await simctlArgsForUdid(udid, ["spawn", udid, ...NOTIFYUTIL_ARGV]);
140794
140766
  const shaker = await prepareHostWindowShake({ kind: "ios", udid, name: device.name });
140795
140767
  for (let i = 0; i < count2; i++) {
140796
- if (i > 0) await sleep13(SHAKE_INTERVAL_MS);
140768
+ if (i > 0) await sleep14(SHAKE_INTERVAL_MS);
140797
140769
  shaker.begin();
140798
140770
  try {
140799
140771
  await execFileAsync36("xcrun", args, { timeout: 15e3 });
@@ -140813,7 +140785,7 @@ var iosRemoteImpl6 = {
140813
140785
  const count2 = params.count ?? 1;
140814
140786
  if (await isRemoteTvOsSimulator(udid)) rejectTv2("shake", device);
140815
140787
  for (let i = 0; i < count2; i++) {
140816
- if (i > 0) await sleep13(SHAKE_INTERVAL_MS);
140788
+ if (i > 0) await sleep14(SHAKE_INTERVAL_MS);
140817
140789
  let result;
140818
140790
  try {
140819
140791
  result = await simctlSpawn(udid, { args: NOTIFYUTIL_ARGV });
@@ -140861,7 +140833,7 @@ function restingVectorFrom(stdout) {
140861
140833
  return read;
140862
140834
  }
140863
140835
  var fmt = (v) => `${v.x.toFixed(4)}:${v.y.toFixed(4)}:${v.z.toFixed(4)}`;
140864
- var sleep14 = (ms3) => new Promise((r) => setTimeout(r, ms3));
140836
+ var sleep15 = (ms3) => new Promise((r) => setTimeout(r, ms3));
140865
140837
  var inFlightByDevice = /* @__PURE__ */ new Map();
140866
140838
  function withDeviceLock(serial, fn) {
140867
140839
  const previous = inFlightByDevice.get(serial) ?? Promise.resolve();
@@ -140926,7 +140898,7 @@ var androidImpl6 = {
140926
140898
  y: rest.y,
140927
140899
  z: rest.z
140928
140900
  });
140929
- await sleep14(SWING_INTERVAL_MS);
140901
+ await sleep15(SWING_INTERVAL_MS);
140930
140902
  }
140931
140903
  }
140932
140904
  } catch (err) {
@@ -141298,7 +141270,7 @@ var DISMISS_SPACING_MS = 1e3;
141298
141270
  var DISMISS_TIMEOUT_MS = 5e3;
141299
141271
  var WAKE_GRACE_READS = 2;
141300
141272
  var abortReason2 = (signal) => signal.reason instanceof Error ? signal.reason : new Error("The fold was cancelled.");
141301
- var sleep15 = (ms3, signal) => new Promise((resolve21, reject) => {
141273
+ var sleep16 = (ms3, signal) => new Promise((resolve21, reject) => {
141302
141274
  if (signal?.aborted) return reject(abortReason2(signal));
141303
141275
  const timer = setTimeout(resolve21, ms3);
141304
141276
  signal?.addEventListener(
@@ -141372,7 +141344,7 @@ async function awaitSettled(serial, expected, wake, signal) {
141372
141344
  let agreeing = 0;
141373
141345
  const deadline = Date.now() + SETTLE_TIMEOUT_MS2;
141374
141346
  while (Date.now() < deadline) {
141375
- await sleep15(POLL_MS2, signal);
141347
+ await sleep16(POLL_MS2, signal);
141376
141348
  const read = await readSnapshot(serial);
141377
141349
  const same = read.state === last?.state && read.awake === last?.awake;
141378
141350
  if (!isReady(read, expected)) agreeing = 0;
@@ -141407,7 +141379,7 @@ async function dismissFoldLockScreen(serial, signal) {
141407
141379
  await shell(serial, "wm dismiss-keyguard");
141408
141380
  }
141409
141381
  }
141410
- await sleep15(POLL_MS2, signal);
141382
+ await sleep16(POLL_MS2, signal);
141411
141383
  }
141412
141384
  return "The fold raised the lock screen and argent could not dismiss it (a PIN or password keeps it up). Unlock the device before the next action.";
141413
141385
  }
@@ -142095,20 +142067,18 @@ var capability25 = {
142095
142067
  macos: { app: true, catalyst: true }
142096
142068
  };
142097
142069
  var zodSchema31 = external_exports.object({
142098
- udid: external_exports.string().describe(
142099
- "Target device id from `list-devices` (iOS UDID, Android serial, Vega serial, <flag:harmonyos>HarmonyOS id, </flag:harmonyos><flag:macos-apps>Mac app id, </flag:macos-apps>or Chromium id), shared across all steps."
142100
- ),
142070
+ udid: external_exports.string().describe("Target device id from `list-devices`, shared across all steps."),
142101
142071
  steps: external_exports.array(
142102
142072
  external_exports.object({
142103
- tool: external_exports.string().describe("Tool name: one of the allowed tools listed in the description."),
142104
- args: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Tool arguments (excluding udid, which is injected automatically)"),
142073
+ tool: external_exports.string().describe("Allowed tool name (see description)."),
142074
+ args: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Tool arguments (omit `udid`, injected automatically)."),
142105
142075
  delayMs: external_exports.number().optional().describe(
142106
- `Wait time in ms after this step (and after the settle wait) before the next (default ${DEFAULT_INTER_STEP_DELAY_MS})`
142076
+ `Extra pause in ms after step settle (default ${DEFAULT_INTER_STEP_DELAY_MS}).`
142107
142077
  )
142108
142078
  })
142109
- ).min(1).describe("Ordered list of interaction steps to execute sequentially"),
142079
+ ).min(1).describe("Ordered steps to execute."),
142110
142080
  settle: external_exports.boolean().optional().describe(
142111
- `Wait up to ${SETTLE_TIMEOUT_MS3}ms after a screen-changing step for the element tree to settle before the next step. Default true; set false on a screen that never stops changing.`
142081
+ `Wait up to ${SETTLE_TIMEOUT_MS3}ms for tree settle between screen-changing steps (default true).`
142112
142082
  )
142113
142083
  });
142114
142084
  function mayStartTransition(step) {
@@ -142150,29 +142120,26 @@ async function waitForStillTree(readTree, signal) {
142150
142120
  function createRunSequenceTool(registry2) {
142151
142121
  return {
142152
142122
  id: "run-sequence",
142153
- description: `Run several device interaction steps in one call.
142154
- Use when every step is known in advance (e.g. several scrolls, or typing then enter). If a step depends on what an earlier one shows, make separate calls.
142155
- Steps run in order. After a step that can change the screen, the next one waits up to 1000ms for the element tree to settle (see \`settle\`); keep an await-ui-element before a step that needs the new screen.
142156
- If a step fails (an error, a tool not allowed or not supported on the target, or a wait step that returns success=false), the sequence stops there. Returns { completed, total, steps } with a result or error for each step that ran.
142157
- One screenshot and element tree are captured after the last step, not per step. A \`{{secret:...}}\` in any step skips that capture, so type and submit a secret in one sequence.
142158
-
142159
- Allowed tools, args (? = optional) and targets. Positions and distances are 0\u20131 fractions of the screen (window on Chromium), not pixels; angles in degrees, durations in ms.
142160
- gesture-tap: x, y, clickCount?<flag:macos-apps>, button? "left"|"right", modifiers? ["control"|"option"|"shift"|"command"] (macos)</flag:macos-apps> [ios/android/chromium<flag:harmonyos>/harmony</flag:harmonyos><flag:macos-apps>/macos</flag:macos-apps>]
142161
- gesture-swipe: fromX, fromY, toX, toY, durationMs?, momentum? [ios/android<flag:harmonyos>/harmony</flag:harmonyos>]
142162
- gesture-scroll: x, y, deltaX?, deltaY? (positive scrolls down), durationMs? [chromium<flag:macos-apps>/macos</flag:macos-apps>]
142123
+ description: `Run multiple interaction steps in one call, with one screenshot + tree captured after the last step.
142124
+ Use when every consecutive step is known in advance (scroll sweeps, type + enter, form fill). Stops at the first error or unmet wait (\`success=false\`) and returns \`{ completed, total, steps }\` normally; compare \`completed\` with \`total\` to check for partial failure. Any \`{{secret:...}}\` skips the final capture, so type + submit secrets in one sequence.
142125
+
142126
+ Allowed tools (coords are [0,1] screen fractions; ? = optional):
142127
+ gesture-tap: x, y, clickCount?<flag:macos-apps>, button?, modifiers?</flag:macos-apps>
142128
+ gesture-swipe: fromX, fromY, toX, toY, durationMs?, momentum?
142129
+ gesture-scroll: x, y, deltaX?, deltaY?, durationMs? [chromium<flag:macos-apps>/macos</flag:macos-apps>]
142163
142130
  gesture-drag: fromX, fromY, toX, toY, durationMs?, momentum? [chromium<flag:macos-apps>/macos</flag:macos-apps>]
142164
- gesture-custom: events: [{ type: "Down"|"Move"|"Up", x, y, x2?, y2?, delayMs? }], interpolate?, edge? [ios/android]
142165
- gesture-pinch: centerX, centerY, startDistance, endDistance, endCenterX?, endCenterY?, angle?, durationMs? [ios/android<flag:harmonyos>/harmony</flag:harmonyos>]
142166
- gesture-rotate: centerX, centerY, startAngle, endAngle, radius (or radiusX + radiusY), durationMs? [ios/android]
142167
- button: button: "home"|"back"|"power"|"volumeUp"|"volumeDown"|"appSwitch"|"actionButton" [ios/android<flag:harmonyos>; harmony: home/back/power</flag:harmonyos>]
142168
- keyboard: text? or key? (one per step, e.g. key "enter"), delayMs?; text may hold {{secret:<NAME>}} placeholders, resolved server-side [all; Apple TV/Android TV: text only]
142169
- paste: text (only where a user would paste, e.g. an OTP) [ios sim/android emu<flag:macos-apps>/macos</flag:macos-apps>]
142170
- rotate: orientation: "Portrait"|"LandscapeLeft"|"LandscapeRight"|"PortraitUpsideDown" [ios sim/android]
142171
- shake: count? [ios sim/android emu]
142172
- fold: posture? "closed"|"half-open"|"open" or angle? 0\u2013180 (later steps land on the new panel) [foldable ios sim/android emu]
142173
- tv-remote: button (one, or an array run as a path), repeat? [apple tv/android tv/vega]
142174
- await-ui-element: condition: "exists"|"visible"|"hidden"|"text", selector: { text?, identifier?, role? }, expectedText?, textMatch?, timeoutMs?, pollIntervalMs? [all]
142175
- await-network-request: bundleId, url, plus the standalone tool's optional args. Call network-capture-start before the sequence. [ios sim/android/chromium<flag:macos-apps>/macos</flag:macos-apps>]`,
142131
+ gesture-custom: events: [{ type: "Down"|"Move"|"Up", x, y, x2?, y2?, delayMs? }], interpolate?, edge?
142132
+ gesture-pinch: centerX, centerY, startDistance, endDistance, endCenterX?, endCenterY?, angle?, durationMs?
142133
+ gesture-rotate: centerX, centerY, startAngle, endAngle, radius (or radiusX+radiusY), durationMs?
142134
+ button: button ("home"|"back"|"power"|"volumeUp"|"volumeDown"|"appSwitch"|"actionButton")<flag:harmonyos> [harmony: home/back/power]</flag:harmonyos>
142135
+ keyboard: text? or key? (one per step), repeat?, delayMs?
142136
+ paste: text (real paste flows only)
142137
+ rotate: orientation ("Portrait"|"LandscapeLeft"|"LandscapeRight"|"PortraitUpsideDown")
142138
+ shake: count?
142139
+ fold: posture? ("closed"|"half-open"|"open") or angle? (0\u2013180)
142140
+ tv-remote: button (string or string[]), repeat?
142141
+ await-ui-element: condition ("exists"|"visible"|"hidden"|"text"), selector, expectedText?, textMatch?, timeoutMs?, pollIntervalMs?
142142
+ await-network-request: bundleId, url, plus optional args (start capture first)`,
142176
142143
  zodSchema: zodSchema31,
142177
142144
  alwaysLoad: true,
142178
142145
  searchHint: "batch sequence multiple gesture steps sequentially",
@@ -145610,8 +145577,13 @@ function formatLine(n, indent, source) {
145610
145577
  const annotated = annotations ? ` ${annotations}` : "";
145611
145578
  return `${pad}${n.role}${annotated} ${fmtFrame(n.frame)}`;
145612
145579
  }
145580
+ var IOS_SCROLL_BAR_LABEL = /^(Vertical|Horizontal) scroll bar, .+\bpages?$/;
145581
+ var PERCENT_VALUE = /^\d+(?:\.\d+)?%$/;
145582
+ function isIosScrollBar(n) {
145583
+ return n.role === "AXAdjustable" && !n.identifier && !n.hint && typeof n.label === "string" && IOS_SCROLL_BAR_LABEL.test(n.label) && (n.value === void 0 || PERCENT_VALUE.test(n.value));
145584
+ }
145613
145585
  function renderFlat(root, contentRoles, source) {
145614
- return root.children.filter((n) => shouldEmit(n, contentRoles) || hasIosState(n)).slice().sort((a, b) => a.frame.y - b.frame.y || a.frame.x - b.frame.x).map((n) => formatLine(n, 1, source));
145586
+ return root.children.filter((n) => !isIosScrollBar(n) && (shouldEmit(n, contentRoles) || hasIosState(n))).slice().sort((a, b) => a.frame.y - b.frame.y || a.frame.x - b.frame.x).map((n) => formatLine(n, 1, source));
145615
145587
  }
145616
145588
  function renderNested(root, contentRoles, source) {
145617
145589
  const lines = [];
@@ -145660,7 +145632,7 @@ function formatDescribeTree(root, opts) {
145660
145632
  }
145661
145633
 
145662
145634
  // ../tool-server/src/tools/describe/platforms/tv.ts
145663
- var sleep16 = (ms3) => new Promise((r) => setTimeout(r, ms3));
145635
+ var sleep17 = (ms3) => new Promise((r) => setTimeout(r, ms3));
145664
145636
  var EMPTY_RETRY_ATTEMPTS = 3;
145665
145637
  var EMPTY_RETRY_DELAY_MS = 600;
145666
145638
  var EMPTY_HINT2 = "No focusable elements after retrying and recycling the read path. Either the app is still loading or mid-transition (after launch-app / restart-app, or a press that opened an app), or the screen has nothing focusable (sleep, screensaver, video playback). Wait ~2-3s and call describe again; a React Native app only exposes focus once its JS bundle has loaded. If it stays empty, take a screenshot to confirm what's actually on screen.";
@@ -145692,7 +145664,7 @@ async function describeTv(registry2, device) {
145692
145664
  let res = await api.describe();
145693
145665
  if (device.platform !== "android") {
145694
145666
  for (let attempt = 1; attempt < EMPTY_RETRY_ATTEMPTS && isEmptyFocus(res); attempt++) {
145695
- await sleep16(EMPTY_RETRY_DELAY_MS);
145667
+ await sleep17(EMPTY_RETRY_DELAY_MS);
145696
145668
  res = await api.describe();
145697
145669
  }
145698
145670
  }
@@ -145803,11 +145775,9 @@ function makeDescribeExecute(registry2) {
145803
145775
  });
145804
145776
  }
145805
145777
  var zodSchema41 = external_exports.object({
145806
- udid: external_exports.string().min(1).describe(
145807
- "Target device id from `list-devices` (iOS UDID, Android serial, Vega serial, <flag:harmonyos>HarmonyOS id, </flag:harmonyos><flag:macos-apps>Mac app id, </flag:macos-apps>or Chromium id)."
145808
- ),
145778
+ udid: external_exports.string().min(1).describe("Target device id from `list-devices`."),
145809
145779
  bundleId: external_exports.string().optional().describe(
145810
- "App bundle ID, used as a target hint on iOS when the AX-service returns no elements and describe falls back to native-devtools inspection. If omitted, the fallback auto-detects the frontmost connected app. Ignored on every other platform, including a physical iOS device."
145780
+ "iOS simulator only: fallback bundle id when AX-service returns empty (auto-detects frontmost if omitted)."
145811
145781
  )
145812
145782
  });
145813
145783
  function createDescribeTool(registry2) {
@@ -145815,20 +145785,10 @@ function createDescribeTool(registry2) {
145815
145785
  id: "describe",
145816
145786
  // Android's device probes plus the tree dump can outlast the 30s MCP fetch timeout.
145817
145787
  longRunning: true,
145818
- description: `Get the accessibility / DOM element tree for the current screen.
145819
- Use when you need element frames or labels and have no fresh tree: most interaction tools (not shake) already return one after each action, or name an identical earlier one by its tree id.
145820
- On iOS it reads the AXRuntime accessibility service, so it sees whatever is visible, including system dialogs and permission prompts. While a system dialog is visible it returns the dialog's elements (buttons, text); otherwise the foreground app's. On a physical iOS device it covers only the app started with launch-app; to read system dialogs there, launch-app \`com.apple.springboard\` first. On a local iOS simulator a text field shows its placeholder as its value, with no label, so an empty field reads like one holding that text. A text field with no accessibility label or identifier (e.g. the Settings search field) can also be missing from the tree, even with text typed in it. Check a screenshot in both cases.
145821
- On Android it reads the tree through Argent's UiAutomation helper, falling back to \`uiautomator dump\`. On Chromium it walks the DOM over the Chrome DevTools Protocol: every visible element with its ARIA role, accessible name and the visible part of its bounding rect; content scrolled or clipped out of view, or skipped by a closed \`<details>\` or \`content-visibility: hidden\`, has a zero-area frame.
145822
- On Vega (Fire TV) it reads the on-device automation toolkit; \`[focused]\`/\`[selected]\` mark the D-pad cursor, which you move with \`tv-remote\` (Vega has no touch).<flag:harmonyos>
145823
- On HarmonyOS it runs the device's \`uitest dumpLayout\` (\`source: "harmony-uitest"\`); each top-level child is a window whose \`identifier\` (not its label) is the owning bundle, so an app plus the status bar reads as two windows. A suspended display still dumps its last frame, so the result then carries a \`hint\`, as it does for an empty dump.</flag:harmonyos><flag:macos-apps>
145824
- On a Mac app it reads the app's accessibility tree with web view content and React Native testIDs merged in; frames are fractions of the app window, grown to include sheets and menus past it.</flag:macos-apps>
145825
- On a TV target (Apple TV / Android TV: a \`list-devices\` entry with runtimeKind 'tv') it returns the FOCUSED element and the FOCUSABLE elements instead, since a TV UI has no tap coordinates. Move the highlight with \`tv-remote\`, then read where focus landed from the tree in its result, or call describe again when it is missing.
145826
-
145827
- Returns \`{ description, source }\`: \`description\` renders the tree one line per element, with its role, label/value/id, VoiceOver hint (iOS simulator), interactivity flags and frame. Frames are normalized [0,1] fractions of the screen / window width and height (not pixels); tap an element at the centre of its frame. The tree has no z-order or occlusion information: an element may be covered by an overlay (e.g. a toolbar over list rows), so check a screenshot when a tap lands unexpectedly.
145828
- Fails if the tree cannot be read, e.g. on a physical iOS device before launch-app has started an app.
145829
-
145830
- For UIKit properties of a view (class name, accessibilityIdentifier), use native-find-views (iOS simulator only).
145831
- For React Native component names, or a testID describe does not list, use debugger-component-tree.`,
145788
+ description: `Read the accessibility / DOM element tree for the current screen (or focused/focusable elements on TV targets). On a physical iPhone it covers only the app started with \`launch-app\`; call \`launch-app\` \`com.apple.springboard\` first to read system dialogs.<flag:harmonyos> On HarmonyOS (\`source: "harmony-uitest"\`), each top-level child is a window whose \`identifier\` is the owning bundle; a suspended display dumps its last frame with a \`hint\`.</flag:harmonyos><flag:macos-apps> On a Mac app, frames are fractions of the app window (expanded for sheets/menus).</flag:macos-apps>
145789
+ Use when you need tap coordinates or labels and have no fresh tree: interaction tools already attach one after each action (or reference an earlier \`Tree id\`).
145790
+ Returns \`{ description, source, hint? }\`: one line per element with role, label/value/id/hint, flags, and normalized \`[0,1]\` frame \`(x,y,w,h)\`. Tap at \`(x+w/2, y+h/2)\`. No z-order/occlusion info; check a screenshot if a tap hits an overlay or a text field shows its placeholder as value. Fails if the tree backend is unreachable.
145791
+ For UIKit view properties (iOS sim) use \`native-find-views\`; for React Native components/testIDs use \`debugger-component-tree\`.`,
145832
145792
  zodSchema: zodSchema41,
145833
145793
  alwaysLoad: true,
145834
145794
  searchHint: "accessibility element tree ui hierarchy tap coordinates ios android chromium vega <flag:harmonyos>harmony harmonyos </flag:harmonyos><flag:macos-apps>macos mac app </flag:macos-apps>dom tv tvos apple tv android tv fire tv focus focusable remote dpad",
@@ -146372,7 +146332,7 @@ init_src2();
146372
146332
  var MAX_CLEAR_KEYS = 100;
146373
146333
  var XCTEST_DELETE = "\b";
146374
146334
  var KEY_TIMING = { holdMs: 20, settleMs: 300, typeDelayMs: 30 };
146375
- var sleep17 = (ms3) => new Promise((r) => setTimeout(r, ms3));
146335
+ var sleep18 = (ms3) => new Promise((r) => setTimeout(r, ms3));
146376
146336
  function typeableOnSimulator(text) {
146377
146337
  for (const char of text) if (!charToKeyPress(char)) return false;
146378
146338
  return true;
@@ -146397,9 +146357,9 @@ async function pressSimulatorBackspace(registry2, device) {
146397
146357
  const ref = simulatorServerRef(device);
146398
146358
  const api = await registry2.resolveService(ref.urn, ref.options);
146399
146359
  await api.pressKey("Down", NAMED_KEYS.backspace);
146400
- await sleep17(KEY_TIMING.holdMs);
146360
+ await sleep18(KEY_TIMING.holdMs);
146401
146361
  await api.pressKey("Up", NAMED_KEYS.backspace);
146402
- await sleep17(KEY_TIMING.settleMs);
146362
+ await sleep18(KEY_TIMING.settleMs);
146403
146363
  }
146404
146364
  async function typeOnSimulator(registry2, device, text) {
146405
146365
  if (!text) return;
@@ -174349,7 +174309,7 @@ var path71 = __toESM(require("node:path"));
174349
174309
  init_zod();
174350
174310
  init_capability();
174351
174311
  init_device_info();
174352
- var sleep18 = (ms3) => new Promise((r) => setTimeout(r, ms3));
174312
+ var sleep19 = (ms3) => new Promise((r) => setTimeout(r, ms3));
174353
174313
  var DEFAULT_PANEL_TIMEOUT_MS = 5e3;
174354
174314
  var MAX_PANEL_TIMEOUT_MS = 3e4;
174355
174315
  var PANEL_POLL_MS2 = 100;
@@ -174459,7 +174419,7 @@ async function waitForPanel(app, params, signal) {
174459
174419
  "file_panel_not_open"
174460
174420
  );
174461
174421
  }
174462
- await sleep18(PANEL_POLL_MS2);
174422
+ await sleep19(PANEL_POLL_MS2);
174463
174423
  }
174464
174424
  }
174465
174425
  async function choose(app, params, ctx) {
@@ -174579,7 +174539,7 @@ Fails if no panel appears within timeoutMs, if more than one panel is open and p
174579
174539
  init_zod();
174580
174540
  init_capability();
174581
174541
  init_device_info();
174582
- var sleep19 = (ms3) => new Promise((r) => setTimeout(r, ms3));
174542
+ var sleep20 = (ms3) => new Promise((r) => setTimeout(r, ms3));
174583
174543
  var MAX_PATH_TITLES = 9;
174584
174544
  var capability41 = {
174585
174545
  macos: { app: true, catalyst: true }
@@ -174704,7 +174664,7 @@ Fails if no item matches (the error lists the titles at that level), if the item
174704
174664
  "Menu.perform",
174705
174665
  params.path !== void 0 ? { path: params.path } : { identifier: params.identifier }
174706
174666
  );
174707
- await sleep19(MACOS_CLICK_SETTLE_MS);
174667
+ await sleep20(MACOS_CLICK_SETTLE_MS);
174708
174668
  return {
174709
174669
  chosen: chosen.path,
174710
174670
  ...chosen.identifier !== void 0 ? { identifier: chosen.identifier } : {}