@swmansion/argent 0.34.1-next.87 → 0.34.1-next.89
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/bin/argent-android-devtools-0.4.0.apk +0 -0
- package/bin/darwin/argent-macos-helper +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +1 -1
- package/dist/installer.mjs +1 -1
- package/dist/tool-args.generated.d.ts +3 -1
- package/dist/tool-server.cjs +237 -191
- package/dylibs/libArgentAudio.dylib +0 -0
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +2 -2
|
Binary file
|
|
Binary file
|
package/bin/darwin/ax-service
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/tcp/ax-service
CHANGED
|
Binary file
|
package/dist/cli-cmds.mjs
CHANGED
|
@@ -36298,7 +36298,7 @@ function isCi(env = process.env) {
|
|
|
36298
36298
|
var SESSION_ID2 = randomUUID5();
|
|
36299
36299
|
function readCliVersion() {
|
|
36300
36300
|
if (true) {
|
|
36301
|
-
return "0.34.1-next.
|
|
36301
|
+
return "0.34.1-next.89";
|
|
36302
36302
|
}
|
|
36303
36303
|
return "0.0.0";
|
|
36304
36304
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -16998,7 +16998,7 @@ function isCi(env = process.env) {
|
|
|
16998
16998
|
var SESSION_ID = randomUUID4();
|
|
16999
16999
|
function readCliVersion() {
|
|
17000
17000
|
if (true) {
|
|
17001
|
-
return "0.34.1-next.
|
|
17001
|
+
return "0.34.1-next.89";
|
|
17002
17002
|
}
|
|
17003
17003
|
return "0.0.0";
|
|
17004
17004
|
}
|
|
@@ -934,9 +934,11 @@ export interface ArgentToolArgs {
|
|
|
934
934
|
args: {
|
|
935
935
|
[key: string]: unknown;
|
|
936
936
|
};
|
|
937
|
-
/** Wait time in ms after this step before the next (default 100) */
|
|
937
|
+
/** Wait time in ms after this step (and after the settle wait) before the next (default 100) */
|
|
938
938
|
delayMs?: number;
|
|
939
939
|
}>;
|
|
940
|
+
/** Wait up to 1000ms after a screen-changing step for the element tree to settle before the next step. Default true; set false on a screen that never stops changing. */
|
|
941
|
+
settle?: boolean;
|
|
940
942
|
};
|
|
941
943
|
"screen-recording-start": {
|
|
942
944
|
/** Target ID from `list-devices`. For a Mac app, use its device ID, such as `macos-app-com.example.notes`. */
|
package/dist/tool-server.cjs
CHANGED
|
@@ -72950,7 +72950,7 @@ function isCi(env = process.env) {
|
|
|
72950
72950
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
72951
72951
|
function readCliVersion() {
|
|
72952
72952
|
if (true) {
|
|
72953
|
-
return "0.34.1-next.
|
|
72953
|
+
return "0.34.1-next.89";
|
|
72954
72954
|
}
|
|
72955
72955
|
return "0.0.0";
|
|
72956
72956
|
}
|
|
@@ -137742,6 +137742,170 @@ init_zod();
|
|
|
137742
137742
|
init_device_info();
|
|
137743
137743
|
init_capability();
|
|
137744
137744
|
|
|
137745
|
+
// ../tool-server/src/tools/flows/flow-android-tree.ts
|
|
137746
|
+
var FLOW_MAX_NODES = 12e3;
|
|
137747
|
+
var SYSTEM_PACKAGES2 = /* @__PURE__ */ new Set(["com.android.systemui"]);
|
|
137748
|
+
var SYSTEM_RID_PREFIXES2 = [
|
|
137749
|
+
"android:id/navigationBarBackground",
|
|
137750
|
+
"android:id/statusBarBackground",
|
|
137751
|
+
"com.android.systemui:id/"
|
|
137752
|
+
];
|
|
137753
|
+
function isSystemChrome2(attrs) {
|
|
137754
|
+
if (SYSTEM_PACKAGES2.has(attrs.package ?? "")) return true;
|
|
137755
|
+
const rid = attrs["resource-id"] ?? "";
|
|
137756
|
+
return SYSTEM_RID_PREFIXES2.some((p) => rid.startsWith(p));
|
|
137757
|
+
}
|
|
137758
|
+
function labelOf2(attrs) {
|
|
137759
|
+
const cd = (attrs["content-desc"] ?? "").trim();
|
|
137760
|
+
if (cd) return cd;
|
|
137761
|
+
return (attrs.text ?? "").trim();
|
|
137762
|
+
}
|
|
137763
|
+
function normalizeRect(rect, screenW, screenH) {
|
|
137764
|
+
const clipped = clipBoundsToScreen(rect, screenW, screenH);
|
|
137765
|
+
if (clipped.w <= 0 || clipped.h <= 0) return null;
|
|
137766
|
+
return {
|
|
137767
|
+
x: clipped.x / screenW,
|
|
137768
|
+
y: clipped.y / screenH,
|
|
137769
|
+
width: clipped.w / screenW,
|
|
137770
|
+
height: clipped.h / screenH
|
|
137771
|
+
};
|
|
137772
|
+
}
|
|
137773
|
+
function childNodes(node2) {
|
|
137774
|
+
return node2.children.filter((c) => c.tag === "node");
|
|
137775
|
+
}
|
|
137776
|
+
function projectAndroidNode(node2, screenW, screenH) {
|
|
137777
|
+
const attrs = node2.attrs;
|
|
137778
|
+
const skip = isSystemChrome2(attrs) || isNoisyUiAutomatorClass(attrs.class ?? "");
|
|
137779
|
+
const identifier = (attrs["resource-id"] ?? "").trim();
|
|
137780
|
+
const isPassword = attrs.password === "true";
|
|
137781
|
+
const isFocused = attrs.focused === "true";
|
|
137782
|
+
const label = isPassword ? "[password]" : labelOf2(attrs);
|
|
137783
|
+
const rawText = (attrs.text ?? "").trim();
|
|
137784
|
+
const hasValue = !isPassword && Boolean(rawText) && rawText !== label;
|
|
137785
|
+
const className = attrs.class ?? "";
|
|
137786
|
+
const role = deriveUiAutomatorRole(className);
|
|
137787
|
+
const hasSemanticRole = !isUiAutomatorLayoutContainer(className);
|
|
137788
|
+
const ownText2 = [label, hasValue ? rawText : ""].filter(Boolean).join(" ");
|
|
137789
|
+
const rect = parseUiAutomatorBounds(attrs.bounds ?? "");
|
|
137790
|
+
let leaf = null;
|
|
137791
|
+
let frame2 = null;
|
|
137792
|
+
if (!skip && (identifier || label || hasSemanticRole || isFocused)) {
|
|
137793
|
+
frame2 = rect ? normalizeRect(rect, screenW, screenH) : null;
|
|
137794
|
+
if (frame2) {
|
|
137795
|
+
leaf = { role, frame: frame2, children: [] };
|
|
137796
|
+
if (label) leaf.label = label;
|
|
137797
|
+
if (identifier) leaf.identifier = identifier;
|
|
137798
|
+
if (hasValue) leaf.value = rawText;
|
|
137799
|
+
if (attrs.clickable === "true") leaf.clickable = true;
|
|
137800
|
+
if (attrs["long-clickable"] === "true") leaf.longClickable = true;
|
|
137801
|
+
if (attrs.scrollable === "true") leaf.scrollable = true;
|
|
137802
|
+
if (attrs.checkable === "true") leaf.checkable = true;
|
|
137803
|
+
if (attrs.checked === "true") leaf.checked = true;
|
|
137804
|
+
if (attrs.enabled === "false") leaf.disabled = true;
|
|
137805
|
+
if (isPassword) leaf.password = true;
|
|
137806
|
+
if (isFocused) leaf.focused = true;
|
|
137807
|
+
}
|
|
137808
|
+
}
|
|
137809
|
+
return {
|
|
137810
|
+
skip,
|
|
137811
|
+
children: childNodes(node2),
|
|
137812
|
+
// Off-screen text must not hoist, or an ancestor text assert would pass on
|
|
137813
|
+
// content the screen doesn't show. Any node with text is leaf-eligible (its
|
|
137814
|
+
// label is non-empty), so `frame` was computed for it.
|
|
137815
|
+
ownText: frame2 ? ownText2 : "",
|
|
137816
|
+
leaf,
|
|
137817
|
+
// A password field shields even when it carries no id, so nothing from it
|
|
137818
|
+
// bubbles into an ancestor's hoisted text.
|
|
137819
|
+
shield: Boolean(identifier) || isPassword,
|
|
137820
|
+
// Scroll-clip inputs (see `flattenHoisting`): a scroller's raw bounds clip
|
|
137821
|
+
// its subtree, so a row scrolled out of view — but still on the device
|
|
137822
|
+
// screen — is dropped, matching the describe path's prune.
|
|
137823
|
+
rect,
|
|
137824
|
+
scrolls: isUiAutomatorScrollable(attrs)
|
|
137825
|
+
};
|
|
137826
|
+
}
|
|
137827
|
+
function adaptFullAndroidHierarchyToDescribeResult(xml, screenW, screenH) {
|
|
137828
|
+
const children = [];
|
|
137829
|
+
if (screenW > 0 && screenH > 0) {
|
|
137830
|
+
const root = parseUiAutomatorXml(xml);
|
|
137831
|
+
if (root) {
|
|
137832
|
+
for (const c of childNodes(root)) {
|
|
137833
|
+
flattenHoisting(c, (n) => projectAndroidNode(n, screenW, screenH), children);
|
|
137834
|
+
}
|
|
137835
|
+
}
|
|
137836
|
+
}
|
|
137837
|
+
return parseDescribeResult({
|
|
137838
|
+
role: "Screen",
|
|
137839
|
+
frame: { x: 0, y: 0, width: 1, height: 1 },
|
|
137840
|
+
children
|
|
137841
|
+
});
|
|
137842
|
+
}
|
|
137843
|
+
async function queryAndroidFullHierarchy(registry2, device, options = {}) {
|
|
137844
|
+
let devtools;
|
|
137845
|
+
try {
|
|
137846
|
+
const ref = androidDevtoolsRef(device);
|
|
137847
|
+
devtools = await registry2.resolveService(ref.urn, ref.options);
|
|
137848
|
+
} catch (err) {
|
|
137849
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
137850
|
+
throw new Error(`the argent android helper is unavailable: ${msg}`, { cause: err });
|
|
137851
|
+
}
|
|
137852
|
+
const [{ xml }, size] = await Promise.all([
|
|
137853
|
+
// clearCache: await/assert polls must see text changes, not cached reads.
|
|
137854
|
+
devtools.getHierarchy({ maxNodes: FLOW_MAX_NODES, clearCache: true, ...options }),
|
|
137855
|
+
devtools.getScreenSize()
|
|
137856
|
+
]);
|
|
137857
|
+
const tree = adaptFullAndroidHierarchyToDescribeResult(xml, size.width, size.height);
|
|
137858
|
+
return {
|
|
137859
|
+
tree,
|
|
137860
|
+
source: "android-devtools",
|
|
137861
|
+
...size.width > 0 && size.height > 0 ? { screen: { width: size.width, height: size.height } } : {}
|
|
137862
|
+
};
|
|
137863
|
+
}
|
|
137864
|
+
|
|
137865
|
+
// ../tool-server/src/tools/flows/flow-chromium-tree.ts
|
|
137866
|
+
function projectChromiumNode(node2) {
|
|
137867
|
+
const onScreen2 = node2.frame.width > 0 && node2.frame.height > 0;
|
|
137868
|
+
const addressable = Boolean(
|
|
137869
|
+
node2.identifier || node2.label || node2.value || node2.clickable || node2.focused
|
|
137870
|
+
);
|
|
137871
|
+
let leaf = null;
|
|
137872
|
+
if (onScreen2 && addressable) {
|
|
137873
|
+
leaf = { ...node2, children: [] };
|
|
137874
|
+
if (node2.password) {
|
|
137875
|
+
leaf.label = "[password]";
|
|
137876
|
+
delete leaf.value;
|
|
137877
|
+
}
|
|
137878
|
+
}
|
|
137879
|
+
return {
|
|
137880
|
+
skip: false,
|
|
137881
|
+
children: node2.children,
|
|
137882
|
+
// Off-screen text must not hoist, or a text assert against an ancestor
|
|
137883
|
+
// would pass on content the screen doesn't show. A password's text never
|
|
137884
|
+
// bubbles up.
|
|
137885
|
+
ownText: onScreen2 && !node2.password ? nodeText(node2) : "",
|
|
137886
|
+
leaf,
|
|
137887
|
+
shield: Boolean(node2.identifier) || node2.password === true
|
|
137888
|
+
};
|
|
137889
|
+
}
|
|
137890
|
+
function adaptChromiumTreeForFlows(tree) {
|
|
137891
|
+
const children = [];
|
|
137892
|
+
for (const child of tree.children) {
|
|
137893
|
+
flattenHoisting(child, projectChromiumNode, children);
|
|
137894
|
+
}
|
|
137895
|
+
return parseDescribeResult({
|
|
137896
|
+
role: "Screen",
|
|
137897
|
+
frame: { x: 0, y: 0, width: 1, height: 1 },
|
|
137898
|
+
children
|
|
137899
|
+
});
|
|
137900
|
+
}
|
|
137901
|
+
var FLOW_WALK_LIMITS = { maxDepth: 96, maxNodes: 12e3 };
|
|
137902
|
+
async function queryChromiumTree(registry2, device) {
|
|
137903
|
+
const ref = chromiumCdpRef(device);
|
|
137904
|
+
const api = await registry2.resolveService(ref.urn, ref.options);
|
|
137905
|
+
const data = await describeChromium(api, FLOW_WALK_LIMITS);
|
|
137906
|
+
return { tree: adaptChromiumTreeForFlows(data.tree), source: data.source };
|
|
137907
|
+
}
|
|
137908
|
+
|
|
137745
137909
|
// ../tool-server/src/utils/sub-invoke.ts
|
|
137746
137910
|
var import_node_crypto18 = require("node:crypto");
|
|
137747
137911
|
init_src2();
|
|
@@ -137809,6 +137973,10 @@ var ALLOWED_TOOLS = /* @__PURE__ */ new Set([
|
|
|
137809
137973
|
// action and its wait run as one sequence, and an unmet wait stops it.
|
|
137810
137974
|
AWAIT_NETWORK_REQUEST_TOOL_ID
|
|
137811
137975
|
]);
|
|
137976
|
+
var SETTLE_TIMEOUT_MS3 = 1e3;
|
|
137977
|
+
var SETTLE_POLL_MS2 = 50;
|
|
137978
|
+
var TOOLS_THAT_SETTLE = /* @__PURE__ */ new Set(["gesture-tap", "button", AWAIT_UI_ELEMENT_TOOL_ID]);
|
|
137979
|
+
var KEYS_THAT_SETTLE = /* @__PURE__ */ new Set(["enter", "return", "escape", "esc"]);
|
|
137812
137980
|
var capability25 = {
|
|
137813
137981
|
// Physical iOS is a valid outer target. Unsupported steps fail at their own gate, not the whole sequence.
|
|
137814
137982
|
apple: { simulator: true, device: true },
|
|
@@ -137833,38 +138001,75 @@ var zodSchema30 = external_exports.object({
|
|
|
137833
138001
|
tool: external_exports.string().describe("Tool name: one of the allowed tools listed in the description."),
|
|
137834
138002
|
args: external_exports.record(external_exports.string(), external_exports.unknown()).describe("Tool arguments (excluding udid, which is injected automatically)"),
|
|
137835
138003
|
delayMs: external_exports.number().optional().describe(
|
|
137836
|
-
`Wait time in ms after this step before the next (default ${DEFAULT_INTER_STEP_DELAY_MS})`
|
|
138004
|
+
`Wait time in ms after this step (and after the settle wait) before the next (default ${DEFAULT_INTER_STEP_DELAY_MS})`
|
|
137837
138005
|
)
|
|
137838
138006
|
})
|
|
137839
|
-
).min(1).describe("Ordered list of interaction steps to execute sequentially")
|
|
138007
|
+
).min(1).describe("Ordered list of interaction steps to execute sequentially"),
|
|
138008
|
+
settle: external_exports.boolean().optional().describe(
|
|
138009
|
+
`Wait up to ${SETTLE_TIMEOUT_MS3}ms after a screen-changing step for the element tree to settle before the next step. Default true; set false on a screen that never stops changing.`
|
|
138010
|
+
)
|
|
137840
138011
|
});
|
|
138012
|
+
function mayStartTransition(step) {
|
|
138013
|
+
if (TOOLS_THAT_SETTLE.has(step.tool)) return true;
|
|
138014
|
+
if (step.tool !== "keyboard") return false;
|
|
138015
|
+
const { key: key2, text } = step.args;
|
|
138016
|
+
if (typeof key2 === "string") return KEYS_THAT_SETTLE.has(key2.toLowerCase());
|
|
138017
|
+
return typeof text === "string" && /[\r\n]/.test(text);
|
|
138018
|
+
}
|
|
138019
|
+
function repeatsTap(step, next) {
|
|
138020
|
+
return step.tool === "gesture-tap" && next.tool === "gesture-tap" && step.args.x === next.args.x && step.args.y === next.args.y;
|
|
138021
|
+
}
|
|
138022
|
+
function settleTreeReader(registry2, device) {
|
|
138023
|
+
if (device.platform === "ios" && device.kind === "simulator") {
|
|
138024
|
+
return () => describeIos(registry2, device, {});
|
|
138025
|
+
}
|
|
138026
|
+
if (device.platform === "android") {
|
|
138027
|
+
return () => queryAndroidFullHierarchy(registry2, device, { waitForIdleMs: 0 });
|
|
138028
|
+
}
|
|
138029
|
+
if (device.platform === "chromium") return () => queryChromiumTree(registry2, device);
|
|
138030
|
+
return void 0;
|
|
138031
|
+
}
|
|
138032
|
+
function settleFingerprint(root) {
|
|
138033
|
+
return `${treeFingerprint(root)}
|
|
138034
|
+
focus:${treeFingerprint(root, (node2) => node2.focused === true)}`;
|
|
138035
|
+
}
|
|
138036
|
+
async function waitForStillTree(readTree, signal) {
|
|
138037
|
+
const deadline = Date.now() + SETTLE_TIMEOUT_MS3;
|
|
138038
|
+
let previous;
|
|
138039
|
+
while (Date.now() < deadline) {
|
|
138040
|
+
const read = await settleWithin(readTree(), deadline - Date.now(), signal);
|
|
138041
|
+
if (read.type !== "value") return;
|
|
138042
|
+
const fingerprint = settleFingerprint(read.value.tree);
|
|
138043
|
+
if (fingerprint === previous) return;
|
|
138044
|
+
previous = fingerprint;
|
|
138045
|
+
if (!await sleepOrAbort(SETTLE_POLL_MS2, signal)) return;
|
|
138046
|
+
}
|
|
138047
|
+
}
|
|
137841
138048
|
function createRunSequenceTool(registry2) {
|
|
137842
138049
|
return {
|
|
137843
138050
|
id: "run-sequence",
|
|
137844
|
-
description: `
|
|
137845
|
-
Use when every step is known in advance
|
|
137846
|
-
|
|
137847
|
-
|
|
137848
|
-
|
|
137849
|
-
|
|
137850
|
-
Allowed tools,
|
|
137851
|
-
gesture-tap: x, y, clickCount?<flag:macos-apps>, button? "left"|"right"
|
|
138051
|
+
description: `Run several device interaction steps in one call.
|
|
138052
|
+
Use when every step is known in advance (e.g. several scrolls, or typing then enter). If a step depends on what an earlier one shows, make separate calls.
|
|
138053
|
+
Steps run in order. After a step that can change the screen, the next one waits up to 1000ms for the element tree to settle (see \`settle\`); keep an await-ui-element before a step that needs the new screen.
|
|
138054
|
+
If a step fails (an error, a tool not allowed or not supported on the target, or a wait step that returns success=false), the sequence stops there. Returns { completed, total, steps } with a result or error for each step that ran.
|
|
138055
|
+
One screenshot and element tree are captured after the last step, not per step. A \`{{secret:...}}\` in any step skips that capture, so type and submit a secret in one sequence.
|
|
138056
|
+
|
|
138057
|
+
Allowed tools, args (? = optional) and targets. Positions and distances are 0\u20131 fractions of the screen (window on Chromium), not pixels; angles in degrees, durations in ms.
|
|
138058
|
+
gesture-tap: x, y, clickCount?<flag:macos-apps>, button? "left"|"right", modifiers? ["control"|"option"|"shift"|"command"] (macos)</flag:macos-apps> [ios/android/chromium<flag:harmonyos>/harmony</flag:harmonyos><flag:macos-apps>/macos</flag:macos-apps>]
|
|
137852
138059
|
gesture-swipe: fromX, fromY, toX, toY, durationMs?, momentum? [ios/android<flag:harmonyos>/harmony</flag:harmonyos>]
|
|
137853
|
-
gesture-scroll: x, y, deltaX?, deltaY? (
|
|
138060
|
+
gesture-scroll: x, y, deltaX?, deltaY? (positive scrolls down), durationMs? [chromium<flag:macos-apps>/macos</flag:macos-apps>]
|
|
137854
138061
|
gesture-drag: fromX, fromY, toX, toY, durationMs?, momentum? [chromium<flag:macos-apps>/macos</flag:macos-apps>]
|
|
137855
|
-
gesture-custom: events: [{ type: "Down"|"Move"|"Up", x, y, x2?, y2?, delayMs? }], interpolate?, edge?
|
|
138062
|
+
gesture-custom: events: [{ type: "Down"|"Move"|"Up", x, y, x2?, y2?, delayMs? }], interpolate?, edge? [ios/android]
|
|
137856
138063
|
gesture-pinch: centerX, centerY, startDistance, endDistance, endCenterX?, endCenterY?, angle?, durationMs? [ios/android<flag:harmonyos>/harmony</flag:harmonyos>]
|
|
137857
138064
|
gesture-rotate: centerX, centerY, startAngle, endAngle, radius (or radiusX + radiusY), durationMs? [ios/android]
|
|
137858
138065
|
button: button: "home"|"back"|"power"|"volumeUp"|"volumeDown"|"appSwitch"|"actionButton" [ios/android<flag:harmonyos>; harmony: home/back/power</flag:harmonyos>]
|
|
137859
|
-
keyboard: text? or key? (one per step
|
|
137860
|
-
|
|
137861
|
-
paste: text (device clipboard + paste shortcut; only where a user would paste, e.g. an OTP, else keyboard) [ios sim/android emu<flag:macos-apps>/macos</flag:macos-apps>]
|
|
138066
|
+
keyboard: text? or key? (one per step, e.g. key "enter"), delayMs?; text may hold {{secret:<NAME>}} placeholders, resolved server-side [all; Apple TV/Android TV: text only]
|
|
138067
|
+
paste: text (only where a user would paste, e.g. an OTP) [ios sim/android emu<flag:macos-apps>/macos</flag:macos-apps>]
|
|
137862
138068
|
rotate: orientation: "Portrait"|"LandscapeLeft"|"LandscapeRight"|"PortraitUpsideDown" [ios sim/android]
|
|
137863
138069
|
shake: count? [ios sim/android emu]
|
|
137864
|
-
fold: posture? "closed"|"half-open"|"open"
|
|
137865
|
-
tv-remote: button (one
|
|
137866
|
-
|
|
137867
|
-
await-ui-element: condition: "exists"|"visible"|"hidden"|"text", selector: { text?, identifier?, role? }, expectedText? (for "text"), textMatch?, timeoutMs?, pollIntervalMs? [all]
|
|
138070
|
+
fold: posture? "closed"|"half-open"|"open" or angle? 0\u2013180 (later steps land on the new panel) [foldable ios sim/android emu]
|
|
138071
|
+
tv-remote: button (one, or an array run as a path), repeat? [apple tv/android tv/vega]
|
|
138072
|
+
await-ui-element: condition: "exists"|"visible"|"hidden"|"text", selector: { text?, identifier?, role? }, expectedText?, textMatch?, timeoutMs?, pollIntervalMs? [all]
|
|
137868
138073
|
await-network-request: bundleId, url, plus the standalone tool's optional args. Call network-capture-start before the sequence. [ios sim/android/chromium<flag:macos-apps>/macos</flag:macos-apps>]`,
|
|
137869
138074
|
zodSchema: zodSchema30,
|
|
137870
138075
|
alwaysLoad: true,
|
|
@@ -137884,9 +138089,10 @@ Allowed tools, their args (? = optional) and targets. Positions and distances ar
|
|
|
137884
138089
|
async execute(_services, params, ctx) {
|
|
137885
138090
|
const { udid, steps } = params;
|
|
137886
138091
|
const device = resolveDevice(udid);
|
|
138092
|
+
const readSettleTree = params.settle === false ? void 0 : settleTreeReader(registry2, device);
|
|
137887
138093
|
const results = [];
|
|
137888
138094
|
const signal = ctx?.signal;
|
|
137889
|
-
for (const step of steps) {
|
|
138095
|
+
for (const [index, step] of steps.entries()) {
|
|
137890
138096
|
if (signal?.aborted) break;
|
|
137891
138097
|
if (!ALLOWED_TOOLS.has(step.tool)) {
|
|
137892
138098
|
results.push({
|
|
@@ -137929,6 +138135,10 @@ Allowed tools, their args (? = optional) and targets. Positions and distances ar
|
|
|
137929
138135
|
});
|
|
137930
138136
|
break;
|
|
137931
138137
|
}
|
|
138138
|
+
const next = steps[index + 1];
|
|
138139
|
+
if (readSettleTree && next && next.tool !== AWAIT_UI_ELEMENT_TOOL_ID && !repeatsTap(step, next) && mayStartTransition(step)) {
|
|
138140
|
+
await waitForStillTree(readSettleTree, signal);
|
|
138141
|
+
}
|
|
137932
138142
|
const delay3 = step.delayMs ?? DEFAULT_INTER_STEP_DELAY_MS;
|
|
137933
138143
|
if (delay3 > 0 && !await sleepOrAbort(delay3, signal)) break;
|
|
137934
138144
|
}
|
|
@@ -141720,126 +141930,6 @@ async function readIosUiTree(registry2, device) {
|
|
|
141720
141930
|
return adaptAxTree(response);
|
|
141721
141931
|
}
|
|
141722
141932
|
|
|
141723
|
-
// ../tool-server/src/tools/flows/flow-android-tree.ts
|
|
141724
|
-
var FLOW_MAX_NODES = 12e3;
|
|
141725
|
-
var SYSTEM_PACKAGES2 = /* @__PURE__ */ new Set(["com.android.systemui"]);
|
|
141726
|
-
var SYSTEM_RID_PREFIXES2 = [
|
|
141727
|
-
"android:id/navigationBarBackground",
|
|
141728
|
-
"android:id/statusBarBackground",
|
|
141729
|
-
"com.android.systemui:id/"
|
|
141730
|
-
];
|
|
141731
|
-
function isSystemChrome2(attrs) {
|
|
141732
|
-
if (SYSTEM_PACKAGES2.has(attrs.package ?? "")) return true;
|
|
141733
|
-
const rid = attrs["resource-id"] ?? "";
|
|
141734
|
-
return SYSTEM_RID_PREFIXES2.some((p) => rid.startsWith(p));
|
|
141735
|
-
}
|
|
141736
|
-
function labelOf2(attrs) {
|
|
141737
|
-
const cd = (attrs["content-desc"] ?? "").trim();
|
|
141738
|
-
if (cd) return cd;
|
|
141739
|
-
return (attrs.text ?? "").trim();
|
|
141740
|
-
}
|
|
141741
|
-
function normalizeRect(rect, screenW, screenH) {
|
|
141742
|
-
const clipped = clipBoundsToScreen(rect, screenW, screenH);
|
|
141743
|
-
if (clipped.w <= 0 || clipped.h <= 0) return null;
|
|
141744
|
-
return {
|
|
141745
|
-
x: clipped.x / screenW,
|
|
141746
|
-
y: clipped.y / screenH,
|
|
141747
|
-
width: clipped.w / screenW,
|
|
141748
|
-
height: clipped.h / screenH
|
|
141749
|
-
};
|
|
141750
|
-
}
|
|
141751
|
-
function childNodes(node2) {
|
|
141752
|
-
return node2.children.filter((c) => c.tag === "node");
|
|
141753
|
-
}
|
|
141754
|
-
function projectAndroidNode(node2, screenW, screenH) {
|
|
141755
|
-
const attrs = node2.attrs;
|
|
141756
|
-
const skip = isSystemChrome2(attrs) || isNoisyUiAutomatorClass(attrs.class ?? "");
|
|
141757
|
-
const identifier = (attrs["resource-id"] ?? "").trim();
|
|
141758
|
-
const isPassword = attrs.password === "true";
|
|
141759
|
-
const isFocused = attrs.focused === "true";
|
|
141760
|
-
const label = isPassword ? "[password]" : labelOf2(attrs);
|
|
141761
|
-
const rawText = (attrs.text ?? "").trim();
|
|
141762
|
-
const hasValue = !isPassword && Boolean(rawText) && rawText !== label;
|
|
141763
|
-
const className = attrs.class ?? "";
|
|
141764
|
-
const role = deriveUiAutomatorRole(className);
|
|
141765
|
-
const hasSemanticRole = !isUiAutomatorLayoutContainer(className);
|
|
141766
|
-
const ownText2 = [label, hasValue ? rawText : ""].filter(Boolean).join(" ");
|
|
141767
|
-
const rect = parseUiAutomatorBounds(attrs.bounds ?? "");
|
|
141768
|
-
let leaf = null;
|
|
141769
|
-
let frame2 = null;
|
|
141770
|
-
if (!skip && (identifier || label || hasSemanticRole || isFocused)) {
|
|
141771
|
-
frame2 = rect ? normalizeRect(rect, screenW, screenH) : null;
|
|
141772
|
-
if (frame2) {
|
|
141773
|
-
leaf = { role, frame: frame2, children: [] };
|
|
141774
|
-
if (label) leaf.label = label;
|
|
141775
|
-
if (identifier) leaf.identifier = identifier;
|
|
141776
|
-
if (hasValue) leaf.value = rawText;
|
|
141777
|
-
if (attrs.clickable === "true") leaf.clickable = true;
|
|
141778
|
-
if (attrs["long-clickable"] === "true") leaf.longClickable = true;
|
|
141779
|
-
if (attrs.scrollable === "true") leaf.scrollable = true;
|
|
141780
|
-
if (attrs.checkable === "true") leaf.checkable = true;
|
|
141781
|
-
if (attrs.checked === "true") leaf.checked = true;
|
|
141782
|
-
if (attrs.enabled === "false") leaf.disabled = true;
|
|
141783
|
-
if (isPassword) leaf.password = true;
|
|
141784
|
-
if (isFocused) leaf.focused = true;
|
|
141785
|
-
}
|
|
141786
|
-
}
|
|
141787
|
-
return {
|
|
141788
|
-
skip,
|
|
141789
|
-
children: childNodes(node2),
|
|
141790
|
-
// Off-screen text must not hoist, or an ancestor text assert would pass on
|
|
141791
|
-
// content the screen doesn't show. Any node with text is leaf-eligible (its
|
|
141792
|
-
// label is non-empty), so `frame` was computed for it.
|
|
141793
|
-
ownText: frame2 ? ownText2 : "",
|
|
141794
|
-
leaf,
|
|
141795
|
-
// A password field shields even when it carries no id, so nothing from it
|
|
141796
|
-
// bubbles into an ancestor's hoisted text.
|
|
141797
|
-
shield: Boolean(identifier) || isPassword,
|
|
141798
|
-
// Scroll-clip inputs (see `flattenHoisting`): a scroller's raw bounds clip
|
|
141799
|
-
// its subtree, so a row scrolled out of view — but still on the device
|
|
141800
|
-
// screen — is dropped, matching the describe path's prune.
|
|
141801
|
-
rect,
|
|
141802
|
-
scrolls: isUiAutomatorScrollable(attrs)
|
|
141803
|
-
};
|
|
141804
|
-
}
|
|
141805
|
-
function adaptFullAndroidHierarchyToDescribeResult(xml, screenW, screenH) {
|
|
141806
|
-
const children = [];
|
|
141807
|
-
if (screenW > 0 && screenH > 0) {
|
|
141808
|
-
const root = parseUiAutomatorXml(xml);
|
|
141809
|
-
if (root) {
|
|
141810
|
-
for (const c of childNodes(root)) {
|
|
141811
|
-
flattenHoisting(c, (n) => projectAndroidNode(n, screenW, screenH), children);
|
|
141812
|
-
}
|
|
141813
|
-
}
|
|
141814
|
-
}
|
|
141815
|
-
return parseDescribeResult({
|
|
141816
|
-
role: "Screen",
|
|
141817
|
-
frame: { x: 0, y: 0, width: 1, height: 1 },
|
|
141818
|
-
children
|
|
141819
|
-
});
|
|
141820
|
-
}
|
|
141821
|
-
async function queryAndroidFullHierarchy(registry2, device) {
|
|
141822
|
-
let devtools;
|
|
141823
|
-
try {
|
|
141824
|
-
const ref = androidDevtoolsRef(device);
|
|
141825
|
-
devtools = await registry2.resolveService(ref.urn, ref.options);
|
|
141826
|
-
} catch (err) {
|
|
141827
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
141828
|
-
throw new Error(`the argent android helper is unavailable: ${msg}`, { cause: err });
|
|
141829
|
-
}
|
|
141830
|
-
const [{ xml }, size] = await Promise.all([
|
|
141831
|
-
// clearCache: await/assert polls must see text changes, not cached reads.
|
|
141832
|
-
devtools.getHierarchy({ maxNodes: FLOW_MAX_NODES, clearCache: true }),
|
|
141833
|
-
devtools.getScreenSize()
|
|
141834
|
-
]);
|
|
141835
|
-
const tree = adaptFullAndroidHierarchyToDescribeResult(xml, size.width, size.height);
|
|
141836
|
-
return {
|
|
141837
|
-
tree,
|
|
141838
|
-
source: "android-devtools",
|
|
141839
|
-
...size.width > 0 && size.height > 0 ? { screen: { width: size.width, height: size.height } } : {}
|
|
141840
|
-
};
|
|
141841
|
-
}
|
|
141842
|
-
|
|
141843
141933
|
// ../tool-server/src/tools/ui-tree/android.ts
|
|
141844
141934
|
var LEGACY_UNSUPPORTED_FIELDS2 = [
|
|
141845
141935
|
"placeholder",
|
|
@@ -161849,50 +161939,6 @@ async function queryIosDeviceFlowTree(registry2, device) {
|
|
|
161849
161939
|
return { ...data, tree: adaptIosDeviceTreeForFlows(data.tree) };
|
|
161850
161940
|
}
|
|
161851
161941
|
|
|
161852
|
-
// ../tool-server/src/tools/flows/flow-chromium-tree.ts
|
|
161853
|
-
function projectChromiumNode(node2) {
|
|
161854
|
-
const onScreen2 = node2.frame.width > 0 && node2.frame.height > 0;
|
|
161855
|
-
const addressable = Boolean(
|
|
161856
|
-
node2.identifier || node2.label || node2.value || node2.clickable || node2.focused
|
|
161857
|
-
);
|
|
161858
|
-
let leaf = null;
|
|
161859
|
-
if (onScreen2 && addressable) {
|
|
161860
|
-
leaf = { ...node2, children: [] };
|
|
161861
|
-
if (node2.password) {
|
|
161862
|
-
leaf.label = "[password]";
|
|
161863
|
-
delete leaf.value;
|
|
161864
|
-
}
|
|
161865
|
-
}
|
|
161866
|
-
return {
|
|
161867
|
-
skip: false,
|
|
161868
|
-
children: node2.children,
|
|
161869
|
-
// Off-screen text must not hoist, or a text assert against an ancestor
|
|
161870
|
-
// would pass on content the screen doesn't show. A password's text never
|
|
161871
|
-
// bubbles up.
|
|
161872
|
-
ownText: onScreen2 && !node2.password ? nodeText(node2) : "",
|
|
161873
|
-
leaf,
|
|
161874
|
-
shield: Boolean(node2.identifier) || node2.password === true
|
|
161875
|
-
};
|
|
161876
|
-
}
|
|
161877
|
-
function adaptChromiumTreeForFlows(tree) {
|
|
161878
|
-
const children = [];
|
|
161879
|
-
for (const child of tree.children) {
|
|
161880
|
-
flattenHoisting(child, projectChromiumNode, children);
|
|
161881
|
-
}
|
|
161882
|
-
return parseDescribeResult({
|
|
161883
|
-
role: "Screen",
|
|
161884
|
-
frame: { x: 0, y: 0, width: 1, height: 1 },
|
|
161885
|
-
children
|
|
161886
|
-
});
|
|
161887
|
-
}
|
|
161888
|
-
var FLOW_WALK_LIMITS = { maxDepth: 96, maxNodes: 12e3 };
|
|
161889
|
-
async function queryChromiumTree(registry2, device) {
|
|
161890
|
-
const ref = chromiumCdpRef(device);
|
|
161891
|
-
const api = await registry2.resolveService(ref.urn, ref.options);
|
|
161892
|
-
const data = await describeChromium(api, FLOW_WALK_LIMITS);
|
|
161893
|
-
return { tree: adaptChromiumTreeForFlows(data.tree), source: data.source };
|
|
161894
|
-
}
|
|
161895
|
-
|
|
161896
161942
|
// ../tool-server/src/tools/flows/flow-vega-tree.ts
|
|
161897
161943
|
function projectVegaNode(node2) {
|
|
161898
161944
|
const onScreen2 = node2.frame.width > 0 && node2.frame.height > 0;
|
|
@@ -162139,8 +162185,8 @@ var FOCUS_REPORTING_SOURCES = /* @__PURE__ */ new Set([
|
|
|
162139
162185
|
function isPointerDesktop(device) {
|
|
162140
162186
|
return device.platform === "chromium" || device.platform === "macos";
|
|
162141
162187
|
}
|
|
162142
|
-
var
|
|
162143
|
-
var
|
|
162188
|
+
var SETTLE_POLL_MS3 = 250;
|
|
162189
|
+
var SETTLE_TIMEOUT_MS4 = 3e3;
|
|
162144
162190
|
var SETTLE_MIN_READS = 2;
|
|
162145
162191
|
var MAX_SCROLL_ITERATIONS = 25;
|
|
162146
162192
|
var SCROLL_INCREMENT = 0.5;
|
|
@@ -162206,7 +162252,7 @@ function readFlowTree(env) {
|
|
|
162206
162252
|
});
|
|
162207
162253
|
}
|
|
162208
162254
|
async function settleTree(env, opts = {}) {
|
|
162209
|
-
const deadline = Date.now() +
|
|
162255
|
+
const deadline = Date.now() + SETTLE_TIMEOUT_MS4;
|
|
162210
162256
|
let prevFp;
|
|
162211
162257
|
let prevTree;
|
|
162212
162258
|
let lastError;
|
|
@@ -162238,7 +162284,7 @@ async function settleTree(env, opts = {}) {
|
|
|
162238
162284
|
}
|
|
162239
162285
|
return prevTree;
|
|
162240
162286
|
}
|
|
162241
|
-
if (!await sleepOrAbort(
|
|
162287
|
+
if (!await sleepOrAbort(SETTLE_POLL_MS3, env.signal)) return void 0;
|
|
162242
162288
|
}
|
|
162243
162289
|
}
|
|
162244
162290
|
async function waitForFrames(env, selectors) {
|
|
@@ -164709,7 +164755,7 @@ function isTerminalResponse(response) {
|
|
|
164709
164755
|
var DEFAULT_SCRIPT_TIMEOUT_MS = 3e4;
|
|
164710
164756
|
var SCRIPT_STEP_LOG_LIMIT_BYTES = 64 * 1024;
|
|
164711
164757
|
var SCRIPT_RUN_LOG_LIMIT_BYTES = 256 * 1024;
|
|
164712
|
-
var
|
|
164758
|
+
var SETTLE_TIMEOUT_MS5 = 500;
|
|
164713
164759
|
var STOP_GRACE_MS2 = 1500;
|
|
164714
164760
|
var CHILD_DEADLINE_MARGIN_MS = 2e3;
|
|
164715
164761
|
var GROUP_POLL_MS = 50;
|
|
@@ -165151,7 +165197,7 @@ var FlowScriptExecutor = class {
|
|
|
165151
165197
|
const deadlinePassed = Date.now() >= deadlineAt;
|
|
165152
165198
|
clearTimeout(timer);
|
|
165153
165199
|
request4.signal?.removeEventListener("abort", onAbort);
|
|
165154
|
-
await Promise.race([closed, sleep(
|
|
165200
|
+
await Promise.race([closed, sleep(SETTLE_TIMEOUT_MS5)]);
|
|
165155
165201
|
await stop();
|
|
165156
165202
|
capture.end();
|
|
165157
165203
|
child.stdout?.destroy();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swmansion/argent",
|
|
3
|
-
"version": "0.34.1-next.
|
|
3
|
+
"version": "0.34.1-next.89",
|
|
4
4
|
"mcpName": "io.github.software-mansion/argent",
|
|
5
5
|
"description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"vitest": "^5.0.5",
|
|
99
99
|
"yaml": "^2.9.1"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "95878977a1315d3be12327987ad3ed6a4b9b7fd4"
|
|
102
102
|
}
|