@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.
- package/dist/cli-cmds.mjs +1 -1
- package/dist/installer.mjs +1 -1
- package/dist/mcp-server.mjs +2 -2
- package/dist/tool-args.generated.d.ts +65 -63
- package/dist/tool-server.cjs +221 -261
- package/package.json +2 -2
package/dist/tool-server.cjs
CHANGED
|
@@ -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.
|
|
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
|
|
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
|
|
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
|
|
106128
|
-
Returns { devices, notes? }.
|
|
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
|
-
|
|
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
|
-
"
|
|
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
|
|
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
|
-
|
|
124109
|
-
|
|
124110
|
-
),
|
|
124111
|
-
timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(
|
|
124112
|
-
|
|
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
|
|
124145
|
-
Use when
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
"
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
135277
|
-
|
|
135278
|
-
|
|
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
|
|
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
|
|
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
|
|
136037
|
-
Use when starting
|
|
136038
|
-
Returns { launched, bundleId, <flag:macos-apps>kind?, appPath?, args?, </flag:macos-apps>note?, networkCapture? }. Fails if the app is not installed
|
|
136039
|
-
|
|
136040
|
-
|
|
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
|
|
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
|
-
|
|
136329
|
-
|
|
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
|
|
136338
|
-
Use when you need a clean in-memory state without
|
|
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
|
|
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
|
|
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
|
|
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
|
|
137937
|
-
Use when you need a baseline image
|
|
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
|
-
|
|
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
|
-
"
|
|
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
|
-
|
|
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
|
|
138165
|
-
|
|
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
|
-
|
|
138291
|
-
),
|
|
138292
|
-
|
|
138293
|
-
|
|
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
|
-
`
|
|
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
|
|
138324
|
-
|
|
138325
|
-
|
|
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
|
-
|
|
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
|
-
|
|
139770
|
-
|
|
139771
|
-
|
|
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
|
-
|
|
139775
|
-
|
|
139776
|
-
|
|
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
|
-
|
|
139797
|
-
|
|
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
|
-
|
|
139926
|
-
|
|
139927
|
-
|
|
139928
|
-
|
|
139929
|
-
|
|
139930
|
-
|
|
139931
|
-
|
|
139932
|
-
|
|
139933
|
-
|
|
139934
|
-
|
|
139935
|
-
|
|
139936
|
-
|
|
139937
|
-
|
|
139938
|
-
|
|
139939
|
-
|
|
139940
|
-
|
|
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
|
-
|
|
139965
|
-
|
|
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
|
-
|
|
140076
|
-
|
|
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
|
-
|
|
140166
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
140218
|
-
Use when
|
|
140219
|
-
|
|
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)
|
|
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 }) =>
|
|
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
|
|
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
|
|
140314
|
+
await sleep13(CHORD_STEP_MS);
|
|
140343
140315
|
await api.pressKey("Down", V_KEYCODE);
|
|
140344
|
-
await
|
|
140316
|
+
await sleep13(CHORD_STEP_MS);
|
|
140345
140317
|
await api.pressKey("Up", V_KEYCODE);
|
|
140346
|
-
await
|
|
140318
|
+
await sleep13(CHORD_STEP_MS);
|
|
140347
140319
|
await api.pressKey("Up", LEFT_GUI_KEYCODE);
|
|
140348
|
-
await
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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("
|
|
142104
|
-
args: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Tool arguments (
|
|
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
|
-
`
|
|
142076
|
+
`Extra pause in ms after step settle (default ${DEFAULT_INTER_STEP_DELAY_MS}).`
|
|
142107
142077
|
)
|
|
142108
142078
|
})
|
|
142109
|
-
).min(1).describe("Ordered
|
|
142079
|
+
).min(1).describe("Ordered steps to execute."),
|
|
142110
142080
|
settle: external_exports.boolean().optional().describe(
|
|
142111
|
-
`Wait up to ${SETTLE_TIMEOUT_MS3}ms
|
|
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
|
|
142154
|
-
Use when every step is known in advance (
|
|
142155
|
-
|
|
142156
|
-
|
|
142157
|
-
|
|
142158
|
-
|
|
142159
|
-
|
|
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?
|
|
142165
|
-
gesture-pinch: centerX, centerY, startDistance, endDistance, endCenterX?, endCenterY?, angle?, durationMs?
|
|
142166
|
-
gesture-rotate: centerX, centerY, startAngle, endAngle, radius (or radiusX
|
|
142167
|
-
button: button
|
|
142168
|
-
keyboard: text? or key? (one per step,
|
|
142169
|
-
paste: text (
|
|
142170
|
-
rotate: orientation
|
|
142171
|
-
shake: count?
|
|
142172
|
-
fold: posture? "closed"|"half-open"|"open" or angle? 0\u2013180
|
|
142173
|
-
tv-remote: button (
|
|
142174
|
-
await-ui-element: condition
|
|
142175
|
-
await-network-request: bundleId, url, plus
|
|
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
|
|
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
|
|
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
|
-
"
|
|
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: `
|
|
145819
|
-
Use when you need
|
|
145820
|
-
|
|
145821
|
-
|
|
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
|
|
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
|
|
146360
|
+
await sleep18(KEY_TIMING.holdMs);
|
|
146401
146361
|
await api.pressKey("Up", NAMED_KEYS.backspace);
|
|
146402
|
-
await
|
|
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
|
|
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
|
|
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
|
|
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
|
|
174667
|
+
await sleep20(MACOS_CLICK_SETTLE_MS);
|
|
174708
174668
|
return {
|
|
174709
174669
|
chosen: chosen.path,
|
|
174710
174670
|
...chosen.identifier !== void 0 ? { identifier: chosen.identifier } : {}
|