@swmansion/argent 0.35.1-next.16 → 0.35.1-next.18
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 +1 -1
- package/dist/tool-args.generated.d.ts +261 -259
- package/dist/tool-server.cjs +1020 -1165
- 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.18";
|
|
72961
72961
|
}
|
|
72962
72962
|
return "0.0.0";
|
|
72963
72963
|
}
|
|
@@ -124218,9 +124218,7 @@ init_device_info();
|
|
|
124218
124218
|
init_zod();
|
|
124219
124219
|
init_external_devices();
|
|
124220
124220
|
var DEFAULT_METRO_PORT = 8081;
|
|
124221
|
-
var metroPortField = external_exports.coerce.number().int().min(1).max(65535).optional().describe(
|
|
124222
|
-
"Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id."
|
|
124223
|
-
);
|
|
124221
|
+
var metroPortField = external_exports.coerce.number().int().min(1).max(65535).optional().describe("Metro port (omit to use this device's port, default 8081; ignored on Chromium).");
|
|
124224
124222
|
function metroPort(params) {
|
|
124225
124223
|
if (params.port !== void 0) return params.port;
|
|
124226
124224
|
const deviceId = canonicalDeviceId(params.device_id);
|
|
@@ -128792,19 +128790,17 @@ async function queryViewHierarchyFor(services, params, toolId, method, errorCode
|
|
|
128792
128790
|
// ../tool-server/src/tools/network/network-capture.ts
|
|
128793
128791
|
var captureSchema = external_exports.object({
|
|
128794
128792
|
udid: external_exports.string().describe(
|
|
128795
|
-
"Device ID from list-devices
|
|
128793
|
+
"Device ID from `list-devices`<flag:macos-apps> (external Mac builds: `macos-app-<bundle id>`)</flag:macos-apps>."
|
|
128796
128794
|
),
|
|
128797
128795
|
bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
|
|
128798
|
-
"
|
|
128796
|
+
"Bundle ID (iOS) / package (Android)<flag:macos-apps> / Mac bundle ID</flag:macos-apps> / placeholder on Chromium (e.g. `argent.capture`)."
|
|
128799
128797
|
),
|
|
128800
128798
|
port: metroPortField.describe(
|
|
128801
|
-
"
|
|
128802
|
-
),
|
|
128803
|
-
layer: external_exports.enum(["js", "native"]).optional().describe(
|
|
128804
|
-
"Omit to control both layers. Selecting one leaves the other alone. Chromium ignores this setting."
|
|
128799
|
+
"Metro port for JS capture and native filtering (omit for device default, usually 8081; ignored on Chromium)."
|
|
128805
128800
|
),
|
|
128801
|
+
layer: external_exports.enum(["js", "native"]).optional().describe("Control one layer only (default: both; ignored on Chromium)."),
|
|
128806
128802
|
logicalDeviceId: external_exports.string().min(1).optional().describe(
|
|
128807
|
-
"
|
|
128803
|
+
"Shared-Metro logical ID for iOS/Android if requested (reuse for start/stop/JS reads)<flag:macos-apps>; omit on Mac apps</flag:macos-apps>."
|
|
128808
128804
|
)
|
|
128809
128805
|
});
|
|
128810
128806
|
function requestedLayers(layer) {
|
|
@@ -128949,19 +128945,17 @@ function errorMessage4(err) {
|
|
|
128949
128945
|
// ../tool-server/src/tools/native-devtools/native-network-logs.ts
|
|
128950
128946
|
var zodSchema5 = external_exports.object({
|
|
128951
128947
|
udid: external_exports.string().describe(
|
|
128952
|
-
"Device ID from list-devices
|
|
128948
|
+
"Device ID from `list-devices`: iOS simulator UDID, Android serial<flag:macos-apps>, or Mac app id (`macos-app-<bundle id>`)</flag:macos-apps>."
|
|
128953
128949
|
),
|
|
128954
128950
|
bundleId: external_exports.string().describe(
|
|
128955
|
-
"
|
|
128951
|
+
"Bundle ID (iOS) or package name (Android)<flag:macos-apps>; on macOS, omit `macos-app-`</flag:macos-apps>."
|
|
128956
128952
|
),
|
|
128957
128953
|
port: metroPortField.describe(
|
|
128958
|
-
"
|
|
128959
|
-
),
|
|
128960
|
-
limit: external_exports.number().int().nonnegative().optional().default(50).describe(
|
|
128961
|
-
"Take the newest matching requests and return them oldest first. Use 0 for capture status and totals without entries."
|
|
128954
|
+
"Metro port to exclude from logs (omit for device default, usually 8081)."
|
|
128962
128955
|
),
|
|
128956
|
+
limit: external_exports.number().int().nonnegative().optional().default(50).describe("Newest requests to return oldest-first (default 50; 0 = status/totals only)."),
|
|
128963
128957
|
clear: external_exports.boolean().optional().default(false).describe(
|
|
128964
|
-
"Hide
|
|
128958
|
+
"Hide current history from later lists (IDs still work in `view-network-request-details`)."
|
|
128965
128959
|
),
|
|
128966
128960
|
// Declared so this non-strict object refuses the old stop instead of stripping it: the read
|
|
128967
128961
|
// would succeed while capture records on.
|
|
@@ -128985,11 +128979,9 @@ function createNativeNetworkLogsTool(registry2) {
|
|
|
128985
128979
|
android: { emulator: true, device: true },
|
|
128986
128980
|
macos: { app: true, catalyst: true }
|
|
128987
128981
|
},
|
|
128988
|
-
description: `List native HTTP requests
|
|
128989
|
-
|
|
128990
|
-
|
|
128991
|
-
If the call fails with NATIVE_DEVTOOLS_NOT_CONNECTED, follow its message.
|
|
128992
|
-
An Apple system app is rejected outright (terminal: never retry it).`,
|
|
128982
|
+
description: `List native HTTP requests (URLSession/NSURLConnection on iOS<flag:macos-apps>/Mac apps</flag:macos-apps>; OkHttp on debuggable Android). Call \`network-capture-start\` first.
|
|
128983
|
+
Use when inspecting native SDK/module traffic (pass an ID to \`view-network-request-details\` for bodies/headers).
|
|
128984
|
+
Returns recent requests oldest-first with capture status in \`header\` (or a precheck status + remedy message on iOS).<flag:macos-apps> If a Mac log stays stopped, check the start result.</flag:macos-apps> Fails on \`NATIVE_DEVTOOLS_NOT_CONNECTED\`. An Apple system app is rejected outright (terminal: never retry it).`,
|
|
128993
128985
|
zodSchema: zodSchema5,
|
|
128994
128986
|
services: (params) => {
|
|
128995
128987
|
const device = resolveDevice(params.udid);
|
|
@@ -129238,25 +129230,24 @@ init_device_info();
|
|
|
129238
129230
|
var MACOS_NO_MATCH_NOTE = "No NSView matched. SwiftUI sets a control's identifier and label on an accessibility element, not on an NSView, so this search does not find SwiftUI controls: describe lists them with their identifiers and frames.";
|
|
129239
129231
|
var zodSchema6 = external_exports.object({
|
|
129240
129232
|
...nativeAppTarget,
|
|
129241
|
-
className: external_exports.string().optional().describe("UIView class name
|
|
129242
|
-
identifier: external_exports.string().optional().describe("
|
|
129243
|
-
label: external_exports.string().optional().describe("
|
|
129244
|
-
tag: external_exports.number().int().optional().describe("UIView
|
|
129245
|
-
nativeID: external_exports.string().optional().describe("React Native nativeID
|
|
129246
|
-
includeAncestors: external_exports.boolean().optional().describe("Include ancestor chain
|
|
129247
|
-
includeChildren: external_exports.boolean().optional().describe("Include child views
|
|
129233
|
+
className: external_exports.string().optional().describe("Exact UIView class name (e.g. UIButton)."),
|
|
129234
|
+
identifier: external_exports.string().optional().describe("Exact accessibility identifier."),
|
|
129235
|
+
label: external_exports.string().optional().describe("Exact accessibility label."),
|
|
129236
|
+
tag: external_exports.number().int().optional().describe("UIView integer tag."),
|
|
129237
|
+
nativeID: external_exports.string().optional().describe("Exact React Native nativeID."),
|
|
129238
|
+
includeAncestors: external_exports.boolean().optional().describe("Include ancestor chain (default true)."),
|
|
129239
|
+
includeChildren: external_exports.boolean().optional().describe("Include child views (default true)."),
|
|
129248
129240
|
fields: external_exports.array(external_exports.string()).optional().describe(
|
|
129249
|
-
"View fields to
|
|
129241
|
+
"View fields to return (defaults: pointer, className, tag, frame, windowFrame, screenFrame, bounds, hidden, alpha, opaque, clipsToBounds, userInteractionEnabled, depth, identifier, label, layerName, nativeID; extra: center, transform, contentMode, backgroundColor, tintColor, value, firstResponder)."
|
|
129250
129242
|
)
|
|
129251
129243
|
});
|
|
129252
129244
|
var nativeFindViewsTool = {
|
|
129253
129245
|
id: "native-find-views",
|
|
129254
|
-
description: `Search
|
|
129255
|
-
Use when
|
|
129256
|
-
Returns { status: "ok", matches }
|
|
129257
|
-
<flag:macos-apps>
|
|
129258
|
-
</flag:macos-apps>If status is restart_required: follow
|
|
129259
|
-
An Apple system app is rejected outright (terminal: never retry it).`,
|
|
129246
|
+
description: `Search UIViews by \`className\`, \`identifier\`, \`label\`, \`tag\`, or \`nativeID\` (at least one required).
|
|
129247
|
+
Use when locating a specific view without dumping \`native-full-hierarchy\`.
|
|
129248
|
+
Returns \`{ status: "ok", matches }\` (frames in points; \`screenFrame\` uses upright UI axes). Matches are not filtered for visibility: before tapping one, check its \`screenFrame\` center with \`native-view-at-point\` \`hitTest: true\` and \`skipClasses: ["UITextEffectsWindow"]\` (check a screenshot if it returns some other view), then divide that center by \`screen\` from \`native-full-hierarchy\` for \`gesture-tap\`.
|
|
129249
|
+
<flag:macos-apps>Mac app: searches NSViews across visible windows; an identifier or label search does not find SwiftUI controls: describe lists them with their identifiers and frames. Tap recipe and statuses below are iOS only.
|
|
129250
|
+
</flag:macos-apps>If status is restart_required: follow message (usually restart-app) and retry. If status is service_stale: restart tool-server (\`argent server stop && argent server start --detach\`) and retry; if the same status comes back, stop restarting. If status is connect_pending: Do not restart it, wait a few seconds and retry. If status is init_failed: reboot simulator. An Apple system app is rejected outright (terminal: never retry it).`,
|
|
129260
129251
|
zodSchema: zodSchema6,
|
|
129261
129252
|
readOnly: true,
|
|
129262
129253
|
interaction: {
|
|
@@ -129298,26 +129289,19 @@ init_zod();
|
|
|
129298
129289
|
var zodSchema7 = external_exports.object({
|
|
129299
129290
|
...nativeAppTarget,
|
|
129300
129291
|
fields: external_exports.array(external_exports.string()).optional().describe(
|
|
129301
|
-
"
|
|
129302
|
-
),
|
|
129303
|
-
skipClasses: external_exports.array(external_exports.string()).optional().describe(
|
|
129304
|
-
'Exact UIView class names whose entire subtree should be pruned (e.g. ["UIImageView"] to drop image leaf nodes)'
|
|
129305
|
-
),
|
|
129306
|
-
skipClassPrefixes: external_exports.array(external_exports.string()).optional().describe(
|
|
129307
|
-
'Class name prefixes to prune entire subtrees. For SwiftUI apps use ["_TtGC7SwiftUI"] to drop mangled SwiftUI generic type subtrees while keeping _UIHostingView and UIKit bridges. Avoid broad prefixes like "_UI": they prune useful system views.'
|
|
129292
|
+
"Exact view fields to return (defaults: pointer, className, tag, frame, windowFrame, screenFrame, bounds, hidden, alpha, opaque, clipsToBounds, userInteractionEnabled, depth, identifier, label, layerName, nativeID; extra: center, transform, contentMode, backgroundColor, tintColor, value, firstResponder)."
|
|
129308
129293
|
),
|
|
129309
|
-
|
|
129294
|
+
skipClasses: external_exports.array(external_exports.string()).optional().describe('Exact UIView classes to prune (e.g. ["UIImageView"]).'),
|
|
129295
|
+
skipClassPrefixes: external_exports.array(external_exports.string()).optional().describe('Class prefixes to prune (e.g. ["_TtGC7SwiftUI"] for SwiftUI; avoid broad "_UI").'),
|
|
129296
|
+
maxDepth: external_exports.number().int().positive().optional().describe("Max recursion depth (default 8).")
|
|
129310
129297
|
});
|
|
129311
129298
|
var nativeFullHierarchyTool = {
|
|
129312
129299
|
id: "native-full-hierarchy",
|
|
129313
|
-
description: `Get the complete UIKit view tree for the running app.
|
|
129314
|
-
|
|
129315
|
-
|
|
129316
|
-
|
|
129317
|
-
|
|
129318
|
-
<flag:macos-apps>On a Mac app it returns the AppKit view tree of the app's windows, each screenFrame in points from the top-left of the area describe reports. The statuses below are iOS only.
|
|
129319
|
-
</flag:macos-apps>If status is restart_required: follow the message (usually restart-app), then retry. If status is service_stale: the app is already injected, so restarting it cannot help. Restart the tool-server (\`argent server stop && argent server start --detach\`) and retry. If the same status comes back after that restart, stop restarting: follow the message, which names the terminal fallback. If status is connect_pending: the app is injected and still connecting. Do not restart it, wait a few seconds and retry. If status is init_failed: follow the message (re-boot the simulator) rather than retrying.
|
|
129320
|
-
An Apple system app is rejected outright (terminal: never retry it).`,
|
|
129300
|
+
description: `Get the complete UIKit view tree for the running app (can be 100KB+; prefer \`native-find-views\` for targeted lookups, or constrain with \`skipClasses\`, \`fields\`, \`maxDepth\`).
|
|
129301
|
+
Use when debugging layout or inspecting views absent from the accessibility tree.
|
|
129302
|
+
Returns \`{ status: "ok", windows, screen }\` (\`screen\` gives upright point size and orientation; \`screenFrame\` uses upright UI axes).
|
|
129303
|
+
<flag:macos-apps>Mac app: returns AppKit window view tree with \`screenFrame\` in points from the \`describe\` area top-left. Statuses below are iOS only.
|
|
129304
|
+
</flag:macos-apps>If status is restart_required: follow message (usually restart-app) and retry. If status is service_stale: restart tool-server (\`argent server stop && argent server start --detach\`) and retry; if the same status comes back, stop restarting. If status is connect_pending: Do not restart it, wait a few seconds and retry. If status is init_failed: reboot simulator. An Apple system app is rejected outright (terminal: never retry it).`,
|
|
129321
129305
|
zodSchema: zodSchema7,
|
|
129322
129306
|
readOnly: true,
|
|
129323
129307
|
interaction: {
|
|
@@ -129413,22 +129397,22 @@ init_src2();
|
|
|
129413
129397
|
var viewAtPointParams = {
|
|
129414
129398
|
...nativeAppTarget,
|
|
129415
129399
|
x: external_exports.number().describe(
|
|
129416
|
-
"Raw X
|
|
129400
|
+
"Raw X in upright UI points<flag:macos-apps> (Mac app: from describe area top-left)</flag:macos-apps>. Not normalized [0,1]."
|
|
129417
129401
|
),
|
|
129418
|
-
y: external_exports.number().describe("Raw Y
|
|
129419
|
-
includeAncestors: external_exports.boolean().optional().describe("Include ancestor chain
|
|
129420
|
-
includeChildren: external_exports.boolean().optional().describe("Include child views
|
|
129402
|
+
y: external_exports.number().describe("Raw Y in upright UI points. Not normalized [0,1]."),
|
|
129403
|
+
includeAncestors: external_exports.boolean().optional().describe("Include ancestor chain (default true)."),
|
|
129404
|
+
includeChildren: external_exports.boolean().optional().describe("Include child views (default false)."),
|
|
129421
129405
|
fields: external_exports.array(external_exports.string()).optional().describe(
|
|
129422
|
-
"View fields to
|
|
129406
|
+
"View fields to return (defaults: pointer, className, tag, frame, windowFrame, screenFrame, bounds, hidden, alpha, opaque, clipsToBounds, userInteractionEnabled, depth, identifier, label, layerName, nativeID; extra: center, transform, contentMode, backgroundColor, tintColor, value, firstResponder)."
|
|
129423
129407
|
),
|
|
129424
|
-
skipClasses: external_exports.array(external_exports.string()).optional().describe("Exact UIView class names
|
|
129425
|
-
skipClassPrefixes: external_exports.array(external_exports.string()).optional().describe("Class name prefixes to prune
|
|
129426
|
-
maxDepth: external_exports.number().int().positive().optional().describe("
|
|
129408
|
+
skipClasses: external_exports.array(external_exports.string()).optional().describe("Exact UIView class names to prune."),
|
|
129409
|
+
skipClassPrefixes: external_exports.array(external_exports.string()).optional().describe("Class name prefixes to prune."),
|
|
129410
|
+
maxDepth: external_exports.number().int().positive().optional().describe("Max serialization depth (default 150).")
|
|
129427
129411
|
};
|
|
129428
129412
|
var zodSchema9 = external_exports.object({
|
|
129429
129413
|
...viewAtPointParams,
|
|
129430
129414
|
hitTest: external_exports.boolean().optional().describe(
|
|
129431
|
-
"true
|
|
129415
|
+
"true: touch-receiving view (UIKit hit-test). false (default): deepest visible view."
|
|
129432
129416
|
)
|
|
129433
129417
|
});
|
|
129434
129418
|
function queryViewAtPoint(services, params, toolId, hitTest) {
|
|
@@ -129443,28 +129427,11 @@ function queryViewAtPoint(services, params, toolId, hitTest) {
|
|
|
129443
129427
|
}
|
|
129444
129428
|
var nativeViewAtPointTool = {
|
|
129445
129429
|
id: "native-view-at-point",
|
|
129446
|
-
description: `Inspect the deepest UIView at
|
|
129447
|
-
|
|
129448
|
-
|
|
129449
|
-
|
|
129450
|
-
|
|
129451
|
-
identifier or nativeID of whatever draws it.
|
|
129452
|
-
|
|
129453
|
-
With hitTest: true it answers "what would receive the touch?". Use when a tap lands
|
|
129454
|
-
somewhere unexpected or does nothing, to see which control UIKit would hand the
|
|
129455
|
-
touch to: a transparent overlay swallowing it, a parent recognizer, a disabled button.
|
|
129456
|
-
|
|
129457
|
-
Returns { status: "ok", view }: the matched view with its class name, frames,
|
|
129458
|
-
identifier, label and layer name, plus its ancestors and subviews as requested.
|
|
129459
|
-
view is null when nothing is drawn at that point, or with hitTest when no touchable view sits under it.
|
|
129460
|
-
|
|
129461
|
-
To get x and y from a normalized describe frame, multiply its values by the
|
|
129462
|
-
screen size in points, on the same axes (landscape when the UI is).
|
|
129463
|
-
native-full-hierarchy returns that size as screen (pass maxDepth: 1 and fields: ["className"] to keep it small).<flag:macos-apps> On a Mac app,
|
|
129464
|
-
multiply them by the size of the area describe reports instead.</flag:macos-apps>
|
|
129465
|
-
|
|
129466
|
-
If status is restart_required: follow the message (usually restart-app), then retry. If status is service_stale: the app is already injected, so restarting it cannot help. Restart the tool-server (\`argent server stop && argent server start --detach\`) and retry. If the same status comes back after that restart, stop restarting: follow the message, which names the terminal fallback. If status is connect_pending: the app is injected and still connecting. Do not restart it, wait a few seconds and retry. If status is init_failed: follow the message (re-boot the simulator) rather than retrying.
|
|
129467
|
-
An Apple system app is rejected outright (terminal: never retry it).`,
|
|
129430
|
+
description: `Inspect the deepest drawn UIView at raw point (x, y) by default, or the touch-receiving UIView with \`hitTest: true\`.
|
|
129431
|
+
Use when debugging unlabeled/custom views not in \`describe\` or checking which view swallows a tap (use \`hitTest: true\`).
|
|
129432
|
+
Convert normalized \`describe\` coords by multiplying by \`screen\` points from \`native-full-hierarchy\` (\`maxDepth: 1\`)<flag:macos-apps>; on a Mac app, multiply by the area \`describe\` reports</flag:macos-apps>.
|
|
129433
|
+
Returns \`{ status: "ok", view }\` (null if none).
|
|
129434
|
+
Status handling: If status is restart_required: follow message (usually restart-app) and retry. If status is service_stale: restart tool-server (\`argent server stop && argent server start --detach\`) and retry; if the same status comes back, stop restarting. If status is connect_pending: Do not restart it, wait a few seconds and retry. If status is init_failed: reboot simulator. An Apple system app is rejected outright (terminal: never retry it).`,
|
|
129468
129435
|
zodSchema: zodSchema9,
|
|
129469
129436
|
readOnly: true,
|
|
129470
129437
|
interaction: {
|
|
@@ -136846,22 +136813,22 @@ var capability6 = {
|
|
|
136846
136813
|
};
|
|
136847
136814
|
var zodSchema15 = external_exports.object({
|
|
136848
136815
|
udid: external_exports.string().min(1).describe(
|
|
136849
|
-
"
|
|
136816
|
+
"Device id from `list-devices` (iOS UDID<flag:harmonyos>, HarmonyOS id,</flag:harmonyos> or Android serial)."
|
|
136850
136817
|
),
|
|
136851
136818
|
bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
|
|
136852
|
-
"
|
|
136819
|
+
"Bundle id (iOS), package name (Android), component id (Vega)<flag:harmonyos>, or bundleName (HarmonyOS)</flag:harmonyos>."
|
|
136853
136820
|
),
|
|
136854
136821
|
appPath: external_exports.string().describe(
|
|
136855
|
-
"Path to
|
|
136822
|
+
"Path to `.app` (iOS), `.apk` (Android), `.vpkg` (Vega)<flag:harmonyos>, or `.hap` (HarmonyOS)</flag:harmonyos>."
|
|
136856
136823
|
)
|
|
136857
136824
|
});
|
|
136858
136825
|
var reinstallAppTool = {
|
|
136859
136826
|
id: "reinstall-app",
|
|
136860
136827
|
// An uninstall plus install can take minutes, past the 30s MCP fetch timeout.
|
|
136861
136828
|
longRunning: true,
|
|
136862
|
-
description: `Install
|
|
136863
|
-
Use
|
|
136864
|
-
Returns { reinstalled, bundleId }
|
|
136829
|
+
description: `Install a fresh app package after uninstalling any existing build (clears app data and permissions).
|
|
136830
|
+
Use when installing a new build or resetting to clean state.
|
|
136831
|
+
Returns \`{ reinstalled, bundleId }\`. Fails if \`appPath\` is invalid or \`bundleId\` does not match it (not checked on Vega or remote simulators; checks run before uninstall), or if install fails. An uninstall error fails the call on Android and physical iPhones, and on a local simulator only when it times out; Vega and remote simulators ignore it.`,
|
|
136865
136832
|
zodSchema: zodSchema15,
|
|
136866
136833
|
interaction: {
|
|
136867
136834
|
startedMsg: ({ params }) => `Reinstalling ${params.bundleId}`,
|
|
@@ -137183,24 +137150,16 @@ var capability7 = {
|
|
|
137183
137150
|
android: { emulator: true, device: true, unknown: true }
|
|
137184
137151
|
};
|
|
137185
137152
|
var zodSchema16 = external_exports.object({
|
|
137186
|
-
udid: external_exports.string().min(1).describe("
|
|
137187
|
-
action: external_exports.enum(PERMISSION_ACTIONS).describe(
|
|
137188
|
-
|
|
137189
|
-
),
|
|
137190
|
-
permission: external_exports.enum(PERMISSION_NAMES).describe(
|
|
137191
|
-
"The permission to change. `notifications` is Android-only; `reminders` is iOS-only; `camera` works on Android, and on iOS only when the simulator's runtime models the service."
|
|
137192
|
-
),
|
|
137193
|
-
bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
|
|
137194
|
-
"App to change the permission for; every action, `reset` included, applies to this app only. iOS: bundle id (e.g. com.example.app). Android: package name."
|
|
137195
|
-
)
|
|
137153
|
+
udid: external_exports.string().min(1).describe("Device id from `list-devices` (iOS simulator UDID or Android serial)."),
|
|
137154
|
+
action: external_exports.enum(PERMISSION_ACTIONS).describe("`grant` (pre-authorize), `deny`, or `reset` (re-prompt on next use)."),
|
|
137155
|
+
permission: external_exports.enum(PERMISSION_NAMES).describe("Permission name (`notifications` = Android-only; `reminders` = iOS-only)."),
|
|
137156
|
+
bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe("Target app bundle id (iOS) or package name (Android).")
|
|
137196
137157
|
});
|
|
137197
137158
|
var settingsPermissionsTool = {
|
|
137198
137159
|
id: "settings-permissions",
|
|
137199
|
-
description: `Grant or deny an app's runtime permission, or reset it, without
|
|
137200
|
-
iOS
|
|
137201
|
-
|
|
137202
|
-
Some permission changes terminate the app if it is running (system behavior on both platforms), so set permissions before launching, or relaunch after.
|
|
137203
|
-
Returns { action, permission, bundleId, applied, skipped? }: \`applied\` lists the platform-level services/permissions actually changed; \`skipped\` (Android) lists mapped permissions the package manager rejected, e.g. ones the manifest doesn't declare. Fails if nothing could be applied.`,
|
|
137160
|
+
description: `Grant or deny an app's runtime permission, or reset it, without opening Settings. Use when setting up permissions before launching or triggering a prompt (changing permissions may terminate a running app).
|
|
137161
|
+
iOS sim: \`grant location\`/\`location-always\` requires the app installed first. Android: app must be installed and declare the mapped permissions in its manifest.
|
|
137162
|
+
Returns \`{ action, permission, bundleId, applied, skipped? }\`. Fails if nothing could be applied.`,
|
|
137204
137163
|
zodSchema: zodSchema16,
|
|
137205
137164
|
searchHint: "grant deny reset revoke app permissions privacy camera microphone location settings",
|
|
137206
137165
|
interaction: {
|
|
@@ -137456,13 +137415,11 @@ var capability8 = {
|
|
|
137456
137415
|
};
|
|
137457
137416
|
var zodSchema17 = external_exports.object({
|
|
137458
137417
|
udid: external_exports.string().min(1).describe(
|
|
137459
|
-
"
|
|
137460
|
-
),
|
|
137461
|
-
url: external_exports.string().describe(
|
|
137462
|
-
"URL or scheme to open (e.g. https://example.com, messages://, tel:555, geo:37.0,-122.0)."
|
|
137418
|
+
"Device id from `list-devices` (iOS UDID, Android serial, <flag:harmonyos>HarmonyOS id, </flag:harmonyos>or Chromium id)."
|
|
137463
137419
|
),
|
|
137420
|
+
url: external_exports.string().describe("URL or custom scheme (e.g. https://example.com, myapp://path)."),
|
|
137464
137421
|
bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).optional().describe(
|
|
137465
|
-
"Physical iOS only:
|
|
137422
|
+
"Physical iOS only: receiving app (defaults to Safari for http/https; required otherwise)."
|
|
137466
137423
|
)
|
|
137467
137424
|
});
|
|
137468
137425
|
var openUrlTool = {
|
|
@@ -137470,12 +137427,9 @@ var openUrlTool = {
|
|
|
137470
137427
|
// On iOS it first waits up to 15s for the simulator watcher's first poll, so a
|
|
137471
137428
|
// slow openurl can pass the MCP fetch timeout, whose replay would open the URL twice.
|
|
137472
137429
|
longRunning: true,
|
|
137473
|
-
description: `Open a URL or
|
|
137474
|
-
Use when navigating to a web page or deep-linking into an app
|
|
137475
|
-
|
|
137476
|
-
An https:// link opens the native app only if that app is verified for the link's domain (Universal Links / App Links); even then, an iOS simulator may open Safari. To reliably open an installed app, use its custom scheme (scheme://path) or launch-app.
|
|
137477
|
-
On a physical iPhone, the app that receives the URL becomes the app under automation.
|
|
137478
|
-
Returns { opened, url, note? }. \`note\` explains the routing caveat when a web URL was opened on a native device<flag:harmonyos>; on HarmonyOS every result carries one, since success only means the system accepted the URI</flag:harmonyos>. Fails if no app is registered to handle the URI (iOS/Android<flag:harmonyos>/HarmonyOS</flag:harmonyos>) or the renderer rejects the navigation (Chromium).`,
|
|
137430
|
+
description: `Open a URL or deep-link scheme on the device.
|
|
137431
|
+
Use when navigating to a web page or deep-linking into an app (prefer custom schemes or \`launch-app\` over \`https://\` Universal/App Links). On Chromium, navigates the primary page (non-page schemes like \`tel:\`/\`mailto:\` fail). On physical iOS, the receiving app becomes active for automation.<flag:harmonyos> HarmonyOS opens URIs via \`aa start -U\`.</flag:harmonyos>
|
|
137432
|
+
Returns \`{ opened, url, note? }\`. Fails if no handler is registered<flag:harmonyos> (iOS/Android/HarmonyOS)</flag:harmonyos> or Chromium rejects navigation.`,
|
|
137479
137433
|
zodSchema: zodSchema17,
|
|
137480
137434
|
interaction: {
|
|
137481
137435
|
startedMsg: ({ params }) => `Opening ${safeDestination(params.url)}`,
|
|
@@ -138409,29 +138363,23 @@ var capability12 = {
|
|
|
138409
138363
|
};
|
|
138410
138364
|
var zodSchema21 = external_exports.object({
|
|
138411
138365
|
udid: external_exports.string().describe(
|
|
138412
|
-
"
|
|
138413
|
-
),
|
|
138414
|
-
x: external_exports.number().min(0).max(1).describe(
|
|
138415
|
-
"Anchor x. The wheel events land here; put it over the element you want to scroll."
|
|
138416
|
-
),
|
|
138417
|
-
y: external_exports.number().min(0).max(1).describe("Anchor y."),
|
|
138418
|
-
deltaX: external_exports.number().optional().describe(
|
|
138419
|
-
"Horizontal scroll distance as a fraction of the window width. Positive reveals content to the right; negative scrolls back left."
|
|
138420
|
-
),
|
|
138421
|
-
deltaY: external_exports.number().optional().describe(
|
|
138422
|
-
"Vertical scroll distance as a fraction of the window height (0.5 = half a window). Positive scrolls down (reveals content below), like rolling a mouse wheel toward you; negative scrolls back up."
|
|
138366
|
+
"Chromium device id (`chromium-cdp-<port>`)<flag:macos-apps> or Mac app id</flag:macos-apps> from `list-devices`."
|
|
138423
138367
|
),
|
|
138368
|
+
x: external_exports.number().min(0).max(1).describe("Normalized anchor x over the scrollable element."),
|
|
138369
|
+
y: external_exports.number().min(0).max(1).describe("Normalized anchor y."),
|
|
138370
|
+
deltaX: external_exports.number().optional().describe("Horizontal scroll fraction (+ right, - left)."),
|
|
138371
|
+
deltaY: external_exports.number().optional().describe("Vertical scroll fraction (+ down, - up; e.g. 0.5)."),
|
|
138424
138372
|
durationMs: external_exports.number().optional().describe(
|
|
138425
|
-
"
|
|
138373
|
+
"Scroll duration in ms (default 300)<flag:macos-apps>; ignored on Mac apps</flag:macos-apps>."
|
|
138426
138374
|
)
|
|
138427
138375
|
}).refine((p) => (p.deltaX ?? 0) !== 0 || (p.deltaY ?? 0) !== 0, {
|
|
138428
138376
|
message: "Pass a non-zero deltaX and/or deltaY \u2014 a scroll with no delta is a no-op."
|
|
138429
138377
|
});
|
|
138430
138378
|
var gestureScrollTool = {
|
|
138431
138379
|
id: "gesture-scroll",
|
|
138432
|
-
description: `Send mouse-wheel events at
|
|
138433
|
-
Use when
|
|
138434
|
-
Returns { scrolled: true, timestampMs }
|
|
138380
|
+
description: `Send mouse-wheel scroll events at normalized [0,1] anchor (x, y) in Chromium<flag:macos-apps> or a Mac app</flag:macos-apps>.
|
|
138381
|
+
Use when scrolling desktop lists or off-screen content (use \`gesture-swipe\` on iOS/Android<flag:harmonyos>/HarmonyOS</flag:harmonyos>).
|
|
138382
|
+
Returns \`{ scrolled: true, timestampMs }\`. Fails if CDP is unreachable<flag:macos-apps> or nothing under the point scrolls on a Mac app</flag:macos-apps>.`,
|
|
138435
138383
|
zodSchema: zodSchema21,
|
|
138436
138384
|
searchHint: "scroll wheel list page chromium<flag:macos-apps> mac</flag:macos-apps> mouse down up content fold",
|
|
138437
138385
|
interaction: {
|
|
@@ -138543,20 +138491,18 @@ async function runPointerDrag(from2, to, opts, pointer) {
|
|
|
138543
138491
|
}
|
|
138544
138492
|
var zodSchema22 = external_exports.object({
|
|
138545
138493
|
udid: external_exports.string().describe(
|
|
138546
|
-
"
|
|
138494
|
+
"Chromium device id (`chromium-cdp-<port>`)<flag:macos-apps> or Mac app id</flag:macos-apps> from `list-devices`."
|
|
138547
138495
|
),
|
|
138548
|
-
fromX: external_exports.number().min(0).max(1).describe("
|
|
138549
|
-
fromY: external_exports.number().min(0).max(1).describe("
|
|
138550
|
-
toX: external_exports.number().min(0).max(1).describe("
|
|
138551
|
-
toY: external_exports.number().min(0).max(1).describe("
|
|
138496
|
+
fromX: external_exports.number().min(0).max(1).describe("Start x."),
|
|
138497
|
+
fromY: external_exports.number().min(0).max(1).describe("Start y."),
|
|
138498
|
+
toX: external_exports.number().min(0).max(1).describe("End x."),
|
|
138499
|
+
toY: external_exports.number().min(0).max(1).describe("End y."),
|
|
138552
138500
|
durationMs: external_exports.number().max(MAX_DURATION_MS2, {
|
|
138553
138501
|
message: `durationMs must be at most ${MAX_DURATION_MS2} (10s): the drag holds the left button down for exactly this long, one frame per ~16ms, so a larger value is that much wall clock spent mid-press.`
|
|
138554
138502
|
}).optional().describe(
|
|
138555
|
-
"
|
|
138556
|
-
),
|
|
138557
|
-
momentum: external_exports.boolean().optional().describe(
|
|
138558
|
-
"Whether the drag releases with momentum; default true (a constant-speed drag). false decelerates into the release point, so an app that derives a fling from the release velocity (carousels, drag libraries) applies little to no momentum: use it when the drag must stop where it was aimed. Under ~100ms durationMs some fling survives; keep the default 300 when the fling must be fully suppressed."
|
|
138503
|
+
"Drag duration in ms (default 300<flag:macos-apps>; 800 for a Mac app long press</flag:macos-apps>)."
|
|
138559
138504
|
),
|
|
138505
|
+
momentum: external_exports.boolean().optional().describe("Default true (constant speed). false decelerates into release to avoid fling."),
|
|
138560
138506
|
// `momentum`'s earlier spelling, with the opposite polarity. Declared so this
|
|
138561
138507
|
// non-strict object refuses it instead of stripping it and running the default.
|
|
138562
138508
|
settle: external_exports.never({
|
|
@@ -138567,9 +138513,9 @@ var zodSchema22 = external_exports.object({
|
|
|
138567
138513
|
});
|
|
138568
138514
|
var gestureDragTool = {
|
|
138569
138515
|
id: "gesture-drag",
|
|
138570
|
-
description: `
|
|
138571
|
-
Use
|
|
138572
|
-
Returns { dragged: true, timestampMs }
|
|
138516
|
+
description: `Drag the left mouse button between normalized [0,1] window points in Chromium<flag:macos-apps> or a Mac app</flag:macos-apps>.
|
|
138517
|
+
Use when dragging sliders, drag-and-drop items, or selecting text (use \`gesture-scroll\` to scroll desktop lists; use \`gesture-swipe\` on iOS/Android<flag:harmonyos>/HarmonyOS</flag:harmonyos>).<flag:macos-apps> Mac app: same start/end point = long press; drops stay inside the app's windows.</flag:macos-apps>
|
|
138518
|
+
Returns \`{ dragged: true, timestampMs }\`. Fails if the CDP session is unreachable.`,
|
|
138573
138519
|
zodSchema: zodSchema22,
|
|
138574
138520
|
searchHint: "drag drop slider mouse press move release chromium<flag:macos-apps> mac</flag:macos-apps> select",
|
|
138575
138521
|
interaction: {
|
|
@@ -138836,22 +138782,18 @@ async function runOnIosDevice(runner, udid, events, interpolate) {
|
|
|
138836
138782
|
return { events: events.length, ...reactivated ? { reactivated: true } : {} };
|
|
138837
138783
|
}
|
|
138838
138784
|
var eventSchema = external_exports.object({
|
|
138839
|
-
type: external_exports.enum(["Down", "Move", "Up"]).describe("Touch event type"),
|
|
138840
|
-
x: external_exports.number().min(0).max(1).describe("
|
|
138841
|
-
y: external_exports.number().min(0).max(1).describe("
|
|
138842
|
-
x2: external_exports.number().min(0).max(1).optional().describe("Second finger x
|
|
138843
|
-
y2: external_exports.number().min(0).max(1).optional().describe("Second finger y
|
|
138844
|
-
delayMs: external_exports.number().optional().describe("Delay before
|
|
138785
|
+
type: external_exports.enum(["Down", "Move", "Up"]).describe("Touch event type."),
|
|
138786
|
+
x: external_exports.number().min(0).max(1).describe("Normalized x."),
|
|
138787
|
+
y: external_exports.number().min(0).max(1).describe("Normalized y."),
|
|
138788
|
+
x2: external_exports.number().min(0).max(1).optional().describe("Second finger x."),
|
|
138789
|
+
y2: external_exports.number().min(0).max(1).optional().describe("Second finger y."),
|
|
138790
|
+
delayMs: external_exports.number().optional().describe("Delay before event in ms (default 16).")
|
|
138845
138791
|
});
|
|
138846
138792
|
var zodSchema23 = external_exports.object({
|
|
138847
138793
|
udid: external_exports.string().describe("Target device id from `list-devices` (iOS UDID or Android serial)."),
|
|
138848
|
-
edge: external_exports.enum(screenEdges).optional().describe(
|
|
138849
|
-
|
|
138850
|
-
)
|
|
138851
|
-
events: external_exports.array(eventSchema).describe("Touch events, dispatched in order."),
|
|
138852
|
-
interpolate: external_exports.number().optional().describe(
|
|
138853
|
-
"Number of Move events to insert between each pair of consecutive events, linearly interpolating both x,y and x2,y2 and splitting the delay evenly, for a smooth gesture. Default: no interpolation."
|
|
138854
|
-
)
|
|
138794
|
+
edge: external_exports.enum(screenEdges).optional().describe("Starting screen edge for a single-finger system gesture (local iOS simulator)."),
|
|
138795
|
+
events: external_exports.array(eventSchema).describe("Ordered touch events."),
|
|
138796
|
+
interpolate: external_exports.number().optional().describe("Insert N linearly interpolated Move events between consecutive events (default 0).")
|
|
138855
138797
|
});
|
|
138856
138798
|
function validateEdge(params, device) {
|
|
138857
138799
|
if (params.edge === void 0) return;
|
|
@@ -138867,30 +138809,11 @@ function validateEdge(params, device) {
|
|
|
138867
138809
|
}
|
|
138868
138810
|
var gestureCustomTool = {
|
|
138869
138811
|
id: "gesture-custom",
|
|
138870
|
-
description: `Send a sequence of touch events
|
|
138871
|
-
Use
|
|
138872
|
-
|
|
138873
|
-
|
|
138874
|
-
|
|
138875
|
-
All x/y values are fractions of the screen width/height (not pixels).
|
|
138876
|
-
Physical iOS: a Down, any Moves, then an Up; x2/y2 adds a second finger. A plain Down then Up: same point = press-hold, other point = drag (Up delayMs = rest before the move); one Move at the Down point between them = long-press pickup (Move delayMs = hold, Up delayMs = move time). Any other train plays as timed paths, each event waiting its delayMs, and needs the app drawn in portrait.
|
|
138877
|
-
Returns { events: number } with the total count of events dispatched. On physical iOS, reactivated: true = app was re-fronted; re-describe. Fails if the target device is not booted or an event type is invalid.
|
|
138878
|
-
|
|
138879
|
-
Example long-press at center:
|
|
138880
|
-
[{"type":"Down","x":0.5,"y":0.5},{"type":"Up","x":0.5,"y":0.5,"delayMs":800}]
|
|
138881
|
-
|
|
138882
|
-
Example pick up a list item with a long press, then drag it up:
|
|
138883
|
-
[{"type":"Down","x":0.5,"y":0.6},{"type":"Move","x":0.5,"y":0.6,"delayMs":800},{"type":"Up","x":0.5,"y":0.3,"delayMs":500}]
|
|
138884
|
-
|
|
138885
|
-
Example smooth scroll down:
|
|
138886
|
-
[{"type":"Down","x":0.5,"y":0.7},
|
|
138887
|
-
{"type":"Move","x":0.5,"y":0.6},{"type":"Move","x":0.5,"y":0.5},{"type":"Move","x":0.5,"y":0.4},
|
|
138888
|
-
{"type":"Up","x":0.5,"y":0.3}]
|
|
138889
|
-
|
|
138890
|
-
Example pinch-to-zoom (with interpolate:10 for smoothness):
|
|
138891
|
-
events: [{"type":"Down","x":0.4,"y":0.5,"x2":0.6,"y2":0.5},
|
|
138892
|
-
{"type":"Up","x":0.2,"y":0.5,"x2":0.8,"y2":0.5}]
|
|
138893
|
-
interpolate: 10`,
|
|
138812
|
+
description: `Send a custom sequence of normalized [0,1] touch events.
|
|
138813
|
+
Use when you need long-press, drag-and-drop, edge/system gestures (\`edge\` on local iOS sim), or multi-waypoint/two-finger paths. Prefer \`gesture-tap\`, \`gesture-swipe\`, \`gesture-pinch\`, or \`gesture-rotate\` for standard gestures.<flag:macos-apps> Not supported on Mac apps (use \`gesture-tap\`, \`gesture-drag\`, \`gesture-scroll\`).</flag:macos-apps>
|
|
138814
|
+
Physical iOS: Down, optional Moves, then Up (\`x2\`/\`y2\` = second finger). Plain Down then Up: same point = press-hold, other point = drag (\`Up delayMs\` = rest before move); one Move at Down point between them = long-press pickup (\`Move delayMs\` = hold, \`Up delayMs\` = move time); any other train plays as timed paths (each waiting its \`delayMs\`, portrait required).
|
|
138815
|
+
Example long-press + drag: \`[{"type":"Down","x":0.5,"y":0.6},{"type":"Move","x":0.5,"y":0.6,"delayMs":800},{"type":"Up","x":0.5,"y":0.3,"delayMs":500}]\`.
|
|
138816
|
+
Returns \`{ events, reactivated? }\` (on physical iOS, \`reactivated: true\` means re-describe). Fails if device is not booted or events are invalid.`,
|
|
138894
138817
|
zodSchema: zodSchema23,
|
|
138895
138818
|
interaction: {
|
|
138896
138819
|
startedMsg: () => "Performing custom gesture",
|
|
@@ -138965,31 +138888,24 @@ var capability15 = {
|
|
|
138965
138888
|
};
|
|
138966
138889
|
var zodSchema24 = external_exports.object({
|
|
138967
138890
|
udid: external_exports.string().describe(
|
|
138968
|
-
"
|
|
138969
|
-
),
|
|
138970
|
-
centerX: external_exports.number().describe("Center of the pinch, horizontal."),
|
|
138971
|
-
centerY: external_exports.number().describe("Center of the pinch, vertical."),
|
|
138972
|
-
startDistance: external_exports.number().describe("Initial distance between the two fingers."),
|
|
138973
|
-
endDistance: external_exports.number().describe("Final distance between the two fingers."),
|
|
138974
|
-
endCenterX: external_exports.number().optional().describe(
|
|
138975
|
-
"Final horizontal center of the pinch. When set, the centroid drifts linearly from centerX to endCenterX over the gesture (e.g. to keep expanding fingers on-screen near an edge). Omit for a fixed center."
|
|
138976
|
-
),
|
|
138977
|
-
endCenterY: external_exports.number().optional().describe(
|
|
138978
|
-
"Final vertical center of the pinch; drifts from centerY like endCenterX. Omit for a fixed center."
|
|
138979
|
-
),
|
|
138980
|
-
angle: external_exports.number().optional().describe(
|
|
138981
|
-
"Angle in degrees of the axis the fingers lie on: 0 = horizontal (default), 90 = vertical."
|
|
138891
|
+
"Device id from `list-devices` (iOS UDID<flag:harmonyos>, HarmonyOS id,</flag:harmonyos> or Android serial)."
|
|
138982
138892
|
),
|
|
138893
|
+
centerX: external_exports.number().describe("Normalized center x."),
|
|
138894
|
+
centerY: external_exports.number().describe("Normalized center y."),
|
|
138895
|
+
startDistance: external_exports.number().describe("Initial normalized finger distance."),
|
|
138896
|
+
endDistance: external_exports.number().describe("Final normalized finger distance (> start = zoom in)."),
|
|
138897
|
+
endCenterX: external_exports.number().optional().describe("Optional final center x (centroid drifts linearly)."),
|
|
138898
|
+
endCenterY: external_exports.number().optional().describe("Optional final center y."),
|
|
138899
|
+
angle: external_exports.number().optional().describe("Finger axis angle in degrees (0 = horizontal, 90 = vertical)."),
|
|
138983
138900
|
durationMs: external_exports.number().optional().describe(
|
|
138984
|
-
"
|
|
138901
|
+
"Duration in ms (default 300)<flag:harmonyos>; clamped to 1\u201315000ms on HarmonyOS</flag:harmonyos>."
|
|
138985
138902
|
)
|
|
138986
138903
|
});
|
|
138987
138904
|
var gesturePinchTool = {
|
|
138988
138905
|
id: "gesture-pinch",
|
|
138989
|
-
description: `
|
|
138990
|
-
|
|
138991
|
-
|
|
138992
|
-
Use when you need to zoom in or out on a map, image, or zoomable view. Returns { pinched: 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, or on a physical iPhone when the app is not drawn in portrait.`,
|
|
138906
|
+
description: `Send a two-finger pinch-to-zoom gesture in normalized [0,1] coords (\`startDistance < endDistance\` zooms in, e.g. 0.2\u21920.6; \`>\` zooms out).
|
|
138907
|
+
Use when zooming maps, photos, or zoomable views (use \`gesture-rotate\` to rotate).
|
|
138908
|
+
Returns \`{ pinched: true, timestampMs, reactivated? }\` (on physical iOS, \`reactivated: true\` means re-describe). Fails if the backend<flag:harmonyos> (\`hdc\` on HarmonyOS)</flag:harmonyos> is unreachable or a physical iPhone app is not in portrait.`,
|
|
138993
138909
|
zodSchema: zodSchema24,
|
|
138994
138910
|
interaction: {
|
|
138995
138911
|
startedMsg: ({ params }) => `Pinching ${params.endDistance > params.startDistance ? "out" : "in"} at (${Math.round(params.centerX * 100)}%, ${Math.round(params.centerY * 100)}%)`,
|
|
@@ -139088,15 +139004,15 @@ var capability16 = {
|
|
|
139088
139004
|
android: { emulator: true, device: true, unknown: true }
|
|
139089
139005
|
};
|
|
139090
139006
|
var zodSchema25 = external_exports.object({
|
|
139091
|
-
udid: external_exports.string().describe("
|
|
139092
|
-
centerX: external_exports.number().describe("
|
|
139093
|
-
centerY: external_exports.number().describe("
|
|
139094
|
-
radius: external_exports.number().optional().describe("
|
|
139095
|
-
radiusX: external_exports.number().optional().describe("
|
|
139096
|
-
radiusY: external_exports.number().optional().describe("
|
|
139097
|
-
startAngle: external_exports.number().describe("
|
|
139098
|
-
endAngle: external_exports.number().describe("
|
|
139099
|
-
durationMs: external_exports.number().optional().describe("
|
|
139007
|
+
udid: external_exports.string().describe("Device id from `list-devices` (iOS UDID or Android serial)."),
|
|
139008
|
+
centerX: external_exports.number().describe("Normalized rotation center x."),
|
|
139009
|
+
centerY: external_exports.number().describe("Normalized rotation center y."),
|
|
139010
|
+
radius: external_exports.number().optional().describe("Normalized finger orbit radius (e.g. 0.15)."),
|
|
139011
|
+
radiusX: external_exports.number().optional().describe("Horizontal radius fraction of screen width (pair with `radiusY`)."),
|
|
139012
|
+
radiusY: external_exports.number().optional().describe("Vertical radius fraction of screen height (pair with `radiusX`)."),
|
|
139013
|
+
startAngle: external_exports.number().describe("Start angle in degrees (0 = right, 90 = down)."),
|
|
139014
|
+
endAngle: external_exports.number().describe("End angle in degrees (> startAngle = clockwise)."),
|
|
139015
|
+
durationMs: external_exports.number().optional().describe("Duration in ms (default 300).")
|
|
139100
139016
|
}).refine((p) => p.radiusX === void 0 === (p.radiusY === void 0), {
|
|
139101
139017
|
message: "radiusX and radiusY must be given together (one physical radius, two normalizations)"
|
|
139102
139018
|
}).refine((p) => p.radius !== void 0 || p.radiusX !== void 0, {
|
|
@@ -139104,10 +139020,9 @@ var zodSchema25 = external_exports.object({
|
|
|
139104
139020
|
});
|
|
139105
139021
|
var gestureRotateTool = {
|
|
139106
139022
|
id: "gesture-rotate",
|
|
139107
|
-
description: `Send a two-finger circular arc gesture
|
|
139108
|
-
|
|
139109
|
-
|
|
139110
|
-
Use when you need to rotate a map, image picker, or any rotateable UI element. Returns { rotated: true, timestampMs }. On physical iOS, reactivated: true = app was re-fronted; re-describe. Fails if the simulator-server / emulator backend is not reachable for the given device, or on a physical iPhone when the app is not drawn in portrait.`,
|
|
139023
|
+
description: `Send a two-finger circular arc gesture in normalized [0,1] coords to rotate content from \`startAngle\` to \`endAngle\`. Pass \`radius\`, or \`radiusX\`+\`radiusY\` with \`radiusX\xB7width = radiusY\xB7height\` for a circular physical orbit (a single radius or equal values trace an ellipse on a non-square screen; one half of the pair alone is rejected).
|
|
139024
|
+
Use when rotating a map, photo, or canvas (use \`gesture-pinch\` for zoom).
|
|
139025
|
+
Returns \`{ rotated: true, timestampMs, reactivated? }\` (on physical iOS, \`reactivated: true\` means re-describe). Fails if the backend is unreachable or a physical iPhone app is not in portrait.`,
|
|
139111
139026
|
zodSchema: zodSchema25,
|
|
139112
139027
|
interaction: {
|
|
139113
139028
|
startedMsg: ({ params }) => {
|
|
@@ -139346,7 +139261,91 @@ init_zod();
|
|
|
139346
139261
|
init_src2();
|
|
139347
139262
|
init_capability();
|
|
139348
139263
|
|
|
139349
|
-
// ../tool-server/src/tools/keyboard/
|
|
139264
|
+
// ../tool-server/src/tools/keyboard/platforms/ios.ts
|
|
139265
|
+
init_src2();
|
|
139266
|
+
init_capability();
|
|
139267
|
+
|
|
139268
|
+
// ../tool-server/src/tools/fill/errors.ts
|
|
139269
|
+
init_src2();
|
|
139270
|
+
init_capability();
|
|
139271
|
+
function noFocusedFieldError(stage) {
|
|
139272
|
+
return new InvalidToolInputError(
|
|
139273
|
+
"Nothing that takes text has keyboard focus, so nothing was changed. Tap the text field first, then call fill again.",
|
|
139274
|
+
{
|
|
139275
|
+
error_code: FAILURE_CODES.FILL_NO_FOCUSED_FIELD,
|
|
139276
|
+
failure_stage: stage,
|
|
139277
|
+
error_kind: "validation"
|
|
139278
|
+
}
|
|
139279
|
+
);
|
|
139280
|
+
}
|
|
139281
|
+
function notVerifiedError(stage) {
|
|
139282
|
+
return new FailureError(
|
|
139283
|
+
"fill wrote to the focused field, but reading it back did not show the requested text. The field may hold other or partial text: read it before retrying.",
|
|
139284
|
+
{
|
|
139285
|
+
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
139286
|
+
failure_stage: stage,
|
|
139287
|
+
failure_area: "tool_server",
|
|
139288
|
+
error_kind: "unknown"
|
|
139289
|
+
}
|
|
139290
|
+
);
|
|
139291
|
+
}
|
|
139292
|
+
function notChangedError(stage) {
|
|
139293
|
+
return new FailureError(
|
|
139294
|
+
"fill could not select the text of the focused field, so nothing was changed. Tap the field and retry.",
|
|
139295
|
+
{
|
|
139296
|
+
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
139297
|
+
failure_stage: stage,
|
|
139298
|
+
failure_area: "tool_server",
|
|
139299
|
+
error_kind: "unknown"
|
|
139300
|
+
}
|
|
139301
|
+
);
|
|
139302
|
+
}
|
|
139303
|
+
function notAnsweredError(stage) {
|
|
139304
|
+
return new FailureError(
|
|
139305
|
+
"The device did not finish the fill in time. The field may have changed: read it before retrying.",
|
|
139306
|
+
{
|
|
139307
|
+
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
139308
|
+
failure_stage: stage,
|
|
139309
|
+
failure_area: "tool_server",
|
|
139310
|
+
error_kind: "timeout"
|
|
139311
|
+
}
|
|
139312
|
+
);
|
|
139313
|
+
}
|
|
139314
|
+
function pageNotAnsweringError(stage, waitedMs) {
|
|
139315
|
+
return new FailureError(
|
|
139316
|
+
`The page did not answer for ${waitedMs / 1e3} s, so fill changed nothing. A JavaScript dialog (alert, confirm or prompt) may be open, or the page is busy or has crashed. Argent cannot close a dialog: ask the user to close it, then retry. A retry fills a busy page once its task ends. If no dialog is open and it still does not answer, restart the app.`,
|
|
139317
|
+
{
|
|
139318
|
+
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
139319
|
+
failure_stage: stage,
|
|
139320
|
+
failure_area: "tool_server",
|
|
139321
|
+
error_kind: "timeout"
|
|
139322
|
+
}
|
|
139323
|
+
);
|
|
139324
|
+
}
|
|
139325
|
+
function pageNotFinishedError(stage) {
|
|
139326
|
+
return new FailureError(
|
|
139327
|
+
"The page did not finish the fill in time; it may have opened a JavaScript dialog or crashed. The field may have changed, and may still change when the page resumes: read it before retrying. If the page does not answer and no dialog is open, restart the app.",
|
|
139328
|
+
{
|
|
139329
|
+
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
139330
|
+
failure_stage: stage,
|
|
139331
|
+
failure_area: "tool_server",
|
|
139332
|
+
error_kind: "timeout"
|
|
139333
|
+
}
|
|
139334
|
+
);
|
|
139335
|
+
}
|
|
139336
|
+
function unsupportedFieldError(detail, stage) {
|
|
139337
|
+
return new InvalidToolInputError(
|
|
139338
|
+
`fill cannot set this field's text: ${detail}. Nothing was changed.`,
|
|
139339
|
+
{
|
|
139340
|
+
error_code: FAILURE_CODES.FILL_UNSUPPORTED_FIELD,
|
|
139341
|
+
failure_stage: stage,
|
|
139342
|
+
error_kind: "unsupported"
|
|
139343
|
+
}
|
|
139344
|
+
);
|
|
139345
|
+
}
|
|
139346
|
+
|
|
139347
|
+
// ../tool-server/src/tools/fill/keys.ts
|
|
139348
|
+
init_src2();
|
|
139350
139349
|
init_src2();
|
|
139351
139350
|
|
|
139352
139351
|
// ../tool-server/src/tools/keyboard/key-codes.ts
|
|
@@ -139436,6 +139435,7 @@ function charToKeyPress(char) {
|
|
|
139436
139435
|
}
|
|
139437
139436
|
|
|
139438
139437
|
// ../tool-server/src/tools/keyboard/simulator-server-keys.ts
|
|
139438
|
+
init_src2();
|
|
139439
139439
|
init_capability();
|
|
139440
139440
|
var sleep10 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
139441
139441
|
var KEY_HOLD = { ms: 20 };
|
|
@@ -139493,6 +139493,118 @@ async function typeSimulatorServer(registry2, device, params) {
|
|
|
139493
139493
|
return { typed: params.text ?? params.key ?? "", keys: keysPressed };
|
|
139494
139494
|
}
|
|
139495
139495
|
|
|
139496
|
+
// ../tool-server/src/tools/fill/keys.ts
|
|
139497
|
+
var MAX_CLEAR_KEYS = 100;
|
|
139498
|
+
var XCTEST_DELETE = "\b";
|
|
139499
|
+
var KEY_TIMING = { holdMs: 20, settleMs: 300, typeDelayMs: 30 };
|
|
139500
|
+
var sleep11 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
139501
|
+
function typeableOnSimulator(text) {
|
|
139502
|
+
for (const char of text) if (!charToKeyPress(char)) return false;
|
|
139503
|
+
return true;
|
|
139504
|
+
}
|
|
139505
|
+
async function withoutTextInErrors(stage, run2) {
|
|
139506
|
+
try {
|
|
139507
|
+
return await run2();
|
|
139508
|
+
} catch (err) {
|
|
139509
|
+
const signal = getFailureSignal(err);
|
|
139510
|
+
throw new FailureError(
|
|
139511
|
+
"fill failed partway through typing: the focused field may hold part of the text. Read it before retrying.",
|
|
139512
|
+
signal ?? {
|
|
139513
|
+
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
139514
|
+
failure_stage: stage,
|
|
139515
|
+
failure_area: "tool_server",
|
|
139516
|
+
error_kind: "unknown"
|
|
139517
|
+
}
|
|
139518
|
+
);
|
|
139519
|
+
}
|
|
139520
|
+
}
|
|
139521
|
+
async function pressSimulatorBackspace(registry2, device) {
|
|
139522
|
+
const ref = simulatorServerRef(device);
|
|
139523
|
+
const api = await registry2.resolveService(ref.urn, ref.options);
|
|
139524
|
+
await api.pressKey("Down", NAMED_KEYS.backspace);
|
|
139525
|
+
await sleep11(KEY_TIMING.holdMs);
|
|
139526
|
+
await api.pressKey("Up", NAMED_KEYS.backspace);
|
|
139527
|
+
await sleep11(KEY_TIMING.settleMs);
|
|
139528
|
+
}
|
|
139529
|
+
async function typeOnSimulator(registry2, device, text) {
|
|
139530
|
+
if (!text) return;
|
|
139531
|
+
await withoutTextInErrors(
|
|
139532
|
+
"fill_keys_ios",
|
|
139533
|
+
() => typeSimulatorServer(registry2, device, {
|
|
139534
|
+
udid: device.id,
|
|
139535
|
+
text,
|
|
139536
|
+
delayMs: KEY_TIMING.typeDelayMs
|
|
139537
|
+
})
|
|
139538
|
+
);
|
|
139539
|
+
}
|
|
139540
|
+
async function fillByDeviceKeys(registry2, device, text) {
|
|
139541
|
+
const bundleId = requireCurrentIosDeviceApp(device.id);
|
|
139542
|
+
const ref = iosDeviceRunnerRef(device);
|
|
139543
|
+
const api = await registry2.resolveService(ref.urn, ref.options);
|
|
139544
|
+
const type = async (chars) => {
|
|
139545
|
+
try {
|
|
139546
|
+
return await typeText(api, bundleId, chars);
|
|
139547
|
+
} catch (err) {
|
|
139548
|
+
if (err instanceof RunnerCommandError && err.code === "TEXT_INPUT_NOT_FOCUSED") {
|
|
139549
|
+
throw noFocusedFieldError("fill_keys_ios_device_focus");
|
|
139550
|
+
}
|
|
139551
|
+
throw err;
|
|
139552
|
+
}
|
|
139553
|
+
};
|
|
139554
|
+
let reactivated = false;
|
|
139555
|
+
const cleared = await type(XCTEST_DELETE.repeat(MAX_CLEAR_KEYS));
|
|
139556
|
+
reactivated ||= cleared.reactivated;
|
|
139557
|
+
if (text) {
|
|
139558
|
+
const typed = await withoutTextInErrors("fill_keys_ios_device", () => type(text));
|
|
139559
|
+
reactivated ||= typed.reactivated;
|
|
139560
|
+
}
|
|
139561
|
+
return { reactivated };
|
|
139562
|
+
}
|
|
139563
|
+
|
|
139564
|
+
// ../tool-server/src/tools/fill/ios.ts
|
|
139565
|
+
var NEWLINE = /[\r\n]/;
|
|
139566
|
+
async function fillIos(registry2, device, text) {
|
|
139567
|
+
const ref = axServiceRef(device);
|
|
139568
|
+
const ax = await registry2.resolveService(ref.urn, ref.options);
|
|
139569
|
+
const typeable = typeableOnSimulator(text) && !NEWLINE.test(text);
|
|
139570
|
+
const first = await ax.fill(text, { typeable });
|
|
139571
|
+
if (!first.focused) throw noFocusedFieldError("fill_ios_no_focus");
|
|
139572
|
+
if (first.unsupported) {
|
|
139573
|
+
throw unsupportedFieldError(
|
|
139574
|
+
"the focused element is not a text input (a date or time input, or a picker)",
|
|
139575
|
+
"fill_ios_unsupported_field"
|
|
139576
|
+
);
|
|
139577
|
+
}
|
|
139578
|
+
if (first.singleLine) {
|
|
139579
|
+
throw unsupportedFieldError(
|
|
139580
|
+
"a single-line text field cannot hold a newline",
|
|
139581
|
+
"fill_ios_single_line"
|
|
139582
|
+
);
|
|
139583
|
+
}
|
|
139584
|
+
if (first.timedOut) throw notAnsweredError("fill_ios_timeout");
|
|
139585
|
+
if (first.untouched) throw notChangedError("fill_ios_select_failed");
|
|
139586
|
+
if (first.verified) return { verified: true };
|
|
139587
|
+
if (first.secure) {
|
|
139588
|
+
if (!typeable) {
|
|
139589
|
+
throw unsupportedFieldError(
|
|
139590
|
+
"a secure text field takes only text the keyboard can type on one line, and this text has a character it cannot",
|
|
139591
|
+
"fill_ios_secure_untypeable"
|
|
139592
|
+
);
|
|
139593
|
+
}
|
|
139594
|
+
if (!first.cleared) throw notVerifiedError("fill_ios_secure_not_cleared");
|
|
139595
|
+
await typeOnSimulator(registry2, device, text);
|
|
139596
|
+
const check3 = await ax.fill(text, { check: true });
|
|
139597
|
+
if (check3.verified) return { verified: true };
|
|
139598
|
+
throw notVerifiedError("fill_ios_not_verified");
|
|
139599
|
+
}
|
|
139600
|
+
if (first.needsBackspace) {
|
|
139601
|
+
await pressSimulatorBackspace(registry2, device);
|
|
139602
|
+
const check3 = await ax.fill(text, { check: true });
|
|
139603
|
+
if (check3.verified) return { verified: true };
|
|
139604
|
+
}
|
|
139605
|
+
throw notVerifiedError("fill_ios_not_verified");
|
|
139606
|
+
}
|
|
139607
|
+
|
|
139496
139608
|
// ../tool-server/src/tools/keyboard/ios-readback.ts
|
|
139497
139609
|
var READBACK_TIMING = {
|
|
139498
139610
|
/** Budget to reach the ax-service; past it, typing goes on unchecked. */
|
|
@@ -139617,6 +139729,13 @@ function capitalizedByIos(typed, held) {
|
|
|
139617
139729
|
// ../tool-server/src/tools/keyboard/platforms/tv.ts
|
|
139618
139730
|
init_capability();
|
|
139619
139731
|
async function typeTv(registry2, device, params) {
|
|
139732
|
+
if (params.clear) {
|
|
139733
|
+
throw new UnsupportedOperationError(
|
|
139734
|
+
"keyboard",
|
|
139735
|
+
device,
|
|
139736
|
+
"clearing a field with `clear: true` is not supported on a TV target"
|
|
139737
|
+
);
|
|
139738
|
+
}
|
|
139620
139739
|
if (params.key) {
|
|
139621
139740
|
throw new UnsupportedOperationError(
|
|
139622
139741
|
"keyboard",
|
|
@@ -139634,13 +139753,34 @@ async function typeTv(registry2, device, params) {
|
|
|
139634
139753
|
|
|
139635
139754
|
// ../tool-server/src/tools/keyboard/platforms/ios.ts
|
|
139636
139755
|
async function typeAndReadBack(registry2, device, params) {
|
|
139756
|
+
if (params.clear) {
|
|
139757
|
+
if (params.text) {
|
|
139758
|
+
for (const char of params.text) {
|
|
139759
|
+
if (!charToKeyPress(char)) {
|
|
139760
|
+
throw new InvalidToolInputError(`No keycode for character "${char}"`, {
|
|
139761
|
+
error_code: FAILURE_CODES.KEYBOARD_CHARACTER_UNSUPPORTED,
|
|
139762
|
+
failure_stage: "keyboard_char_simulator",
|
|
139763
|
+
error_kind: "unsupported"
|
|
139764
|
+
});
|
|
139765
|
+
}
|
|
139766
|
+
}
|
|
139767
|
+
}
|
|
139768
|
+
await fillIos(registry2, device, "");
|
|
139769
|
+
if (!params.text && !params.key) {
|
|
139770
|
+
return { typed: "", keys: 0, cleared: true };
|
|
139771
|
+
}
|
|
139772
|
+
}
|
|
139637
139773
|
const { result, readback } = await typeWithReadback(
|
|
139638
139774
|
registry2,
|
|
139639
139775
|
device,
|
|
139640
139776
|
params.text ?? "",
|
|
139641
139777
|
() => typeSimulatorServer(registry2, device, params)
|
|
139642
139778
|
);
|
|
139643
|
-
return
|
|
139779
|
+
return {
|
|
139780
|
+
...result,
|
|
139781
|
+
...params.clear ? { cleared: true } : {},
|
|
139782
|
+
...readback ?? {}
|
|
139783
|
+
};
|
|
139644
139784
|
}
|
|
139645
139785
|
function makeIosImpl3(registry2) {
|
|
139646
139786
|
return {
|
|
@@ -139649,7 +139789,16 @@ function makeIosImpl3(registry2) {
|
|
|
139649
139789
|
}
|
|
139650
139790
|
function makeIosRemoteImpl(registry2) {
|
|
139651
139791
|
return {
|
|
139652
|
-
handler: async (_services, params, device) =>
|
|
139792
|
+
handler: async (_services, params, device) => {
|
|
139793
|
+
if (params.clear && await isRemoteTvOsSimulator(device.id)) {
|
|
139794
|
+
throw new UnsupportedOperationError(
|
|
139795
|
+
"keyboard",
|
|
139796
|
+
device,
|
|
139797
|
+
"clearing a field with `clear: true` is not supported on a TV target"
|
|
139798
|
+
);
|
|
139799
|
+
}
|
|
139800
|
+
return typeAndReadBack(registry2, device, params);
|
|
139801
|
+
}
|
|
139653
139802
|
};
|
|
139654
139803
|
}
|
|
139655
139804
|
|
|
@@ -139688,17 +139837,28 @@ function makeIosDeviceImpl(registry2) {
|
|
|
139688
139837
|
}
|
|
139689
139838
|
);
|
|
139690
139839
|
}
|
|
139691
|
-
if (!params.text && !key2) {
|
|
139840
|
+
if (!params.text && !key2 && !params.clear) {
|
|
139692
139841
|
return {
|
|
139693
139842
|
typed: "",
|
|
139694
139843
|
keys: 0
|
|
139695
139844
|
};
|
|
139696
139845
|
}
|
|
139846
|
+
let keys = 0;
|
|
139847
|
+
let reactivated = false;
|
|
139848
|
+
if (params.clear) {
|
|
139849
|
+
const cleared = await fillByDeviceKeys(registry2, device, "");
|
|
139850
|
+
reactivated ||= cleared.reactivated;
|
|
139851
|
+
if (!params.text) {
|
|
139852
|
+
return {
|
|
139853
|
+
typed: "",
|
|
139854
|
+
keys: 0,
|
|
139855
|
+
...reactivated ? { reactivated: true } : {}
|
|
139856
|
+
};
|
|
139857
|
+
}
|
|
139858
|
+
}
|
|
139697
139859
|
const bundleId = requireCurrentIosDeviceApp(device.id);
|
|
139698
139860
|
const ref = iosDeviceRunnerRef(device);
|
|
139699
139861
|
const api = await registry2.resolveService(ref.urn, ref.options);
|
|
139700
|
-
let keys = 0;
|
|
139701
|
-
let reactivated = false;
|
|
139702
139862
|
if (params.text) {
|
|
139703
139863
|
const typed = await mapNotFocused(typeText(api, bundleId, params.text));
|
|
139704
139864
|
reactivated ||= typed.reactivated;
|
|
@@ -139730,7 +139890,30 @@ function makeIosDeviceImpl(registry2) {
|
|
|
139730
139890
|
|
|
139731
139891
|
// ../tool-server/src/tools/keyboard/platforms/android.ts
|
|
139732
139892
|
init_adb();
|
|
139733
|
-
|
|
139893
|
+
|
|
139894
|
+
// ../tool-server/src/tools/fill/android.ts
|
|
139895
|
+
async function fillAndroid(registry2, device, text) {
|
|
139896
|
+
const ref = androidDevtoolsRef(device);
|
|
139897
|
+
const helper = await registry2.resolveService(ref.urn, ref.options);
|
|
139898
|
+
const answer = await helper.setText(text);
|
|
139899
|
+
if (!answer.focused) throw noFocusedFieldError("fill_android_no_focus");
|
|
139900
|
+
if (answer.singleLine) {
|
|
139901
|
+
throw unsupportedFieldError(
|
|
139902
|
+
"a single-line text field cannot hold a newline",
|
|
139903
|
+
"fill_android_single_line"
|
|
139904
|
+
);
|
|
139905
|
+
}
|
|
139906
|
+
if (answer.timedOut) throw notAnsweredError("fill_android_timeout");
|
|
139907
|
+
if (answer.verified) return { verified: true };
|
|
139908
|
+
throw notVerifiedError("fill_android_not_verified");
|
|
139909
|
+
}
|
|
139910
|
+
|
|
139911
|
+
// ../tool-server/src/tools/keyboard/platforms/android.ts
|
|
139912
|
+
async function typeAndroidPhone(registry2, device, params) {
|
|
139913
|
+
if (params.clear) {
|
|
139914
|
+
if (params.text) assertTypeableAndroidText(params.text);
|
|
139915
|
+
await fillAndroid(registry2, device, "");
|
|
139916
|
+
}
|
|
139734
139917
|
let keysPressed = 0;
|
|
139735
139918
|
if (params.text) {
|
|
139736
139919
|
await injectAndroidText(device.id, params.text);
|
|
@@ -139741,7 +139924,11 @@ async function typeAndroidPhone(device, params) {
|
|
|
139741
139924
|
await injectAndroidNamedKey(device.id, params.key, count2);
|
|
139742
139925
|
keysPressed += count2;
|
|
139743
139926
|
}
|
|
139744
|
-
return {
|
|
139927
|
+
return {
|
|
139928
|
+
typed: params.text ?? params.key ?? "",
|
|
139929
|
+
keys: keysPressed,
|
|
139930
|
+
...params.clear ? { cleared: true } : {}
|
|
139931
|
+
};
|
|
139745
139932
|
}
|
|
139746
139933
|
function makeAndroidImpl(registry2) {
|
|
139747
139934
|
return {
|
|
@@ -139749,7 +139936,7 @@ function makeAndroidImpl(registry2) {
|
|
|
139749
139936
|
// either way), so declaring it makes a missing binary fail with
|
|
139750
139937
|
// `dispatchByPlatform`'s 424 install hint instead of from inside the probe.
|
|
139751
139938
|
requires: ["adb"],
|
|
139752
|
-
handler: async (_services, params, device) => await isAndroidTv(device.id) ? typeTv(registry2, device, params) : typeAndroidPhone(device, params)
|
|
139939
|
+
handler: async (_services, params, device) => await isAndroidTv(device.id) ? typeTv(registry2, device, params) : typeAndroidPhone(registry2, device, params)
|
|
139753
139940
|
};
|
|
139754
139941
|
}
|
|
139755
139942
|
|
|
@@ -139757,6 +139944,259 @@ function makeAndroidImpl(registry2) {
|
|
|
139757
139944
|
init_src2();
|
|
139758
139945
|
init_capability();
|
|
139759
139946
|
|
|
139947
|
+
// ../tool-server/src/tools/fill/chromium.ts
|
|
139948
|
+
init_src2();
|
|
139949
|
+
function buildChromiumFillScript(text) {
|
|
139950
|
+
return `(async () => {
|
|
139951
|
+
const text = ${JSON.stringify(text)};
|
|
139952
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
139953
|
+
try {
|
|
139954
|
+
const deepActive = (doc) => {
|
|
139955
|
+
let el = doc.activeElement;
|
|
139956
|
+
while (el && el.shadowRoot && el.shadowRoot.activeElement) el = el.shadowRoot.activeElement;
|
|
139957
|
+
return el;
|
|
139958
|
+
};
|
|
139959
|
+
let el = deepActive(document);
|
|
139960
|
+
while (el && /^(i?frame|object)$/.test(String(el.tagName).toLowerCase())) {
|
|
139961
|
+
// An <object> showing an image or a plugin has no document to descend into.
|
|
139962
|
+
if (!el.contentWindow) break;
|
|
139963
|
+
let inner = null;
|
|
139964
|
+
try { inner = el.contentDocument; } catch (e) { inner = null; }
|
|
139965
|
+
// A cross-origin or sandboxed frame hides its document.
|
|
139966
|
+
if (!inner) return { status: "unsupported", detail: "focus is in a cross-origin frame, which fill cannot reach" };
|
|
139967
|
+
el = deepActive(inner);
|
|
139968
|
+
}
|
|
139969
|
+
if (!el || el.tagName === undefined) return { status: "no_focus" };
|
|
139970
|
+
const doc = el.ownerDocument || document;
|
|
139971
|
+
const win = doc.defaultView || window;
|
|
139972
|
+
const tag = String(el.tagName).toLowerCase();
|
|
139973
|
+
if (tag === "embed") return { status: "unsupported", detail: "focus is in an <embed>, which fill cannot reach" };
|
|
139974
|
+
const type = tag === "input" ? String(el.type || "text").toLowerCase() : null;
|
|
139975
|
+
if (type !== null && /^(date|time|month|week|datetime-local)$/.test(type)) {
|
|
139976
|
+
return { status: "unsupported", detail: "a " + type + " input holds a structured value" };
|
|
139977
|
+
}
|
|
139978
|
+
const control =
|
|
139979
|
+
tag === "textarea" ||
|
|
139980
|
+
(tag === "input" && !/^(button|checkbox|radio|file|submit|reset|image|range|color|hidden)$/.test(type));
|
|
139981
|
+
if (!control) {
|
|
139982
|
+
// Focus in a closed shadow root stops at its host. An element that can
|
|
139983
|
+
// host one is focusable itself only as a tab stop, an editing host or a
|
|
139984
|
+
// box the user can scroll; one with focus that is none of these, or whose
|
|
139985
|
+
// selection is in its shadow tree, holds it in a closed shadow root. The
|
|
139986
|
+
// browser shows such a selection collapsed before the host, or in place
|
|
139987
|
+
// when the page set it there, even in an editing host's own text. In a
|
|
139988
|
+
// focused page, which :focus needs, an editing host focused itself
|
|
139989
|
+
// matches :focus-visible; one whose focus is in its shadow tree does not.
|
|
139990
|
+
const scrolls = (style) =>
|
|
139991
|
+
(/^(auto|scroll)$/.test(style.overflowY) && el.scrollHeight > el.clientHeight) ||
|
|
139992
|
+
(/^(auto|scroll)$/.test(style.overflowX) && el.scrollWidth > el.clientWidth);
|
|
139993
|
+
const inShadow = (node, offset) => {
|
|
139994
|
+
if (node == null) return false;
|
|
139995
|
+
if (node === el.parentNode && node.childNodes[offset] === el) return true;
|
|
139996
|
+
for (let root = node.getRootNode(); root.host; root = root.host.getRootNode()) if (root.host === el) return true;
|
|
139997
|
+
return false;
|
|
139998
|
+
};
|
|
139999
|
+
const selectionInShadow = () => {
|
|
140000
|
+
if (el.shadowRoot) return false;
|
|
140001
|
+
const sel = el.getRootNode().getSelection();
|
|
140002
|
+
return inShadow(sel.anchorNode, sel.anchorOffset) && inShadow(sel.focusNode, sel.focusOffset);
|
|
140003
|
+
};
|
|
140004
|
+
const focusInShadow = () => {
|
|
140005
|
+
if (el.isContentEditable !== true) return false;
|
|
140006
|
+
try {
|
|
140007
|
+
return el.matches(":focus") && !el.matches(":focus-visible");
|
|
140008
|
+
} catch (e) {
|
|
140009
|
+
// Chromium before 86 has no :focus-visible.
|
|
140010
|
+
return false;
|
|
140011
|
+
}
|
|
140012
|
+
};
|
|
140013
|
+
const closedHost =
|
|
140014
|
+
/-|^(article|aside|blockquote|div|footer|h[1-6]|header|main|nav|p|section|span)$/.test(tag) &&
|
|
140015
|
+
((!el.hasAttribute("tabindex") &&
|
|
140016
|
+
(el.isContentEditable !== true || (el.parentElement !== null && el.parentElement.isContentEditable === true)) &&
|
|
140017
|
+
!scrolls(win.getComputedStyle(el))) ||
|
|
140018
|
+
selectionInShadow() ||
|
|
140019
|
+
focusInShadow());
|
|
140020
|
+
if (closedHost) return { status: "unsupported", detail: "focus is in a closed shadow root, which fill cannot reach" };
|
|
140021
|
+
if (el.isContentEditable !== true) return { status: "no_focus" };
|
|
140022
|
+
}
|
|
140023
|
+
if (control && el.disabled === true) return { status: "unsupported", detail: "it is disabled" };
|
|
140024
|
+
if (control && el.readOnly === true) return { status: "unsupported", detail: "it is read-only" };
|
|
140025
|
+
// An <input> holds one line and drops a newline.
|
|
140026
|
+
if (tag === "input" && /[\\r\\n]/.test(text)) {
|
|
140027
|
+
return { status: "unsupported", detail: "a single-line input cannot hold a newline" };
|
|
140028
|
+
}
|
|
140029
|
+
// A textarea or an editable element stores a CR or CRLF as one LF.
|
|
140030
|
+
const want = text.replace(/\\r\\n?/g, "\\n");
|
|
140031
|
+
// Typed text stops at maxlength, which the value setter ignores.
|
|
140032
|
+
const limited = tag === "textarea" || /^(text|search|url|tel|email|password)$/.test(type);
|
|
140033
|
+
if (limited && el.maxLength >= 0 && want.length > el.maxLength) {
|
|
140034
|
+
return { status: "unsupported", detail: "the text is longer than its maxlength of " + el.maxLength };
|
|
140035
|
+
}
|
|
140036
|
+
// A number input holds only a valid number and an email input drops the
|
|
140037
|
+
// whitespace around an address, typed or set. A detached input of the
|
|
140038
|
+
// same type applies the browser's own sanitization; outside an HTML
|
|
140039
|
+
// document only the XHTML namespace makes it an input.
|
|
140040
|
+
if (type === "number" || type === "email") {
|
|
140041
|
+
const probe = doc.createElementNS("http://www.w3.org/1999/xhtml", "input");
|
|
140042
|
+
probe.type = type;
|
|
140043
|
+
probe.multiple = el.multiple === true;
|
|
140044
|
+
probe.value = text;
|
|
140045
|
+
if (probe.value !== text) {
|
|
140046
|
+
return {
|
|
140047
|
+
status: "unsupported",
|
|
140048
|
+
detail: type === "number" ? "a number input holds only a valid number" : "an email input drops the whitespace around an address",
|
|
140049
|
+
};
|
|
140050
|
+
}
|
|
140051
|
+
}
|
|
140052
|
+
if (!control) {
|
|
140053
|
+
// designMode or <body contenteditable>: the whole document is the field.
|
|
140054
|
+
let host = el;
|
|
140055
|
+
while (host.parentElement && host.parentElement.isContentEditable === true) host = host.parentElement;
|
|
140056
|
+
if (host === doc.body || host === doc.documentElement) {
|
|
140057
|
+
return { status: "unsupported", detail: "the whole document is editable" };
|
|
140058
|
+
}
|
|
140059
|
+
}
|
|
140060
|
+
const trimEnd = (s) => s.replace(/[\\u200b\\ufeff]/g, "").replace(/\\n+$/, "");
|
|
140061
|
+
const read = () =>
|
|
140062
|
+
control ? String(el.value == null ? "" : el.value) : trimEnd(String(el.innerText == null ? el.textContent || "" : el.innerText));
|
|
140063
|
+
// A number input showing text it cannot parse reads as "".
|
|
140064
|
+
const badInput = () => el.validity != null && el.validity.badInput === true;
|
|
140065
|
+
// Chrome stores an edited email address's non-ASCII domain in ASCII, by
|
|
140066
|
+
// UTS #46 transitional processing: the URL parser's, once its deviations
|
|
140067
|
+
// (\xDF, \u03C2, ZWNJ, ZWJ) are mapped.
|
|
140068
|
+
const asciiEmail = (a) => {
|
|
140069
|
+
const at = a.indexOf("@");
|
|
140070
|
+
if (at < 0 || !/[^\\x00-\\x7f]/.test(a)) return a;
|
|
140071
|
+
const host = a.slice(at + 1).replace(/[\\u00df\\u1e9e]/g, "ss").replace(/\\u03c2/g, "\\u03c3").replace(/[\\u200c\\u200d]/g, "");
|
|
140072
|
+
// A link parses its href with the URL parser even where a page's own URL
|
|
140073
|
+
// global shadows the builtin. The ".a" label keeps a numeric last label
|
|
140074
|
+
// from parsing as IPv4.
|
|
140075
|
+
const link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a");
|
|
140076
|
+
link.href = "http://" + host + ".a";
|
|
140077
|
+
// Unparsable, or not a bare host: it has a user, a port or a path.
|
|
140078
|
+
if (link.href !== "http://" + link.hostname + "/") return a;
|
|
140079
|
+
return a.slice(0, at + 1) + link.hostname.slice(0, -2);
|
|
140080
|
+
};
|
|
140081
|
+
const sameText = (got) => {
|
|
140082
|
+
if (type !== "email") return got === want;
|
|
140083
|
+
const split = (s) => (el.multiple === true ? s.split(",") : [s]);
|
|
140084
|
+
const wants = split(want);
|
|
140085
|
+
const gots = split(got);
|
|
140086
|
+
return gots.length === wants.length && gots.every((g, i) => g === wants[i] || g === asciiEmail(wants[i]));
|
|
140087
|
+
};
|
|
140088
|
+
const matches = () => (control ? sameText(read()) && !badInput() : read() === trimEnd(want));
|
|
140089
|
+
const settle = async () => {
|
|
140090
|
+
for (let i = 0; i < 10; i++) {
|
|
140091
|
+
await sleep(i === 0 ? 0 : 50);
|
|
140092
|
+
if (matches()) return true;
|
|
140093
|
+
}
|
|
140094
|
+
return false;
|
|
140095
|
+
};
|
|
140096
|
+
|
|
140097
|
+
const before = read();
|
|
140098
|
+
// The browser fires input synchronously for an edit it performed. The
|
|
140099
|
+
// window's capture phase sees it unless a page listener added there
|
|
140100
|
+
// earlier stops it.
|
|
140101
|
+
let edited = false;
|
|
140102
|
+
const onInput = () => { edited = true; };
|
|
140103
|
+
win.addEventListener("input", onInput, true);
|
|
140104
|
+
try {
|
|
140105
|
+
if (control) {
|
|
140106
|
+
try { el.select(); } catch (e) { /* no selection API */ }
|
|
140107
|
+
} else {
|
|
140108
|
+
const sel = doc.getSelection();
|
|
140109
|
+
const range = doc.createRange();
|
|
140110
|
+
range.selectNodeContents(el);
|
|
140111
|
+
sel.removeAllRanges();
|
|
140112
|
+
sel.addRange(range);
|
|
140113
|
+
}
|
|
140114
|
+
try {
|
|
140115
|
+
if (text === "") {
|
|
140116
|
+
if (read() !== "" || badInput()) doc.execCommand("delete");
|
|
140117
|
+
} else {
|
|
140118
|
+
doc.execCommand("insertText", false, text);
|
|
140119
|
+
}
|
|
140120
|
+
} catch (e) {
|
|
140121
|
+
// An SVG document has no editing commands; a control still has its setter.
|
|
140122
|
+
if (!control) throw e;
|
|
140123
|
+
}
|
|
140124
|
+
} finally {
|
|
140125
|
+
win.removeEventListener("input", onInput, true);
|
|
140126
|
+
}
|
|
140127
|
+
let verified = await settle();
|
|
140128
|
+
// An edit that did not happen fires no input and leaves the old text.
|
|
140129
|
+
// Anything else is the browser's or the page's own rewrite, which the
|
|
140130
|
+
// setter must not override, even when the rewrite equals the old text.
|
|
140131
|
+
if (!verified && control && !edited && read() === before) {
|
|
140132
|
+
const proto = tag === "textarea" ? win.HTMLTextAreaElement.prototype : win.HTMLInputElement.prototype;
|
|
140133
|
+
const setter = Object.getOwnPropertyDescriptor(proto, "value").set;
|
|
140134
|
+
setter.call(el, text);
|
|
140135
|
+
el.dispatchEvent(new win.Event("input", { bubbles: true }));
|
|
140136
|
+
el.dispatchEvent(new win.Event("change", { bubbles: true }));
|
|
140137
|
+
verified = await settle();
|
|
140138
|
+
}
|
|
140139
|
+
return { status: "ok", verified: verified };
|
|
140140
|
+
} catch (e) {
|
|
140141
|
+
return { status: "error" };
|
|
140142
|
+
}
|
|
140143
|
+
})()`;
|
|
140144
|
+
}
|
|
140145
|
+
var PAGE_ANSWER_TIMEOUT_MS = 1e4;
|
|
140146
|
+
var FILL_TIMEOUT_MS2 = 1e4;
|
|
140147
|
+
async function withTimeoutError(send, timeoutError) {
|
|
140148
|
+
try {
|
|
140149
|
+
return await send();
|
|
140150
|
+
} catch (err) {
|
|
140151
|
+
if (getFailureSignal(err)?.error_code === FAILURE_CODES.DEBUGGER_CDP_REQUEST_TIMEOUT) {
|
|
140152
|
+
throw timeoutError();
|
|
140153
|
+
}
|
|
140154
|
+
throw err;
|
|
140155
|
+
}
|
|
140156
|
+
}
|
|
140157
|
+
async function fillChromium(registry2, device, text) {
|
|
140158
|
+
const ref = chromiumCdpRef(device);
|
|
140159
|
+
const api = await withTimeoutError(
|
|
140160
|
+
() => registry2.resolveService(ref.urn, {
|
|
140161
|
+
...ref.options,
|
|
140162
|
+
answerTimeoutMs: PAGE_ANSWER_TIMEOUT_MS
|
|
140163
|
+
}),
|
|
140164
|
+
() => pageNotAnsweringError("fill_chromium_connect", PAGE_ANSWER_TIMEOUT_MS)
|
|
140165
|
+
);
|
|
140166
|
+
await withTimeoutError(
|
|
140167
|
+
() => api.cdp.send("Runtime.evaluate", { expression: "0" }, PAGE_ANSWER_TIMEOUT_MS),
|
|
140168
|
+
() => pageNotAnsweringError("fill_chromium_page_blocked", PAGE_ANSWER_TIMEOUT_MS)
|
|
140169
|
+
);
|
|
140170
|
+
const out = await withTimeoutError(
|
|
140171
|
+
() => api.cdp.send(
|
|
140172
|
+
"Runtime.evaluate",
|
|
140173
|
+
{ expression: buildChromiumFillScript(text), awaitPromise: true, returnByValue: true },
|
|
140174
|
+
FILL_TIMEOUT_MS2
|
|
140175
|
+
),
|
|
140176
|
+
() => pageNotFinishedError("fill_chromium_timeout")
|
|
140177
|
+
);
|
|
140178
|
+
const answer = out.result?.value;
|
|
140179
|
+
switch (answer?.status) {
|
|
140180
|
+
case "ok":
|
|
140181
|
+
if (answer.verified === true) {
|
|
140182
|
+
return { verified: true };
|
|
140183
|
+
}
|
|
140184
|
+
throw notVerifiedError("fill_chromium_not_verified");
|
|
140185
|
+
case "no_focus":
|
|
140186
|
+
throw noFocusedFieldError("fill_chromium_no_focus");
|
|
140187
|
+
case "unsupported":
|
|
140188
|
+
throw unsupportedFieldError(answer.detail ?? "unsupported field", "fill_chromium_field");
|
|
140189
|
+
default:
|
|
140190
|
+
throw new FailureError("fill could not run in the page; nothing is known about the field.", {
|
|
140191
|
+
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
140192
|
+
failure_stage: "fill_chromium_script",
|
|
140193
|
+
failure_area: "tool_server",
|
|
140194
|
+
error_kind: "unknown",
|
|
140195
|
+
failure_command: "cdp"
|
|
140196
|
+
});
|
|
140197
|
+
}
|
|
140198
|
+
}
|
|
140199
|
+
|
|
139760
140200
|
// ../tool-server/src/tools/keyboard/chromium-keys.ts
|
|
139761
140201
|
var CHROMIUM_NAMED_KEYS = {
|
|
139762
140202
|
"enter": { key: "Enter", code: "Enter", windowsVirtualKeyCode: 13 },
|
|
@@ -139823,7 +140263,7 @@ function charToChromiumKey(char) {
|
|
|
139823
140263
|
}
|
|
139824
140264
|
|
|
139825
140265
|
// ../tool-server/src/tools/keyboard/platforms/chromium.ts
|
|
139826
|
-
var
|
|
140266
|
+
var sleep12 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
139827
140267
|
async function runChromium(api, params) {
|
|
139828
140268
|
const delay3 = params.delayMs ?? 50;
|
|
139829
140269
|
let keysPressed = 0;
|
|
@@ -139851,7 +140291,7 @@ async function runChromium(api, params) {
|
|
|
139851
140291
|
windowsVirtualKeyCode: desc.windowsVirtualKeyCode
|
|
139852
140292
|
});
|
|
139853
140293
|
keysPressed++;
|
|
139854
|
-
await
|
|
140294
|
+
await sleep12(delay3);
|
|
139855
140295
|
}
|
|
139856
140296
|
}
|
|
139857
140297
|
if (params.key) {
|
|
@@ -139877,7 +140317,7 @@ async function runChromium(api, params) {
|
|
|
139877
140317
|
code: named.code,
|
|
139878
140318
|
windowsVirtualKeyCode: named.windowsVirtualKeyCode
|
|
139879
140319
|
});
|
|
139880
|
-
await
|
|
140320
|
+
await sleep12(delay3);
|
|
139881
140321
|
await api.dispatchKeyEvent({
|
|
139882
140322
|
type: "keyUp",
|
|
139883
140323
|
key: named.key,
|
|
@@ -139885,7 +140325,7 @@ async function runChromium(api, params) {
|
|
|
139885
140325
|
windowsVirtualKeyCode: named.windowsVirtualKeyCode
|
|
139886
140326
|
});
|
|
139887
140327
|
keysPressed++;
|
|
139888
|
-
if (i < count2 - 1) await
|
|
140328
|
+
if (i < count2 - 1) await sleep12(delay3);
|
|
139889
140329
|
}
|
|
139890
140330
|
}
|
|
139891
140331
|
return { typed: params.text ?? params.key ?? "", keys: keysPressed };
|
|
@@ -139893,18 +140333,44 @@ async function runChromium(api, params) {
|
|
|
139893
140333
|
function makeChromiumImpl(registry2) {
|
|
139894
140334
|
return {
|
|
139895
140335
|
handler: async (_services, params, device) => {
|
|
140336
|
+
if (params.clear) {
|
|
140337
|
+
if (params.text) {
|
|
140338
|
+
for (const char of params.text) {
|
|
140339
|
+
if (!charToChromiumKey(char)) {
|
|
140340
|
+
throw new InvalidToolInputError(`No CDP key descriptor for character "${char}"`, {
|
|
140341
|
+
error_code: FAILURE_CODES.KEYBOARD_CHARACTER_UNSUPPORTED,
|
|
140342
|
+
failure_stage: "keyboard_char_chromium",
|
|
140343
|
+
error_kind: "unsupported"
|
|
140344
|
+
});
|
|
140345
|
+
}
|
|
140346
|
+
}
|
|
140347
|
+
}
|
|
140348
|
+
await fillChromium(registry2, device, "");
|
|
140349
|
+
if (!params.text && !params.key) {
|
|
140350
|
+
return { typed: "", keys: 0, cleared: true };
|
|
140351
|
+
}
|
|
140352
|
+
}
|
|
139896
140353
|
const ref = chromiumCdpRef(device);
|
|
139897
140354
|
const chromium = await registry2.resolveService(ref.urn, ref.options);
|
|
139898
|
-
|
|
140355
|
+
const result = await runChromium(chromium, params);
|
|
140356
|
+
return params.clear ? { ...result, cleared: true } : result;
|
|
139899
140357
|
}
|
|
139900
140358
|
};
|
|
139901
140359
|
}
|
|
139902
140360
|
|
|
139903
140361
|
// ../tool-server/src/tools/keyboard/platforms/macos.ts
|
|
139904
|
-
|
|
140362
|
+
init_capability();
|
|
140363
|
+
var sleep13 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
139905
140364
|
function makeMacosImpl(registry2) {
|
|
139906
140365
|
return {
|
|
139907
140366
|
handler: async (_services, params, device) => {
|
|
140367
|
+
if (params.clear) {
|
|
140368
|
+
throw new UnsupportedOperationError(
|
|
140369
|
+
"keyboard",
|
|
140370
|
+
device,
|
|
140371
|
+
'clearing a field with `clear: true` is not supported on Mac apps; when a text field is focused, send `key: "command+a"` then `key: "backspace"`'
|
|
140372
|
+
);
|
|
140373
|
+
}
|
|
139908
140374
|
const app = await resolveMacosApp(registry2, device, "keyboard");
|
|
139909
140375
|
if (params.text) {
|
|
139910
140376
|
const keys = await macosTypeText(app, params.text, { delayMs: params.delayMs });
|
|
@@ -139915,7 +140381,7 @@ function makeMacosImpl(registry2) {
|
|
|
139915
140381
|
const delay3 = params.delayMs ?? 50;
|
|
139916
140382
|
for (let i = 0; i < count2; i++) {
|
|
139917
140383
|
await macosPressKey(app, params.key);
|
|
139918
|
-
if (i < count2 - 1) await
|
|
140384
|
+
if (i < count2 - 1) await sleep13(delay3);
|
|
139919
140385
|
}
|
|
139920
140386
|
return { typed: params.key, keys: count2 };
|
|
139921
140387
|
}
|
|
@@ -139924,6 +140390,9 @@ function makeMacosImpl(registry2) {
|
|
|
139924
140390
|
};
|
|
139925
140391
|
}
|
|
139926
140392
|
|
|
140393
|
+
// ../tool-server/src/tools/keyboard/platforms/vega.ts
|
|
140394
|
+
init_capability();
|
|
140395
|
+
|
|
139927
140396
|
// ../tool-server/src/utils/vega-input.ts
|
|
139928
140397
|
init_src2();
|
|
139929
140398
|
init_adb();
|
|
@@ -140020,7 +140489,14 @@ async function injectVegaText(text) {
|
|
|
140020
140489
|
}
|
|
140021
140490
|
|
|
140022
140491
|
// ../tool-server/src/tools/keyboard/platforms/vega.ts
|
|
140023
|
-
async function runVega2(params) {
|
|
140492
|
+
async function runVega2(device, params) {
|
|
140493
|
+
if (params.clear) {
|
|
140494
|
+
throw new UnsupportedOperationError(
|
|
140495
|
+
"keyboard",
|
|
140496
|
+
device,
|
|
140497
|
+
"clearing a field with `clear: true` is not supported on Vega"
|
|
140498
|
+
);
|
|
140499
|
+
}
|
|
140024
140500
|
let keysPressed = 0;
|
|
140025
140501
|
if (params.text) {
|
|
140026
140502
|
await injectVegaText(params.text);
|
|
@@ -140037,7 +140513,7 @@ async function runVega2(params) {
|
|
|
140037
140513
|
}
|
|
140038
140514
|
var vegaImpl4 = {
|
|
140039
140515
|
requires: ["adb"],
|
|
140040
|
-
handler: (_services, params) => runVega2(params)
|
|
140516
|
+
handler: (_services, params, device) => runVega2(device, params)
|
|
140041
140517
|
};
|
|
140042
140518
|
|
|
140043
140519
|
// ../tool-server/src/tools/keyboard/platforms/harmony.ts
|
|
@@ -140094,7 +140570,14 @@ function resolveHarmonyKeycode(key2) {
|
|
|
140094
140570
|
}
|
|
140095
140571
|
return code;
|
|
140096
140572
|
}
|
|
140097
|
-
async function typeHarmony(connectKey, params, signal) {
|
|
140573
|
+
async function typeHarmony(device, connectKey, params, signal) {
|
|
140574
|
+
if (params.clear) {
|
|
140575
|
+
throw new UnsupportedOperationError(
|
|
140576
|
+
"keyboard",
|
|
140577
|
+
device,
|
|
140578
|
+
"clearing a field with `clear: true` is not supported on HarmonyOS"
|
|
140579
|
+
);
|
|
140580
|
+
}
|
|
140098
140581
|
const keycode = params.key ? resolveHarmonyKeycode(params.key) : null;
|
|
140099
140582
|
if (params.text) assertTypeableHarmonyText(params.text);
|
|
140100
140583
|
if (keycode === null && !params.text) return { typed: "", keys: 0 };
|
|
@@ -140133,7 +140616,7 @@ async function typeHarmony(connectKey, params, signal) {
|
|
|
140133
140616
|
}
|
|
140134
140617
|
var harmonyImpl5 = {
|
|
140135
140618
|
requires: ["hdc"],
|
|
140136
|
-
handler: (_services, params, device, options) => typeHarmony(harmonyConnectKey(device.id), params, options?.signal)
|
|
140619
|
+
handler: (_services, params, device, options) => typeHarmony(device, harmonyConnectKey(device.id), params, options?.signal)
|
|
140137
140620
|
};
|
|
140138
140621
|
|
|
140139
140622
|
// ../tool-server/src/tools/keyboard/index.ts
|
|
@@ -140152,7 +140635,10 @@ var zodSchema27 = external_exports.object({
|
|
|
140152
140635
|
"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)."
|
|
140153
140636
|
),
|
|
140154
140637
|
key: external_exports.string().optional().describe(
|
|
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>"
|
|
140638
|
+
"Named key. Cannot be combined with `text` or `clear` (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>"
|
|
140639
|
+
),
|
|
140640
|
+
clear: external_exports.boolean().optional().describe(
|
|
140641
|
+
"Clear the focused text field before typing `text` (or alone when `text` is omitted). Cannot be combined with `key`. Fails if nothing editable has focus. On physical iOS, deletes up to 100 characters before the caret, unverified, and returns no `cleared`. Not supported on <flag:macos-apps>Mac apps, </flag:macos-apps><flag:harmonyos>HarmonyOS, </flag:harmonyos>Apple TV, Android TV, or Vega."
|
|
140156
140642
|
),
|
|
140157
140643
|
repeat: external_exports.number().int().min(1).max(100).optional().describe(
|
|
140158
140644
|
'Press `key` this many times in one call, e.g. `{ key: "backspace", repeat: 12 }`. Only valid with `key`.'
|
|
@@ -140178,7 +140664,7 @@ function createKeyboardTool(registry2) {
|
|
|
140178
140664
|
id: "keyboard",
|
|
140179
140665
|
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
140666
|
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.`,
|
|
140667
|
+
Returns { typed, keys, cleared?, 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.`,
|
|
140182
140668
|
zodSchema: zodSchema27,
|
|
140183
140669
|
alwaysLoad: true,
|
|
140184
140670
|
searchHint: "type text keyboard input named key enter escape arrow tv vega fire tv <flag:harmonyos>harmony harmonyos </flag:harmonyos>search field hid leanback",
|
|
@@ -140191,6 +140677,9 @@ Returns { typed, keys, verified?, warning?, reactivated? }. Fails if an unsuppor
|
|
|
140191
140677
|
// rejects (text+key, `{ key: "" }`), while `completedMsg` runs only after
|
|
140192
140678
|
// a success and sees neither. Both see the empty request, a no-op.
|
|
140193
140679
|
startedMsg: ({ params }) => {
|
|
140680
|
+
if (params.clear && params.key === void 0) {
|
|
140681
|
+
return params.text !== void 0 ? "Clearing field and entering text" : "Clearing field";
|
|
140682
|
+
}
|
|
140194
140683
|
if (params.text === void 0) {
|
|
140195
140684
|
return (params.repeat ?? 1) > 1 ? `Pressing a key ${params.repeat} times` : "Pressing a key";
|
|
140196
140685
|
}
|
|
@@ -140198,6 +140687,9 @@ Returns { typed, keys, verified?, warning?, reactivated? }. Fails if an unsuppor
|
|
|
140198
140687
|
return "Entering text and pressing a key";
|
|
140199
140688
|
},
|
|
140200
140689
|
completedMsg: ({ params }) => {
|
|
140690
|
+
if (params.clear) {
|
|
140691
|
+
return params.text !== void 0 ? "Cleared field and entered text" : "Cleared field";
|
|
140692
|
+
}
|
|
140201
140693
|
if (params.text !== void 0) return "Entered text";
|
|
140202
140694
|
return (params.repeat ?? 1) > 1 ? `Pressed a key ${params.repeat} times` : "Pressed a key";
|
|
140203
140695
|
},
|
|
@@ -140244,6 +140736,14 @@ Returns { typed, keys, verified?, warning?, reactivated? }. Fails if an unsuppor
|
|
|
140244
140736
|
}
|
|
140245
140737
|
);
|
|
140246
140738
|
}
|
|
140739
|
+
if (params.clear && params.key !== void 0) {
|
|
140740
|
+
throw new InvalidToolInputError(
|
|
140741
|
+
"keyboard `clear: true` cannot be combined with `key`, so nothing was changed. Pass `clear: true` alone to empty the field, or with `text` to replace its contents.",
|
|
140742
|
+
{
|
|
140743
|
+
failure_stage: "keyboard_clear_and_key_combined"
|
|
140744
|
+
}
|
|
140745
|
+
);
|
|
140746
|
+
}
|
|
140247
140747
|
if (params.repeat !== void 0 && params.key === void 0) {
|
|
140248
140748
|
throw new InvalidToolInputError(
|
|
140249
140749
|
'`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`.',
|
|
@@ -140252,14 +140752,24 @@ Returns { typed, keys, verified?, warning?, reactivated? }. Fails if an unsuppor
|
|
|
140252
140752
|
}
|
|
140253
140753
|
);
|
|
140254
140754
|
}
|
|
140255
|
-
|
|
140755
|
+
const runDispatch = async (callParams) => {
|
|
140756
|
+
try {
|
|
140757
|
+
return await dispatch(services, callParams, options);
|
|
140758
|
+
} catch (err) {
|
|
140759
|
+
if (callParams.clear && err instanceof Error && getFailureSignal(err)?.error_code?.startsWith("FILL_")) {
|
|
140760
|
+
err.message = err.message.replace(/\bthe fill\b/g, "clearing the field").replace(/\bfill\b/g, "keyboard");
|
|
140761
|
+
}
|
|
140762
|
+
throw err;
|
|
140763
|
+
}
|
|
140764
|
+
};
|
|
140765
|
+
if (params.text === void 0) return runDispatch(params);
|
|
140256
140766
|
const { text, secrets } = resolveSecretPlaceholders(params.text, {
|
|
140257
140767
|
clientSecrets: options?.clientSecrets
|
|
140258
140768
|
});
|
|
140259
|
-
if (secrets.length === 0) return
|
|
140769
|
+
if (secrets.length === 0) return runDispatch(params);
|
|
140260
140770
|
noteTypedSecrets(params.udid, secrets);
|
|
140261
140771
|
try {
|
|
140262
|
-
const result = await
|
|
140772
|
+
const result = await runDispatch({ ...params, text });
|
|
140263
140773
|
return { ...result, typed: params.text };
|
|
140264
140774
|
} catch (err) {
|
|
140265
140775
|
throw redactSecretsFromError(err, secrets);
|
|
@@ -140272,10 +140782,10 @@ Returns { typed, keys, verified?, warning?, reactivated? }. Fails if an unsuppor
|
|
|
140272
140782
|
init_zod();
|
|
140273
140783
|
var pasteZodSchema = external_exports.object({
|
|
140274
140784
|
udid: external_exports.string().min(1).describe(
|
|
140275
|
-
"
|
|
140785
|
+
"Device id from `list-devices` (iOS simulator UDID, Android emulator serial<flag:macos-apps>, or Mac app id</flag:macos-apps>)."
|
|
140276
140786
|
),
|
|
140277
140787
|
text: external_exports.string().min(1).describe(
|
|
140278
|
-
"Text to
|
|
140788
|
+
"Text to paste. Supports `{{secret:<NAME>}}` placeholders resolved server-side (never ask the user for plaintext)."
|
|
140279
140789
|
)
|
|
140280
140790
|
});
|
|
140281
140791
|
|
|
@@ -140285,7 +140795,7 @@ init_capability();
|
|
|
140285
140795
|
var LEFT_GUI_KEYCODE = 227;
|
|
140286
140796
|
var V_KEYCODE = charToKeyPress("v").keyCode;
|
|
140287
140797
|
var CHORD_STEP_MS = 50;
|
|
140288
|
-
var
|
|
140798
|
+
var sleep14 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
140289
140799
|
var typesAsText = (char) => !"\n\r ".includes(char) && !!charToKeyPress(char);
|
|
140290
140800
|
function rejectTv(device) {
|
|
140291
140801
|
throw new UnsupportedOperationError(
|
|
@@ -140311,13 +140821,13 @@ async function pasteSimulator(registry2, device, api, params) {
|
|
|
140311
140821
|
return { pasted: true, via: "keyboard" };
|
|
140312
140822
|
}
|
|
140313
140823
|
await api.pressKey("Down", LEFT_GUI_KEYCODE);
|
|
140314
|
-
await
|
|
140824
|
+
await sleep14(CHORD_STEP_MS);
|
|
140315
140825
|
await api.pressKey("Down", V_KEYCODE);
|
|
140316
|
-
await
|
|
140826
|
+
await sleep14(CHORD_STEP_MS);
|
|
140317
140827
|
await api.pressKey("Up", V_KEYCODE);
|
|
140318
|
-
await
|
|
140828
|
+
await sleep14(CHORD_STEP_MS);
|
|
140319
140829
|
await api.pressKey("Up", LEFT_GUI_KEYCODE);
|
|
140320
|
-
await
|
|
140830
|
+
await sleep14(CHORD_STEP_MS);
|
|
140321
140831
|
return { pasted: true };
|
|
140322
140832
|
}
|
|
140323
140833
|
function makeIosImpl4(registry2) {
|
|
@@ -140432,9 +140942,9 @@ function createPasteTool(registry2) {
|
|
|
140432
140942
|
});
|
|
140433
140943
|
return {
|
|
140434
140944
|
id: "paste",
|
|
140435
|
-
description: `Set the
|
|
140436
|
-
|
|
140437
|
-
|
|
140945
|
+
description: `Set the device clipboard to \`text\` and paste into the focused field (iOS simulator, Android emulator).<flag:macos-apps> Mac app: types \`text\` directly without touching the pasteboard.</flag:macos-apps>
|
|
140946
|
+
Use when pasting something a real user would paste (OTP/2FA code, long token/URL, or testing paste handling). Use \`keyboard\` for normal typing. Tap the field first to focus it.
|
|
140947
|
+
Returns \`{ pasted: true, via? }\`. Fails on TV targets, if clipboard/typing fails<flag:macos-apps>, or if the Mac app focus accepts no text</flag:macos-apps>.`,
|
|
140438
140948
|
zodSchema: pasteZodSchema,
|
|
140439
140949
|
searchHint: "paste clipboard pasteboard otp 2fa code fill field",
|
|
140440
140950
|
interaction: {
|
|
@@ -140729,7 +141239,7 @@ async function prepareHostWindowShake(target) {
|
|
|
140729
141239
|
var execFileAsync36 = (0, import_node_util37.promisify)(import_node_child_process48.execFile);
|
|
140730
141240
|
var SHAKE_NOTIFICATION = "com.apple.UIKit.SimulatorShake";
|
|
140731
141241
|
var SHAKE_INTERVAL_MS = 400;
|
|
140732
|
-
var
|
|
141242
|
+
var sleep15 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
140733
141243
|
var NOTIFYUTIL_ARGV = ["notifyutil", "-p", SHAKE_NOTIFICATION];
|
|
140734
141244
|
function rejectTv2(toolId, device) {
|
|
140735
141245
|
throw new UnsupportedOperationError(
|
|
@@ -140765,7 +141275,7 @@ var iosImpl4 = {
|
|
|
140765
141275
|
const args = await simctlArgsForUdid(udid, ["spawn", udid, ...NOTIFYUTIL_ARGV]);
|
|
140766
141276
|
const shaker = await prepareHostWindowShake({ kind: "ios", udid, name: device.name });
|
|
140767
141277
|
for (let i = 0; i < count2; i++) {
|
|
140768
|
-
if (i > 0) await
|
|
141278
|
+
if (i > 0) await sleep15(SHAKE_INTERVAL_MS);
|
|
140769
141279
|
shaker.begin();
|
|
140770
141280
|
try {
|
|
140771
141281
|
await execFileAsync36("xcrun", args, { timeout: 15e3 });
|
|
@@ -140785,7 +141295,7 @@ var iosRemoteImpl6 = {
|
|
|
140785
141295
|
const count2 = params.count ?? 1;
|
|
140786
141296
|
if (await isRemoteTvOsSimulator(udid)) rejectTv2("shake", device);
|
|
140787
141297
|
for (let i = 0; i < count2; i++) {
|
|
140788
|
-
if (i > 0) await
|
|
141298
|
+
if (i > 0) await sleep15(SHAKE_INTERVAL_MS);
|
|
140789
141299
|
let result;
|
|
140790
141300
|
try {
|
|
140791
141301
|
result = await simctlSpawn(udid, { args: NOTIFYUTIL_ARGV });
|
|
@@ -140833,7 +141343,7 @@ function restingVectorFrom(stdout) {
|
|
|
140833
141343
|
return read;
|
|
140834
141344
|
}
|
|
140835
141345
|
var fmt = (v) => `${v.x.toFixed(4)}:${v.y.toFixed(4)}:${v.z.toFixed(4)}`;
|
|
140836
|
-
var
|
|
141346
|
+
var sleep16 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
140837
141347
|
var inFlightByDevice = /* @__PURE__ */ new Map();
|
|
140838
141348
|
function withDeviceLock(serial, fn) {
|
|
140839
141349
|
const previous = inFlightByDevice.get(serial) ?? Promise.resolve();
|
|
@@ -140898,7 +141408,7 @@ var androidImpl6 = {
|
|
|
140898
141408
|
y: rest.y,
|
|
140899
141409
|
z: rest.z
|
|
140900
141410
|
});
|
|
140901
|
-
await
|
|
141411
|
+
await sleep16(SWING_INTERVAL_MS);
|
|
140902
141412
|
}
|
|
140903
141413
|
}
|
|
140904
141414
|
} catch (err) {
|
|
@@ -140943,11 +141453,9 @@ var capability21 = {
|
|
|
140943
141453
|
};
|
|
140944
141454
|
var shakeTool = {
|
|
140945
141455
|
id: "shake",
|
|
140946
|
-
description: `Send a shake gesture to
|
|
140947
|
-
Use when
|
|
140948
|
-
|
|
140949
|
-
Returns { shaken: true, count }.
|
|
140950
|
-
Works on local and remote (sim-remote) iOS simulators. Fails on a physical device or a TV: only phone/tablet simulators and emulators are supported.`,
|
|
141456
|
+
description: `Send a shake gesture to an iOS simulator or Android emulator.
|
|
141457
|
+
Use when triggering shake-bound actions (iOS Undo/Redo Typing, React Native dev menu, shake-to-report).
|
|
141458
|
+
Returns \`{ shaken: true, count }\`. Fails on physical devices or TVs.`,
|
|
140951
141459
|
zodSchema: shakeZodSchema,
|
|
140952
141460
|
searchHint: "shake motion accelerometer undo typing dev menu gesture",
|
|
140953
141461
|
interaction: {
|
|
@@ -140974,18 +141482,16 @@ init_device_info();
|
|
|
140974
141482
|
// ../tool-server/src/tools/network-conditions/schema.ts
|
|
140975
141483
|
init_zod();
|
|
140976
141484
|
var networkConditionsZodSchema = external_exports.object({
|
|
140977
|
-
udid: external_exports.string().min(1).describe("Device ID from list-devices
|
|
140978
|
-
bundleId: external_exports.string().min(1).optional().describe("
|
|
141485
|
+
udid: external_exports.string().min(1).describe("Device ID from `list-devices`."),
|
|
141486
|
+
bundleId: external_exports.string().min(1).optional().describe("App bundle ID (required on iOS; ignored elsewhere)."),
|
|
140979
141487
|
port: metroPortField.describe(
|
|
140980
|
-
"Metro port
|
|
141488
|
+
"Metro port exempt from shaping (omit for device default, usually 8081)."
|
|
140981
141489
|
),
|
|
140982
|
-
latencyMs: external_exports.number().int().min(0).max(6e4).optional().describe(
|
|
140983
|
-
|
|
140984
|
-
),
|
|
140985
|
-
downloadKbps: external_exports.number().int().min(1).optional().describe("Download limit in kilobits per second."),
|
|
140986
|
-
uploadKbps: external_exports.number().int().min(1).optional().describe("Upload limit in kilobits per second."),
|
|
141490
|
+
latencyMs: external_exports.number().int().min(0).max(6e4).optional().describe("Added latency in ms."),
|
|
141491
|
+
downloadKbps: external_exports.number().int().min(1).optional().describe("Download cap in kbps."),
|
|
141492
|
+
uploadKbps: external_exports.number().int().min(1).optional().describe("Upload cap in kbps."),
|
|
140987
141493
|
offline: external_exports.boolean().optional().describe(
|
|
140988
|
-
"
|
|
141494
|
+
"Simulate offline (on Android, `adb reverse` ports stay reachable while Metro at `10.0.2.2` does not; `false` alone resets conditions)."
|
|
140989
141495
|
)
|
|
140990
141496
|
}).strict();
|
|
140991
141497
|
function requestedConditions(params) {
|
|
@@ -141216,12 +141722,9 @@ var capability22 = {
|
|
|
141216
141722
|
};
|
|
141217
141723
|
var networkConditionsTool = {
|
|
141218
141724
|
id: "network-conditions",
|
|
141219
|
-
description: `Add latency,
|
|
141220
|
-
|
|
141221
|
-
|
|
141222
|
-
On Android, Argent shapes traffic that uses the system proxy. Restart the app if existing connections bypass shaping. Throttling fails if the emulator has a proxy Argent did not set. Ethernet can prevent offline mode. Reset if a crash leaves the emulator unable to connect.
|
|
141223
|
-
On Chromium, Argent shapes the active page. Workers and cross-site iframes are outside its scope.
|
|
141224
|
-
Fails on physical devices and remote iOS simulators.`,
|
|
141725
|
+
description: `Add latency, throttle bandwidth, or simulate offline mode on iOS simulators (per-app via native devtools, Metro/WS exempt), Android emulators (system proxy), or Chromium (active page). On Android, restart the app if existing connections bypass shaping, note that Ethernet can prevent offline mode, and reset if a crash leaves the emulator unable to connect. Omit all condition fields to reset.
|
|
141726
|
+
Use when testing loading states, retries, or timeouts (each call replaces previous conditions).
|
|
141727
|
+
Returns the scope and applied conditions (or null on reset), or on iOS a \`{ status, message }\` precheck block (follow \`message\` if \`status\` is present). Fails on physical devices, remote iOS simulators, or if Android has an unmanaged proxy.`,
|
|
141225
141728
|
zodSchema: networkConditionsZodSchema,
|
|
141226
141729
|
searchHint: "network throttle latency slow offline bandwidth 3g conditions emulate",
|
|
141227
141730
|
interaction: {
|
|
@@ -141270,7 +141773,7 @@ var DISMISS_SPACING_MS = 1e3;
|
|
|
141270
141773
|
var DISMISS_TIMEOUT_MS = 5e3;
|
|
141271
141774
|
var WAKE_GRACE_READS = 2;
|
|
141272
141775
|
var abortReason2 = (signal) => signal.reason instanceof Error ? signal.reason : new Error("The fold was cancelled.");
|
|
141273
|
-
var
|
|
141776
|
+
var sleep17 = (ms3, signal) => new Promise((resolve21, reject) => {
|
|
141274
141777
|
if (signal?.aborted) return reject(abortReason2(signal));
|
|
141275
141778
|
const timer = setTimeout(resolve21, ms3);
|
|
141276
141779
|
signal?.addEventListener(
|
|
@@ -141344,7 +141847,7 @@ async function awaitSettled(serial, expected, wake, signal) {
|
|
|
141344
141847
|
let agreeing = 0;
|
|
141345
141848
|
const deadline = Date.now() + SETTLE_TIMEOUT_MS2;
|
|
141346
141849
|
while (Date.now() < deadline) {
|
|
141347
|
-
await
|
|
141850
|
+
await sleep17(POLL_MS2, signal);
|
|
141348
141851
|
const read = await readSnapshot(serial);
|
|
141349
141852
|
const same = read.state === last?.state && read.awake === last?.awake;
|
|
141350
141853
|
if (!isReady(read, expected)) agreeing = 0;
|
|
@@ -141379,7 +141882,7 @@ async function dismissFoldLockScreen(serial, signal) {
|
|
|
141379
141882
|
await shell(serial, "wm dismiss-keyguard");
|
|
141380
141883
|
}
|
|
141381
141884
|
}
|
|
141382
|
-
await
|
|
141885
|
+
await sleep17(POLL_MS2, signal);
|
|
141383
141886
|
}
|
|
141384
141887
|
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.";
|
|
141385
141888
|
}
|
|
@@ -141636,25 +142139,19 @@ var iosImpl6 = {
|
|
|
141636
142139
|
};
|
|
141637
142140
|
var zodSchema29 = external_exports.object({
|
|
141638
142141
|
udid: external_exports.string().describe(
|
|
141639
|
-
"
|
|
141640
|
-
),
|
|
141641
|
-
posture: external_exports.enum(POSTURES2).optional().describe(
|
|
141642
|
-
"Where to move the hinge: `closed` shows the cover panel, `half-open` and `open` show the inner panel."
|
|
142142
|
+
"Foldable device id from `list-devices` (iOS simulator UDID or Android emulator serial)."
|
|
141643
142143
|
),
|
|
141644
|
-
|
|
142144
|
+
posture: external_exports.enum(POSTURES2).optional().describe("Target posture: `closed` (cover panel), `half-open`, or `open` (inner panel)."),
|
|
142145
|
+
angle: external_exports.number().min(0).max(180).optional().describe("Hinge angle in degrees (0 = closed, 180 = open).")
|
|
141645
142146
|
}).refine((p) => p.posture === void 0 !== (p.angle === void 0), {
|
|
141646
142147
|
message: "Pass exactly one of `posture` and `angle`."
|
|
141647
142148
|
});
|
|
141648
142149
|
var foldTool = {
|
|
141649
142150
|
id: "fold",
|
|
141650
|
-
description: `Move
|
|
141651
|
-
Use when
|
|
141652
|
-
|
|
141653
|
-
|
|
141654
|
-
To move a full-screen app onto either half of the open iPhone Duo, use \`gesture-custom\` with \`edge: "bottom"\`. Drag up, pause at center, then drag sideways and release in one contact.
|
|
141655
|
-
iOS returns { activeScreen, screen: { id, panel, width, height }, posture?, hingeAngle, warning? }. screen names the active panel and gives its size in pixels. posture is set only at 0\xB0, 120\xB0 and 180\xB0. warning is set when argent cannot find the active panel, or when the device did not change to the expected panel.
|
|
141656
|
-
Android returns { posture?, deviceState, hingeAngle?, warning? }. deviceState is the state Android committed (CLOSED, HALF_OPENED, OPENED), and posture is the matching preset. A lock screen the fold raises is dismissed; warning is set when it cannot be, or when a lock screen is showing or the screen is off after the fold. On a generic foldable AVD, closed shows only the left part of the display and describe frames do not match tap coordinates; use a Pixel Fold AVD to test the cover panel.
|
|
141657
|
-
Fails if the device is not foldable, is a remote simulator or a physical Android device.`,
|
|
142151
|
+
description: `Move a foldable iOS simulator or Android emulator hinge to a \`posture\` or \`angle\` (pass exactly one) and wait until input is ready.
|
|
142152
|
+
Use when testing an app across folded/unfolded postures (\`list-devices\` marks \`foldable: true\`; use \`rotate\` for orientation). Coordinates change with the active panel, so read the returned tree or call \`describe\` before tapping.
|
|
142153
|
+
iOS: fold to \`closed\`/\`open\` to guarantee a panel switch; returns \`{ activeScreen, screen, posture?, hingeAngle, warning? }\`. Android: returns \`{ posture?, deviceState, hingeAngle?, warning? }\` (use Pixel Fold AVD for accurate cover-panel coords).
|
|
142154
|
+
Fails if the device is not foldable, is a remote simulator, or is a physical Android device.`,
|
|
141658
142155
|
zodSchema: zodSchema29,
|
|
141659
142156
|
searchHint: "fold unfold hinge foldable duo posture open closed half-open panel screen split view",
|
|
141660
142157
|
interaction: {
|
|
@@ -141772,22 +142269,19 @@ var buttonSchema = external_exports.preprocess(
|
|
|
141772
142269
|
},
|
|
141773
142270
|
external_exports.union([external_exports.enum(BUTTONS), external_exports.array(external_exports.enum(BUTTONS)).min(1).max(64)])
|
|
141774
142271
|
).describe(
|
|
141775
|
-
'
|
|
142272
|
+
'Single remote button or array path run in one call (e.g. ["up","right","select"]; prefer an array over repeated calls).'
|
|
141776
142273
|
);
|
|
141777
142274
|
var zodSchema30 = external_exports.object({
|
|
141778
|
-
udid: external_exports.string().describe("
|
|
142275
|
+
udid: external_exports.string().describe("TV device id from `list-devices` (Apple TV, Android TV, or Vega)."),
|
|
141779
142276
|
button: buttonSchema,
|
|
141780
|
-
repeat: external_exports.number().int().min(1).max(50).optional().describe(
|
|
141781
|
-
'Repeat the whole `button` value this many times (default 1). Compact for long same-button runs, e.g. { button: "down", repeat: 12 }.'
|
|
141782
|
-
)
|
|
142277
|
+
repeat: external_exports.number().int().min(1).max(50).optional().describe('Repeat `button` N times (default 1, e.g. `{ button: "down", repeat: 12 }`).')
|
|
141783
142278
|
});
|
|
141784
142279
|
function createTvRemoteTool(registry2) {
|
|
141785
142280
|
return {
|
|
141786
142281
|
id: "tv-remote",
|
|
141787
|
-
description: `Press a TV remote / D-pad button (or
|
|
141788
|
-
|
|
141789
|
-
|
|
141790
|
-
Returns { pressed, count }. Fails on a target that is not a TV, and on the Apple TV simulator for rewind, fastForward, next, previous, volumeUp, volumeDown and mute (its HID stack ignores them); every other button works on all three platforms.`,
|
|
142282
|
+
description: `Press a TV remote / D-pad button (or array path) on Apple TV (tvOS), Android TV, or Vega (Fire TV).
|
|
142283
|
+
Use when navigating focus or pressing remote keys on a TV instead of touch gestures. Call \`describe\` first to locate focus; check the returned tree after.
|
|
142284
|
+
Returns \`{ pressed, count }\`. Fails on non-TV targets, or on Apple TV sim for rewind/fastForward/next/previous/volume/mute.`,
|
|
141791
142285
|
zodSchema: zodSchema30,
|
|
141792
142286
|
searchHint: "tv remote dpad d-pad navigate focus up down left right select ok back home menu play pause rewind fast forward sequence path apple tv tvos android tv leanback vega fire tv",
|
|
141793
142287
|
interaction: {
|
|
@@ -142132,7 +142626,7 @@ Allowed tools (coords are [0,1] screen fractions; ? = optional):
|
|
|
142132
142626
|
gesture-pinch: centerX, centerY, startDistance, endDistance, endCenterX?, endCenterY?, angle?, durationMs?
|
|
142133
142627
|
gesture-rotate: centerX, centerY, startAngle, endAngle, radius (or radiusX+radiusY), durationMs?
|
|
142134
142628
|
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?
|
|
142629
|
+
keyboard: text? or key? (one per step), clear?, repeat?, delayMs?
|
|
142136
142630
|
paste: text (real paste flows only)
|
|
142137
142631
|
rotate: orientation ("Portrait"|"LandscapeLeft"|"LandscapeRight"|"PortraitUpsideDown")
|
|
142138
142632
|
shake: count?
|
|
@@ -142225,14 +142719,14 @@ init_zod();
|
|
|
142225
142719
|
var zodSchema32 = external_exports.object({
|
|
142226
142720
|
port: metroPortField,
|
|
142227
142721
|
device_id: external_exports.string().describe(
|
|
142228
|
-
"Device id from list-devices
|
|
142722
|
+
"Device id from `list-devices`: iOS UDID, Android/Vega serial, <flag:macos-apps>Mac app id (`macos-app-<bundle id>`), </flag:macos-apps>or Chromium id (`chromium-cdp-<port>`). Reuse this same id on subsequent `debugger-*` calls (or pass the error's `logicalDeviceId` if shared Metro is ambiguous)."
|
|
142229
142723
|
)
|
|
142230
142724
|
});
|
|
142231
142725
|
var debuggerConnectTool = {
|
|
142232
142726
|
id: "debugger-connect",
|
|
142233
|
-
description: `Connect to an app's
|
|
142234
|
-
Use when starting a debug session or before
|
|
142235
|
-
Returns connection
|
|
142727
|
+
description: `Connect to an app's JS debugger (React Native via Metro, or Chromium CDP) and start capturing console logs; reuses existing connections.<flag:macos-apps> Mac apps need a Debug build loading JS from Metro (react-native-macos 0.76+ or Mac Catalyst launched via Argent).</flag:macos-apps>
|
|
142728
|
+
Use when starting a debug session or before other \`debugger-*\` tools (keep the same \`device_id\`; retry with \`logicalDeviceId\` only if shared Metro reports ambiguity<flag:macos-apps>; Mac apps always keep the Mac app id</flag:macos-apps>).
|
|
142729
|
+
Returns connection info (plus \`note\` with prior log path after a crash). Fails if the runtime is unreachable.`,
|
|
142236
142730
|
zodSchema: zodSchema32,
|
|
142237
142731
|
interaction: {
|
|
142238
142732
|
startedMsg: () => "Connecting JavaScript debugger",
|
|
@@ -142268,16 +142762,15 @@ init_device_info();
|
|
|
142268
142762
|
var zodSchema33 = external_exports.object({
|
|
142269
142763
|
port: metroPortField,
|
|
142270
142764
|
device_id: external_exports.string().describe(
|
|
142271
|
-
"Device id
|
|
142765
|
+
"Device id from `debugger-connect`<flag:macos-apps> (macOS: Mac app id)</flag:macos-apps>."
|
|
142272
142766
|
)
|
|
142273
142767
|
});
|
|
142274
142768
|
function createDebuggerStatusTool(registry2) {
|
|
142275
142769
|
return {
|
|
142276
142770
|
id: "debugger-status",
|
|
142277
|
-
description: `
|
|
142278
|
-
Use when
|
|
142279
|
-
|
|
142280
|
-
- { status: "not_connected", connected: false, reason, detail, guidance } (port omitted on Chromium), with reason one of metro_not_running, no_app_connected, device_mismatch, cdp_unreachable, runtime_unresponsive, stale_connection, reconnecting. Follow the guidance field; do not retry in a loop.`,
|
|
142771
|
+
description: `Check JS runtime debugger connectivity and diagnostics.
|
|
142772
|
+
Use when verifying debugger health before other \`debugger-*\` tools.
|
|
142773
|
+
Returns \`{ status: "connected", port, projectRoot, deviceName, appName, logicalDeviceId, isNewDebugger, loadedScripts, sourceMapReady }\` or \`{ status: "not_connected", reason, detail, guidance }\` (follow \`guidance\`; don't retry in a loop). Never fails when the runtime is simply unreachable.`,
|
|
142281
142774
|
zodSchema: zodSchema33,
|
|
142282
142775
|
readOnly: true,
|
|
142283
142776
|
interaction: {
|
|
@@ -142374,14 +142867,15 @@ function guardModuleLoadErrors(expression) {
|
|
|
142374
142867
|
var zodSchema34 = external_exports.object({
|
|
142375
142868
|
port: metroPortField,
|
|
142376
142869
|
device_id: external_exports.string().describe(
|
|
142377
|
-
"Device id
|
|
142870
|
+
"Device id from `debugger-connect`<flag:macos-apps> (macOS: Mac app id)</flag:macos-apps>."
|
|
142378
142871
|
),
|
|
142379
|
-
expression: external_exports.string().describe("JavaScript expression to evaluate
|
|
142872
|
+
expression: external_exports.string().describe("JavaScript expression to evaluate.")
|
|
142380
142873
|
});
|
|
142381
142874
|
var debuggerEvaluateTool = {
|
|
142382
142875
|
id: "debugger-evaluate",
|
|
142383
|
-
description: `Run JavaScript in the app
|
|
142384
|
-
|
|
142876
|
+
description: `Run JavaScript in the app runtime (Hermes on React Native/Vega<flag:macos-apps>/Mac apps</flag:macos-apps>; V8 on Chromium; awaits Promises).
|
|
142877
|
+
Use when inspecting runtime state (e.g. localStorage/sessionStorage on Chromium) or calling app functions.
|
|
142878
|
+
Returns \`{ result, deviceName, appName, logicalDeviceId }\` (JSON-serialized; cyclic objects fail). Fails if disconnected or the expression throws.`,
|
|
142385
142879
|
zodSchema: zodSchema34,
|
|
142386
142880
|
searchHint: "javascript js eval expression runtime app state localstorage sessionstorage web storage",
|
|
142387
142881
|
interaction: {
|
|
@@ -143321,32 +143815,18 @@ function buildTextTree(data, opts) {
|
|
|
143321
143815
|
var zodSchema36 = external_exports.object({
|
|
143322
143816
|
port: metroPortField,
|
|
143323
143817
|
device_id: external_exports.string().describe(
|
|
143324
|
-
"Device id
|
|
143325
|
-
),
|
|
143326
|
-
onScreenOnly: external_exports.boolean().default(true).describe(
|
|
143327
|
-
"When true, only components visible on screen are returned. Set to false to include all mounted components, including those scrolled off-screen, e.g. to understand the full page structure."
|
|
143818
|
+
"Device id from `debugger-connect`<flag:macos-apps> (macOS: Mac app id)</flag:macos-apps>."
|
|
143328
143819
|
),
|
|
143329
|
-
|
|
143330
|
-
|
|
143331
|
-
)
|
|
143332
|
-
includeSkipped: external_exports.boolean().default(false).describe(
|
|
143333
|
-
"When true, appends a summary of all filtered components: total fiber count and skip counts by component name and by filter."
|
|
143334
|
-
)
|
|
143820
|
+
onScreenOnly: external_exports.boolean().default(true).describe("Only on-screen components (default true; false includes off-screen mounted nodes)."),
|
|
143821
|
+
maxNodes: external_exports.coerce.number().optional().describe("Max nodes to return (collapses single-child wrappers when exceeded)."),
|
|
143822
|
+
includeSkipped: external_exports.boolean().default(false).describe("Append filtered/skipped fiber counts summary.")
|
|
143335
143823
|
});
|
|
143336
143824
|
function createDebuggerComponentTreeTool() {
|
|
143337
143825
|
return {
|
|
143338
143826
|
id: "debugger-component-tree",
|
|
143339
|
-
description: `Fetch
|
|
143340
|
-
|
|
143341
|
-
|
|
143342
|
-
Full-screen transparent wrappers and implementation-detail components are pruned. Wrappers the size
|
|
143343
|
-
of their parent are pruned too, so a missing name proves nothing: check with debugger-inspect-element.
|
|
143344
|
-
|
|
143345
|
-
Use when you need what describe does not show: a testID for a selector (on Android, describe omits
|
|
143346
|
-
the testID of a view that has no label and is not tappable), or the component names and nesting
|
|
143347
|
-
behind the screen before editing code. To find what to tap, use describe.
|
|
143348
|
-
|
|
143349
|
-
Returns a compact text tree; call again after navigation. Fails if the Metro debugger is disconnected.<flag:macos-apps> On Mac apps with several React Native windows, the tool uses the root with the most components. With the old architecture (Paper), native views around the React root can shift tap points. Use describe for tap targets.</flag:macos-apps>`,
|
|
143827
|
+
description: `Fetch a compact React Native component tree with text/accessibilityLabel, \`[testID=\u2026]\`, and normalized \`(tap: x,y)\`<flag:macos-apps> (Mac app window incl. title bar)</flag:macos-apps>.
|
|
143828
|
+
Use when you need React component names/nesting or missing Android \`testID\`s (use \`describe\` for tap targets; verify pruned wrappers with \`debugger-inspect-element\`).
|
|
143829
|
+
Returns a text tree. Fails if the Metro debugger is disconnected.<flag:macos-apps> Mac apps: uses the root with the most components; on Paper, use \`describe\` for tap points.</flag:macos-apps>`,
|
|
143350
143830
|
zodSchema: zodSchema36,
|
|
143351
143831
|
searchHint: "react native component tree testID testIDs selector component names hierarchy",
|
|
143352
143832
|
readOnly: true,
|
|
@@ -143890,33 +144370,24 @@ function filterInspectItems(items, includeSkipped = false) {
|
|
|
143890
144370
|
var zodSchema37 = external_exports.object({
|
|
143891
144371
|
port: metroPortField,
|
|
143892
144372
|
device_id: external_exports.string().describe(
|
|
143893
|
-
"Device id
|
|
144373
|
+
"Device id from `debugger-connect`<flag:macos-apps> (macOS: Mac app id)</flag:macos-apps>."
|
|
143894
144374
|
),
|
|
143895
144375
|
x: external_exports.coerce.number().describe(
|
|
143896
|
-
"
|
|
144376
|
+
"X in logical pixels from screen left<flag:macos-apps> (or Mac app window left, title bar included)</flag:macos-apps>."
|
|
143897
144377
|
),
|
|
143898
144378
|
y: external_exports.coerce.number().describe(
|
|
143899
|
-
"
|
|
143900
|
-
),
|
|
143901
|
-
contextLines: external_exports.coerce.number().default(3).describe("Lines of source context to include around the component definition"),
|
|
143902
|
-
resolveSourceMaps: external_exports.boolean().default(true).describe(
|
|
143903
|
-
"When true, resolves bundled frame locations to original source files via Metro symbolication and includes a code fragment. When false, returns the raw bundled frame info (file, line, column) without a code fragment."
|
|
143904
|
-
),
|
|
143905
|
-
maxItems: external_exports.coerce.number().default(35).describe(
|
|
143906
|
-
"Maximum number of hierarchy items to return, most specific first. The default covers all app-specific code; increase to 70+ to also see the navigation/screen structure."
|
|
144379
|
+
"Y in logical pixels from screen top<flag:macos-apps> (or Mac app window top, title bar included)</flag:macos-apps>."
|
|
143907
144380
|
),
|
|
143908
|
-
|
|
143909
|
-
|
|
143910
|
-
)
|
|
144381
|
+
contextLines: external_exports.coerce.number().default(3).describe("Source context lines around each component."),
|
|
144382
|
+
resolveSourceMaps: external_exports.boolean().default(true).describe("Symbolicate via Metro and include code snippets (false = raw bundle frames)."),
|
|
144383
|
+
maxItems: external_exports.coerce.number().default(35).describe("Max hierarchy items, most specific first (default 35)."),
|
|
144384
|
+
includeSkipped: external_exports.boolean().default(false).describe("Keep normally filtered items marked `skipped: true`.")
|
|
143911
144385
|
});
|
|
143912
144386
|
var debuggerInspectElementTool = {
|
|
143913
144387
|
id: "debugger-inspect-element",
|
|
143914
|
-
description: `Inspect the React component hierarchy at
|
|
143915
|
-
|
|
143916
|
-
|
|
143917
|
-
The first items (lowest indices) are the most specific: the exact component under
|
|
143918
|
-
the tap point and its direct parents. Higher indices are broader context (page, navigator).
|
|
143919
|
-
Use when you need the source file and line for a component at a point. Convert fractions from debugger-component-tree using the width and height in its Screen line. Fails if the app is disconnected or the point is outside the screen.<flag:macos-apps> On Mac apps with several React Native windows, the tool uses the root with the most components. With the old architecture (Paper), native views around the React root can shift the result. Check the returned component against the intended control.</flag:macos-apps>`,
|
|
144388
|
+
description: `Inspect the React component hierarchy at logical pixel (x, y), from the tapped leaf upward with source file:line and code snippets.
|
|
144389
|
+
Use when finding the source file/line for a React Native element (multiply \`debugger-component-tree\` fractions by its Screen dimensions).
|
|
144390
|
+
Returns \`{ x, y, items, truncated?, hiddenCount? }\`. Fails if disconnected or (x, y) is off-screen.<flag:macos-apps> Mac apps: uses the window root with the most components; on Paper, native views can offset hits.</flag:macos-apps>`,
|
|
143920
144391
|
zodSchema: zodSchema37,
|
|
143921
144392
|
readOnly: true,
|
|
143922
144393
|
interaction: {
|
|
@@ -144048,20 +144519,17 @@ var CONSOLE_LEVELS = [
|
|
|
144048
144519
|
var zodSchema38 = external_exports.object({
|
|
144049
144520
|
port: metroPortField,
|
|
144050
144521
|
device_id: external_exports.string().describe(
|
|
144051
|
-
"Device id
|
|
144522
|
+
"Device id from `debugger-connect`<flag:macos-apps> (macOS: Mac app id)</flag:macos-apps>."
|
|
144052
144523
|
),
|
|
144053
|
-
tail: external_exports.coerce.number().int().min(1).max(RECENT_PER_LEVEL).optional().describe("
|
|
144054
|
-
levels: external_exports.array(external_exports.enum(CONSOLE_LEVELS)).min(1).optional().describe(
|
|
144055
|
-
'Return only these levels in `entries`, e.g. ["warning", "error"]. Stats and clusters stay unfiltered.'
|
|
144056
|
-
)
|
|
144524
|
+
tail: external_exports.coerce.number().int().min(1).max(RECENT_PER_LEVEL).optional().describe("Newest entries to inline (default 20)."),
|
|
144525
|
+
levels: external_exports.array(external_exports.enum(CONSOLE_LEVELS)).min(1).optional().describe('Filter inline `entries` by level (e.g. ["warning", "error"]).')
|
|
144057
144526
|
});
|
|
144058
144527
|
function createDebuggerLogRegistryTool(registry2) {
|
|
144059
144528
|
return {
|
|
144060
144529
|
id: "debugger-log-registry",
|
|
144061
|
-
description: `Get a summary of
|
|
144062
|
-
|
|
144063
|
-
|
|
144064
|
-
When the debugger cannot be reached, it returns { status: "not_connected", reason, detail, guidance } with NO log file. Follow the guidance (do not retry in a loop). Grep a log file in this state only when a { note } names one kept from before the app crashed. A "connected" result's stats may come from a session whose socket has since died. Use debugger-status, not this tool, to judge debugger health.`,
|
|
144530
|
+
description: `Get a summary of JS console logs captured from React Native<flag:macos-apps> (including Mac apps)</flag:macos-apps> or Chromium, with newest \`entries\` inline (truncated to 300 chars).
|
|
144531
|
+
Use when investigating warnings, errors, or console output. Check \`entries\` first; Grep \`file\` for older/full lines (never Read it whole; up to 50k lines). Use \`debugger-status\` to check connection health.
|
|
144532
|
+
Returns \`{ status: "connected", file, entries, clusters, note? }\` (\`note\` flags missing/crashed prior sessions), or \`{ status: "not_connected", reason, guidance }\` (follow guidance; don't retry in a loop). Never fails when the runtime is simply unreachable.`,
|
|
144065
144533
|
zodSchema: zodSchema38,
|
|
144066
144534
|
readOnly: true,
|
|
144067
144535
|
interaction: {
|
|
@@ -144265,20 +144733,17 @@ ${lines.join("\n")}`;
|
|
|
144265
144733
|
var zodSchema39 = external_exports.object({
|
|
144266
144734
|
port: metroPortField,
|
|
144267
144735
|
device_id: external_exports.string().describe(
|
|
144268
|
-
"Device ID from list-devices
|
|
144736
|
+
"Device ID from `list-devices` (or `logicalDeviceId` if shared Metro capture used it)<flag:macos-apps>; Mac app: Mac app id `macos-app-<bundle id>`</flag:macos-apps>."
|
|
144269
144737
|
),
|
|
144270
144738
|
// `.default` covers only an omitted param, and `z.coerce.number()` reads null as 0, so
|
|
144271
144739
|
// null would return the oldest page. Agents send null for "not set": read it as "latest".
|
|
144272
|
-
pageIndex: external_exports.union([external_exports.coerce.number().int().nonnegative(), external_exports.literal("latest")]).nullable().default("latest").transform((value) => value ?? "latest").describe(
|
|
144273
|
-
'Zero-based page index. "latest" and null select the newest page. Each page contains up to 50 entries.'
|
|
144274
|
-
)
|
|
144740
|
+
pageIndex: external_exports.union([external_exports.coerce.number().int().nonnegative(), external_exports.literal("latest")]).nullable().default("latest").transform((value) => value ?? "latest").describe('0-based page index, or `"latest"`/null for newest (50 entries/page).')
|
|
144275
144741
|
});
|
|
144276
144742
|
var networkLogsTool = {
|
|
144277
144743
|
id: "view-network-logs",
|
|
144278
|
-
description: `List captured HTTP requests
|
|
144279
|
-
|
|
144280
|
-
|
|
144281
|
-
Fails if the Chromium target is unreachable. A read can also fail if Argent cannot reach the debugger for an existing JS capture. If the tool returns a capture message in place of a list, follow it before retrying.`,
|
|
144744
|
+
description: `List captured JS HTTP requests (React Native) or active-tab requests (Chromium). Call \`network-capture-start\` first on iOS<flag:macos-apps>/Mac apps</flag:macos-apps>/Android (on Vega, reading starts capture). Use \`native-network-logs\` for native traffic.
|
|
144745
|
+
Use when finding requests or comparing API calls (pass an ID to \`view-network-request-details\` for headers/bodies).
|
|
144746
|
+
Returns a paginated list of request IDs, status, size, and timing. Fails if Chromium or the JS debugger is unreachable.`,
|
|
144282
144747
|
zodSchema: zodSchema39,
|
|
144283
144748
|
readOnly: true,
|
|
144284
144749
|
interaction: {
|
|
@@ -144445,16 +144910,18 @@ ${postData.slice(0, MAX_BODY_SIZE)}...`;
|
|
|
144445
144910
|
var zodSchema40 = external_exports.object({
|
|
144446
144911
|
port: metroPortField,
|
|
144447
144912
|
device_id: external_exports.string().describe(
|
|
144448
|
-
"Device ID for the
|
|
144913
|
+
"Device ID for the log (or `logicalDeviceId` if JS capture used it)<flag:macos-apps>; Mac app: Mac app id</flag:macos-apps>."
|
|
144449
144914
|
),
|
|
144450
|
-
requestId: external_exports.string().describe(
|
|
144451
|
-
|
|
144915
|
+
requestId: external_exports.string().describe(
|
|
144916
|
+
"Request ID from `view-network-logs`, `native-network-logs`, or `await-network-request`."
|
|
144917
|
+
),
|
|
144918
|
+
includeBody: external_exports.boolean().default(true).describe("Include response body (default true).")
|
|
144452
144919
|
});
|
|
144453
144920
|
var networkRequestTool = {
|
|
144454
144921
|
id: "view-network-request-details",
|
|
144455
|
-
description: `Read
|
|
144456
|
-
|
|
144457
|
-
|
|
144922
|
+
description: `Read full details (status, timing, redacted headers, and bodies truncated to 1000 chars) for one captured HTTP request ID.
|
|
144923
|
+
Use when inspecting payloads or headers of a request from a network log or \`await-network-request\`.
|
|
144924
|
+
Returns request/response details, or a not-found message (refresh the log after JS reloads). Fails if the backing debugger/CDP target is unreachable.`,
|
|
144458
144925
|
zodSchema: zodSchema40,
|
|
144459
144926
|
readOnly: true,
|
|
144460
144927
|
interaction: {
|
|
@@ -144851,10 +145318,9 @@ var JS_ANSWER_WAIT_MS = 5e3;
|
|
|
144851
145318
|
function createNetworkCaptureStartTool(registry2) {
|
|
144852
145319
|
return {
|
|
144853
145320
|
id: "network-capture-start",
|
|
144854
|
-
description: `Start HTTP capture on iOS simulators, Android<flag:macos-apps>, Mac apps</flag:macos-apps
|
|
144855
|
-
|
|
144856
|
-
|
|
144857
|
-
Fails with NETWORK_CAPTURE_UNAVAILABLE or TOOL_DEPENDENCY_MISSING when every requested layer is unavailable.`,
|
|
145321
|
+
description: `Start HTTP capture (JS and/or native) on iOS simulators, Android<flag:macos-apps>, Mac apps</flag:macos-apps>, and Chromium, opening a new window for \`await-network-request\`.
|
|
145322
|
+
Use when preparing to inspect or assert network traffic before triggering an action (stop with \`network-capture-stop\` afterward; re-call after reload/relaunch for JS capture).<flag:macos-apps> Xcode-launched RN Mac apps: pass \`layer: "js"\`.</flag:macos-apps>
|
|
145323
|
+
Returns \`{ status: "ok", layers }\` with each layer's \`armed\` state and any \`reason\`. Fails if every requested layer is unavailable.`,
|
|
144858
145324
|
zodSchema: captureSchema,
|
|
144859
145325
|
capability: CAPTURE_CAPABILITY,
|
|
144860
145326
|
interaction: {
|
|
@@ -145209,8 +145675,9 @@ var JS_ANSWER_WAIT_MS2 = 5e3;
|
|
|
145209
145675
|
function createNetworkCaptureStopTool(registry2) {
|
|
145210
145676
|
return {
|
|
145211
145677
|
id: "network-capture-stop",
|
|
145212
|
-
description: `Stop capture
|
|
145213
|
-
|
|
145678
|
+
description: `Stop HTTP capture while keeping recorded requests (closes the \`await-network-request\` window on Chromium; read Android native bodies before stopping).
|
|
145679
|
+
Use when done collecting traffic or before profiling.
|
|
145680
|
+
Returns \`{ status: "ok", layers }\` with \`armed\` and any \`reason\`. Fails on invalid targets.`,
|
|
145214
145681
|
zodSchema: captureSchema,
|
|
145215
145682
|
capability: CAPTURE_CAPABILITY,
|
|
145216
145683
|
interaction: {
|
|
@@ -145632,7 +146099,7 @@ function formatDescribeTree(root, opts) {
|
|
|
145632
146099
|
}
|
|
145633
146100
|
|
|
145634
146101
|
// ../tool-server/src/tools/describe/platforms/tv.ts
|
|
145635
|
-
var
|
|
146102
|
+
var sleep18 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
145636
146103
|
var EMPTY_RETRY_ATTEMPTS = 3;
|
|
145637
146104
|
var EMPTY_RETRY_DELAY_MS = 600;
|
|
145638
146105
|
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.";
|
|
@@ -145664,7 +146131,7 @@ async function describeTv(registry2, device) {
|
|
|
145664
146131
|
let res = await api.describe();
|
|
145665
146132
|
if (device.platform !== "android") {
|
|
145666
146133
|
for (let attempt = 1; attempt < EMPTY_RETRY_ATTEMPTS && isEmptyFocus(res); attempt++) {
|
|
145667
|
-
await
|
|
146134
|
+
await sleep18(EMPTY_RETRY_DELAY_MS);
|
|
145668
146135
|
res = await api.describe();
|
|
145669
146136
|
}
|
|
145670
146137
|
}
|
|
@@ -146246,465 +146713,6 @@ A field is unset when it is unknown.`,
|
|
|
146246
146713
|
init_zod();
|
|
146247
146714
|
init_capability();
|
|
146248
146715
|
init_adb();
|
|
146249
|
-
|
|
146250
|
-
// ../tool-server/src/tools/fill/errors.ts
|
|
146251
|
-
init_src2();
|
|
146252
|
-
init_capability();
|
|
146253
|
-
function noFocusedFieldError(stage) {
|
|
146254
|
-
return new InvalidToolInputError(
|
|
146255
|
-
"Nothing that takes text has keyboard focus, so nothing was changed. Tap the text field first, then call fill again.",
|
|
146256
|
-
{
|
|
146257
|
-
error_code: FAILURE_CODES.FILL_NO_FOCUSED_FIELD,
|
|
146258
|
-
failure_stage: stage,
|
|
146259
|
-
error_kind: "validation"
|
|
146260
|
-
}
|
|
146261
|
-
);
|
|
146262
|
-
}
|
|
146263
|
-
function notVerifiedError(stage) {
|
|
146264
|
-
return new FailureError(
|
|
146265
|
-
"fill wrote to the focused field, but reading it back did not show the requested text. The field may hold other or partial text: read it before retrying.",
|
|
146266
|
-
{
|
|
146267
|
-
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
146268
|
-
failure_stage: stage,
|
|
146269
|
-
failure_area: "tool_server",
|
|
146270
|
-
error_kind: "unknown"
|
|
146271
|
-
}
|
|
146272
|
-
);
|
|
146273
|
-
}
|
|
146274
|
-
function notChangedError(stage) {
|
|
146275
|
-
return new FailureError(
|
|
146276
|
-
"fill could not select the text of the focused field, so nothing was changed. Tap the field and retry.",
|
|
146277
|
-
{
|
|
146278
|
-
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
146279
|
-
failure_stage: stage,
|
|
146280
|
-
failure_area: "tool_server",
|
|
146281
|
-
error_kind: "unknown"
|
|
146282
|
-
}
|
|
146283
|
-
);
|
|
146284
|
-
}
|
|
146285
|
-
function notAnsweredError(stage) {
|
|
146286
|
-
return new FailureError(
|
|
146287
|
-
"The device did not finish the fill in time. The field may have changed: read it before retrying.",
|
|
146288
|
-
{
|
|
146289
|
-
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
146290
|
-
failure_stage: stage,
|
|
146291
|
-
failure_area: "tool_server",
|
|
146292
|
-
error_kind: "timeout"
|
|
146293
|
-
}
|
|
146294
|
-
);
|
|
146295
|
-
}
|
|
146296
|
-
function pageNotAnsweringError(stage, waitedMs) {
|
|
146297
|
-
return new FailureError(
|
|
146298
|
-
`The page did not answer for ${waitedMs / 1e3} s, so fill changed nothing. A JavaScript dialog (alert, confirm or prompt) may be open, or the page is busy or has crashed. Argent cannot close a dialog: ask the user to close it, then retry. A retry fills a busy page once its task ends. If no dialog is open and it still does not answer, restart the app.`,
|
|
146299
|
-
{
|
|
146300
|
-
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
146301
|
-
failure_stage: stage,
|
|
146302
|
-
failure_area: "tool_server",
|
|
146303
|
-
error_kind: "timeout"
|
|
146304
|
-
}
|
|
146305
|
-
);
|
|
146306
|
-
}
|
|
146307
|
-
function pageNotFinishedError(stage) {
|
|
146308
|
-
return new FailureError(
|
|
146309
|
-
"The page did not finish the fill in time; it may have opened a JavaScript dialog or crashed. The field may have changed, and may still change when the page resumes: read it before retrying. If the page does not answer and no dialog is open, restart the app.",
|
|
146310
|
-
{
|
|
146311
|
-
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
146312
|
-
failure_stage: stage,
|
|
146313
|
-
failure_area: "tool_server",
|
|
146314
|
-
error_kind: "timeout"
|
|
146315
|
-
}
|
|
146316
|
-
);
|
|
146317
|
-
}
|
|
146318
|
-
function unsupportedFieldError(detail, stage) {
|
|
146319
|
-
return new InvalidToolInputError(
|
|
146320
|
-
`fill cannot set this field's text: ${detail}. Nothing was changed.`,
|
|
146321
|
-
{
|
|
146322
|
-
error_code: FAILURE_CODES.FILL_UNSUPPORTED_FIELD,
|
|
146323
|
-
failure_stage: stage,
|
|
146324
|
-
error_kind: "unsupported"
|
|
146325
|
-
}
|
|
146326
|
-
);
|
|
146327
|
-
}
|
|
146328
|
-
|
|
146329
|
-
// ../tool-server/src/tools/fill/keys.ts
|
|
146330
|
-
init_src2();
|
|
146331
|
-
init_src2();
|
|
146332
|
-
var MAX_CLEAR_KEYS = 100;
|
|
146333
|
-
var XCTEST_DELETE = "\b";
|
|
146334
|
-
var KEY_TIMING = { holdMs: 20, settleMs: 300, typeDelayMs: 30 };
|
|
146335
|
-
var sleep18 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
146336
|
-
function typeableOnSimulator(text) {
|
|
146337
|
-
for (const char of text) if (!charToKeyPress(char)) return false;
|
|
146338
|
-
return true;
|
|
146339
|
-
}
|
|
146340
|
-
async function withoutTextInErrors(stage, run2) {
|
|
146341
|
-
try {
|
|
146342
|
-
return await run2();
|
|
146343
|
-
} catch (err) {
|
|
146344
|
-
const signal = getFailureSignal(err);
|
|
146345
|
-
throw new FailureError(
|
|
146346
|
-
"fill failed partway through typing: the focused field may hold part of the text. Read it before retrying.",
|
|
146347
|
-
signal ?? {
|
|
146348
|
-
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
146349
|
-
failure_stage: stage,
|
|
146350
|
-
failure_area: "tool_server",
|
|
146351
|
-
error_kind: "unknown"
|
|
146352
|
-
}
|
|
146353
|
-
);
|
|
146354
|
-
}
|
|
146355
|
-
}
|
|
146356
|
-
async function pressSimulatorBackspace(registry2, device) {
|
|
146357
|
-
const ref = simulatorServerRef(device);
|
|
146358
|
-
const api = await registry2.resolveService(ref.urn, ref.options);
|
|
146359
|
-
await api.pressKey("Down", NAMED_KEYS.backspace);
|
|
146360
|
-
await sleep18(KEY_TIMING.holdMs);
|
|
146361
|
-
await api.pressKey("Up", NAMED_KEYS.backspace);
|
|
146362
|
-
await sleep18(KEY_TIMING.settleMs);
|
|
146363
|
-
}
|
|
146364
|
-
async function typeOnSimulator(registry2, device, text) {
|
|
146365
|
-
if (!text) return;
|
|
146366
|
-
await withoutTextInErrors(
|
|
146367
|
-
"fill_keys_ios",
|
|
146368
|
-
() => typeSimulatorServer(registry2, device, {
|
|
146369
|
-
udid: device.id,
|
|
146370
|
-
text,
|
|
146371
|
-
delayMs: KEY_TIMING.typeDelayMs
|
|
146372
|
-
})
|
|
146373
|
-
);
|
|
146374
|
-
}
|
|
146375
|
-
async function fillByDeviceKeys(registry2, device, text) {
|
|
146376
|
-
const bundleId = requireCurrentIosDeviceApp(device.id);
|
|
146377
|
-
const ref = iosDeviceRunnerRef(device);
|
|
146378
|
-
const api = await registry2.resolveService(ref.urn, ref.options);
|
|
146379
|
-
const type = async (chars) => {
|
|
146380
|
-
try {
|
|
146381
|
-
await typeText(api, bundleId, chars);
|
|
146382
|
-
} catch (err) {
|
|
146383
|
-
if (err instanceof RunnerCommandError && err.code === "TEXT_INPUT_NOT_FOCUSED") {
|
|
146384
|
-
throw noFocusedFieldError("fill_keys_ios_device_focus");
|
|
146385
|
-
}
|
|
146386
|
-
throw err;
|
|
146387
|
-
}
|
|
146388
|
-
};
|
|
146389
|
-
await type(XCTEST_DELETE.repeat(MAX_CLEAR_KEYS));
|
|
146390
|
-
if (text) await withoutTextInErrors("fill_keys_ios_device", () => type(text));
|
|
146391
|
-
}
|
|
146392
|
-
|
|
146393
|
-
// ../tool-server/src/tools/fill/ios.ts
|
|
146394
|
-
var NEWLINE = /[\r\n]/;
|
|
146395
|
-
async function fillIos(registry2, device, text) {
|
|
146396
|
-
const ref = axServiceRef(device);
|
|
146397
|
-
const ax = await registry2.resolveService(ref.urn, ref.options);
|
|
146398
|
-
const typeable = typeableOnSimulator(text) && !NEWLINE.test(text);
|
|
146399
|
-
const first = await ax.fill(text, { typeable });
|
|
146400
|
-
if (!first.focused) throw noFocusedFieldError("fill_ios_no_focus");
|
|
146401
|
-
if (first.unsupported) {
|
|
146402
|
-
throw unsupportedFieldError(
|
|
146403
|
-
"the focused element is not a text input (a date or time input, or a picker)",
|
|
146404
|
-
"fill_ios_unsupported_field"
|
|
146405
|
-
);
|
|
146406
|
-
}
|
|
146407
|
-
if (first.singleLine) {
|
|
146408
|
-
throw unsupportedFieldError(
|
|
146409
|
-
"a single-line text field cannot hold a newline",
|
|
146410
|
-
"fill_ios_single_line"
|
|
146411
|
-
);
|
|
146412
|
-
}
|
|
146413
|
-
if (first.timedOut) throw notAnsweredError("fill_ios_timeout");
|
|
146414
|
-
if (first.untouched) throw notChangedError("fill_ios_select_failed");
|
|
146415
|
-
if (first.verified) return { verified: true };
|
|
146416
|
-
if (first.secure) {
|
|
146417
|
-
if (!typeable) {
|
|
146418
|
-
throw unsupportedFieldError(
|
|
146419
|
-
"a secure text field takes only text the keyboard can type on one line, and this text has a character it cannot",
|
|
146420
|
-
"fill_ios_secure_untypeable"
|
|
146421
|
-
);
|
|
146422
|
-
}
|
|
146423
|
-
if (!first.cleared) throw notVerifiedError("fill_ios_secure_not_cleared");
|
|
146424
|
-
await typeOnSimulator(registry2, device, text);
|
|
146425
|
-
const check3 = await ax.fill(text, { check: true });
|
|
146426
|
-
if (check3.verified) return { verified: true };
|
|
146427
|
-
throw notVerifiedError("fill_ios_not_verified");
|
|
146428
|
-
}
|
|
146429
|
-
if (first.needsBackspace) {
|
|
146430
|
-
await pressSimulatorBackspace(registry2, device);
|
|
146431
|
-
const check3 = await ax.fill(text, { check: true });
|
|
146432
|
-
if (check3.verified) return { verified: true };
|
|
146433
|
-
}
|
|
146434
|
-
throw notVerifiedError("fill_ios_not_verified");
|
|
146435
|
-
}
|
|
146436
|
-
|
|
146437
|
-
// ../tool-server/src/tools/fill/android.ts
|
|
146438
|
-
async function fillAndroid(registry2, device, text) {
|
|
146439
|
-
const ref = androidDevtoolsRef(device);
|
|
146440
|
-
const helper = await registry2.resolveService(ref.urn, ref.options);
|
|
146441
|
-
const answer = await helper.setText(text);
|
|
146442
|
-
if (!answer.focused) throw noFocusedFieldError("fill_android_no_focus");
|
|
146443
|
-
if (answer.singleLine) {
|
|
146444
|
-
throw unsupportedFieldError(
|
|
146445
|
-
"a single-line text field cannot hold a newline",
|
|
146446
|
-
"fill_android_single_line"
|
|
146447
|
-
);
|
|
146448
|
-
}
|
|
146449
|
-
if (answer.timedOut) throw notAnsweredError("fill_android_timeout");
|
|
146450
|
-
if (answer.verified) return { verified: true };
|
|
146451
|
-
throw notVerifiedError("fill_android_not_verified");
|
|
146452
|
-
}
|
|
146453
|
-
|
|
146454
|
-
// ../tool-server/src/tools/fill/chromium.ts
|
|
146455
|
-
init_src2();
|
|
146456
|
-
function buildChromiumFillScript(text) {
|
|
146457
|
-
return `(async () => {
|
|
146458
|
-
const text = ${JSON.stringify(text)};
|
|
146459
|
-
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
146460
|
-
try {
|
|
146461
|
-
const deepActive = (doc) => {
|
|
146462
|
-
let el = doc.activeElement;
|
|
146463
|
-
while (el && el.shadowRoot && el.shadowRoot.activeElement) el = el.shadowRoot.activeElement;
|
|
146464
|
-
return el;
|
|
146465
|
-
};
|
|
146466
|
-
let el = deepActive(document);
|
|
146467
|
-
while (el && /^(i?frame|object)$/.test(String(el.tagName).toLowerCase())) {
|
|
146468
|
-
// An <object> showing an image or a plugin has no document to descend into.
|
|
146469
|
-
if (!el.contentWindow) break;
|
|
146470
|
-
let inner = null;
|
|
146471
|
-
try { inner = el.contentDocument; } catch (e) { inner = null; }
|
|
146472
|
-
// A cross-origin or sandboxed frame hides its document.
|
|
146473
|
-
if (!inner) return { status: "unsupported", detail: "focus is in a cross-origin frame, which fill cannot reach" };
|
|
146474
|
-
el = deepActive(inner);
|
|
146475
|
-
}
|
|
146476
|
-
if (!el || el.tagName === undefined) return { status: "no_focus" };
|
|
146477
|
-
const doc = el.ownerDocument || document;
|
|
146478
|
-
const win = doc.defaultView || window;
|
|
146479
|
-
const tag = String(el.tagName).toLowerCase();
|
|
146480
|
-
if (tag === "embed") return { status: "unsupported", detail: "focus is in an <embed>, which fill cannot reach" };
|
|
146481
|
-
const type = tag === "input" ? String(el.type || "text").toLowerCase() : null;
|
|
146482
|
-
if (type !== null && /^(date|time|month|week|datetime-local)$/.test(type)) {
|
|
146483
|
-
return { status: "unsupported", detail: "a " + type + " input holds a structured value" };
|
|
146484
|
-
}
|
|
146485
|
-
const control =
|
|
146486
|
-
tag === "textarea" ||
|
|
146487
|
-
(tag === "input" && !/^(button|checkbox|radio|file|submit|reset|image|range|color|hidden)$/.test(type));
|
|
146488
|
-
if (!control) {
|
|
146489
|
-
// Focus in a closed shadow root stops at its host. An element that can
|
|
146490
|
-
// host one is focusable itself only as a tab stop, an editing host or a
|
|
146491
|
-
// box the user can scroll; one with focus that is none of these, or whose
|
|
146492
|
-
// selection is in its shadow tree, holds it in a closed shadow root. The
|
|
146493
|
-
// browser shows such a selection collapsed before the host, or in place
|
|
146494
|
-
// when the page set it there, even in an editing host's own text. In a
|
|
146495
|
-
// focused page, which :focus needs, an editing host focused itself
|
|
146496
|
-
// matches :focus-visible; one whose focus is in its shadow tree does not.
|
|
146497
|
-
const scrolls = (style) =>
|
|
146498
|
-
(/^(auto|scroll)$/.test(style.overflowY) && el.scrollHeight > el.clientHeight) ||
|
|
146499
|
-
(/^(auto|scroll)$/.test(style.overflowX) && el.scrollWidth > el.clientWidth);
|
|
146500
|
-
const inShadow = (node, offset) => {
|
|
146501
|
-
if (node == null) return false;
|
|
146502
|
-
if (node === el.parentNode && node.childNodes[offset] === el) return true;
|
|
146503
|
-
for (let root = node.getRootNode(); root.host; root = root.host.getRootNode()) if (root.host === el) return true;
|
|
146504
|
-
return false;
|
|
146505
|
-
};
|
|
146506
|
-
const selectionInShadow = () => {
|
|
146507
|
-
if (el.shadowRoot) return false;
|
|
146508
|
-
const sel = el.getRootNode().getSelection();
|
|
146509
|
-
return inShadow(sel.anchorNode, sel.anchorOffset) && inShadow(sel.focusNode, sel.focusOffset);
|
|
146510
|
-
};
|
|
146511
|
-
const focusInShadow = () => {
|
|
146512
|
-
if (el.isContentEditable !== true) return false;
|
|
146513
|
-
try {
|
|
146514
|
-
return el.matches(":focus") && !el.matches(":focus-visible");
|
|
146515
|
-
} catch (e) {
|
|
146516
|
-
// Chromium before 86 has no :focus-visible.
|
|
146517
|
-
return false;
|
|
146518
|
-
}
|
|
146519
|
-
};
|
|
146520
|
-
const closedHost =
|
|
146521
|
-
/-|^(article|aside|blockquote|div|footer|h[1-6]|header|main|nav|p|section|span)$/.test(tag) &&
|
|
146522
|
-
((!el.hasAttribute("tabindex") &&
|
|
146523
|
-
(el.isContentEditable !== true || (el.parentElement !== null && el.parentElement.isContentEditable === true)) &&
|
|
146524
|
-
!scrolls(win.getComputedStyle(el))) ||
|
|
146525
|
-
selectionInShadow() ||
|
|
146526
|
-
focusInShadow());
|
|
146527
|
-
if (closedHost) return { status: "unsupported", detail: "focus is in a closed shadow root, which fill cannot reach" };
|
|
146528
|
-
if (el.isContentEditable !== true) return { status: "no_focus" };
|
|
146529
|
-
}
|
|
146530
|
-
if (control && el.disabled === true) return { status: "unsupported", detail: "it is disabled" };
|
|
146531
|
-
if (control && el.readOnly === true) return { status: "unsupported", detail: "it is read-only" };
|
|
146532
|
-
// An <input> holds one line and drops a newline.
|
|
146533
|
-
if (tag === "input" && /[\\r\\n]/.test(text)) {
|
|
146534
|
-
return { status: "unsupported", detail: "a single-line input cannot hold a newline" };
|
|
146535
|
-
}
|
|
146536
|
-
// A textarea or an editable element stores a CR or CRLF as one LF.
|
|
146537
|
-
const want = text.replace(/\\r\\n?/g, "\\n");
|
|
146538
|
-
// Typed text stops at maxlength, which the value setter ignores.
|
|
146539
|
-
const limited = tag === "textarea" || /^(text|search|url|tel|email|password)$/.test(type);
|
|
146540
|
-
if (limited && el.maxLength >= 0 && want.length > el.maxLength) {
|
|
146541
|
-
return { status: "unsupported", detail: "the text is longer than its maxlength of " + el.maxLength };
|
|
146542
|
-
}
|
|
146543
|
-
// A number input holds only a valid number and an email input drops the
|
|
146544
|
-
// whitespace around an address, typed or set. A detached input of the
|
|
146545
|
-
// same type applies the browser's own sanitization; outside an HTML
|
|
146546
|
-
// document only the XHTML namespace makes it an input.
|
|
146547
|
-
if (type === "number" || type === "email") {
|
|
146548
|
-
const probe = doc.createElementNS("http://www.w3.org/1999/xhtml", "input");
|
|
146549
|
-
probe.type = type;
|
|
146550
|
-
probe.multiple = el.multiple === true;
|
|
146551
|
-
probe.value = text;
|
|
146552
|
-
if (probe.value !== text) {
|
|
146553
|
-
return {
|
|
146554
|
-
status: "unsupported",
|
|
146555
|
-
detail: type === "number" ? "a number input holds only a valid number" : "an email input drops the whitespace around an address",
|
|
146556
|
-
};
|
|
146557
|
-
}
|
|
146558
|
-
}
|
|
146559
|
-
if (!control) {
|
|
146560
|
-
// designMode or <body contenteditable>: the whole document is the field.
|
|
146561
|
-
let host = el;
|
|
146562
|
-
while (host.parentElement && host.parentElement.isContentEditable === true) host = host.parentElement;
|
|
146563
|
-
if (host === doc.body || host === doc.documentElement) {
|
|
146564
|
-
return { status: "unsupported", detail: "the whole document is editable" };
|
|
146565
|
-
}
|
|
146566
|
-
}
|
|
146567
|
-
const trimEnd = (s) => s.replace(/[\\u200b\\ufeff]/g, "").replace(/\\n+$/, "");
|
|
146568
|
-
const read = () =>
|
|
146569
|
-
control ? String(el.value == null ? "" : el.value) : trimEnd(String(el.innerText == null ? el.textContent || "" : el.innerText));
|
|
146570
|
-
// A number input showing text it cannot parse reads as "".
|
|
146571
|
-
const badInput = () => el.validity != null && el.validity.badInput === true;
|
|
146572
|
-
// Chrome stores an edited email address's non-ASCII domain in ASCII, by
|
|
146573
|
-
// UTS #46 transitional processing: the URL parser's, once its deviations
|
|
146574
|
-
// (\xDF, \u03C2, ZWNJ, ZWJ) are mapped.
|
|
146575
|
-
const asciiEmail = (a) => {
|
|
146576
|
-
const at = a.indexOf("@");
|
|
146577
|
-
if (at < 0 || !/[^\\x00-\\x7f]/.test(a)) return a;
|
|
146578
|
-
const host = a.slice(at + 1).replace(/[\\u00df\\u1e9e]/g, "ss").replace(/\\u03c2/g, "\\u03c3").replace(/[\\u200c\\u200d]/g, "");
|
|
146579
|
-
// A link parses its href with the URL parser even where a page's own URL
|
|
146580
|
-
// global shadows the builtin. The ".a" label keeps a numeric last label
|
|
146581
|
-
// from parsing as IPv4.
|
|
146582
|
-
const link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a");
|
|
146583
|
-
link.href = "http://" + host + ".a";
|
|
146584
|
-
// Unparsable, or not a bare host: it has a user, a port or a path.
|
|
146585
|
-
if (link.href !== "http://" + link.hostname + "/") return a;
|
|
146586
|
-
return a.slice(0, at + 1) + link.hostname.slice(0, -2);
|
|
146587
|
-
};
|
|
146588
|
-
const sameText = (got) => {
|
|
146589
|
-
if (type !== "email") return got === want;
|
|
146590
|
-
const split = (s) => (el.multiple === true ? s.split(",") : [s]);
|
|
146591
|
-
const wants = split(want);
|
|
146592
|
-
const gots = split(got);
|
|
146593
|
-
return gots.length === wants.length && gots.every((g, i) => g === wants[i] || g === asciiEmail(wants[i]));
|
|
146594
|
-
};
|
|
146595
|
-
const matches = () => (control ? sameText(read()) && !badInput() : read() === trimEnd(want));
|
|
146596
|
-
const settle = async () => {
|
|
146597
|
-
for (let i = 0; i < 10; i++) {
|
|
146598
|
-
await sleep(i === 0 ? 0 : 50);
|
|
146599
|
-
if (matches()) return true;
|
|
146600
|
-
}
|
|
146601
|
-
return false;
|
|
146602
|
-
};
|
|
146603
|
-
|
|
146604
|
-
const before = read();
|
|
146605
|
-
// The browser fires input synchronously for an edit it performed. The
|
|
146606
|
-
// window's capture phase sees it unless a page listener added there
|
|
146607
|
-
// earlier stops it.
|
|
146608
|
-
let edited = false;
|
|
146609
|
-
const onInput = () => { edited = true; };
|
|
146610
|
-
win.addEventListener("input", onInput, true);
|
|
146611
|
-
try {
|
|
146612
|
-
if (control) {
|
|
146613
|
-
try { el.select(); } catch (e) { /* no selection API */ }
|
|
146614
|
-
} else {
|
|
146615
|
-
const sel = doc.getSelection();
|
|
146616
|
-
const range = doc.createRange();
|
|
146617
|
-
range.selectNodeContents(el);
|
|
146618
|
-
sel.removeAllRanges();
|
|
146619
|
-
sel.addRange(range);
|
|
146620
|
-
}
|
|
146621
|
-
try {
|
|
146622
|
-
if (text === "") {
|
|
146623
|
-
if (read() !== "" || badInput()) doc.execCommand("delete");
|
|
146624
|
-
} else {
|
|
146625
|
-
doc.execCommand("insertText", false, text);
|
|
146626
|
-
}
|
|
146627
|
-
} catch (e) {
|
|
146628
|
-
// An SVG document has no editing commands; a control still has its setter.
|
|
146629
|
-
if (!control) throw e;
|
|
146630
|
-
}
|
|
146631
|
-
} finally {
|
|
146632
|
-
win.removeEventListener("input", onInput, true);
|
|
146633
|
-
}
|
|
146634
|
-
let verified = await settle();
|
|
146635
|
-
// An edit that did not happen fires no input and leaves the old text.
|
|
146636
|
-
// Anything else is the browser's or the page's own rewrite, which the
|
|
146637
|
-
// setter must not override, even when the rewrite equals the old text.
|
|
146638
|
-
if (!verified && control && !edited && read() === before) {
|
|
146639
|
-
const proto = tag === "textarea" ? win.HTMLTextAreaElement.prototype : win.HTMLInputElement.prototype;
|
|
146640
|
-
const setter = Object.getOwnPropertyDescriptor(proto, "value").set;
|
|
146641
|
-
setter.call(el, text);
|
|
146642
|
-
el.dispatchEvent(new win.Event("input", { bubbles: true }));
|
|
146643
|
-
el.dispatchEvent(new win.Event("change", { bubbles: true }));
|
|
146644
|
-
verified = await settle();
|
|
146645
|
-
}
|
|
146646
|
-
return { status: "ok", verified: verified };
|
|
146647
|
-
} catch (e) {
|
|
146648
|
-
return { status: "error" };
|
|
146649
|
-
}
|
|
146650
|
-
})()`;
|
|
146651
|
-
}
|
|
146652
|
-
var PAGE_ANSWER_TIMEOUT_MS = 1e4;
|
|
146653
|
-
var FILL_TIMEOUT_MS2 = 1e4;
|
|
146654
|
-
async function withTimeoutError(send, timeoutError) {
|
|
146655
|
-
try {
|
|
146656
|
-
return await send();
|
|
146657
|
-
} catch (err) {
|
|
146658
|
-
if (getFailureSignal(err)?.error_code === FAILURE_CODES.DEBUGGER_CDP_REQUEST_TIMEOUT) {
|
|
146659
|
-
throw timeoutError();
|
|
146660
|
-
}
|
|
146661
|
-
throw err;
|
|
146662
|
-
}
|
|
146663
|
-
}
|
|
146664
|
-
async function fillChromium(registry2, device, text) {
|
|
146665
|
-
const ref = chromiumCdpRef(device);
|
|
146666
|
-
const api = await withTimeoutError(
|
|
146667
|
-
() => registry2.resolveService(ref.urn, {
|
|
146668
|
-
...ref.options,
|
|
146669
|
-
answerTimeoutMs: PAGE_ANSWER_TIMEOUT_MS
|
|
146670
|
-
}),
|
|
146671
|
-
() => pageNotAnsweringError("fill_chromium_connect", PAGE_ANSWER_TIMEOUT_MS)
|
|
146672
|
-
);
|
|
146673
|
-
await withTimeoutError(
|
|
146674
|
-
() => api.cdp.send("Runtime.evaluate", { expression: "0" }, PAGE_ANSWER_TIMEOUT_MS),
|
|
146675
|
-
() => pageNotAnsweringError("fill_chromium_page_blocked", PAGE_ANSWER_TIMEOUT_MS)
|
|
146676
|
-
);
|
|
146677
|
-
const out = await withTimeoutError(
|
|
146678
|
-
() => api.cdp.send(
|
|
146679
|
-
"Runtime.evaluate",
|
|
146680
|
-
{ expression: buildChromiumFillScript(text), awaitPromise: true, returnByValue: true },
|
|
146681
|
-
FILL_TIMEOUT_MS2
|
|
146682
|
-
),
|
|
146683
|
-
() => pageNotFinishedError("fill_chromium_timeout")
|
|
146684
|
-
);
|
|
146685
|
-
const answer = out.result?.value;
|
|
146686
|
-
switch (answer?.status) {
|
|
146687
|
-
case "ok":
|
|
146688
|
-
if (answer.verified === true) {
|
|
146689
|
-
return { verified: true };
|
|
146690
|
-
}
|
|
146691
|
-
throw notVerifiedError("fill_chromium_not_verified");
|
|
146692
|
-
case "no_focus":
|
|
146693
|
-
throw noFocusedFieldError("fill_chromium_no_focus");
|
|
146694
|
-
case "unsupported":
|
|
146695
|
-
throw unsupportedFieldError(answer.detail ?? "unsupported field", "fill_chromium_field");
|
|
146696
|
-
default:
|
|
146697
|
-
throw new FailureError("fill could not run in the page; nothing is known about the field.", {
|
|
146698
|
-
error_code: FAILURE_CODES.FILL_NOT_VERIFIED,
|
|
146699
|
-
failure_stage: "fill_chromium_script",
|
|
146700
|
-
failure_area: "tool_server",
|
|
146701
|
-
error_kind: "unknown",
|
|
146702
|
-
failure_command: "cdp"
|
|
146703
|
-
});
|
|
146704
|
-
}
|
|
146705
|
-
}
|
|
146706
|
-
|
|
146707
|
-
// ../tool-server/src/tools/fill/index.ts
|
|
146708
146716
|
var capability29 = {
|
|
146709
146717
|
apple: { simulator: true, device: true },
|
|
146710
146718
|
appleRemote: { simulator: true },
|
|
@@ -147202,32 +147210,24 @@ var DEFAULT_TIMEOUT_MS4 = 1e4;
|
|
|
147202
147210
|
var DEFAULT_POLL_INTERVAL_MS2 = 400;
|
|
147203
147211
|
var MIN_JS_READ_MS = 1e3;
|
|
147204
147212
|
var zodSchema45 = external_exports.object({
|
|
147205
|
-
udid: external_exports.string().min(1).describe(
|
|
147206
|
-
"Device ID passed as udid to network-capture-start. The wait reuses its Metro target."
|
|
147207
|
-
),
|
|
147213
|
+
udid: external_exports.string().min(1).describe("Device ID used in `network-capture-start`."),
|
|
147208
147214
|
bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
|
|
147209
|
-
"
|
|
147215
|
+
"`bundleId` used in `network-capture-start` (Chromium: placeholder like `argent.capture`)."
|
|
147210
147216
|
),
|
|
147211
147217
|
url: external_exports.string().min(1).describe(
|
|
147212
|
-
"URL text
|
|
147218
|
+
"URL text/regex to match (no `{{secret:...}}` placeholders; full URL is returned)."
|
|
147213
147219
|
),
|
|
147214
147220
|
urlMatch: external_exports.enum(["contains", "equals", "matches"]).optional().describe(
|
|
147215
|
-
"contains (default)
|
|
147221
|
+
"`contains` (default) / `equals` (case-insensitive) or `matches` (case-sensitive JS regex)."
|
|
147216
147222
|
),
|
|
147217
|
-
method: external_exports.string().min(1).optional().describe("HTTP method
|
|
147223
|
+
method: external_exports.string().min(1).optional().describe("HTTP method (case-insensitive)."),
|
|
147218
147224
|
status: external_exports.union([
|
|
147219
147225
|
external_exports.enum(STATUS_CLASSES),
|
|
147220
147226
|
external_exports.coerce.number().int().min(100).max(599)
|
|
147221
|
-
]).optional().describe(
|
|
147222
|
-
|
|
147223
|
-
),
|
|
147224
|
-
|
|
147225
|
-
"complete (default) accepts a finished response, including HTTP errors. failed accepts a request error. any accepts either."
|
|
147226
|
-
),
|
|
147227
|
-
timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(`Wait limit in milliseconds. Default ${DEFAULT_TIMEOUT_MS4}.`),
|
|
147228
|
-
pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(
|
|
147229
|
-
`Interval between capture reads in milliseconds. Default ${DEFAULT_POLL_INTERVAL_MS2}.`
|
|
147230
|
-
)
|
|
147227
|
+
]).optional().describe('Exact HTTP status or class (e.g. "2xx").'),
|
|
147228
|
+
outcome: external_exports.enum(["complete", "failed", "any"]).optional().describe("`complete` (default, incl. HTTP errors), `failed` (network error), or `any`."),
|
|
147229
|
+
timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(`Timeout in ms (default ${DEFAULT_TIMEOUT_MS4}).`),
|
|
147230
|
+
pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(`Poll interval in ms (default ${DEFAULT_POLL_INTERVAL_MS2}).`)
|
|
147231
147231
|
}).strict().superRefine((params, ctx) => {
|
|
147232
147232
|
if (params.url.includes(SECRET_PLACEHOLDER_MARKER)) {
|
|
147233
147233
|
ctx.addIssue({
|
|
@@ -147276,9 +147276,9 @@ function createAwaitNetworkRequestTool(registry2) {
|
|
|
147276
147276
|
return {
|
|
147277
147277
|
// A literal, so scripts/extract-tools.mjs finds the description it scores.
|
|
147278
147278
|
id: "await-network-request",
|
|
147279
|
-
description: `Check
|
|
147280
|
-
|
|
147281
|
-
|
|
147279
|
+
description: `Check for a matching HTTP request in the latest \`network-capture-start\` window (unsupported on physical iPhones and Vega; Chromium matches post-redirect URL/method).
|
|
147280
|
+
Use when asserting or synchronizing on an API call after triggering a UI action.
|
|
147281
|
+
Returns \`{ success, elapsed, match?, cause?, nearMisses?, layers? }\` (pass \`match.id\` to \`view-network-request-details\`). Fails with \`NETWORK_CAPTURE_NOT_STARTED\` if capture was not started; \`success: false\` fails e2e steps and stops \`run-sequence\`.`,
|
|
147282
147282
|
zodSchema: zodSchema45,
|
|
147283
147283
|
searchHint: "wait await network request http api call fetch xhr response status url match after capture start e2e assert",
|
|
147284
147284
|
readOnly: true,
|
|
@@ -147774,21 +147774,17 @@ function safeGetState(registry2, urn) {
|
|
|
147774
147774
|
var zodSchema47 = external_exports.object({
|
|
147775
147775
|
port: metroPortField,
|
|
147776
147776
|
device_id: external_exports.string().describe(
|
|
147777
|
-
"Device ID from list-devices<flag:macos-apps>, including a Mac app ID</flag:macos-apps
|
|
147777
|
+
"Device ID from list-devices<flag:macos-apps>, including a Mac app ID</flag:macos-apps> (or `logicalDeviceId` on shared Metro if requested)."
|
|
147778
147778
|
),
|
|
147779
|
-
sample_interval_us: external_exports.coerce.number().int().positive().default(100).describe("CPU sampling interval in microseconds"),
|
|
147780
|
-
force: external_exports.boolean().default(false).describe(
|
|
147781
|
-
"Take over an active profiling session even when it is owned by another tool-server and still fresh. Set to true only when you know the prior owner is gone."
|
|
147782
|
-
)
|
|
147779
|
+
sample_interval_us: external_exports.coerce.number().int().positive().default(100).describe("CPU sampling interval in microseconds."),
|
|
147780
|
+
force: external_exports.boolean().default(false).describe("Take over another active fresh session (ask user approval first).")
|
|
147783
147781
|
});
|
|
147784
147782
|
function createReactProfilerStartTool(registry2) {
|
|
147785
147783
|
return {
|
|
147786
147784
|
id: "react-profiler-start",
|
|
147787
|
-
description: `
|
|
147788
|
-
|
|
147789
|
-
|
|
147790
|
-
Returns { started_at, startedAtEpochMs, hermes_version, detected_architecture }. On iOS and Android, a warning names the apps with native network capture on (started by network-capture-start): their timings in the profile can differ. If a session is already running, returns { already_running: true, mine, owner, \u2026 } instead, without clobbering its data, unless it is another tool-server's stale run, has no owner record, or is a lost run of this tool-server: start replaces those. mine: true means this tool-server started the run: if it is yours, call react-profiler-stop. With stale: true it may be another agent's: follow the note. Otherwise, BEFORE OVERTAKING with { force: true }, ask the user for approval first, as how_to_reclaim explains. A start that replaces a run reports it in took_over.
|
|
147791
|
-
Fails if the Hermes runtime is not reachable or the Metro CDP connection cannot be established.`,
|
|
147785
|
+
description: `Start recording Hermes CPU samples and React commits. Use when profiling React Native performance (pair with \`native-profiler-start\` in parallel on iOS/Android<flag:macos-apps>/Mac apps</flag:macos-apps>, then stop with \`react-profiler-stop\`).<flag:macos-apps> Mac apps need a Debug build loading JS from Metro (react-native-macos 0.76+ or Mac Catalyst); connects without debugger-connect.</flag:macos-apps>
|
|
147786
|
+
Returns \`{ started_at, startedAtEpochMs, hermes_version, detected_architecture }\` or \`{ already_running: true, mine, owner, \u2026 }\` (ask approval before \`force: true\`). On iOS and Android, a warning names the apps with native network capture on.
|
|
147787
|
+
Fails if Hermes or Metro CDP is unreachable.`,
|
|
147792
147788
|
zodSchema: zodSchema47,
|
|
147793
147789
|
interaction: {
|
|
147794
147790
|
startedMsg: () => "Starting React profiler",
|
|
@@ -148865,12 +148861,9 @@ var zodSchema48 = external_exports.object({
|
|
|
148865
148861
|
function createReactProfilerStopTool(registry2) {
|
|
148866
148862
|
return {
|
|
148867
148863
|
id: "react-profiler-stop",
|
|
148868
|
-
description: `Stop
|
|
148869
|
-
|
|
148870
|
-
|
|
148871
|
-
Returns { duration_ms, sample_count, fiber_renders_captured, total_react_commits, hot_commit_indices, react_render_ms, react_render_share_pct, react_render_peak_1s_pct }.
|
|
148872
|
-
If some fibers' display names could not be resolved (typically modals, tooltips or animations that unmounted before stop), it also returns { unattributed_ms, unattributed_fiber_count, unattributed_commit_count }: the work missing from the per-component breakdown. Per-commit durations stay correct.
|
|
148873
|
-
Fails if no active profiling session exists, another stop is running, the CDP connection was lost during recording, or another session took the run over.`,
|
|
148864
|
+
description: `Stop React profiling and store CPU samples + commit tree for \`react-profiler-analyze\`, \`profiler-commit-query\`, and \`profiler-cpu-query\`.
|
|
148865
|
+
Use when finishing an interaction recorded after \`react-profiler-start\`.
|
|
148866
|
+
Returns \`{ duration_ms, sample_count, fiber_renders_captured, total_react_commits, hot_commit_indices, react_render_ms, react_render_share_pct, react_render_peak_1s_pct, unattributed_*? }\`. Fails if no active session exists, CDP disconnected, or another session took over.`,
|
|
148874
148867
|
zodSchema: zodSchema48,
|
|
148875
148868
|
// Collection can outlast the MCP client's 30 s abort. The client would then
|
|
148876
148869
|
// resend the call, and the resend fails on the stop still collecting.
|
|
@@ -150858,34 +150851,24 @@ async function unrelatedPaths(a, b) {
|
|
|
150858
150851
|
return outside((0, import_path6.relative)(from2, to)) && outside((0, import_path6.relative)(to, from2));
|
|
150859
150852
|
}
|
|
150860
150853
|
var annotationSchema = external_exports.object({
|
|
150861
|
-
offsetMs: external_exports.coerce.number().describe(
|
|
150862
|
-
|
|
150863
|
-
),
|
|
150864
|
-
label: external_exports.string().describe("Description of the action performed")
|
|
150854
|
+
offsetMs: external_exports.coerce.number().describe("Ms since profiling started (`tapTimestampMs - startedAtEpochMs`)."),
|
|
150855
|
+
label: external_exports.string().describe("Action label.")
|
|
150865
150856
|
});
|
|
150866
150857
|
var zodSchema50 = external_exports.object({
|
|
150867
150858
|
port: metroPortField,
|
|
150868
150859
|
device_id: external_exports.string().describe(
|
|
150869
|
-
"Device ID
|
|
150860
|
+
"Device ID from list-devices used for the profile<flag:macos-apps> (Mac app: its list-devices ID)</flag:macos-apps>."
|
|
150870
150861
|
),
|
|
150871
|
-
project_root: external_exports.string().describe("Absolute path to the RN project root
|
|
150872
|
-
platform: external_exports.enum(["ios", "android", "macos"]).optional().describe("
|
|
150873
|
-
rn_version: external_exports.coerce.string().default("unknown").describe('
|
|
150874
|
-
annotations: external_exports.array(annotationSchema).optional().describe(
|
|
150875
|
-
"User actions to annotate the report's commits with: each commit shows the action that preceded it."
|
|
150876
|
-
)
|
|
150862
|
+
project_root: external_exports.string().describe("Absolute path to the RN project root."),
|
|
150863
|
+
platform: external_exports.enum(["ios", "android", "macos"]).optional().describe("Fallback platform for source lookup if absent from recording.").meta({ [FLAG_ENUM_META_KEY]: { macos: MACOS_APPS_FLAG } }),
|
|
150864
|
+
rn_version: external_exports.coerce.string().default("unknown").describe('RN version (e.g. "0.73.4").'),
|
|
150865
|
+
annotations: external_exports.array(annotationSchema).optional().describe("User actions to annotate report commits.")
|
|
150877
150866
|
});
|
|
150878
150867
|
var reactProfilerAnalyzeTool = {
|
|
150879
150868
|
id: "react-profiler-analyze",
|
|
150880
|
-
description: `Analyze stored profiling data
|
|
150881
|
-
|
|
150882
|
-
|
|
150883
|
-
render cascades, root cause identification, and a top components table.
|
|
150884
|
-
Raw profiling data is saved to disk with a unique session timestamp for later reload via profiler-load.
|
|
150885
|
-
After presenting the report, ask the user whether to investigate further (drill-down with
|
|
150886
|
-
profiler-cpu-query / profiler-commit-query) or implement fixes and re-profile for comparison.
|
|
150887
|
-
Use when the profiling session is complete and you need to interpret the collected data.
|
|
150888
|
-
Fails if react-profiler-stop has not been called or no profiling data is stored.`,
|
|
150869
|
+
description: `Analyze stored React profiling data into a markdown report of hot commits (\u226516ms), render cascades, root causes, and top components.
|
|
150870
|
+
Use when \`react-profiler-stop\` has finished and you want to interpret the profile (drill down further with \`profiler-cpu-query\` / \`profiler-commit-query\`).
|
|
150871
|
+
Returns \`{ report, reportFile, hotCommitsTotal, hotCommitsShown, sessionFiles }\`. Fails if no profiling data is stored.`,
|
|
150889
150872
|
zodSchema: zodSchema50,
|
|
150890
150873
|
interaction: {
|
|
150891
150874
|
startedMsg: () => "Analyzing React profile",
|
|
@@ -156121,23 +156104,22 @@ var zodSchema55 = external_exports.object({
|
|
|
156121
156104
|
"Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
|
|
156122
156105
|
),
|
|
156123
156106
|
app_process: external_exports.string().optional().describe(
|
|
156124
|
-
"iOS
|
|
156107
|
+
"iOS executable/name or Android package (auto-detects foreground app if omitted)<flag:macos-apps>; omit for Mac apps</flag:macos-apps>."
|
|
156125
156108
|
),
|
|
156126
156109
|
template_path: external_exports.string().optional().describe(
|
|
156127
|
-
'iOS<flag:macos-apps
|
|
156110
|
+
'iOS<flag:macos-apps>/Mac app</flag:macos-apps> Instruments `.tracetemplate` path or built-in name (e.g. "Time Profiler"; default: bundled template).'
|
|
156128
156111
|
),
|
|
156129
156112
|
malloc_stack_logging: external_exports.boolean().optional().describe(
|
|
156130
|
-
"iOS<flag:macos-apps
|
|
156113
|
+
"iOS<flag:macos-apps>/Mac apps</flag:macos-apps> only: restart app with allocation stacks from launch (adds overhead; leave off for CPU/hang timing)."
|
|
156131
156114
|
)
|
|
156132
156115
|
});
|
|
156133
156116
|
var nativeProfilerStartTool = {
|
|
156134
156117
|
id: "native-profiler-start",
|
|
156135
156118
|
// iOS can outlast the 30s MCP fetch timeout, whose replay would start a second xctrace.
|
|
156136
156119
|
longRunning: true,
|
|
156137
|
-
description: `Start native profiling
|
|
156138
|
-
|
|
156139
|
-
|
|
156140
|
-
With malloc stack logging off, Argent blocks the bundled template if it detects a WebKit heap or the check fails. Use "Time Profiler" to keep the app's state, or set malloc_stack_logging to true to restart the app and record leaks with the bundled template. With logging off, other templates that use the Allocations instrument, including "Leaks" and "Allocations", can freeze an affected app.</flag:macos-apps>`,
|
|
156120
|
+
description: `Start native profiling: Instruments (CPU, hangs, leaks) on iOS<flag:macos-apps> and Mac apps</flag:macos-apps>, or Perfetto (CPU, jank, memory) on Android.
|
|
156121
|
+
Use when profiling native performance. Launch the target app first, wait for this call to return before reproducing the scenario, then call \`native-profiler-stop\` while the app is still running.<flag:macos-apps> Mac apps need a dev-signed build launched via Argent (use "Time Profiler" if signing/WebKit blocks the bundled template, or set \`malloc_stack_logging: true\` for leak stacks).</flag:macos-apps>
|
|
156122
|
+
Returns \`{ status: "recording", pid, traceFile, warning? }\` (warns on iOS/Android if native network capture is active). Fails if the app, xctrace, or adb is unavailable.`,
|
|
156141
156123
|
zodSchema: zodSchema55,
|
|
156142
156124
|
interaction: {
|
|
156143
156125
|
startedMsg: () => "Starting native profiler",
|
|
@@ -157564,19 +157546,11 @@ var launchAnalysisMode = {
|
|
|
157564
157546
|
}
|
|
157565
157547
|
};
|
|
157566
157548
|
var zodSchema58 = external_exports.object({
|
|
157567
|
-
mode: external_exports.enum(["measure", "profile"]).describe(
|
|
157568
|
-
|
|
157569
|
-
),
|
|
157570
|
-
|
|
157571
|
-
|
|
157572
|
-
),
|
|
157573
|
-
device_id: external_exports.string().optional().describe(
|
|
157574
|
-
"Connected iPhone UDID; required for a physical-device run. With allow_simulator, a booted simulator UDID also works."
|
|
157575
|
-
),
|
|
157576
|
-
allow_simulator: external_exports.boolean().default(false).describe("Explicitly allow a booted simulator when no iPhone is selected."),
|
|
157577
|
-
duration_seconds: external_exports.number().int().min(5).max(60).optional().describe(
|
|
157578
|
-
`profile mode only: App Launch trace recording length in seconds (default ${DEFAULT_PROFILE_SECONDS}). Rejected in measure mode.`
|
|
157579
|
-
)
|
|
157549
|
+
mode: external_exports.enum(["measure", "profile"]).describe("`measure`: 5 XCTest timed launches. `profile`: 1 Instruments App Launch trace."),
|
|
157550
|
+
bundle_id: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe("Installed Release build bundle ID (not built or installed by this tool)."),
|
|
157551
|
+
device_id: external_exports.string().optional().describe("iPhone UDID (or booted simulator UDID with `allow_simulator: true`)."),
|
|
157552
|
+
allow_simulator: external_exports.boolean().default(false).describe("Allow booted simulator when no iPhone is selected."),
|
|
157553
|
+
duration_seconds: external_exports.number().int().min(5).max(60).optional().describe(`\`profile\` mode only: trace duration in s (default ${DEFAULT_PROFILE_SECONDS}).`)
|
|
157580
157554
|
}).superRefine((params, ctx) => {
|
|
157581
157555
|
if (params.mode === "measure" && params.duration_seconds !== void 0) {
|
|
157582
157556
|
ctx.addIssue({
|
|
@@ -157596,13 +157570,9 @@ var nativeProfilerLaunchAnalysisTool = {
|
|
|
157596
157570
|
completedMsg: ({ params }) => launchAnalysisMode[params.mode].completed,
|
|
157597
157571
|
failedMsg: ({ params, failureSignal: failureSignal2 }) => `${launchAnalysisMode[params.mode].failed}: ${failureSignal2.error_code}`
|
|
157598
157572
|
},
|
|
157599
|
-
description: `Profile or measure iOS app startup
|
|
157600
|
-
|
|
157601
|
-
|
|
157602
|
-
Install a Release build of bundle_id before calling; the tool does not build or install the app.
|
|
157603
|
-
Use when you need the iOS launch time or want to find what slows the app's startup.
|
|
157604
|
-
Returns samplesCollected in measure mode. In profile mode, launchMs runs from the first lifecycle phase after Process Creation to the first frame (null on a simulator); follow profilerSession.next to load the CPU samples with profiler-load and query them with profiler-stack-query.
|
|
157605
|
-
Fails if the app is not installed or no iPhone or allowed simulator is available.`,
|
|
157573
|
+
description: `Profile or measure iOS app startup on an already-installed Release build (warms once, then measures).
|
|
157574
|
+
Use when benchmarking launch time (\`measure\`: 5 XCTest launches incl. extended tasks; signed runner on iPhone) or profiling pre-first-frame CPU work (\`profile\`: Instruments App Launch trace; follow \`profilerSession.next\` with \`profiler-load\` + \`profiler-stack-query\`).
|
|
157575
|
+
Returns \`samplesCollected\` (\`measure\`) or \`launchMs\` + \`profilerSession\` (\`profile\`). Fails if the app is not installed or no iPhone / allowed simulator is available.`,
|
|
157606
157576
|
zodSchema: zodSchema58,
|
|
157607
157577
|
services: () => ({}),
|
|
157608
157578
|
async execute(_services, params, ctx) {
|
|
@@ -160270,25 +160240,20 @@ var capability34 = {
|
|
|
160270
160240
|
};
|
|
160271
160241
|
var zodSchema60 = external_exports.object({
|
|
160272
160242
|
udid: external_exports.string().describe(
|
|
160273
|
-
"Target ID from `list-devices
|
|
160274
|
-
),
|
|
160275
|
-
timeLimitSeconds: external_exports.number().int().min(1).max(MAX_TIME_LIMIT_SECONDS).optional().describe(
|
|
160276
|
-
`Auto-stop cap in seconds (default ${DEFAULT_TIME_LIMIT_SECONDS}). Set it to slightly more than the interaction you plan to capture.`
|
|
160277
|
-
),
|
|
160278
|
-
trimStatic: external_exports.boolean().optional().describe(
|
|
160279
|
-
"Default true. Collapse stretches where the screen does not change: the first second of each still stretch is kept, then unchanged frames are dropped until something moves again, so a long recording with brief activity comes back short instead of full of dead air. Set false to keep a faithful real-time recording."
|
|
160243
|
+
"Target ID from `list-devices`<flag:macos-apps> (Mac app: `macos-app-<bundle id>`)</flag:macos-apps>."
|
|
160280
160244
|
),
|
|
160245
|
+
timeLimitSeconds: external_exports.number().int().min(1).max(MAX_TIME_LIMIT_SECONDS).optional().describe(`Auto-stop cap in seconds (default ${DEFAULT_TIME_LIMIT_SECONDS}).`),
|
|
160246
|
+
trimStatic: external_exports.boolean().optional().describe("Collapse idle unchanged stretches after 1s (default true; false = real-time)."),
|
|
160281
160247
|
showTouches: external_exports.boolean().optional().describe(
|
|
160282
|
-
"Draw touch markers
|
|
160248
|
+
"Draw touch markers (default true; unsupported on physical iPhones)<flag:macos-apps>. Mac apps: shows pointer, click ring, and hold dot</flag:macos-apps>."
|
|
160283
160249
|
)
|
|
160284
160250
|
});
|
|
160285
160251
|
function createScreenRecordingStartTool(registry2) {
|
|
160286
160252
|
return {
|
|
160287
160253
|
id: "screen-recording-start",
|
|
160288
|
-
description: `Start an MP4 recording of the device screen<flag:macos-apps> or Mac app window</flag:macos-apps>. Use when
|
|
160289
|
-
|
|
160290
|
-
|
|
160291
|
-
For a Mac app started by Argent, restore its window and move it fully onto one display. Capture protection blocks recording. Mac app recording needs neither Screen Recording permission nor ffmpeg and continues while the Mac is locked. If start returns \`MACOS_APP_LIBRARY_OUTDATED\`, run \`restart-app\` and retry.</flag:macos-apps>`,
|
|
160254
|
+
description: `Start an MP4 recording of the device screen<flag:macos-apps> or Mac app window</flag:macos-apps>. Use when capturing video of an interaction or animation (use \`screenshot\` for a still image).
|
|
160255
|
+
Continues until \`screen-recording-stop\` or \`timeLimitSeconds\` (always retrieve via \`screen-recording-stop\`). Requires \`ffmpeg\` on simulators, Android, and wired iPhones (needs \`transportType: "wired"\` and camera access for \`ios-screen-stream\`). Unsupported on tvOS, Chromium<flag:harmonyos>, HarmonyOS</flag:harmonyos>, and Vega.<flag:macos-apps> Mac apps: needs a visible window on one display, no capture protection, no Screen Recording permission or ffmpeg; on \`MACOS_APP_LIBRARY_OUTDATED\`, run \`restart-app\` and retry.</flag:macos-apps>
|
|
160256
|
+
Returns \`{ outputFile }\` on the tool-server host. Fails if target is unavailable or already recording.`,
|
|
160292
160257
|
zodSchema: zodSchema60,
|
|
160293
160258
|
searchHint: "record video screen capture movie mp4 start filming screencast",
|
|
160294
160259
|
interaction: {
|
|
@@ -160830,35 +160795,26 @@ function getTopComponents(entries, topN2) {
|
|
|
160830
160795
|
}));
|
|
160831
160796
|
}
|
|
160832
160797
|
var timeRangeSchema = external_exports.object({
|
|
160833
|
-
start: external_exports.coerce.number().describe("Start
|
|
160834
|
-
end: external_exports.coerce.number().describe("End
|
|
160798
|
+
start: external_exports.coerce.number().describe("Start ms."),
|
|
160799
|
+
end: external_exports.coerce.number().describe("End ms.")
|
|
160835
160800
|
});
|
|
160836
160801
|
var zodSchema62 = external_exports.object({
|
|
160837
160802
|
port: metroPortField,
|
|
160838
160803
|
device_id: metroDeviceIdParam(
|
|
160839
160804
|
"Device ID used to record or load the React profile<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>."
|
|
160840
160805
|
),
|
|
160841
|
-
mode: external_exports.enum(["by_component", "by_time_range", "by_index", "cascade_tree", "render_counts"]).describe("Query mode
|
|
160842
|
-
component_name: external_exports.string().optional().describe("Component name
|
|
160843
|
-
time_range_ms: timeRangeSchema.optional().describe("
|
|
160806
|
+
mode: external_exports.enum(["by_component", "by_time_range", "by_index", "cascade_tree", "render_counts"]).describe("Query mode."),
|
|
160807
|
+
component_name: external_exports.string().optional().describe("Component name (optional filter for `render_counts`)."),
|
|
160808
|
+
time_range_ms: timeRangeSchema.optional().describe("Range in ms since profiling started."),
|
|
160844
160809
|
// Without `.nullable()`, `z.coerce.number()` reads null as commit 0.
|
|
160845
|
-
commit_index: external_exports.coerce.number().int().nullable().transform((value) => value ?? void 0).optional().describe("Commit index"),
|
|
160846
|
-
top_n: external_exports.coerce.number().int().positive().optional().describe(
|
|
160847
|
-
"Max results to return. Defaults to 20 for by_component / by_time_range, which count commits, and render_counts, which counts components. by_index counts individual fibers and returns all of them unless this is set; a small cap there can show less than the analyze report it is meant to expand on."
|
|
160848
|
-
)
|
|
160810
|
+
commit_index: external_exports.coerce.number().int().nullable().transform((value) => value ?? void 0).optional().describe("Commit index."),
|
|
160811
|
+
top_n: external_exports.coerce.number().int().positive().optional().describe("Max results (default 20; unlimited for `by_index`).")
|
|
160849
160812
|
});
|
|
160850
160813
|
var profilerCommitQueryTool = {
|
|
160851
160814
|
id: "profiler-commit-query",
|
|
160852
|
-
description: `Query React commit data
|
|
160853
|
-
|
|
160854
|
-
|
|
160855
|
-
- by_time_range: What happened in time_range_ms.
|
|
160856
|
-
- by_index: Full detail dump of the commit at commit_index (all components, props changed, parent cascade).
|
|
160857
|
-
- cascade_tree: Parent-child cascade tree for the commit at commit_index, showing who triggered whom.
|
|
160858
|
-
- render_counts: Re-render count, rate and self time per component over ALL commits, including those under 16ms that the other modes cannot see. Library components included.
|
|
160859
|
-
Use when drilling into specific components or time windows after react-profiler-analyze.
|
|
160860
|
-
Returns a markdown table or tree of commit data matching the requested mode.
|
|
160861
|
-
Fails if react-profiler-stop has not been called.`,
|
|
160815
|
+
description: `Query React commit data by mode: \`by_component\`, \`by_time_range\`, \`by_index\` (full fiber dump), \`cascade_tree\` (parent\u2192child triggers), or \`render_counts\` (counts/rates across ALL commits, incl. <16ms).
|
|
160816
|
+
Use when drilling into components, cascades, or time windows after \`react-profiler-analyze\`.
|
|
160817
|
+
Returns a markdown table or tree. Fails if \`react-profiler-stop\` has not been called.`,
|
|
160862
160818
|
zodSchema: zodSchema62,
|
|
160863
160819
|
readOnly: true,
|
|
160864
160820
|
interaction: {
|
|
@@ -161292,41 +161248,27 @@ function nodesNestedInSameName(nodeMap, childToParent) {
|
|
|
161292
161248
|
return nested;
|
|
161293
161249
|
}
|
|
161294
161250
|
var timeWindowSchema = external_exports.object({
|
|
161295
|
-
start: external_exports.coerce.number().describe("Start
|
|
161296
|
-
end: external_exports.coerce.number().describe("End
|
|
161251
|
+
start: external_exports.coerce.number().describe("Start ms."),
|
|
161252
|
+
end: external_exports.coerce.number().describe("End ms.")
|
|
161297
161253
|
});
|
|
161298
161254
|
var zodSchema63 = external_exports.object({
|
|
161299
161255
|
port: metroPortField,
|
|
161300
161256
|
device_id: metroDeviceIdParam(
|
|
161301
161257
|
"Device ID used to record or load the React profile<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>."
|
|
161302
161258
|
),
|
|
161303
|
-
mode: external_exports.enum(["top_functions", "time_window", "call_tree", "component_cpu"]).describe("Query mode
|
|
161304
|
-
time_window_ms: timeWindowSchema.optional().describe(
|
|
161305
|
-
|
|
161306
|
-
),
|
|
161307
|
-
|
|
161308
|
-
|
|
161309
|
-
|
|
161310
|
-
include_callers: external_exports.boolean().default(false).describe("Also show callers of the function"),
|
|
161311
|
-
react_only: external_exports.boolean().default(false).describe(
|
|
161312
|
-
"top_functions and time_window: list only React component functions (PascalCase names)"
|
|
161313
|
-
)
|
|
161259
|
+
mode: external_exports.enum(["top_functions", "time_window", "call_tree", "component_cpu"]).describe("Query mode."),
|
|
161260
|
+
time_window_ms: timeWindowSchema.optional().describe("Window in ms since profiling started (same clock as `profiler-commit-query`)."),
|
|
161261
|
+
component_name: external_exports.string().optional().describe("Component name."),
|
|
161262
|
+
function_name: external_exports.string().optional().describe("Function name."),
|
|
161263
|
+
top_n: external_exports.coerce.number().int().positive().default(15).describe("Max rows (default 15)."),
|
|
161264
|
+
include_callers: external_exports.boolean().default(false).describe("Include callers (`call_tree`)."),
|
|
161265
|
+
react_only: external_exports.boolean().default(false).describe("Only PascalCase React components.")
|
|
161314
161266
|
});
|
|
161315
161267
|
var profilerCpuQueryTool = {
|
|
161316
161268
|
id: "profiler-cpu-query",
|
|
161317
|
-
description: `Query Hermes CPU
|
|
161318
|
-
|
|
161319
|
-
|
|
161320
|
-
- time_window: CPU breakdown for time_window_ms (e.g. during a slow commit or hang).
|
|
161321
|
-
- call_tree: For a given function_name, show its callees, and its callers with include_callers.
|
|
161322
|
-
- component_cpu: For a given component_name, aggregate CPU activity across its stored commits.
|
|
161323
|
-
In top_functions and time_window, self-times are the summed sampling intervals of the samples that
|
|
161324
|
-
landed in the window, so they measure sampled coverage rather than the window's width and do not
|
|
161325
|
-
change if you widen the query. Their tables state how many samples they cover and how much was idle.
|
|
161326
|
-
Each row is one call path, so a function can have several rows and top_n counts rows.
|
|
161327
|
-
Use when investigating JS CPU hotspots or correlating CPU cost with specific components.
|
|
161328
|
-
Returns a markdown table of CPU hotspots, call tree, or per-component CPU breakdown.
|
|
161329
|
-
Fails if no CPU profile is stored; run react-profiler-stop (and ideally react-profiler-analyze) first.`,
|
|
161269
|
+
description: `Query Hermes CPU samples by mode: \`top_functions\` (global hotspots, optional \`time_window_ms\`), \`time_window\` (breakdown during \`time_window_ms\`), \`call_tree\` (callees/callers for \`function_name\`), or \`component_cpu\` (CPU across \`component_name\` commits).
|
|
161270
|
+
Use when drilling into JS CPU hotspots after \`react-profiler-analyze\`. Self-times measure sampled coverage per call path.
|
|
161271
|
+
Returns a markdown table or call tree. Fails if no CPU profile is stored (run \`react-profiler-stop\` first).`,
|
|
161330
161272
|
zodSchema: zodSchema63,
|
|
161331
161273
|
readOnly: true,
|
|
161332
161274
|
interaction: {
|
|
@@ -161718,24 +161660,21 @@ var zodSchema64 = external_exports.object({
|
|
|
161718
161660
|
device_id: metroDeviceIdParam(
|
|
161719
161661
|
"Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
|
|
161720
161662
|
),
|
|
161721
|
-
mode: external_exports.enum(["hang_stacks", "function_callers", "thread_breakdown", "leak_stacks"]).describe("Query mode
|
|
161663
|
+
mode: external_exports.enum(["hang_stacks", "function_callers", "thread_breakdown", "leak_stacks"]).describe("Query mode."),
|
|
161722
161664
|
// Without `.nullable()`, `z.coerce.number()` reads null as hang 0.
|
|
161723
|
-
hang_index: external_exports.coerce.number().int().nullable().transform((value) => value ?? void 0).optional().describe("0-based
|
|
161724
|
-
function_name: external_exports.string().optional().describe("Native function name"),
|
|
161665
|
+
hang_index: external_exports.coerce.number().int().nullable().transform((value) => value ?? void 0).optional().describe("0-based hang index."),
|
|
161666
|
+
function_name: external_exports.string().optional().describe("Native function name."),
|
|
161725
161667
|
thread: external_exports.string().optional().describe(
|
|
161726
|
-
'Thread filter
|
|
161668
|
+
'Thread filter (substring for `thread_breakdown`; exact raw name or `"main"` for `function_callers`).'
|
|
161727
161669
|
),
|
|
161728
|
-
object_type: external_exports.string().optional().describe("Object type filter"),
|
|
161729
|
-
top_n: external_exports.coerce.number().int().positive().default(15).describe("Max results
|
|
161670
|
+
object_type: external_exports.string().optional().describe("Object type filter (`leak_stacks`)."),
|
|
161671
|
+
top_n: external_exports.coerce.number().int().positive().default(15).describe("Max results (default 15).")
|
|
161730
161672
|
});
|
|
161731
161673
|
var profilerStackQueryTool = {
|
|
161732
161674
|
id: "profiler-stack-query",
|
|
161733
|
-
description: `
|
|
161734
|
-
|
|
161735
|
-
|
|
161736
|
-
- function_callers: Who calls function_name and what it calls.
|
|
161737
|
-
- thread_breakdown: CPU time split by thread, optionally filtered.
|
|
161738
|
-
- leak_stacks: Memory leak details (iOS<flag:macos-apps> and Mac apps</flag:macos-apps> only). Requires a trace with leak data.`,
|
|
161675
|
+
description: `Query native profiler stacks after \`native-profiler-analyze\` or \`profiler-load\`: \`hang_stacks\` (by \`hang_index\`), \`function_callers\` (for \`function_name\`), \`thread_breakdown\`, or \`leak_stacks\` (iOS<flag:macos-apps>/Mac apps</flag:macos-apps>).
|
|
161676
|
+
Use when drilling into native hangs, callers, threads, or leaks.
|
|
161677
|
+
Returns a markdown breakdown. Fails if no native trace is loaded.`,
|
|
161739
161678
|
zodSchema: zodSchema64,
|
|
161740
161679
|
readOnly: true,
|
|
161741
161680
|
interaction: {
|
|
@@ -162518,27 +162457,17 @@ var profilerLoadAction = {
|
|
|
162518
162457
|
}
|
|
162519
162458
|
};
|
|
162520
162459
|
var zodSchema66 = external_exports.object({
|
|
162521
|
-
mode: external_exports.enum(["list", "load_react", "load_native"]).describe("
|
|
162522
|
-
session_id: external_exports.string().regex(SESSION_ID_PATTERN, "session_id may only contain letters, digits, '_' and '-'").optional().describe("
|
|
162460
|
+
mode: external_exports.enum(["list", "load_react", "load_native"]).describe("`list`, `load_react`, or `load_native`."),
|
|
162461
|
+
session_id: external_exports.string().regex(SESSION_ID_PATTERN, "session_id may only contain letters, digits, '_' and '-'").optional().describe("Session ID from `list` (required for `load_*`)."),
|
|
162523
162462
|
port: metroPortField,
|
|
162524
|
-
device_id: metroDeviceIdParam(
|
|
162525
|
-
|
|
162526
|
-
),
|
|
162527
|
-
app_process: external_exports.string().optional().describe(
|
|
162528
|
-
"Android package name to pass when restoring an older load_native .pftrace session that has no metadata sidecar."
|
|
162529
|
-
)
|
|
162463
|
+
device_id: metroDeviceIdParam("Device id from `list-devices` to bind the loaded session to."),
|
|
162464
|
+
app_process: external_exports.string().optional().describe("Android package name for legacy `.pftrace` sessions without metadata.")
|
|
162530
162465
|
});
|
|
162531
162466
|
var profilerLoadTool = {
|
|
162532
162467
|
id: "profiler-load",
|
|
162533
|
-
description: `
|
|
162534
|
-
Use when
|
|
162535
|
-
|
|
162536
|
-
- list: Show all available profiling sessions in the project's debug directory.
|
|
162537
|
-
- load_react: Load a React profiler session (CPU profile + commit tree) into memory. Requires session_id.
|
|
162538
|
-
- load_native: Restore native trace data (xctrace XML on iOS<flag:macos-apps> and Mac apps</flag:macos-apps>, .pftrace on Android). Requires session_id.
|
|
162539
|
-
Loading replaces the session in memory for this device_id (and Metro port, for React): the one the query tools and react-profiler-analyze read. The replaced session stays on disk; load it again by its session_id.
|
|
162540
|
-
Returns a summary of the loaded session or a session list for the list mode.
|
|
162541
|
-
Fails if the session_id is not found or the session's trace files are missing from disk.`,
|
|
162468
|
+
description: `List or restore saved React/native profiling sessions from disk into memory for \`profiler-*-query\` / \`react-profiler-analyze\` (\`load_react\` loads CPU+commits; \`load_native\` loads xctrace on iOS<flag:macos-apps>/Mac apps</flag:macos-apps> or \`.pftrace\` on Android).
|
|
162469
|
+
Use when revisiting past sessions without re-recording (replaces the in-memory session for \`device_id\` without deleting disk files).
|
|
162470
|
+
Returns a session list or loaded summary. Fails if \`session_id\` or its files are missing.`,
|
|
162542
162471
|
zodSchema: zodSchema66,
|
|
162543
162472
|
interaction: {
|
|
162544
162473
|
startedMsg: ({ params }) => profilerLoadAction[params.mode].started(params),
|
|
@@ -162709,7 +162638,9 @@ var zodSchema67 = external_exports.object({
|
|
|
162709
162638
|
function createStopSimulatorServerTool(registry2) {
|
|
162710
162639
|
return {
|
|
162711
162640
|
id: "stop-simulator-server",
|
|
162712
|
-
description: `Stop the transport session for
|
|
162641
|
+
description: `Stop the transport session for one device (simulator-server, physical iOS runner, Chromium CDP, or TV daemons).
|
|
162642
|
+
Use when restarting a wedged transport or freeing one device without affecting others (not routinely after every task; use \`stop-all-simulator-servers\` with \`devices\` to also stop devtools/profilers/debuggers). On Chromium, also ends the JS debugger session.<flag:macos-apps> On Mac apps, also stops native capture (discarding records) and screen recording.</flag:macos-apps>
|
|
162643
|
+
Returns \`{ stopped, udid }\` (\`stopped: false\` if none was running). Fails only on invalid input.`,
|
|
162713
162644
|
zodSchema: zodSchema67,
|
|
162714
162645
|
interaction: {
|
|
162715
162646
|
startedMsg: ({ params }) => `Stopping simulator server for ${params.udid}`,
|
|
@@ -162753,11 +162684,10 @@ var zodSchema68 = external_exports.object({
|
|
|
162753
162684
|
function createStopAllSimulatorServersTool(registry2) {
|
|
162754
162685
|
return {
|
|
162755
162686
|
id: "stop-all-simulator-servers",
|
|
162756
|
-
description: `Stop
|
|
162757
|
-
|
|
162758
|
-
|
|
162759
|
-
Returns { stopped
|
|
162760
|
-
Fails if the input has an unknown key (e.g. \`udids\` instead of \`devices\`); otherwise it always succeeds, and reaping nothing is a result, not a failure.`,
|
|
162687
|
+
description: `Stop device-owned background services (simulator-server, devtools, accessibility, TV daemons, Chromium CDP, screen recordings, profilers, network capture/throttle, and JS debugger sessions), freeing their processes and ports.
|
|
162688
|
+
Use when cleaning up or ending a session, or when a skill asks to recycle services \u2014 not routinely after every task (services are reused). Use \`network-capture-stop\` to stop network capture while keeping recorded requests.
|
|
162689
|
+
Always pass \`devices\` with this session's device IDs (plus any \`logicalDeviceId\` used with \`debugger-connect\` on shared Metro) so other agents' devices aren't torn down; omit \`devices\` only for a machine-wide sweep. \`[]\` stops nothing.
|
|
162690
|
+
Returns \`{ stopped, unmatched?, left_running?, aborted? }\` (\`left_running\` names unscoped debugger URNs; re-call with the id after \`<ns>:<port>:\` to reap them). Fails if unknown keys (e.g. \`udids\`) are passed.`,
|
|
162761
162691
|
zodSchema: zodSchema68,
|
|
162762
162692
|
interaction: {
|
|
162763
162693
|
// "all" only holds for the unscoped sweep; a scoped call touches just the
|
|
@@ -164493,14 +164423,10 @@ var fileInputs3 = [
|
|
|
164493
164423
|
{ target: "project_root", path: "${project_root}", kind: "probe" }
|
|
164494
164424
|
];
|
|
164495
164425
|
var zodSchema70 = external_exports.object({
|
|
164496
|
-
name: external_exports.string().describe(
|
|
164497
|
-
|
|
164498
|
-
),
|
|
164499
|
-
project_root: external_exports.string().describe(
|
|
164500
|
-
"Absolute path to the project root directory (the directory that contains or should contain `.argent/e2e/`)."
|
|
164501
|
-
),
|
|
164426
|
+
name: external_exports.string().describe("E2E test name (letters, digits, `_`, `-`)."),
|
|
164427
|
+
project_root: external_exports.string().describe("Absolute path to the project root containing `.argent/e2e/`."),
|
|
164502
164428
|
executionPrerequisite: external_exports.string().optional().describe(
|
|
164503
|
-
|
|
164429
|
+
"Fragments only: entry state assumed. Omit for standalone tests (Chromium records as a fragment, then add `launch: { chromium: <app path> }` and remove this)."
|
|
164504
164430
|
),
|
|
164505
164431
|
requires: external_exports.object({
|
|
164506
164432
|
platform: external_exports.union([
|
|
@@ -164508,40 +164434,15 @@ var zodSchema70 = external_exports.object({
|
|
|
164508
164434
|
external_exports.array(external_exports.enum(LAUNCH_PLATFORMS).meta(MACOS_PLATFORM_FLAG)).min(1)
|
|
164509
164435
|
]).optional(),
|
|
164510
164436
|
runtimeKind: external_exports.enum(RUNTIME_KINDS).optional()
|
|
164511
|
-
}).optional().describe(
|
|
164512
|
-
|
|
164513
|
-
),
|
|
164514
|
-
env: envRecordSchema(external_exports.string()).optional().describe(
|
|
164515
|
-
"Default script environment values saved in the test's top-level env. Use {{secret:NAME}} for credentials."
|
|
164516
|
-
)
|
|
164437
|
+
}).optional().describe("Supported target filter (`platform` and/or `runtimeKind`, ANDed). Omit for any."),
|
|
164438
|
+
env: envRecordSchema(external_exports.string()).optional().describe("Top-level script env defaults. Supports `{{secret:NAME}}`.")
|
|
164517
164439
|
});
|
|
164518
164440
|
var flowStartRecordingTool = {
|
|
164519
164441
|
id: "e2e-start-recording",
|
|
164520
|
-
description: `Start recording a new e2e test, resetting
|
|
164521
|
-
Use when
|
|
164522
|
-
|
|
164523
|
-
|
|
164524
|
-
|
|
164525
|
-
Several e2e tests can be recorded at once, each keyed by the \`name\` + \`project_root\`
|
|
164526
|
-
that every subsequent recording tool repeats, and one recording's steps never
|
|
164527
|
-
land in another's file.
|
|
164528
|
-
|
|
164529
|
-
After starting, use e2e-add-step to append tool calls. Each step runs LIVE, so
|
|
164530
|
-
give each concurrent recording its own device and pick a name unique to your
|
|
164531
|
-
task. Read each step's \`message\`: it warns when a recorded await-ui-element did
|
|
164532
|
-
not hold, or may fail once converted to \`await:\`/\`assert:\`. A wait nested in a
|
|
164533
|
-
recorded run-sequence gets no such warning, so read its \`toolResult\`. For a
|
|
164534
|
-
standalone e2e test, record a restart-app of the app under test as the FIRST step
|
|
164535
|
-
(captured as the e2e test's \`launch\` step); for a reusable fragment, skip that and
|
|
164536
|
-
pass executionPrerequisite instead. Starting over an existing e2e test replaces the
|
|
164537
|
-
whole file, including its \`requires:\` and \`env:\` blocks; pass \`requires\` and \`env\` to keep them.
|
|
164538
|
-
Use e2e-add-echo to add labels, and
|
|
164539
|
-
e2e-add-script to run a local .mjs, .mts, .js or .ts file and record it as a \`script:\` step.
|
|
164540
|
-
Call e2e-finish-recording when done.
|
|
164541
|
-
|
|
164542
|
-
To remove or reorder steps, edit the .yaml file after e2e-finish-recording, not
|
|
164543
|
-
during the recording: over a link, the next recorded step writes over your edit,
|
|
164544
|
-
and without a link, an edit that renumbers the steps drops their warnings.`,
|
|
164442
|
+
description: `Start recording a new e2e test, resetting \`.argent/e2e/<name>.yaml\`. Starting over an existing test replaces the whole file, including its \`requires:\` and \`env:\` blocks (pass \`requires\` and \`env\` to keep them), and runs pending fragment cleanup on restart.
|
|
164443
|
+
Use when capturing a reusable sequence of device actions for replay; load the \`argent-create-e2e\` skill first. Not for Apple TV or Android TV.
|
|
164444
|
+
Record live steps with \`e2e-add-step\` (start standalone tests with \`restart-app\`; use \`executionPrerequisite\` for fragments), \`e2e-add-echo\`, and \`e2e-add-script\`, then call \`e2e-finish-recording\`. Edit the YAML only after finishing.
|
|
164445
|
+
Returns \`{ message, e2eTestFile, savedTo, restarted?, discardedSteps?, fragmentShutdown? }\`. Fails if the target file or directory cannot be written.`,
|
|
164545
164446
|
zodSchema: zodSchema70,
|
|
164546
164447
|
aliases: ["flow-start-recording"],
|
|
164547
164448
|
interaction: {
|
|
@@ -167919,17 +167820,13 @@ var fileInputs4 = [
|
|
|
167919
167820
|
{ target: "project_root", path: "${project_root}", kind: "probe", collect: "step" }
|
|
167920
167821
|
];
|
|
167921
167822
|
var zodSchema71 = external_exports.object({
|
|
167922
|
-
name: external_exports.string().describe("
|
|
167923
|
-
project_root: external_exports.string().describe(
|
|
167924
|
-
"Absolute path to the project root of the e2e test being recorded: the same value passed to e2e-start-recording."
|
|
167925
|
-
),
|
|
167823
|
+
name: external_exports.string().describe("E2E test name from `e2e-start-recording`."),
|
|
167824
|
+
project_root: external_exports.string().describe("Project root from `e2e-start-recording`."),
|
|
167926
167825
|
command: external_exports.string().describe(
|
|
167927
|
-
'MCP tool to
|
|
167928
|
-
),
|
|
167929
|
-
args: external_exports.string().optional().describe(
|
|
167930
|
-
`Tool arguments as a JSON string, e.g. '{"udid": "ABC", "x": 0.5, "y": 0.3}'. Omit for tools with no arguments.`
|
|
167826
|
+
'MCP tool id to run and record (e.g. "gesture-tap"; call `e2e-add-script` directly for scripts).'
|
|
167931
167827
|
),
|
|
167932
|
-
|
|
167828
|
+
args: external_exports.string().optional().describe("JSON string of tool arguments (omit if none)."),
|
|
167829
|
+
delayMs: external_exports.number().int().min(0).optional().describe("Replay delay in ms before this step."),
|
|
167933
167830
|
shutdown: external_exports.boolean().optional().describe(
|
|
167934
167831
|
"Save the call in the shutdown list. Pending fragment cleanup runs before the call. stepCount counts shutdown entries."
|
|
167935
167832
|
)
|
|
@@ -167937,10 +167834,9 @@ var zodSchema71 = external_exports.object({
|
|
|
167937
167834
|
function createFlowAddStepTool(registry2) {
|
|
167938
167835
|
return deferredShutdownFirst({
|
|
167939
167836
|
id: "e2e-add-step",
|
|
167940
|
-
description: `Execute one MCP tool and
|
|
167941
|
-
|
|
167942
|
-
|
|
167943
|
-
Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status, says whether a step was appended. Fails with an error, recording nothing. Call recording tools, including \`e2e-add-script\`, directly.`,
|
|
167837
|
+
description: `Execute one MCP tool live and append it to an open e2e recording (\`gesture-tap\` records as a portable \`tap\` selector; \`restart-app\` as \`launch\`; supports \`{{output:PATH}}\` references).
|
|
167838
|
+
Use when recording steps after \`e2e-start-recording\` (pass \`shutdown: true\` for cleanup steps; call recording tools like \`e2e-add-script\` directly).
|
|
167839
|
+
Returns \`{ message, toolResult, stepCount, recorded?, savedTo }\`. Fails if no recording is open or the step errors (nothing recorded).`,
|
|
167944
167840
|
zodSchema: zodSchema71,
|
|
167945
167841
|
aliases: ["flow-add-step"],
|
|
167946
167842
|
interaction: {
|
|
@@ -168384,22 +168280,20 @@ function renderOutput(output2) {
|
|
|
168384
168280
|
return { outputJson: kept.toString("utf8"), outputTruncated: true };
|
|
168385
168281
|
}
|
|
168386
168282
|
var zodSchema74 = external_exports.object({
|
|
168387
|
-
name: external_exports.string().describe("E2E test name
|
|
168388
|
-
project_root: external_exports.string().describe("
|
|
168389
|
-
path: external_exports.string().describe(
|
|
168390
|
-
|
|
168391
|
-
),
|
|
168392
|
-
timeout: external_exports.number().optional().describe("Time limit in milliseconds. The default is 30000 and the minimum is 100."),
|
|
168393
|
-
env: envRecordSchema(external_exports.string()).optional().describe(
|
|
168394
|
-
"Environment overrides for this script. Argent uses them immediately and saves them on the step. Values can include {{secret:NAME}} or {{output:PATH}}."
|
|
168395
|
-
),
|
|
168283
|
+
name: external_exports.string().describe("E2E test name from `e2e-start-recording`."),
|
|
168284
|
+
project_root: external_exports.string().describe("Project root from `e2e-start-recording`."),
|
|
168285
|
+
path: external_exports.string().describe("Script path (.mjs/.mts/.js/.ts) relative to the test YAML."),
|
|
168286
|
+
timeout: external_exports.number().optional().describe("Timeout in ms (default 30000, min 100)."),
|
|
168287
|
+
env: envRecordSchema(external_exports.string()).optional().describe("Env overrides (supports `{{secret:NAME}}` and `{{output:PATH}}`)."),
|
|
168396
168288
|
shutdown: external_exports.boolean().optional().describe(
|
|
168397
168289
|
"Save the script in the shutdown list. Pending fragment cleanup runs before the script. The script's output reaches only later shutdown steps. stepCount counts shutdown entries."
|
|
168398
168290
|
)
|
|
168399
168291
|
});
|
|
168400
168292
|
var flowAddScriptTool = deferredShutdownFirst({
|
|
168401
168293
|
id: "e2e-add-script",
|
|
168402
|
-
description: `Run a local
|
|
168294
|
+
description: `Run a local JS/TS script and record it as a \`script:\` step (requires no \`argent link\` / \`ARGENT_TOOLS_URL\`).
|
|
168295
|
+
Use when the user requests a local script in an open recording (output is available to later steps via \`{{output:PATH}}\`).
|
|
168296
|
+
Returns \`{ status, reason?, outputJson?, stepCount, recorded? }\`. A failed script returns \`status: "fail"\` or \`"error"\` without recording (check \`reason\` and affected state before retrying). Fails on invalid input, no open recording, or recording over a link.`,
|
|
168403
168297
|
zodSchema: zodSchema74,
|
|
168404
168298
|
fileInputs: PROJECT_ROOT_INPUT,
|
|
168405
168299
|
aliases: ["flow-add-script"],
|
|
@@ -168555,16 +168449,14 @@ function anchoredWarnings(recorded, warnings, steps) {
|
|
|
168555
168449
|
return kept;
|
|
168556
168450
|
}
|
|
168557
168451
|
var zodSchema75 = external_exports.object({
|
|
168558
|
-
name: external_exports.string().describe("
|
|
168559
|
-
project_root: external_exports.string().describe(
|
|
168560
|
-
"Absolute path to the project root of the e2e test being recorded: the same value passed to e2e-start-recording."
|
|
168561
|
-
)
|
|
168452
|
+
name: external_exports.string().describe("E2E test name from `e2e-start-recording`."),
|
|
168453
|
+
project_root: external_exports.string().describe("Project root from `e2e-start-recording`.")
|
|
168562
168454
|
});
|
|
168563
168455
|
var flowFinishRecordingTool = {
|
|
168564
168456
|
id: "e2e-finish-recording",
|
|
168565
|
-
description: `
|
|
168566
|
-
|
|
168567
|
-
|
|
168457
|
+
description: `Finalize an open e2e recording (runs pending fragment cleanup first).
|
|
168458
|
+
Use when all steps have been recorded and you are ready to polish or replay the YAML (check any \`warning:\` lines in \`summary\` for recorded waits).
|
|
168459
|
+
Returns \`{ message, path, steps, shutdownSteps?, fragmentShutdown?, summary, e2eTestFile, savedTo }\`. Fails if no recording is open for \`name\` + \`project_root\`.`,
|
|
168568
168460
|
zodSchema: zodSchema75,
|
|
168569
168461
|
fileInputs: PROJECT_ROOT_INPUT,
|
|
168570
168462
|
aliases: ["flow-finish-recording"],
|
|
@@ -171697,31 +171589,23 @@ Run the e2e test on the computer that runs the tool-server, with no link and no
|
|
|
171697
171589
|
);
|
|
171698
171590
|
}
|
|
171699
171591
|
var zodSchema76 = external_exports.object({
|
|
171700
|
-
name: external_exports.string().optional().describe(
|
|
171701
|
-
'Name of a saved e2e test to run from `<project_root>/.argent/e2e`, or `.argent/flows` when it is not there (e.g. "settings-explore").'
|
|
171702
|
-
),
|
|
171592
|
+
name: external_exports.string().optional().describe("Saved e2e test name in `<project_root>/.argent/e2e/` (or `.argent/flows/`)."),
|
|
171703
171593
|
project_root: external_exports.string().describe(
|
|
171704
|
-
"Absolute path to the
|
|
171705
|
-
),
|
|
171706
|
-
e2e_test_file: external_exports.string().optional().describe(
|
|
171707
|
-
"Path to the e2e test .yaml as readable by the tool-server. Internal: the argent client derives it from project_root and name automatically; leave unset."
|
|
171594
|
+
"Absolute path to the project root (script cwd; with e2e_test_path, run:/script:/baselines resolve beside the YAML)."
|
|
171708
171595
|
),
|
|
171709
|
-
|
|
171596
|
+
e2e_test_file: external_exports.string().optional().describe("Internal; leave unset (derived from `project_root` and `name`)."),
|
|
171597
|
+
e2e_test_path: external_exports.string().optional().describe("Absolute path to an e2e test `.yaml` on the client."),
|
|
171710
171598
|
device: external_exports.string().optional().describe(
|
|
171711
|
-
"
|
|
171599
|
+
"Target device id from `list-devices` (iOS UDID, Android/Vega serial, Chromium id<flag:macos-apps>, Mac app id</flag:macos-apps>). Auto-detected only when one booted device matches; pass explicitly if multiple are booted."
|
|
171712
171600
|
),
|
|
171713
171601
|
platform: external_exports.enum(SELECTABLE_PLATFORMS).optional().describe(
|
|
171714
|
-
"
|
|
171602
|
+
"Filter auto-detection (`ios` = local simulator, `ios-remote` = remote). With `chromium` and no `device`, boots Electron from `launch: { chromium: <app path> }` and tears it down after.<flag:macos-apps> With `macos` and no `device`, runs on the Mac app named in `launch` (auto-detection never picks Mac apps otherwise).</flag:macos-apps>"
|
|
171715
171603
|
).meta({ [FLAG_ENUM_META_KEY]: { macos: MACOS_APPS_FLAG } }),
|
|
171716
|
-
updateBaselines: external_exports.boolean().optional().describe(
|
|
171717
|
-
"Write/refresh screenshot baselines for `snapshot` steps instead of diffing against them, also in the e2e tests that tool: e2e-execute steps run, unless such a step sets updateBaselines itself. Over a link, the client writes the new baselines when the run ends."
|
|
171718
|
-
),
|
|
171604
|
+
updateBaselines: external_exports.boolean().optional().describe("Refresh screenshot baselines for `snapshot` steps instead of diffing."),
|
|
171719
171605
|
prerequisiteAcknowledged: external_exports.boolean().optional().describe(
|
|
171720
|
-
"Set
|
|
171606
|
+
"Set true to confirm a fragment's `executionPrerequisite` is met; otherwise returns the prerequisite text without running. Not a dry run: a test with no prerequisite runs in full (read `executionPrerequisite` in the YAML to inspect without running)."
|
|
171721
171607
|
),
|
|
171722
|
-
env: external_exports.record(external_exports.string(), external_exports.string()).optional().describe(
|
|
171723
|
-
"Script environment overrides for this run, including run: fragments. Names match [A-Za-z_][A-Za-z0-9_]*, except __proto__. Values can include {{secret:NAME}}. A missing secret rejects the run before any step."
|
|
171724
|
-
)
|
|
171608
|
+
env: external_exports.record(external_exports.string(), external_exports.string()).optional().describe("Script env overrides (also for `run:` fragments). Supports `{{secret:NAME}}`.")
|
|
171725
171609
|
}).superRefine((params, ctx) => {
|
|
171726
171610
|
const envProblem = params.env === void 0 ? void 0 : flowEnvProblem(params.env);
|
|
171727
171611
|
if (envProblem) {
|
|
@@ -171740,20 +171624,9 @@ var zodSchema76 = external_exports.object({
|
|
|
171740
171624
|
function createRunFlowTool(registry2) {
|
|
171741
171625
|
return {
|
|
171742
171626
|
id: "e2e-execute",
|
|
171743
|
-
description: `Run a saved YAML e2e test end to end. Use when
|
|
171744
|
-
|
|
171745
|
-
|
|
171746
|
-
exactly one e2e test source: name (under project_root) or e2e_test_path.
|
|
171747
|
-
Returns a per-step report. A failure in the main steps skips the rest of that list. Shutdown entries
|
|
171748
|
-
then run independently, unless the run is cancelled. If a shutdown entry fails, the run fails and the
|
|
171749
|
-
report sets \`shutdownFailed\`. Shutdown steps report \`shutdown: true\`.
|
|
171750
|
-
Over a link (argent link or ARGENT_TOOLS_URL), the client uploads the e2e test with the run: fragments,
|
|
171751
|
-
snapshot baselines and absolute .png/.yaml file arguments its steps use, from under project_root or beside
|
|
171752
|
-
the e2e test file. The run fails if a step needs any other project file (a script: step, a recording tool,
|
|
171753
|
-
a nested e2e-execute not called by name with an absolute project_root, a directory, app or output-directory
|
|
171754
|
-
argument, a file path built from several arguments, a relative path): it stops before the first step and the
|
|
171755
|
-
error lists each such step. An absolute .png/.yaml argument from anywhere else fails only when its step runs.
|
|
171756
|
-
Without a link, every step kind runs.`,
|
|
171627
|
+
description: `Run a saved YAML e2e test end to end. Use when replaying a recorded path or QA regression (use gesture tools for one-off actions, \`e2e-start-recording\` to author tests). Pass exactly one e2e test source: \`name\` or \`e2e_test_path\`.
|
|
171628
|
+
Returns a per-step report (\`ok: false\` on step failure). A main-step failure skips remaining main steps, then runs \`shutdown:\` steps (marked \`shutdown: true\`; failure sets \`shutdownFailed\`).
|
|
171629
|
+
Over a link (\`argent link\` / \`ARGENT_TOOLS_URL\`), the client uploads the test, \`run:\` fragments, baselines, and absolute \`.png\`/\`.yaml\` args; steps needing other client files (e.g. \`script:\`, recording tools, directories) fail before step 1. Fails if the YAML is invalid, no unique matching device is booted, or pre-step link validation fails.`,
|
|
171757
171630
|
zodSchema: zodSchema76,
|
|
171758
171631
|
aliases: ["flow-execute"],
|
|
171759
171632
|
interaction: {
|
|
@@ -173448,37 +173321,27 @@ var fileInputs8 = [
|
|
|
173448
173321
|
{ target: "outputDir", path: "${outputDir}", kind: "probe", optional: true }
|
|
173449
173322
|
];
|
|
173450
173323
|
var zodSchema80 = external_exports.object({
|
|
173451
|
-
baselinePath: external_exports.string().min(1).optional().describe(
|
|
173452
|
-
|
|
173453
|
-
),
|
|
173454
|
-
currentPath: external_exports.string().min(1).optional().describe(
|
|
173455
|
-
"Path to the saved current PNG file. Required unless captureCurrent is true; do not pass both."
|
|
173456
|
-
),
|
|
173324
|
+
baselinePath: external_exports.string().min(1).optional().describe("Saved baseline PNG path (omit when `captureBaseline: true`)."),
|
|
173325
|
+
currentPath: external_exports.string().min(1).optional().describe("Saved current PNG path (omit when `captureCurrent: true`)."),
|
|
173457
173326
|
udid: external_exports.string().min(1).describe(
|
|
173458
|
-
"Target device id from `list-devices` (iOS UDID<flag:harmonyos>, HarmonyOS id,</flag:harmonyos> or Android serial<flag:macos-apps>, or
|
|
173327
|
+
"Target device id from `list-devices` (iOS UDID<flag:harmonyos>, HarmonyOS id,</flag:harmonyos> or Android serial<flag:macos-apps>, or Mac app id</flag:macos-apps>)."
|
|
173459
173328
|
),
|
|
173460
173329
|
captureBaseline: external_exports.boolean().optional().describe(
|
|
173461
|
-
"Capture
|
|
173330
|
+
"Capture baseline live from the device, at full resolution (mutually exclusive with `captureCurrent`)."
|
|
173462
173331
|
),
|
|
173463
173332
|
captureCurrent: external_exports.boolean().optional().describe(
|
|
173464
|
-
"Capture
|
|
173333
|
+
"Capture current live from the device, at full resolution (mutually exclusive with `captureBaseline`)."
|
|
173465
173334
|
),
|
|
173466
173335
|
rotation: external_exports.enum(["Portrait", "LandscapeLeft", "LandscapeRight", "PortraitUpsideDown"]).optional().describe(
|
|
173467
|
-
"Orientation override for live
|
|
173336
|
+
"Orientation override for live captures.<flag:harmonyos> Rejected on HarmonyOS.</flag:harmonyos> Ignored on physical iPhones."
|
|
173468
173337
|
),
|
|
173469
|
-
outputDir: external_exports.string().min(1).optional().describe("
|
|
173338
|
+
outputDir: external_exports.string().min(1).optional().describe("Output directory for diff artifacts (default: temp dir).")
|
|
173470
173339
|
}).strict();
|
|
173471
173340
|
var screenshotDiffTool = {
|
|
173472
173341
|
id: "screenshot-diff",
|
|
173473
|
-
description: `Compare two PNG screenshots and return a
|
|
173474
|
-
|
|
173475
|
-
|
|
173476
|
-
Use when stable before/after screenshots exist and the expected result is pixel-visible: layout, spacing, color, typography, image/icon rendering, clipping, overflow, or text rendering.
|
|
173477
|
-
Physical iPhones: live captures are device-wide and need no registered app.
|
|
173478
|
-
<flag:macos-apps>Mac apps: a resized window fails as a dimension mismatch.
|
|
173479
|
-
</flag:macos-apps>Returns { summary }, plus diffPath and contextDiffPath when pixels differ. The summary uses normalized [0,1] screen locations matching describe coordinates; diffPath is the full-size diff image and contextDiffPath is a downscaled image for MCP/agent display.
|
|
173480
|
-
Ignores the fixed top status-bar band for both pixel and OCR text comparisons.
|
|
173481
|
-
Fails if the input sources are invalid, PNG files cannot be read, outputDir cannot be written, or the simulator-server / emulator backend<flag:harmonyos>, or \`hdc\` on HarmonyOS,</flag:harmonyos> is not reachable.`,
|
|
173342
|
+
description: `Compare two PNG screenshots (saved files or one live capture<flag:harmonyos> on iOS, Android, or HarmonyOS</flag:harmonyos>) and return a visual-diff summary (status bar ignored).
|
|
173343
|
+
Use when checking pixel-visible regressions (layout, spacing, color, typography, clipping, overflow). Both images must have identical dimensions: save baselines with screenshot scale: 1.0, one per device model.<flag:macos-apps> Mac apps: resized windows fail as a dimension mismatch.</flag:macos-apps>
|
|
173344
|
+
Returns \`{ summary, diffPath?, contextDiffPath? }\` with normalized [0,1] changed regions. Fails if sources are invalid, dimensions differ, files cannot be read/written, or the capture backend<flag:harmonyos> (\`hdc\` on HarmonyOS)</flag:harmonyos> is unreachable.`,
|
|
173482
173345
|
zodSchema: zodSchema80,
|
|
173483
173346
|
searchHint: "compare screenshots png diff visual UI changes UI regression visual regression screenshot diff changed regions text ocr live capture<flag:harmonyos> harmony harmonyos</flag:harmonyos>",
|
|
173484
173347
|
interaction: {
|
|
@@ -173992,22 +173855,17 @@ var capability37 = {
|
|
|
173992
173855
|
chromium: { app: true }
|
|
173993
173856
|
};
|
|
173994
173857
|
var zodSchema83 = external_exports.object({
|
|
173995
|
-
udid: external_exports.string().describe("Chromium device id
|
|
173996
|
-
action: external_exports.enum(["list", "select", "new", "close"]).describe(
|
|
173997
|
-
|
|
173998
|
-
),
|
|
173999
|
-
|
|
174000
|
-
"Target tab for `select` (required) / `close`: a tabId like `t2` or a label. `close` defaults to the active tab."
|
|
174001
|
-
),
|
|
174002
|
-
url: external_exports.string().optional().describe("`new` only: URL to open (defaults to about:blank)."),
|
|
174003
|
-
label: external_exports.string().optional().describe("`new` only: a memorable label usable interchangeably with the tabId.")
|
|
173858
|
+
udid: external_exports.string().describe("Chromium device id (`chromium-cdp-<port>`)."),
|
|
173859
|
+
action: external_exports.enum(["list", "select", "new", "close"]).describe("Tab operation."),
|
|
173860
|
+
tab: external_exports.string().optional().describe("Tab id (e.g. `t2`) or label (`select` required; `close` defaults to active)."),
|
|
173861
|
+
url: external_exports.string().optional().describe("URL for `new` (default `about:blank`)."),
|
|
173862
|
+
label: external_exports.string().optional().describe("Optional alias label for `new`.")
|
|
174004
173863
|
});
|
|
174005
173864
|
var chromiumTabsTool = {
|
|
174006
173865
|
id: "chromium-tabs",
|
|
174007
|
-
description: `List and switch
|
|
174008
|
-
|
|
174009
|
-
|
|
174010
|
-
Returns { tabs: [{ tabId, targetId, title, url, active, label? }] } after the action. Fails if the device is not a Chromium (CDP) device, or the requested tabId/label no longer matches a live tab.`,
|
|
173866
|
+
description: `List and switch tabs/windows (or open/close them) in a Chromium (CDP) or Electron app (all UI tools target the active tab).
|
|
173867
|
+
Use when switching between multiple tabs/windows or opening/closing pages.
|
|
173868
|
+
Returns \`{ tabs: [{ tabId, targetId, title, url, active, label? }] }\`. Fails on non-Chromium targets or unknown tab ids.`,
|
|
174011
173869
|
zodSchema: zodSchema83,
|
|
174012
173870
|
searchHint: "tab tabs window windows switch select close new open multi-tab chromium electron",
|
|
174013
173871
|
interaction: {
|
|
@@ -174126,28 +173984,25 @@ var capability38 = {
|
|
|
174126
173984
|
chromium: { app: true }
|
|
174127
173985
|
};
|
|
174128
173986
|
var zodSchema84 = external_exports.object({
|
|
174129
|
-
udid: external_exports.string().describe("Chromium device id
|
|
173987
|
+
udid: external_exports.string().describe("Chromium device id (`chromium-cdp-<port>`)."),
|
|
174130
173988
|
action: external_exports.enum(["get", "set", "delete", "clear"]).describe(
|
|
174131
|
-
"get: read cookies. set: create/update a cookie. delete: remove matching cookies. clear: remove ALL browser cookies."
|
|
174132
|
-
),
|
|
174133
|
-
name: external_exports.string().optional().describe("Cookie name."),
|
|
174134
|
-
value: external_exports.string().optional().describe("Cookie value."),
|
|
174135
|
-
url: external_exports.string().optional().describe(
|
|
174136
|
-
"get: restrict to this URL (defaults to the active page). set/delete: scope the cookie by URL."
|
|
173989
|
+
"get: read cookies. set: create/update a cookie. delete: remove matching cookies. clear: remove ALL browser cookies across all domains (ignores url/domain)."
|
|
174137
173990
|
),
|
|
174138
|
-
|
|
174139
|
-
|
|
174140
|
-
|
|
174141
|
-
|
|
174142
|
-
|
|
174143
|
-
|
|
173991
|
+
name: external_exports.string().optional().describe("Cookie name (required for `set`/`delete`)."),
|
|
173992
|
+
value: external_exports.string().optional().describe("Cookie value (required for `set`)."),
|
|
173993
|
+
url: external_exports.string().optional().describe("URL filter for `get` (defaults to the active page) or scope for `set`/`delete`."),
|
|
173994
|
+
domain: external_exports.string().optional().describe("Domain scope (`set`/`delete`)."),
|
|
173995
|
+
path: external_exports.string().optional().describe("Path scope (default `/`)."),
|
|
173996
|
+
secure: external_exports.boolean().optional().describe("Secure flag (`set`)."),
|
|
173997
|
+
httpOnly: external_exports.boolean().optional().describe("HttpOnly flag (`set`)."),
|
|
173998
|
+
sameSite: external_exports.enum(["Strict", "Lax", "None"]).optional().describe("SameSite policy (`set`)."),
|
|
173999
|
+
expires: external_exports.number().optional().describe("Unix expiry in seconds (`set`; omit for session).")
|
|
174144
174000
|
});
|
|
174145
174001
|
var chromiumCookiesTool = {
|
|
174146
174002
|
id: "chromium-cookies",
|
|
174147
|
-
description: `Read and write cookies
|
|
174148
|
-
|
|
174149
|
-
|
|
174150
|
-
Returns { cookies, count } for get, or a small status object ({ set } / { deleted } / { cleared }) otherwise. Fails if the device is not a Chromium (CDP) device, or a param that \`set\` / \`delete\` needs is missing.`,
|
|
174003
|
+
description: `Read and write cookies (including HttpOnly) in a Chromium (CDP) app.
|
|
174004
|
+
Use when seeding an auth session or asserting cookie state (\`set\`/\`delete\` need \`url\` or \`domain\`). \`clear\` wipes ALL browser cookies across every domain (ignores \`url\`/\`domain\`); use \`get\` + \`delete\` to clear a single domain.
|
|
174005
|
+
Returns \`{ cookies, count }\` (\`get\`) or \`{ set }\` / \`{ deleted }\` / \`{ cleared }\`. Fails on non-Chromium targets or missing required params.`,
|
|
174151
174006
|
zodSchema: zodSchema84,
|
|
174152
174007
|
searchHint: "cookies cookie get set delete clear httponly samesite session auth chromium",
|
|
174153
174008
|
interaction: {
|