@swmansion/argent 0.34.1-next.98 → 0.34.1-next.99
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
CHANGED
|
@@ -38575,7 +38575,7 @@ function isCi(env = process.env) {
|
|
|
38575
38575
|
var SESSION_ID2 = randomUUID5();
|
|
38576
38576
|
function readCliVersion() {
|
|
38577
38577
|
if (true) {
|
|
38578
|
-
return "0.34.1-next.
|
|
38578
|
+
return "0.34.1-next.99";
|
|
38579
38579
|
}
|
|
38580
38580
|
return "0.0.0";
|
|
38581
38581
|
}
|
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.99";
|
|
17002
17002
|
}
|
|
17003
17003
|
return "0.0.0";
|
|
17004
17004
|
}
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -36931,12 +36931,176 @@ function getAutoScreenshotDelayMs(toolName) {
|
|
|
36931
36931
|
import { randomInt } from "node:crypto";
|
|
36932
36932
|
var MAX_UNCHANGED_IN_A_ROW = 3;
|
|
36933
36933
|
var UNCHANGED_MAX_AGE_MS = 5 * 6e4;
|
|
36934
|
+
var MAX_DIFF_RATIO = 0.6;
|
|
36935
|
+
var MAX_EDIT_DISTANCE = 256;
|
|
36936
|
+
var CONTEXT_LINES = 1;
|
|
36934
36937
|
function treeIdLine(id) {
|
|
36935
36938
|
return `Tree id: ${id}`;
|
|
36936
36939
|
}
|
|
36937
36940
|
function unchangedTreeNote(id, tool) {
|
|
36938
36941
|
return `Element tree matches \`${id}\` from an earlier \`${tool}\` result. Actions may have effects the tree omits. Call \`describe\` if you lack that tree.`;
|
|
36939
36942
|
}
|
|
36943
|
+
function treeDiffHeader(id, tool) {
|
|
36944
|
+
return `Diff against \`${id}\` (\`${tool}\`) \u2014 all other lines match \`${id}\` (- gone, + new; call \`describe\` if you lack \`${id}\`):`;
|
|
36945
|
+
}
|
|
36946
|
+
function countLines(lines) {
|
|
36947
|
+
const counts = /* @__PURE__ */ new Map();
|
|
36948
|
+
for (const line of lines) counts.set(line, (counts.get(line) ?? 0) + 1);
|
|
36949
|
+
return counts;
|
|
36950
|
+
}
|
|
36951
|
+
function isMultisetSubset(subset, superset) {
|
|
36952
|
+
if (subset.length === 0) return true;
|
|
36953
|
+
if (subset.length > superset.length) return false;
|
|
36954
|
+
const counts = countLines(superset);
|
|
36955
|
+
for (const line of subset) {
|
|
36956
|
+
const left = counts.get(line) ?? 0;
|
|
36957
|
+
if (left === 0) return false;
|
|
36958
|
+
counts.set(line, left - 1);
|
|
36959
|
+
}
|
|
36960
|
+
return true;
|
|
36961
|
+
}
|
|
36962
|
+
function treeMetaSignature(tree) {
|
|
36963
|
+
const meta2 = [];
|
|
36964
|
+
for (const line of tree.split("\n")) {
|
|
36965
|
+
if (line.startsWith("Hint: ") || line.startsWith("Source: ") || line.startsWith("Mode: ")) {
|
|
36966
|
+
meta2.push(line);
|
|
36967
|
+
} else if (line.trim() !== "") {
|
|
36968
|
+
break;
|
|
36969
|
+
}
|
|
36970
|
+
}
|
|
36971
|
+
return meta2.join("\n");
|
|
36972
|
+
}
|
|
36973
|
+
function myersDiff(a, b, maxD) {
|
|
36974
|
+
const n = a.length;
|
|
36975
|
+
const m = b.length;
|
|
36976
|
+
const limit = Math.min(maxD, n + m);
|
|
36977
|
+
const offset = limit;
|
|
36978
|
+
const v = new Int32Array(2 * limit + 1);
|
|
36979
|
+
const trace = [];
|
|
36980
|
+
for (let d = 0; d <= limit; d++) {
|
|
36981
|
+
trace.push(v.slice());
|
|
36982
|
+
for (let k = -d; k <= d; k += 2) {
|
|
36983
|
+
let x;
|
|
36984
|
+
if (k === -d || k !== d && v[offset + k - 1] < v[offset + k + 1]) {
|
|
36985
|
+
x = v[offset + k + 1];
|
|
36986
|
+
} else {
|
|
36987
|
+
x = v[offset + k - 1] + 1;
|
|
36988
|
+
}
|
|
36989
|
+
let y = x - k;
|
|
36990
|
+
while (x < n && y < m && a[x] === b[y]) {
|
|
36991
|
+
x++;
|
|
36992
|
+
y++;
|
|
36993
|
+
}
|
|
36994
|
+
v[offset + k] = x;
|
|
36995
|
+
if (x === n && y === m) {
|
|
36996
|
+
const ops = [];
|
|
36997
|
+
let bx = n;
|
|
36998
|
+
let by = m;
|
|
36999
|
+
for (let step = d; step > 0; step--) {
|
|
37000
|
+
const prevV = trace[step];
|
|
37001
|
+
const bk = bx - by;
|
|
37002
|
+
const prevK = bk === -step || bk !== step && prevV[offset + bk - 1] < prevV[offset + bk + 1] ? bk + 1 : bk - 1;
|
|
37003
|
+
const prevX = prevV[offset + prevK];
|
|
37004
|
+
const prevY = prevX - prevK;
|
|
37005
|
+
while (bx > prevX && by > prevY) {
|
|
37006
|
+
bx--;
|
|
37007
|
+
by--;
|
|
37008
|
+
ops.push({ kind: "eq", line: a[bx] });
|
|
37009
|
+
}
|
|
37010
|
+
if (bx === prevX) {
|
|
37011
|
+
by--;
|
|
37012
|
+
ops.push({ kind: "ins", line: b[by] });
|
|
37013
|
+
} else {
|
|
37014
|
+
bx--;
|
|
37015
|
+
ops.push({ kind: "del", line: a[bx] });
|
|
37016
|
+
}
|
|
37017
|
+
}
|
|
37018
|
+
while (bx > 0 && by > 0) {
|
|
37019
|
+
bx--;
|
|
37020
|
+
by--;
|
|
37021
|
+
ops.push({ kind: "eq", line: a[bx] });
|
|
37022
|
+
}
|
|
37023
|
+
ops.reverse();
|
|
37024
|
+
return ops;
|
|
37025
|
+
}
|
|
37026
|
+
}
|
|
37027
|
+
}
|
|
37028
|
+
return null;
|
|
37029
|
+
}
|
|
37030
|
+
function diffLines(before, after) {
|
|
37031
|
+
let prefix = 0;
|
|
37032
|
+
const minLen = Math.min(before.length, after.length);
|
|
37033
|
+
while (prefix < minLen && before[prefix] === after[prefix]) prefix++;
|
|
37034
|
+
let suffix = 0;
|
|
37035
|
+
while (suffix < minLen - prefix && before[before.length - 1 - suffix] === after[after.length - 1 - suffix]) {
|
|
37036
|
+
suffix++;
|
|
37037
|
+
}
|
|
37038
|
+
const midBefore = before.slice(prefix, before.length - suffix);
|
|
37039
|
+
const midAfter = after.slice(prefix, after.length - suffix);
|
|
37040
|
+
const midOps = midBefore.length === 0 && midAfter.length === 0 ? [] : myersDiff(midBefore, midAfter, MAX_EDIT_DISTANCE);
|
|
37041
|
+
if (midOps === null) return null;
|
|
37042
|
+
const ops = [];
|
|
37043
|
+
for (let i = 0; i < prefix; i++) ops.push({ kind: "eq", line: before[i] });
|
|
37044
|
+
for (const op of midOps) ops.push(op);
|
|
37045
|
+
for (let i = before.length - suffix; i < before.length; i++) {
|
|
37046
|
+
ops.push({ kind: "eq", line: before[i] });
|
|
37047
|
+
}
|
|
37048
|
+
return ops;
|
|
37049
|
+
}
|
|
37050
|
+
function renderHunks(ops) {
|
|
37051
|
+
const visible = new Uint8Array(ops.length);
|
|
37052
|
+
for (let i = 0; i < ops.length; i++) {
|
|
37053
|
+
if (ops[i].kind === "eq") continue;
|
|
37054
|
+
const start = Math.max(0, i - CONTEXT_LINES);
|
|
37055
|
+
const end = Math.min(ops.length - 1, i + CONTEXT_LINES);
|
|
37056
|
+
for (let j = start; j <= end; j++) visible[j] = 1;
|
|
37057
|
+
}
|
|
37058
|
+
const out = [];
|
|
37059
|
+
let inHunk = false;
|
|
37060
|
+
let hadHunk = false;
|
|
37061
|
+
for (let i = 0; i < ops.length; i++) {
|
|
37062
|
+
if (!visible[i]) {
|
|
37063
|
+
inHunk = false;
|
|
37064
|
+
continue;
|
|
37065
|
+
}
|
|
37066
|
+
if (!inHunk) {
|
|
37067
|
+
if (hadHunk) out.push("...");
|
|
37068
|
+
inHunk = true;
|
|
37069
|
+
hadHunk = true;
|
|
37070
|
+
}
|
|
37071
|
+
const op = ops[i];
|
|
37072
|
+
if (op.kind === "del") out.push(`- ${op.line}`);
|
|
37073
|
+
else if (op.kind === "ins") out.push(`+ ${op.line}`);
|
|
37074
|
+
else out.push(` ${op.line}`);
|
|
37075
|
+
}
|
|
37076
|
+
return out;
|
|
37077
|
+
}
|
|
37078
|
+
function splitTreeLines(tree) {
|
|
37079
|
+
const trimmed = tree.endsWith("\n") ? tree.slice(0, -1) : tree;
|
|
37080
|
+
return trimmed.split("\n");
|
|
37081
|
+
}
|
|
37082
|
+
function computeTreeDiff(base, next, id, tool) {
|
|
37083
|
+
if (treeMetaSignature(base) !== treeMetaSignature(next)) return null;
|
|
37084
|
+
if (base === next) {
|
|
37085
|
+
return { mode: "unchanged", text: unchangedTreeNote(id, tool), removed: [], added: [] };
|
|
37086
|
+
}
|
|
37087
|
+
const before = splitTreeLines(base);
|
|
37088
|
+
const after = splitTreeLines(next);
|
|
37089
|
+
const ops = diffLines(before, after);
|
|
37090
|
+
if (ops === null) return null;
|
|
37091
|
+
const removed = [];
|
|
37092
|
+
const added = [];
|
|
37093
|
+
for (const op of ops) {
|
|
37094
|
+
if (op.kind === "del") removed.push(op.line);
|
|
37095
|
+
else if (op.kind === "ins") added.push(op.line);
|
|
37096
|
+
}
|
|
37097
|
+
if (removed.length === 0 && added.length === 0) {
|
|
37098
|
+
return { mode: "unchanged", text: unchangedTreeNote(id, tool), removed, added };
|
|
37099
|
+
}
|
|
37100
|
+
const text = [treeDiffHeader(id, tool), ...renderHunks(ops)].join("\n");
|
|
37101
|
+
if (text.length > Math.floor(next.length * MAX_DIFF_RATIO)) return null;
|
|
37102
|
+
return { mode: "diff", text, removed, added };
|
|
37103
|
+
}
|
|
36940
37104
|
function randomTag() {
|
|
36941
37105
|
return randomInt(36 ** 3).toString(36).padStart(3, "0");
|
|
36942
37106
|
}
|
|
@@ -36945,7 +37109,14 @@ function createTreeMemory(now = Date.now, tag = randomTag()) {
|
|
|
36945
37109
|
let count = 0;
|
|
36946
37110
|
const sent = (udid, tree, toolName) => {
|
|
36947
37111
|
const id = `${tag}-${++count}`;
|
|
36948
|
-
lastSent.set(udid, {
|
|
37112
|
+
lastSent.set(udid, {
|
|
37113
|
+
id,
|
|
37114
|
+
tree,
|
|
37115
|
+
tool: normalizeToolName(toolName),
|
|
37116
|
+
sentAt: now(),
|
|
37117
|
+
shortResults: 0,
|
|
37118
|
+
priorDiff: null
|
|
37119
|
+
});
|
|
36949
37120
|
return id;
|
|
36950
37121
|
};
|
|
36951
37122
|
return {
|
|
@@ -36953,13 +37124,50 @@ function createTreeMemory(now = Date.now, tag = randomTag()) {
|
|
|
36953
37124
|
afterAction(udid, tree, toolName) {
|
|
36954
37125
|
const last = lastSent.get(udid);
|
|
36955
37126
|
const identical = last !== void 0 && last.tree === tree;
|
|
36956
|
-
|
|
36957
|
-
|
|
36958
|
-
|
|
37127
|
+
const canShorten = last !== void 0 && last.shortResults < MAX_UNCHANGED_IN_A_ROW && now() - last.sentAt <= UNCHANGED_MAX_AGE_MS;
|
|
37128
|
+
if (canShorten) {
|
|
37129
|
+
if (identical) {
|
|
37130
|
+
if (last.priorDiff === null) {
|
|
37131
|
+
last.shortResults += 1;
|
|
37132
|
+
return {
|
|
37133
|
+
text: unchangedTreeNote(last.id, last.tool),
|
|
37134
|
+
mode: "unchanged",
|
|
37135
|
+
identical: true,
|
|
37136
|
+
note: true
|
|
37137
|
+
};
|
|
37138
|
+
}
|
|
37139
|
+
} else {
|
|
37140
|
+
const diff = computeTreeDiff(last.tree, tree, last.id, last.tool);
|
|
37141
|
+
if (diff !== null) {
|
|
37142
|
+
if (diff.mode === "unchanged") {
|
|
37143
|
+
if (last.priorDiff === null) {
|
|
37144
|
+
last.shortResults += 1;
|
|
37145
|
+
return {
|
|
37146
|
+
text: diff.text,
|
|
37147
|
+
mode: "unchanged",
|
|
37148
|
+
identical: true,
|
|
37149
|
+
note: true
|
|
37150
|
+
};
|
|
37151
|
+
}
|
|
37152
|
+
} else {
|
|
37153
|
+
const monotonic = last.priorDiff === null || isMultisetSubset(last.priorDiff.removed, diff.removed) && isMultisetSubset(last.priorDiff.added, diff.added);
|
|
37154
|
+
if (monotonic) {
|
|
37155
|
+
last.shortResults += 1;
|
|
37156
|
+
last.priorDiff = { removed: diff.removed, added: diff.added };
|
|
37157
|
+
return {
|
|
37158
|
+
text: diff.text,
|
|
37159
|
+
mode: "diff",
|
|
37160
|
+
identical: false,
|
|
37161
|
+
note: false
|
|
37162
|
+
};
|
|
37163
|
+
}
|
|
37164
|
+
}
|
|
37165
|
+
}
|
|
37166
|
+
}
|
|
36959
37167
|
}
|
|
36960
37168
|
const id = sent(udid, tree, toolName);
|
|
36961
37169
|
return { text: `${treeIdLine(id)}
|
|
36962
|
-
${tree}`, identical, note: false };
|
|
37170
|
+
${tree}`, mode: "full", identical, note: false };
|
|
36963
37171
|
},
|
|
36964
37172
|
forget(udid) {
|
|
36965
37173
|
lastSent.delete(udid);
|
|
@@ -37428,7 +37636,7 @@ function debuggerLogRegistryText(result) {
|
|
|
37428
37636
|
}
|
|
37429
37637
|
|
|
37430
37638
|
// ../argent-mcp/src/instructions.ts
|
|
37431
|
-
var SERVER_INSTRUCTIONS = "Argent \u2014 iOS Simulator, Android Emulator, and Chromium app control for interacting, testing, profiling and debugging mobile and Chromium applications. Use the platform the user named; otherwise prefer a device list-devices shows already running, and do not default to iOS. In a single-platform project, boot that platform. Prefer these tools over raw xcrun or adb commands, which are a fallback. Prefer launch-app or open-url over tapping home-screen icons. If the task may need a saved e2e test, load the argent-create-e2e skill (argent-qa-e2e for acceptance tests) before the first launch or in-app action: recording is not retroactive. Load the matching argent-* skill before React Native build or debug work, profiling, a physical phone, a Mac app or a TV. Interaction tools return the screen after the action: a screenshot plus the accessibility element tree with normalized tap frames. Take coordinates from that tree; call describe only when no fresh tree is available \u2014 never guess coordinates from pixels.
|
|
37639
|
+
var SERVER_INSTRUCTIONS = "Argent \u2014 iOS Simulator, Android Emulator, and Chromium app control for interacting, testing, profiling and debugging mobile and Chromium applications. Use the platform the user named; otherwise prefer a device list-devices shows already running, and do not default to iOS. In a single-platform project, boot that platform. Prefer these tools over raw xcrun or adb commands, which are a fallback. Prefer launch-app or open-url over tapping home-screen icons. If the task may need a saved e2e test, load the argent-create-e2e skill (argent-qa-e2e for acceptance tests) before the first launch or in-app action: recording is not retroactive. Load the matching argent-* skill before React Native build or debug work, profiling, a physical phone, a Mac app or a TV. Interaction tools return the screen after the action: a screenshot plus the accessibility element tree with normalized tap frames. Take coordinates from that tree; call describe only when no fresh tree is available \u2014 never guess coordinates from pixels. When the tree matches or differs slightly from an earlier tree, the result names that earlier tree by its tree id (unchanged note or `-` gone / `+` new lines) in place of repeating it. If a tap fails twice, stop retrying and call a discovery tool again. Use await-ui-element to wait for the UI instead of polling with screenshots. Do not stop simulator servers when a task finishes: the next task reuses them. Call stop-all-simulator-servers when the user asks to clean up or ends the session, or when a skill tells you to recycle a device's services, always with devices: [...] naming the devices this session used. Never stop a Metro the user started unless they ask. One tool-server is shared by every agent using this argent install, so an unscoped call tears down their devices too \u2014 reserve it for a deliberate machine-wide cleanup. The argent CLI manages the toolkit: argent --help lists its commands.";
|
|
37432
37640
|
|
|
37433
37641
|
// ../argent-mcp/src/installed-version.ts
|
|
37434
37642
|
import * as fs12 from "node:fs";
|
|
@@ -37735,6 +37943,8 @@ async function startMcpServer(options) {
|
|
|
37735
37943
|
name: toolName,
|
|
37736
37944
|
durationMs: Date.now() - t1,
|
|
37737
37945
|
chars: tree?.length ?? 0,
|
|
37946
|
+
sentChars: shown?.text.length ?? 0,
|
|
37947
|
+
mode: shown?.mode,
|
|
37738
37948
|
// `identical` is the repeat rate; `note` is what the agent was spared.
|
|
37739
37949
|
identical: shown?.identical ?? false,
|
|
37740
37950
|
note: shown?.note ?? false
|
package/dist/tool-server.cjs
CHANGED
|
@@ -72948,7 +72948,7 @@ function isCi(env = process.env) {
|
|
|
72948
72948
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
72949
72949
|
function readCliVersion() {
|
|
72950
72950
|
if (true) {
|
|
72951
|
-
return "0.34.1-next.
|
|
72951
|
+
return "0.34.1-next.99";
|
|
72952
72952
|
}
|
|
72953
72953
|
return "0.0.0";
|
|
72954
72954
|
}
|
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.99",
|
|
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": "1434678620bf0a87c1281b78db69256cac5dd387"
|
|
102
102
|
}
|
|
@@ -43,7 +43,7 @@ After a network test, call `network-conditions` with the same target and omit th
|
|
|
43
43
|
|
|
44
44
|
## 3. Finding Tap Targets
|
|
45
45
|
|
|
46
|
-
After an action moves you to a different screen, or whenever you don't know an element's coordinates, discover before tapping. Interaction results already carry the element tree (`--- Elements after action (describe) ---`): use it, and call a discovery tool only when no fresh tree covers the current screen. Each tree has a `Tree id`. When the tree
|
|
46
|
+
After an action moves you to a different screen, or whenever you don't know an element's coordinates, discover before tapping. Interaction results already carry the element tree (`--- Elements after action (describe) ---`): use it, and call a discovery tool only when no fresh tree covers the current screen. Each full tree has a `Tree id`. When the tree matches an earlier one, or only a few lines changed, the result names that id in place of repeating the full tree (an unchanged note, or `-` gone / `+` new lines against it): apply that to the named tree, and call `describe` if it is not in your context. An identical tree does not mean the action did nothing.
|
|
47
47
|
|
|
48
48
|
| Need | Tool |
|
|
49
49
|
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
@@ -16,7 +16,7 @@ For implementation tasks that modify visible UI, this workflow also serves as a
|
|
|
16
16
|
1. **Baseline screenshot**: call `screenshot` to see the current UI state. For visual regression comparison or UI change verification, capture the baseline at `scale: 1.0` with `includeImageInContext: false` and keep the returned `path` before editing whenever feasible.
|
|
17
17
|
2. **Find target**: get element coordinates from a discovery tool before tapping:
|
|
18
18
|
- **App screens (React Native included), in-app modals and system dialogs**: `describe`. Fall back to `screenshot` only if an overlay is not exposed reliably. When the app raises its own permission dialog, answer it here; that's the real flow under test. To take a prompt _out_ of the flow, use `argent-settings-permissions` during setup.
|
|
19
|
-
3. **Interact**: perform the action (`gesture-tap`, `gesture-swipe`, `keyboard`, `button`, ...); you receive a screenshot and element tree automatically (an identical
|
|
19
|
+
3. **Interact**: perform the action (`gesture-tap`, `gesture-swipe`, `keyboard`, `button`, ...); you receive a screenshot and element tree automatically (an identical or slightly changed tree references the earlier `Tree id` with a note or `-`/`+` line diff instead of repeating the full tree).
|
|
20
20
|
4. **Verify**: check the returned screenshot. If it shows a loading/transitional state, block with `await-ui-element` (expected element `visible`, or a spinner `hidden`) rather than a guessed delay (its result carries the new screenshot and element tree), but only with a selector you can trust (`text`/`identifier`/`role`) that the screen is known to have or that you saw in a prior `describe`; a guessed one just times out. Otherwise use a short fixed wait. Pick evidence by what's being asserted:
|
|
21
21
|
- **Visual** (layout, spacing, color, typography, image/icon rendering, clipping, overflow, text rendering): prefer `screenshot-diff` against the step 1 baseline: it surfaces pixel-visible changes the auto-screenshot might miss. Fall back to inspecting the auto-screenshot only when a stable baseline isn't available.
|
|
22
22
|
- **Structural** (navigation state, element existence, accessibility labels/values, selection, hierarchy, route): verify with `describe` or `debugger-component-tree`.
|