@swmansion/argent 0.34.1-next.92 → 0.34.1-next.94
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 +219 -4
- package/dist/tool-server.cjs +6565 -6150
- package/package.json +2 -2
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.94";
|
|
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.94";
|
|
17002
17002
|
}
|
|
17003
17003
|
return "0.0.0";
|
|
17004
17004
|
}
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -37080,6 +37080,220 @@ ${STOPPED_SIMULATORS_HEADER}
|
|
|
37080
37080
|
${stopped.join("\n")}`;
|
|
37081
37081
|
}
|
|
37082
37082
|
|
|
37083
|
+
// ../argent-mcp/src/native-network-logs-text.ts
|
|
37084
|
+
var KNOWN_TOP_KEYS = /* @__PURE__ */ new Set([
|
|
37085
|
+
"status",
|
|
37086
|
+
"header",
|
|
37087
|
+
"armed",
|
|
37088
|
+
"started",
|
|
37089
|
+
"stopped",
|
|
37090
|
+
"capture",
|
|
37091
|
+
"captureDetail",
|
|
37092
|
+
"count",
|
|
37093
|
+
"total",
|
|
37094
|
+
"requests"
|
|
37095
|
+
]);
|
|
37096
|
+
var KNOWN_REQUEST_KEYS = /* @__PURE__ */ new Set([
|
|
37097
|
+
"id",
|
|
37098
|
+
"method",
|
|
37099
|
+
"url",
|
|
37100
|
+
"state",
|
|
37101
|
+
"status",
|
|
37102
|
+
"mimeType",
|
|
37103
|
+
"durationMs",
|
|
37104
|
+
"errorText",
|
|
37105
|
+
"rnRequestId"
|
|
37106
|
+
]);
|
|
37107
|
+
function isRecord5(value) {
|
|
37108
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
37109
|
+
}
|
|
37110
|
+
function isRequestLine(value) {
|
|
37111
|
+
return isRecord5(value) && typeof value.id === "string" && typeof value.method === "string" && typeof value.url === "string" && typeof value.state === "string";
|
|
37112
|
+
}
|
|
37113
|
+
function quoteIfNeeded2(value) {
|
|
37114
|
+
return value === "" || /[\s"\\]/.test(value) ? JSON.stringify(value) : value;
|
|
37115
|
+
}
|
|
37116
|
+
function extraFields(record2, known) {
|
|
37117
|
+
const parts = [];
|
|
37118
|
+
for (const [key, value] of Object.entries(record2)) {
|
|
37119
|
+
if (known.has(key) || value === void 0 || value === null) continue;
|
|
37120
|
+
if (value === true) parts.push(key);
|
|
37121
|
+
else if (typeof value === "string" || typeof value === "number") {
|
|
37122
|
+
parts.push(`${key}=${quoteIfNeeded2(String(value))}`);
|
|
37123
|
+
} else {
|
|
37124
|
+
parts.push(`${key}=${JSON.stringify(value)}`);
|
|
37125
|
+
}
|
|
37126
|
+
}
|
|
37127
|
+
return parts;
|
|
37128
|
+
}
|
|
37129
|
+
function formatRequestLine(req) {
|
|
37130
|
+
const id = req.id;
|
|
37131
|
+
const method = req.method;
|
|
37132
|
+
const url = req.url;
|
|
37133
|
+
const state = req.state;
|
|
37134
|
+
const status = typeof req.status === "number" ? req.status : void 0;
|
|
37135
|
+
const mimeType = typeof req.mimeType === "string" && req.mimeType ? req.mimeType : void 0;
|
|
37136
|
+
const durationMs = typeof req.durationMs === "number" ? req.durationMs : void 0;
|
|
37137
|
+
const errorText = typeof req.errorText === "string" && req.errorText ? req.errorText : void 0;
|
|
37138
|
+
const rnRequestId = typeof req.rnRequestId === "number" ? req.rnRequestId : void 0;
|
|
37139
|
+
let outcome;
|
|
37140
|
+
if (state === "failed") {
|
|
37141
|
+
outcome = [
|
|
37142
|
+
"failed",
|
|
37143
|
+
status !== void 0 ? String(status) : "",
|
|
37144
|
+
errorText ? JSON.stringify(errorText) : ""
|
|
37145
|
+
].filter(Boolean).join(" ");
|
|
37146
|
+
} else if (status !== void 0) {
|
|
37147
|
+
outcome = state === "complete" ? String(status) : `${status} (${state})`;
|
|
37148
|
+
} else {
|
|
37149
|
+
outcome = state;
|
|
37150
|
+
}
|
|
37151
|
+
const parts = [
|
|
37152
|
+
`{id: ${id}}`,
|
|
37153
|
+
JSON.stringify(`${method} ${url}`),
|
|
37154
|
+
outcome,
|
|
37155
|
+
mimeType ?? "",
|
|
37156
|
+
durationMs !== void 0 ? `${durationMs}ms` : "",
|
|
37157
|
+
rnRequestId !== void 0 ? `rnRequestId=${rnRequestId}` : "",
|
|
37158
|
+
...extraFields(req, KNOWN_REQUEST_KEYS)
|
|
37159
|
+
].filter(Boolean);
|
|
37160
|
+
return parts.join(" ");
|
|
37161
|
+
}
|
|
37162
|
+
function nativeNetworkLogsText(result) {
|
|
37163
|
+
if (!isRecord5(result) || result.status !== "ok" || typeof result.header !== "string" || typeof result.armed !== "boolean" || typeof result.count !== "number" || typeof result.total !== "number" || !Array.isArray(result.requests) || !result.requests.every(isRequestLine)) {
|
|
37164
|
+
return void 0;
|
|
37165
|
+
}
|
|
37166
|
+
const lines = [result.header];
|
|
37167
|
+
if (typeof result.capture === "string" && !result.header.includes(`capture ${result.capture}`)) {
|
|
37168
|
+
const detail = typeof result.captureDetail === "string" && result.captureDetail ? ` (${result.captureDetail})` : "";
|
|
37169
|
+
lines.push(`Capture: ${result.capture}${detail}`);
|
|
37170
|
+
}
|
|
37171
|
+
if (result.count < result.total) {
|
|
37172
|
+
lines.push(
|
|
37173
|
+
`Showing ${result.count === 0 ? "0" : `last ${result.count}`} of ${result.total} requests.`
|
|
37174
|
+
);
|
|
37175
|
+
}
|
|
37176
|
+
const extras = extraFields(result, KNOWN_TOP_KEYS);
|
|
37177
|
+
if (extras.length > 0) lines.push(extras.join(" "));
|
|
37178
|
+
for (const req of result.requests) {
|
|
37179
|
+
lines.push(formatRequestLine(req));
|
|
37180
|
+
}
|
|
37181
|
+
return lines.join("\n");
|
|
37182
|
+
}
|
|
37183
|
+
|
|
37184
|
+
// ../argent-mcp/src/debugger-log-registry-text.ts
|
|
37185
|
+
var KNOWN_TOP_KEYS2 = /* @__PURE__ */ new Set([
|
|
37186
|
+
"status",
|
|
37187
|
+
"file",
|
|
37188
|
+
"totalEntries",
|
|
37189
|
+
"byLevel",
|
|
37190
|
+
"fileSizeBytes",
|
|
37191
|
+
"clusters",
|
|
37192
|
+
"entries",
|
|
37193
|
+
"deviceName",
|
|
37194
|
+
"appName",
|
|
37195
|
+
"logicalDeviceId",
|
|
37196
|
+
"note"
|
|
37197
|
+
]);
|
|
37198
|
+
function isRecord6(value) {
|
|
37199
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
37200
|
+
}
|
|
37201
|
+
function isCluster(value) {
|
|
37202
|
+
return isRecord6(value) && typeof value.message === "string" && typeof value.count === "number" && typeof value.level === "string" && typeof value.firstId === "number" && typeof value.lastId === "number";
|
|
37203
|
+
}
|
|
37204
|
+
function isRecentEntry(value) {
|
|
37205
|
+
return isRecord6(value) && typeof value.id === "number" && typeof value.timestamp === "string" && typeof value.level === "string" && typeof value.message === "string";
|
|
37206
|
+
}
|
|
37207
|
+
function quoteIfNeeded3(value) {
|
|
37208
|
+
return value === "" || /[\s"\\]/.test(value) ? JSON.stringify(value) : value;
|
|
37209
|
+
}
|
|
37210
|
+
function formatBytes(bytes) {
|
|
37211
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
37212
|
+
const kb = bytes / 1024;
|
|
37213
|
+
if (kb < 1024) return `${kb.toFixed(1)} KB`;
|
|
37214
|
+
const mb = kb / 1024;
|
|
37215
|
+
return `${mb.toFixed(1)} MB`;
|
|
37216
|
+
}
|
|
37217
|
+
function formatMessage(message) {
|
|
37218
|
+
return message.includes("\n") ? message.replace(/\r?\n/g, "\n ") : message;
|
|
37219
|
+
}
|
|
37220
|
+
function extraFields2(record2) {
|
|
37221
|
+
const parts = [];
|
|
37222
|
+
for (const [key, value] of Object.entries(record2)) {
|
|
37223
|
+
if (KNOWN_TOP_KEYS2.has(key) || value === void 0 || value === null) continue;
|
|
37224
|
+
if (value === true) parts.push(key);
|
|
37225
|
+
else if (typeof value === "string" || typeof value === "number") {
|
|
37226
|
+
parts.push(`${key}=${quoteIfNeeded3(String(value))}`);
|
|
37227
|
+
} else {
|
|
37228
|
+
parts.push(`${key}=${JSON.stringify(value)}`);
|
|
37229
|
+
}
|
|
37230
|
+
}
|
|
37231
|
+
return parts;
|
|
37232
|
+
}
|
|
37233
|
+
function formatClusterLine(cluster) {
|
|
37234
|
+
const count = cluster.count;
|
|
37235
|
+
const level = cluster.level;
|
|
37236
|
+
const firstId = cluster.firstId;
|
|
37237
|
+
const lastId = cluster.lastId;
|
|
37238
|
+
const message = cluster.message;
|
|
37239
|
+
const idRange = firstId === lastId ? `#${firstId}` : `#${firstId}..#${lastId}`;
|
|
37240
|
+
const sourceFile = typeof cluster.sourceFile === "string" && cluster.sourceFile ? cluster.sourceFile : void 0;
|
|
37241
|
+
const sourceLine = typeof cluster.sourceLine === "number" ? cluster.sourceLine : void 0;
|
|
37242
|
+
const source = sourceFile ? ` ${sourceFile}${sourceLine !== void 0 ? `:${sourceLine}` : ""}` : "";
|
|
37243
|
+
return `[x${count}] ${level} ${idRange}${source} | ${formatMessage(message)}`;
|
|
37244
|
+
}
|
|
37245
|
+
function formatEntryLine(entry) {
|
|
37246
|
+
const id = entry.id;
|
|
37247
|
+
const timestamp = entry.timestamp;
|
|
37248
|
+
const level = entry.level;
|
|
37249
|
+
const message = entry.message;
|
|
37250
|
+
return `[L:${id}] ${timestamp} ${level} | ${formatMessage(message)}`;
|
|
37251
|
+
}
|
|
37252
|
+
function debuggerLogRegistryText(result) {
|
|
37253
|
+
if (!isRecord6(result) || result.status !== "connected" || typeof result.file !== "string" || typeof result.totalEntries !== "number" || !isRecord6(result.byLevel) || typeof result.fileSizeBytes !== "number" || !Array.isArray(result.clusters) || !result.clusters.every(isCluster) || !Array.isArray(result.entries) || !result.entries.every(isRecentEntry)) {
|
|
37254
|
+
return void 0;
|
|
37255
|
+
}
|
|
37256
|
+
const total = result.totalEntries;
|
|
37257
|
+
const noun = total === 1 ? "entry" : "entries";
|
|
37258
|
+
const levelParts = Object.entries(result.byLevel).filter(([, count]) => typeof count === "number" && count > 0).map(([level, count]) => `${level}=${count}`);
|
|
37259
|
+
const levelsSuffix = levelParts.length > 0 ? ` (${levelParts.join(", ")})` : "";
|
|
37260
|
+
const metaParts = [];
|
|
37261
|
+
if (typeof result.appName === "string" && result.appName) {
|
|
37262
|
+
metaParts.push(`app=${quoteIfNeeded3(result.appName)}`);
|
|
37263
|
+
}
|
|
37264
|
+
if (typeof result.deviceName === "string" && result.deviceName) {
|
|
37265
|
+
metaParts.push(`device=${quoteIfNeeded3(result.deviceName)}`);
|
|
37266
|
+
}
|
|
37267
|
+
if (typeof result.logicalDeviceId === "string" && result.logicalDeviceId) {
|
|
37268
|
+
metaParts.push(`id=${quoteIfNeeded3(result.logicalDeviceId)}`);
|
|
37269
|
+
}
|
|
37270
|
+
const metaSuffix = metaParts.length > 0 ? ` | ${metaParts.join(" ")}` : "";
|
|
37271
|
+
const lines = [
|
|
37272
|
+
`JS console logs (connected): ${total} ${noun}${levelsSuffix}${metaSuffix}`,
|
|
37273
|
+
`File: ${result.file} (${formatBytes(result.fileSizeBytes)})`
|
|
37274
|
+
];
|
|
37275
|
+
if (typeof result.note === "string" && result.note) {
|
|
37276
|
+
lines.push(`Note: ${result.note}`);
|
|
37277
|
+
}
|
|
37278
|
+
const extras = extraFields2(result);
|
|
37279
|
+
if (extras.length > 0) lines.push(extras.join(" "));
|
|
37280
|
+
if (result.clusters.length > 0) {
|
|
37281
|
+
lines.push("", `Clusters (${result.clusters.length}):`);
|
|
37282
|
+
for (const cluster of result.clusters) {
|
|
37283
|
+
lines.push(formatClusterLine(cluster));
|
|
37284
|
+
}
|
|
37285
|
+
}
|
|
37286
|
+
if (result.entries.length > 0) {
|
|
37287
|
+
lines.push("", `Recent entries (${result.entries.length}, oldest first):`);
|
|
37288
|
+
for (const entry of result.entries) {
|
|
37289
|
+
lines.push(formatEntryLine(entry));
|
|
37290
|
+
}
|
|
37291
|
+
} else if (total > 0) {
|
|
37292
|
+
lines.push("", "Recent entries: none");
|
|
37293
|
+
}
|
|
37294
|
+
return lines.join("\n");
|
|
37295
|
+
}
|
|
37296
|
+
|
|
37083
37297
|
// ../argent-mcp/src/instructions.ts
|
|
37084
37298
|
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. A result names an identical earlier tree by its tree id 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.";
|
|
37085
37299
|
|
|
@@ -37473,11 +37687,12 @@ ${shown.text}` }];
|
|
|
37473
37687
|
deviceId: getDeviceIdFromArgs(params.arguments),
|
|
37474
37688
|
signal: callSignal
|
|
37475
37689
|
};
|
|
37476
|
-
const
|
|
37690
|
+
const toolId = canonicalToolId(params.name);
|
|
37691
|
+
const compactText = toolId === "list-devices" ? listDevicesText(result) : toolId === "native-network-logs" ? nativeNetworkLogsText(result) : toolId === "debugger-log-registry" ? debuggerLogRegistryText(result) : void 0;
|
|
37477
37692
|
let content;
|
|
37478
|
-
if (
|
|
37479
|
-
content = [{ type: "text", text:
|
|
37480
|
-
} else if (
|
|
37693
|
+
if (compactText !== void 0) {
|
|
37694
|
+
content = [{ type: "text", text: compactText }];
|
|
37695
|
+
} else if (toolId === "e2e-execute" && result && typeof result === "object" && ("e2eTest" in result || "flow" in result) && "steps" in result) {
|
|
37481
37696
|
content = await flowRunToMcpContent(result, ctx);
|
|
37482
37697
|
} else if (params.name === "screenshot-diff" && isScreenshotDiffResult(result)) {
|
|
37483
37698
|
content = await screenshotDiffToMcpContent(result, ctx);
|