@swmansion/argent 0.34.1-next.81 → 0.34.1-next.82
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 +7 -5
- package/dist/client.js +1 -0
- package/dist/installer.mjs +2 -1
- package/dist/mcp-server.mjs +1 -0
- package/dist/tool-args.generated.d.ts +20 -0
- package/dist/tool-server.cjs +888 -200
- package/package.json +2 -2
- package/skills/argent-create-e2e/references/live-authoring.md +13 -2
- package/skills/argent-device-interact/SKILL.md +1 -1
- package/skills/argent-metro-debugger/SKILL.md +4 -2
- package/skills/argent-qa-e2e/SKILL.md +3 -2
- package/skills/argent-test-ui-flow/SKILL.md +1 -1
package/dist/tool-server.cjs
CHANGED
|
@@ -1762,6 +1762,7 @@ var init_failure_codes = __esm({
|
|
|
1762
1762
|
ANDROID_NETWORK_INSPECTOR_DEVICE_IN_USE: "ANDROID_NETWORK_INSPECTOR_DEVICE_IN_USE",
|
|
1763
1763
|
ANDROID_NETWORK_INSPECTOR_NO_DEVICE_PORT: "ANDROID_NETWORK_INSPECTOR_NO_DEVICE_PORT",
|
|
1764
1764
|
NETWORK_CAPTURE_UNAVAILABLE: "NETWORK_CAPTURE_UNAVAILABLE",
|
|
1765
|
+
NETWORK_CAPTURE_NOT_STARTED: "NETWORK_CAPTURE_NOT_STARTED",
|
|
1765
1766
|
NDJSON_CDP_REQUEST_TIMEOUT: "NDJSON_CDP_REQUEST_TIMEOUT",
|
|
1766
1767
|
NDJSON_CDP_REQUEST_FAILED: "NDJSON_CDP_REQUEST_FAILED",
|
|
1767
1768
|
NDJSON_CDP_CONNECTION_CLOSED: "NDJSON_CDP_CONNECTION_CLOSED",
|
|
@@ -18038,8 +18039,8 @@ function finalize(ctx, schema) {
|
|
|
18038
18039
|
const root = ctx.seen.get(schema);
|
|
18039
18040
|
if (!root)
|
|
18040
18041
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
18041
|
-
const flattenRef = (
|
|
18042
|
-
const seen = ctx.seen.get(
|
|
18042
|
+
const flattenRef = (zodSchema87) => {
|
|
18043
|
+
const seen = ctx.seen.get(zodSchema87);
|
|
18043
18044
|
if (seen.ref === null)
|
|
18044
18045
|
return;
|
|
18045
18046
|
const schema2 = seen.def ?? seen.schema;
|
|
@@ -18057,7 +18058,7 @@ function finalize(ctx, schema) {
|
|
|
18057
18058
|
assignProps(schema2, refSchema);
|
|
18058
18059
|
}
|
|
18059
18060
|
assignProps(schema2, _cached);
|
|
18060
|
-
const isParentRef =
|
|
18061
|
+
const isParentRef = zodSchema87._zod.parent === ref;
|
|
18061
18062
|
if (isParentRef) {
|
|
18062
18063
|
for (const key2 in schema2) {
|
|
18063
18064
|
if (key2 === "$ref" || key2 === "allOf")
|
|
@@ -18077,7 +18078,7 @@ function finalize(ctx, schema) {
|
|
|
18077
18078
|
}
|
|
18078
18079
|
}
|
|
18079
18080
|
}
|
|
18080
|
-
const parent =
|
|
18081
|
+
const parent = zodSchema87._zod.parent;
|
|
18081
18082
|
if (parent && parent !== ref) {
|
|
18082
18083
|
flattenRef(parent);
|
|
18083
18084
|
const parentSeen = ctx.seen.get(parent);
|
|
@@ -18095,7 +18096,7 @@ function finalize(ctx, schema) {
|
|
|
18095
18096
|
}
|
|
18096
18097
|
}
|
|
18097
18098
|
ctx.override({
|
|
18098
|
-
zodSchema:
|
|
18099
|
+
zodSchema: zodSchema87,
|
|
18099
18100
|
jsonSchema: schema2,
|
|
18100
18101
|
path: seen.path ?? []
|
|
18101
18102
|
});
|
|
@@ -21530,10 +21531,10 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21530
21531
|
}
|
|
21531
21532
|
ctx.processing.add(refPath);
|
|
21532
21533
|
const resolved = resolveRef(refPath, ctx);
|
|
21533
|
-
const
|
|
21534
|
-
ctx.refs.set(refPath,
|
|
21534
|
+
const zodSchema88 = convertSchema(resolved, ctx);
|
|
21535
|
+
ctx.refs.set(refPath, zodSchema88);
|
|
21535
21536
|
ctx.processing.delete(refPath);
|
|
21536
|
-
return
|
|
21537
|
+
return zodSchema88;
|
|
21537
21538
|
}
|
|
21538
21539
|
if (schema.enum !== void 0) {
|
|
21539
21540
|
const enumValues = schema.enum;
|
|
@@ -21575,7 +21576,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21575
21576
|
if (!type) {
|
|
21576
21577
|
return z.any();
|
|
21577
21578
|
}
|
|
21578
|
-
let
|
|
21579
|
+
let zodSchema87;
|
|
21579
21580
|
switch (type) {
|
|
21580
21581
|
case "string": {
|
|
21581
21582
|
let stringSchema = z.string();
|
|
@@ -21644,7 +21645,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21644
21645
|
if (schema.pattern) {
|
|
21645
21646
|
stringSchema = stringSchema.regex(new RegExp(schema.pattern));
|
|
21646
21647
|
}
|
|
21647
|
-
|
|
21648
|
+
zodSchema87 = stringSchema;
|
|
21648
21649
|
break;
|
|
21649
21650
|
}
|
|
21650
21651
|
case "number":
|
|
@@ -21669,15 +21670,15 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21669
21670
|
if (typeof schema.multipleOf === "number") {
|
|
21670
21671
|
numberSchema = numberSchema.multipleOf(schema.multipleOf);
|
|
21671
21672
|
}
|
|
21672
|
-
|
|
21673
|
+
zodSchema87 = numberSchema;
|
|
21673
21674
|
break;
|
|
21674
21675
|
}
|
|
21675
21676
|
case "boolean": {
|
|
21676
|
-
|
|
21677
|
+
zodSchema87 = z.boolean();
|
|
21677
21678
|
break;
|
|
21678
21679
|
}
|
|
21679
21680
|
case "null": {
|
|
21680
|
-
|
|
21681
|
+
zodSchema87 = z.null();
|
|
21681
21682
|
break;
|
|
21682
21683
|
}
|
|
21683
21684
|
case "object": {
|
|
@@ -21704,21 +21705,21 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21704
21705
|
}
|
|
21705
21706
|
schemasToIntersect.push(...looseRecords);
|
|
21706
21707
|
if (schemasToIntersect.length === 0) {
|
|
21707
|
-
|
|
21708
|
+
zodSchema87 = z.object({}).passthrough();
|
|
21708
21709
|
} else if (schemasToIntersect.length === 1) {
|
|
21709
|
-
|
|
21710
|
+
zodSchema87 = schemasToIntersect[0];
|
|
21710
21711
|
} else {
|
|
21711
21712
|
let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
21712
21713
|
for (let i = 2; i < schemasToIntersect.length; i++) {
|
|
21713
21714
|
result = z.intersection(result, schemasToIntersect[i]);
|
|
21714
21715
|
}
|
|
21715
|
-
|
|
21716
|
+
zodSchema87 = result;
|
|
21716
21717
|
}
|
|
21717
21718
|
if (schema.additionalProperties === false) {
|
|
21718
21719
|
const propertyKeys = Object.keys(shape);
|
|
21719
21720
|
const patterns = patternKeys.map((p) => new RegExp(p));
|
|
21720
|
-
const basePatternSchema =
|
|
21721
|
-
|
|
21721
|
+
const basePatternSchema = zodSchema87;
|
|
21722
|
+
zodSchema87 = zodSchema87.check((payload) => {
|
|
21722
21723
|
if (!isPlainObject2(payload.value))
|
|
21723
21724
|
return;
|
|
21724
21725
|
const unrecognized = [];
|
|
@@ -21742,11 +21743,11 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21742
21743
|
} else {
|
|
21743
21744
|
const objectSchema = z.object(shape);
|
|
21744
21745
|
if (schema.additionalProperties === false) {
|
|
21745
|
-
|
|
21746
|
+
zodSchema87 = objectSchema.strict();
|
|
21746
21747
|
} else if (additionalSchema) {
|
|
21747
|
-
|
|
21748
|
+
zodSchema87 = objectSchema.catchall(additionalSchema);
|
|
21748
21749
|
} else {
|
|
21749
|
-
|
|
21750
|
+
zodSchema87 = objectSchema.passthrough();
|
|
21750
21751
|
}
|
|
21751
21752
|
}
|
|
21752
21753
|
const hasKeyGuard = schema.propertyNames !== void 0 && schema.propertyNames !== true;
|
|
@@ -21758,7 +21759,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21758
21759
|
const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === void 0 ? { type: "string", ...schema.propertyNames } : schema.propertyNames;
|
|
21759
21760
|
keySchema = convertSchema(keyJSONSchema, ctx);
|
|
21760
21761
|
}
|
|
21761
|
-
|
|
21762
|
+
zodSchema87 = checkObjectGuards(zodSchema87, { keySchema, minProperties, maxProperties });
|
|
21762
21763
|
}
|
|
21763
21764
|
break;
|
|
21764
21765
|
}
|
|
@@ -21771,12 +21772,12 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21771
21772
|
const positionalItems = applyMinItems(tupleItems, minItems);
|
|
21772
21773
|
const rest = !Array.isArray(items) ? getTupleRest(items, ctx) : void 0;
|
|
21773
21774
|
const tupleSchema = z.tuple(positionalItems);
|
|
21774
|
-
|
|
21775
|
+
zodSchema87 = rest ? tupleSchema.rest(rest) : tupleSchema;
|
|
21775
21776
|
if (typeof schema.minItems === "number") {
|
|
21776
|
-
|
|
21777
|
+
zodSchema87 = zodSchema87.check(z.minLength(schema.minItems));
|
|
21777
21778
|
}
|
|
21778
21779
|
if (typeof schema.maxItems === "number") {
|
|
21779
|
-
|
|
21780
|
+
zodSchema87 = zodSchema87.check(z.maxLength(schema.maxItems));
|
|
21780
21781
|
}
|
|
21781
21782
|
} else if (Array.isArray(items)) {
|
|
21782
21783
|
const minItems = typeof schema.minItems === "number" ? schema.minItems : 0;
|
|
@@ -21784,12 +21785,12 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21784
21785
|
const positionalItems = applyMinItems(tupleItems, minItems);
|
|
21785
21786
|
const rest = getTupleRest(schema.additionalItems, ctx);
|
|
21786
21787
|
const tupleSchema = z.tuple(positionalItems);
|
|
21787
|
-
|
|
21788
|
+
zodSchema87 = rest ? tupleSchema.rest(rest) : tupleSchema;
|
|
21788
21789
|
if (typeof schema.minItems === "number") {
|
|
21789
|
-
|
|
21790
|
+
zodSchema87 = zodSchema87.check(z.minLength(schema.minItems));
|
|
21790
21791
|
}
|
|
21791
21792
|
if (typeof schema.maxItems === "number") {
|
|
21792
|
-
|
|
21793
|
+
zodSchema87 = zodSchema87.check(z.maxLength(schema.maxItems));
|
|
21793
21794
|
}
|
|
21794
21795
|
} else if (items !== void 0) {
|
|
21795
21796
|
const element = convertSchema(items, ctx);
|
|
@@ -21800,12 +21801,12 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21800
21801
|
if (typeof schema.maxItems === "number") {
|
|
21801
21802
|
arraySchema = arraySchema.max(schema.maxItems);
|
|
21802
21803
|
}
|
|
21803
|
-
|
|
21804
|
+
zodSchema87 = arraySchema;
|
|
21804
21805
|
} else {
|
|
21805
|
-
|
|
21806
|
+
zodSchema87 = z.array(z.any());
|
|
21806
21807
|
}
|
|
21807
21808
|
if (schema.uniqueItems === true || schema.contains !== void 0) {
|
|
21808
|
-
|
|
21809
|
+
zodSchema87 = checkArrayGuards(zodSchema87, {
|
|
21809
21810
|
uniqueItems: schema.uniqueItems === true,
|
|
21810
21811
|
containsSchema: schema.contains !== void 0 ? convertSchema(schema.contains, ctx) : void 0,
|
|
21811
21812
|
minContains: typeof schema.minContains === "number" ? schema.minContains : void 0,
|
|
@@ -21817,7 +21818,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
21817
21818
|
default:
|
|
21818
21819
|
throw new Error(`Unsupported type: ${type}`);
|
|
21819
21820
|
}
|
|
21820
|
-
return
|
|
21821
|
+
return zodSchema87;
|
|
21821
21822
|
}
|
|
21822
21823
|
function convertSchema(schema, ctx) {
|
|
21823
21824
|
if (typeof schema === "boolean") {
|
|
@@ -72946,7 +72947,7 @@ function isCi(env = process.env) {
|
|
|
72946
72947
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
72947
72948
|
function readCliVersion() {
|
|
72948
72949
|
if (true) {
|
|
72949
|
-
return "0.34.1-next.
|
|
72950
|
+
return "0.34.1-next.81";
|
|
72950
72951
|
}
|
|
72951
72952
|
return "0.0.0";
|
|
72952
72953
|
}
|
|
@@ -96488,7 +96489,9 @@ function createIosNetworkRecords(state3, link, recording = () => true, layer = "
|
|
|
96488
96489
|
}
|
|
96489
96490
|
for (const record2 of open5) resize(record2);
|
|
96490
96491
|
},
|
|
96491
|
-
records: (port) => records.filter(
|
|
96492
|
+
records: (port, options) => records.filter(
|
|
96493
|
+
(r) => (options?.includeHidden === true || !cleared.has(r)) && !isMetroTraffic(r.request.url, port)
|
|
96494
|
+
),
|
|
96492
96495
|
record: (id) => byId.get(id),
|
|
96493
96496
|
clear() {
|
|
96494
96497
|
for (const record2 of records) cleared.add(record2);
|
|
@@ -101267,6 +101270,7 @@ function createNetworkManager(deps) {
|
|
|
101267
101270
|
const { cdp } = deps;
|
|
101268
101271
|
const order = [];
|
|
101269
101272
|
const byId = /* @__PURE__ */ new Map();
|
|
101273
|
+
const seqOf = /* @__PURE__ */ new Map();
|
|
101270
101274
|
let lastSeq = 0;
|
|
101271
101275
|
let mark;
|
|
101272
101276
|
let conditions = null;
|
|
@@ -101275,11 +101279,14 @@ function createNetworkManager(deps) {
|
|
|
101275
101279
|
if (!rec) {
|
|
101276
101280
|
rec = { requestId, method: "", url: "", startedDateTime: "", startTs: 0 };
|
|
101277
101281
|
byId.set(requestId, rec);
|
|
101278
|
-
lastSeq
|
|
101282
|
+
seqOf.set(requestId, ++lastSeq);
|
|
101279
101283
|
order.push(requestId);
|
|
101280
101284
|
if (order.length > MAX_RECORDS2) {
|
|
101281
101285
|
const evicted = order.shift();
|
|
101282
|
-
if (evicted)
|
|
101286
|
+
if (evicted) {
|
|
101287
|
+
byId.delete(evicted);
|
|
101288
|
+
seqOf.delete(evicted);
|
|
101289
|
+
}
|
|
101283
101290
|
}
|
|
101284
101291
|
}
|
|
101285
101292
|
return rec;
|
|
@@ -101333,6 +101340,7 @@ function createNetworkManager(deps) {
|
|
|
101333
101340
|
case "Network.loadingFinished": {
|
|
101334
101341
|
const rec = byId.get(params.requestId);
|
|
101335
101342
|
if (rec) {
|
|
101343
|
+
rec.finished = true;
|
|
101336
101344
|
rec.encodedDataLength = params.encodedDataLength;
|
|
101337
101345
|
if (rec.startTs) rec.durationMs = (params.timestamp - rec.startTs) * 1e3;
|
|
101338
101346
|
}
|
|
@@ -101352,12 +101360,18 @@ function createNetworkManager(deps) {
|
|
|
101352
101360
|
cdp.events.on("event", onEvent);
|
|
101353
101361
|
return {
|
|
101354
101362
|
requests: () => order.map((id) => byId.get(id)).filter((r) => !!r),
|
|
101363
|
+
requestsAfter: (seq) => order.flatMap((id) => {
|
|
101364
|
+
const at = seqOf.get(id);
|
|
101365
|
+
const rec = byId.get(id);
|
|
101366
|
+
return at !== void 0 && at > seq && rec ? [{ seq: at, record: rec }] : [];
|
|
101367
|
+
}),
|
|
101355
101368
|
get: (requestId) => byId.get(requestId),
|
|
101356
101369
|
startCapture: () => mark = { lastSeq },
|
|
101357
101370
|
stopCapture: () => {
|
|
101358
101371
|
if (mark && mark.stoppedSeq === void 0) mark = { ...mark, stoppedSeq: lastSeq };
|
|
101359
101372
|
return mark;
|
|
101360
101373
|
},
|
|
101374
|
+
captureMark: () => mark,
|
|
101361
101375
|
reattach: async () => {
|
|
101362
101376
|
await cdp.send("Network.enable").catch(() => {
|
|
101363
101377
|
});
|
|
@@ -106374,15 +106388,15 @@ async function memberText(member, tempDirs, lookupUpload, taken) {
|
|
|
106374
106388
|
}
|
|
106375
106389
|
const file2 = await materializeMember(member, tempDirs, lookupUpload);
|
|
106376
106390
|
if (file2 === void 0) return void 0;
|
|
106377
|
-
const
|
|
106391
|
+
const unreadable2 = (err) => {
|
|
106378
106392
|
throw new FileInputError(
|
|
106379
106393
|
`Could not read the uploaded file "${member.path}": ${errorText(err)}`
|
|
106380
106394
|
);
|
|
106381
106395
|
};
|
|
106382
|
-
const { size } = await (0, import_promises10.stat)(file2).catch(
|
|
106396
|
+
const { size } = await (0, import_promises10.stat)(file2).catch(unreadable2);
|
|
106383
106397
|
checkUploadSize(member, size);
|
|
106384
106398
|
countMemberBytes(member, taken, size);
|
|
106385
|
-
return (0, import_promises10.readFile)(file2, "utf8").catch(
|
|
106399
|
+
return (0, import_promises10.readFile)(file2, "utf8").catch(unreadable2);
|
|
106386
106400
|
}
|
|
106387
106401
|
async function resolveMembers(members2, tempDirs, lookupUpload) {
|
|
106388
106402
|
const out = {};
|
|
@@ -117929,6 +117943,7 @@ function createMacosAppApi(bundleId) {
|
|
|
117929
117943
|
let disposed = false;
|
|
117930
117944
|
let captureStarted = false;
|
|
117931
117945
|
let captureStopped = false;
|
|
117946
|
+
let captureMark;
|
|
117932
117947
|
let captureGap = false;
|
|
117933
117948
|
let armedSinceLaunch = false;
|
|
117934
117949
|
let recordedProcess = null;
|
|
@@ -118500,8 +118515,9 @@ function createMacosAppApi(bundleId) {
|
|
|
118500
118515
|
},
|
|
118501
118516
|
isConnected: () => Boolean(channel?.isOpen && channel.handshake),
|
|
118502
118517
|
handshake: () => channel?.isOpen ? channel.handshake : null,
|
|
118503
|
-
async startNetworkCapture() {
|
|
118518
|
+
async startNetworkCapture(metroPort2) {
|
|
118504
118519
|
captureStopped = false;
|
|
118520
|
+
captureMark = { lastRecord: lastIosRecordNumber(), metroPort: metroPort2 };
|
|
118505
118521
|
const startedNow = !captureStarted;
|
|
118506
118522
|
captureStarted = true;
|
|
118507
118523
|
if (channel) channel.stopUnconfirmed = false;
|
|
@@ -118570,13 +118586,15 @@ function createMacosAppApi(bundleId) {
|
|
|
118570
118586
|
}
|
|
118571
118587
|
},
|
|
118572
118588
|
forgetNetworkCaptureStart() {
|
|
118573
|
-
if (liveChannel()) return;
|
|
118589
|
+
if (liveChannel() || !captureStarted) return;
|
|
118574
118590
|
captureStarted = false;
|
|
118575
118591
|
captureGap = false;
|
|
118576
118592
|
armedSinceLaunch = false;
|
|
118593
|
+
captureMark = void 0;
|
|
118577
118594
|
},
|
|
118578
118595
|
isNetworkCaptureStarted: () => captureStarted,
|
|
118579
118596
|
isNetworkCaptureStopped: () => captureStopped,
|
|
118597
|
+
networkCaptureMark: () => captureMark,
|
|
118580
118598
|
isNetworkCaptureStopUnconfirmed: () => liveChannel()?.stopUnconfirmed === true,
|
|
118581
118599
|
takeCaptureGap: () => {
|
|
118582
118600
|
const gap = captureGap;
|
|
@@ -119904,11 +119922,23 @@ function deriveSelector(node2) {
|
|
|
119904
119922
|
return null;
|
|
119905
119923
|
}
|
|
119906
119924
|
|
|
119907
|
-
// ../tool-server/src/
|
|
119925
|
+
// ../tool-server/src/utils/wait-result.ts
|
|
119908
119926
|
var AWAIT_UI_ELEMENT_TOOL_ID = "await-ui-element";
|
|
119909
|
-
|
|
119910
|
-
|
|
119927
|
+
var AWAIT_NETWORK_REQUEST_TOOL_ID = "await-network-request";
|
|
119928
|
+
var WAIT_TOOL_IDS = /* @__PURE__ */ new Set([
|
|
119929
|
+
AWAIT_UI_ELEMENT_TOOL_ID,
|
|
119930
|
+
AWAIT_NETWORK_REQUEST_TOOL_ID
|
|
119931
|
+
]);
|
|
119932
|
+
function isUnmetWaitResult(tool, result) {
|
|
119933
|
+
return WAIT_TOOL_IDS.has(tool) && typeof result === "object" && result !== null && result.success === false;
|
|
119911
119934
|
}
|
|
119935
|
+
var DARK_TAIL_TOLERANCE_INTERVALS = 2;
|
|
119936
|
+
var DARK_TAIL_TOLERANCE_MAX_MS = 2e3;
|
|
119937
|
+
function darkTailToleranceMs(pollIntervalMs) {
|
|
119938
|
+
return Math.min(DARK_TAIL_TOLERANCE_INTERVALS * pollIntervalMs, DARK_TAIL_TOLERANCE_MAX_MS);
|
|
119939
|
+
}
|
|
119940
|
+
|
|
119941
|
+
// ../tool-server/src/tools/await-ui-element/index.ts
|
|
119912
119942
|
var WAIT_CANCELLED_NOTE = "wait was cancelled before the condition was met";
|
|
119913
119943
|
var TREE_FETCH_FAILED_NOTE_PREFIX = "last tree fetch failed: ";
|
|
119914
119944
|
var HIDDEN_UNREADABLE_NOTE = "could not confirm the element is hidden \u2014 the UI tree was empty or unreadable at timeout";
|
|
@@ -119937,18 +119967,12 @@ var conditionCompleted = {
|
|
|
119937
119967
|
hidden: "UI element became hidden",
|
|
119938
119968
|
text: "UI element matched expected text"
|
|
119939
119969
|
};
|
|
119940
|
-
var DARK_TAIL_TOLERANCE_INTERVALS = 2;
|
|
119941
|
-
var DARK_TAIL_TOLERANCE_MAX_MS = 2e3;
|
|
119942
119970
|
function timeoutCause(condition, lastTrustedReadAt, finalRead, pollIntervalMs) {
|
|
119943
119971
|
if (lastTrustedReadAt === void 0) return "unreadable";
|
|
119944
119972
|
if (finalRead === "trusted") return "unmet";
|
|
119945
119973
|
if (finalRead === "untrusted" && condition === "hidden") return "unreadable";
|
|
119946
119974
|
const darkTailMs = Date.now() - lastTrustedReadAt;
|
|
119947
|
-
|
|
119948
|
-
DARK_TAIL_TOLERANCE_INTERVALS * pollIntervalMs,
|
|
119949
|
-
DARK_TAIL_TOLERANCE_MAX_MS
|
|
119950
|
-
);
|
|
119951
|
-
return darkTailMs > tolerance ? "unreadable" : "unmet";
|
|
119975
|
+
return darkTailMs > darkTailToleranceMs(pollIntervalMs) ? "unreadable" : "unmet";
|
|
119952
119976
|
}
|
|
119953
119977
|
var capability = {
|
|
119954
119978
|
apple: { simulator: true, device: true },
|
|
@@ -120887,14 +120911,21 @@ function nestedOrchestratorOutcome(tool, result) {
|
|
|
120887
120911
|
}
|
|
120888
120912
|
|
|
120889
120913
|
// ../tool-server/src/utils/tool-result-verdict.ts
|
|
120890
|
-
function
|
|
120914
|
+
function unmetWaitCause(tool, result) {
|
|
120915
|
+
if (tool === AWAIT_UI_ELEMENT_TOOL_ID) return unmetUiWaitCause(result);
|
|
120916
|
+
const carried = result?.cause;
|
|
120917
|
+
return carried === "unreadable" || carried === "cancelled" ? carried : "unmet";
|
|
120918
|
+
}
|
|
120919
|
+
function unmetWaitReason(tool, result) {
|
|
120891
120920
|
const { note } = result;
|
|
120892
|
-
const cause =
|
|
120921
|
+
const cause = unmetWaitCause(tool, result);
|
|
120893
120922
|
const what = cause === "unmet" ? "condition not met" : `condition not judged (${cause})`;
|
|
120894
|
-
return
|
|
120923
|
+
return `${tool} ${what}${note ? `: ${note}` : ""}`;
|
|
120895
120924
|
}
|
|
120896
120925
|
function toolResultVerdict(tool, result) {
|
|
120897
|
-
if (
|
|
120926
|
+
if (isUnmetWaitResult(tool, result)) {
|
|
120927
|
+
return { status: "fail", reason: unmetWaitReason(tool, result) };
|
|
120928
|
+
}
|
|
120898
120929
|
const nested = nestedOrchestratorOutcome(tool, result);
|
|
120899
120930
|
if (nested) return nested;
|
|
120900
120931
|
if (isDebuggerNotConnectedResult(tool, result)) {
|
|
@@ -122076,6 +122107,9 @@ var RUN_TAG2 = (0, import_node_crypto14.randomBytes)(2).toString("hex");
|
|
|
122076
122107
|
var ANDROID_NATIVE_REQUEST_ID = /^android-[0-9a-f]{4}-\d+$/;
|
|
122077
122108
|
var liveInspectors = /* @__PURE__ */ new Map();
|
|
122078
122109
|
var nextRecordNumber2 = 1;
|
|
122110
|
+
function lastAndroidRecordNumber() {
|
|
122111
|
+
return nextRecordNumber2 - 1;
|
|
122112
|
+
}
|
|
122079
122113
|
function allHandles() {
|
|
122080
122114
|
return [...liveInspectors.values()].flatMap((set2) => [...set2]);
|
|
122081
122115
|
}
|
|
@@ -123502,8 +123536,8 @@ function createInspector(serial, packageName, initialMetroPort) {
|
|
|
123502
123536
|
...!conn && note && !stopped ? { note: shownNote() } : {}
|
|
123503
123537
|
};
|
|
123504
123538
|
},
|
|
123505
|
-
records: (port) => records.filter(
|
|
123506
|
-
(r) => !cleared.has(r) && !isMetroTraffic(r.request.url, port, { androidEmulatorHost: true })
|
|
123539
|
+
records: (port, options) => records.filter(
|
|
123540
|
+
(r) => (options?.includeHidden === true || !cleared.has(r)) && !isMetroTraffic(r.request.url, port, { androidEmulatorHost: true })
|
|
123507
123541
|
),
|
|
123508
123542
|
record: (id) => byId.get(id)?.record,
|
|
123509
123543
|
responseBody: (id) => fetchBody(id, "response"),
|
|
@@ -124623,17 +124657,19 @@ function nativeAppServices(params) {
|
|
|
124623
124657
|
}
|
|
124624
124658
|
function requireMacosAppOfBundle(services, device, toolId, bundleId) {
|
|
124625
124659
|
const app = requireMacosApp(services, toolId, device);
|
|
124626
|
-
|
|
124627
|
-
throw new InvalidToolInputError(
|
|
124628
|
-
`bundleId '${bundleId}' is not the app of this device: a Mac app id names one app. Pass bundleId '${app.bundleId}', or use the device id macos-app-${bundleId}.`,
|
|
124629
|
-
{
|
|
124630
|
-
error_code: FAILURE_CODES.MACOS_APP_BUNDLE_ID_MISMATCH,
|
|
124631
|
-
failure_stage: "native_devtools_macos_bundle_id"
|
|
124632
|
-
}
|
|
124633
|
-
);
|
|
124634
|
-
}
|
|
124660
|
+
assertMacosAppBundle(app.bundleId, bundleId);
|
|
124635
124661
|
return app;
|
|
124636
124662
|
}
|
|
124663
|
+
function assertMacosAppBundle(appBundleId, bundleId) {
|
|
124664
|
+
if (bundleId === appBundleId) return;
|
|
124665
|
+
throw new InvalidToolInputError(
|
|
124666
|
+
`bundleId '${bundleId}' is not the app of this device: a Mac app id names one app. Pass bundleId '${appBundleId}', or use the device id macos-app-${bundleId}.`,
|
|
124667
|
+
{
|
|
124668
|
+
error_code: FAILURE_CODES.MACOS_APP_BUNDLE_ID_MISMATCH,
|
|
124669
|
+
failure_stage: "native_devtools_macos_bundle_id"
|
|
124670
|
+
}
|
|
124671
|
+
);
|
|
124672
|
+
}
|
|
124637
124673
|
var VIEW_HIERARCHY_TIMEOUT_MS = 22e3;
|
|
124638
124674
|
async function queryViewHierarchyFor(services, params, toolId, method, errorCode2, toResult) {
|
|
124639
124675
|
const { udid, bundleId, ...rpcParams } = params;
|
|
@@ -124733,15 +124769,25 @@ function lockDevice(udid) {
|
|
|
124733
124769
|
return deviceKeyOf(udid).toLowerCase();
|
|
124734
124770
|
}
|
|
124735
124771
|
var nativeUnavailable = /* @__PURE__ */ new Map();
|
|
124736
|
-
function
|
|
124772
|
+
function appKey(udid, bundleId) {
|
|
124737
124773
|
return `${lockDevice(udid)}:${bundleId}`;
|
|
124738
124774
|
}
|
|
124739
124775
|
function setNativeUnavailable(udid, bundleId, reason2) {
|
|
124740
|
-
if (reason2 === void 0) nativeUnavailable.delete(
|
|
124741
|
-
else nativeUnavailable.set(
|
|
124776
|
+
if (reason2 === void 0) nativeUnavailable.delete(appKey(udid, bundleId));
|
|
124777
|
+
else nativeUnavailable.set(appKey(udid, bundleId), reason2);
|
|
124742
124778
|
}
|
|
124743
124779
|
function nativeUnavailableReason(udid, bundleId) {
|
|
124744
|
-
return nativeUnavailable.get(
|
|
124780
|
+
return nativeUnavailable.get(appKey(udid, bundleId));
|
|
124781
|
+
}
|
|
124782
|
+
var lastStarts = /* @__PURE__ */ new Map();
|
|
124783
|
+
function noteCaptureStart(udid, bundleId, layers, nativeFloor) {
|
|
124784
|
+
lastStarts.set(appKey(udid, bundleId), {
|
|
124785
|
+
layers: new Set(layers.filter((entry) => !entry.unavailable).map((entry) => entry.layer)),
|
|
124786
|
+
nativeFloor
|
|
124787
|
+
});
|
|
124788
|
+
}
|
|
124789
|
+
function lastCaptureStart(udid, bundleId) {
|
|
124790
|
+
return lastStarts.get(appKey(udid, bundleId));
|
|
124745
124791
|
}
|
|
124746
124792
|
function forgetNativeUnavailableOf(devices2) {
|
|
124747
124793
|
const covered = devices2 && new Set(devices2.map(lockDevice));
|
|
@@ -127529,17 +127575,10 @@ function makeNetworkLogReadScript(start2, limit, metroPort2) {
|
|
|
127529
127575
|
var log = globalThis.__argent_network_log;
|
|
127530
127576
|
if (!log) return JSON.stringify({ entries: [], total: 0, interceptorInstalled: false });
|
|
127531
127577
|
|
|
127532
|
-
|
|
127578
|
+
${metroFilter(metroPort2)}
|
|
127533
127579
|
var filtered = [];
|
|
127534
127580
|
for (var i = 0; i < log.length; i++) {
|
|
127535
|
-
|
|
127536
|
-
if (e.request && e.request.url) {
|
|
127537
|
-
try {
|
|
127538
|
-
var u = e.request.url;
|
|
127539
|
-
if ((u.indexOf('://localhost:${metroPort2}') !== -1 || u.indexOf('://127.0.0.1:${metroPort2}') !== -1)) continue;
|
|
127540
|
-
} catch(ex) {}
|
|
127541
|
-
}
|
|
127542
|
-
filtered.push(e);
|
|
127581
|
+
if (!isMetro(log[i])) filtered.push(log[i]);
|
|
127543
127582
|
}
|
|
127544
127583
|
|
|
127545
127584
|
var total = filtered.length;
|
|
@@ -127574,6 +127613,49 @@ function makeNetworkLogReadScript(start2, limit, metroPort2) {
|
|
|
127574
127613
|
});
|
|
127575
127614
|
})()`;
|
|
127576
127615
|
}
|
|
127616
|
+
function metroFilter(metroPort2) {
|
|
127617
|
+
return `function isMetro(e) {
|
|
127618
|
+
var u = e.request && e.request.url;
|
|
127619
|
+
return typeof u === 'string' && (u.indexOf('://localhost:${metroPort2}') !== -1 || u.indexOf('://127.0.0.1:${metroPort2}') !== -1);
|
|
127620
|
+
}`;
|
|
127621
|
+
}
|
|
127622
|
+
function makeNetworkWaitReadScript(mark, metroPort2) {
|
|
127623
|
+
return `(function() {
|
|
127624
|
+
var g = globalThis;
|
|
127625
|
+
var xhr = typeof g.XMLHttpRequest === 'function';
|
|
127626
|
+
var log = g.__argent_network_log;
|
|
127627
|
+
if (typeof g.__argent_network_mark !== 'function' || !Array.isArray(log)) {
|
|
127628
|
+
return JSON.stringify({ installed: false, xhr: xhr });
|
|
127629
|
+
}
|
|
127630
|
+
${metroFilter(metroPort2)}
|
|
127631
|
+
var token = typeof g.__argent_network_install === 'string' ? g.__argent_network_install : null;
|
|
127632
|
+
var markToken = ${JSON.stringify(mark.install)};
|
|
127633
|
+
var lastId = ${mark.install === null ? 0 : mark.lastId};
|
|
127634
|
+
var sameContext = markToken !== null && token === markToken;
|
|
127635
|
+
var entries = [];
|
|
127636
|
+
for (var i = 0; i < log.length; i++) {
|
|
127637
|
+
var e = log[i];
|
|
127638
|
+
if (sameContext && !(e.id > lastId)) continue;
|
|
127639
|
+
if (isMetro(e)) continue;
|
|
127640
|
+
entries.push({
|
|
127641
|
+
requestId: e.requestId,
|
|
127642
|
+
state: e.state,
|
|
127643
|
+
method: e.request ? e.request.method : undefined,
|
|
127644
|
+
url: e.request ? e.request.url : undefined,
|
|
127645
|
+
status: e.response ? e.response.status : undefined,
|
|
127646
|
+
durationMs: e.durationMs,
|
|
127647
|
+
errorText: e.errorText
|
|
127648
|
+
});
|
|
127649
|
+
}
|
|
127650
|
+
return JSON.stringify({
|
|
127651
|
+
installed: true,
|
|
127652
|
+
xhr: xhr,
|
|
127653
|
+
token: token,
|
|
127654
|
+
paused: g.__argent_network_paused === true,
|
|
127655
|
+
entries: entries
|
|
127656
|
+
});
|
|
127657
|
+
})()`;
|
|
127658
|
+
}
|
|
127577
127659
|
function makeNetworkDetailReadScript(requestId) {
|
|
127578
127660
|
return `(function() {
|
|
127579
127661
|
var byId = globalThis.__argent_network_by_id;
|
|
@@ -127672,6 +127754,18 @@ function jsCapturesOn(device) {
|
|
|
127672
127754
|
function findJsCapture(device, bundleId) {
|
|
127673
127755
|
return jsCapturesOn(device).find((capture) => capture.bundleId === bundleId);
|
|
127674
127756
|
}
|
|
127757
|
+
function findJsCaptureOfDevice(udid, bundleId) {
|
|
127758
|
+
let byPhysical;
|
|
127759
|
+
for (const [payload, capture] of jsCaptures) {
|
|
127760
|
+
if (capture.bundleId !== bundleId) continue;
|
|
127761
|
+
const { port, device } = splitPayload(payload);
|
|
127762
|
+
if (sameDevice(device, udid)) return { payload, port, capture };
|
|
127763
|
+
if (capture.physicalDeviceId !== void 0 && sameDevice(capture.physicalDeviceId, udid)) {
|
|
127764
|
+
byPhysical ??= { payload, port, capture };
|
|
127765
|
+
}
|
|
127766
|
+
}
|
|
127767
|
+
return byPhysical;
|
|
127768
|
+
}
|
|
127675
127769
|
function jsCapturesOfAppOn(port, bundleId, exceptDevice) {
|
|
127676
127770
|
return [...jsCaptures].filter(([payload, capture]) => {
|
|
127677
127771
|
const { port: on, device } = splitPayload(payload);
|
|
@@ -136983,9 +137077,9 @@ async function invokeSubTool(registry2, ctx, toolId, args, extra) {
|
|
|
136983
137077
|
}
|
|
136984
137078
|
function describeNestedParamError(registry2, err, toolId, dispatchedArgs, authoredArgs) {
|
|
136985
137079
|
if (getFailureSignal(err)?.error_code !== FAILURE_CODES.TOOL_INPUT_INVALID) return void 0;
|
|
136986
|
-
const
|
|
136987
|
-
if (!
|
|
136988
|
-
const parsed2 =
|
|
137080
|
+
const zodSchema87 = registry2.getTool(toolId)?.zodSchema;
|
|
137081
|
+
if (!zodSchema87) return void 0;
|
|
137082
|
+
const parsed2 = zodSchema87.safeParse(dispatchedArgs ?? {});
|
|
136989
137083
|
if (parsed2.success) return void 0;
|
|
136990
137084
|
return `Invalid params for tool "${toolId}": ${describeParamIssues(parsed2.error, authoredArgs)}`;
|
|
136991
137085
|
}
|
|
@@ -137013,7 +137107,10 @@ var ALLOWED_TOOLS = /* @__PURE__ */ new Set([
|
|
|
137013
137107
|
// it returns state only; the capture comes once, after the last step.
|
|
137014
137108
|
"fold",
|
|
137015
137109
|
"tv-remote",
|
|
137016
|
-
AWAIT_UI_ELEMENT_TOOL_ID
|
|
137110
|
+
AWAIT_UI_ELEMENT_TOOL_ID,
|
|
137111
|
+
// Returns its match, never an image: after network-capture-start, an
|
|
137112
|
+
// action and its wait run as one sequence, and an unmet wait stops it.
|
|
137113
|
+
AWAIT_NETWORK_REQUEST_TOOL_ID
|
|
137017
137114
|
]);
|
|
137018
137115
|
var capability25 = {
|
|
137019
137116
|
// Physical iOS is a valid outer target. Unsupported steps fail at their own gate, not the whole sequence.
|
|
@@ -137049,7 +137146,7 @@ function createRunSequenceTool(registry2) {
|
|
|
137049
137146
|
id: "run-sequence",
|
|
137050
137147
|
description: `Execute several device interaction steps in one call.
|
|
137051
137148
|
Use when every step is known in advance and you do not need to see the screen between steps (e.g. scrolling several times, typing then pressing enter). If a step depends on the result of an earlier one (e.g. a menu item that appears only after a tap), make separate calls instead.
|
|
137052
|
-
|
|
137149
|
+
If a step fails, the sequence stops. This includes an unsupported tool or a wait step that returns success=false. Returns { completed, total, steps } with a result or error for each step attempted.
|
|
137053
137150
|
One screenshot and element tree are captured after the whole sequence, not per step: call screenshot separately only for a baseline before it or to see an intermediate step. A \`{{secret:...}}\` in any step skips that capture, so type a secret and submit it in one sequence.
|
|
137054
137151
|
On a TV target (Apple TV / Android TV / Vega) use tv-remote for remote presses and keyboard for text.
|
|
137055
137152
|
|
|
@@ -137070,7 +137167,8 @@ Allowed tools, their args (? = optional) and targets. Positions and distances ar
|
|
|
137070
137167
|
fold: posture? "closed"|"half-open"|"open", or angle? 0\u2013180, exactly one (later steps land on the new panel, whose coordinates differ) [foldable ios sim/android emu]
|
|
137071
137168
|
tv-remote: button (one button, or an array run as a path in one step), repeat? [apple tv/android tv/vega]
|
|
137072
137169
|
buttons: up/down/left/right/select/back/home/menu/playPause; rewind/fastForward/next/previous/volumeUp/volumeDown/mute on Android TV and Vega only
|
|
137073
|
-
await-ui-element: condition: "exists"|"visible"|"hidden"|"text", selector: { text?, identifier?, role? }, expectedText? (for "text"), textMatch?, timeoutMs?, pollIntervalMs? [all]
|
|
137170
|
+
await-ui-element: condition: "exists"|"visible"|"hidden"|"text", selector: { text?, identifier?, role? }, expectedText? (for "text"), textMatch?, timeoutMs?, pollIntervalMs? [all]
|
|
137171
|
+
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>]`,
|
|
137074
137172
|
zodSchema: zodSchema30,
|
|
137075
137173
|
alwaysLoad: true,
|
|
137076
137174
|
searchHint: "batch sequence multiple gesture steps sequentially",
|
|
@@ -137115,8 +137213,8 @@ Allowed tools, their args (? = optional) and targets. Positions and distances ar
|
|
|
137115
137213
|
const toolArgs = { ...step.args, udid };
|
|
137116
137214
|
try {
|
|
137117
137215
|
const result = await invokeSubTool(registry2, ctx, step.tool, toolArgs);
|
|
137118
|
-
if (
|
|
137119
|
-
results.push({ tool: step.tool, error: unmetWaitReason(result) });
|
|
137216
|
+
if (isUnmetWaitResult(step.tool, result)) {
|
|
137217
|
+
results.push({ tool: step.tool, error: unmetWaitReason(step.tool, result) });
|
|
137120
137218
|
break;
|
|
137121
137219
|
}
|
|
137122
137220
|
results.push({ tool: step.tool, result });
|
|
@@ -139750,8 +139848,8 @@ var JS_ANSWER_WAIT_MS = 5e3;
|
|
|
139750
139848
|
function createNetworkCaptureStartTool(registry2) {
|
|
139751
139849
|
return {
|
|
139752
139850
|
id: "network-capture-start",
|
|
139753
|
-
description: `Start network capture on iOS simulators and Android<flag:macos-apps> (also on Mac apps)</flag:macos-apps>. Use when you need to inspect
|
|
139754
|
-
On Chromium, Argent connects if needed and marks the start of
|
|
139851
|
+
description: `Start network capture on iOS simulators and Android<flag:macos-apps> (also on Mac apps)</flag:macos-apps>. Use when you need to inspect traffic from an upcoming action or check a request with await-network-request. A new start keeps the log and begins a new window for the wait. Capture can slow the app.
|
|
139852
|
+
On Chromium, Argent connects if needed and marks the start of the wait window. The log records while connected.
|
|
139755
139853
|
The JavaScript layer needs an app connected to Metro. Start again after its JavaScript loads, including after a reload or relaunch. Android native capture needs a debuggable build.<flag:macos-apps> For a supported React Native app launched from Xcode, use layer js and form udid as macos-app-<bundle id>. Native capture needs a supported build launched through Argent.</flag:macos-apps>
|
|
139756
139854
|
Returns { status, layers }: check armed and reason for each requested layer. A pending native layer can become ready when Argent launches or reconnects to the app. On a device whose devtools agent Argent attached to, start native capture again after a relaunch.
|
|
139757
139855
|
When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_UNAVAILABLE or TOOL_DEPENDENCY_MISSING.`,
|
|
@@ -139790,6 +139888,7 @@ When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_U
|
|
|
139790
139888
|
}
|
|
139791
139889
|
const port = metroPort({ device_id: params.udid, port: params.port });
|
|
139792
139890
|
const layers = await withCaptureLock(params.udid, params.bundleId, async () => {
|
|
139891
|
+
const nativeFloor = device.platform === "android" ? lastAndroidRecordNumber() : lastIosRecordNumber();
|
|
139793
139892
|
const app = device.platform === "macos" ? await macosAppOfCall(registry2, device, "network-capture-start", params.bundleId) : void 0;
|
|
139794
139893
|
if (device.platform === "ios-remote") await ensureDeps(["sim-remote"]);
|
|
139795
139894
|
if (run2.native && device.platform === "ios" && isInjectableBundleId(params.bundleId)) {
|
|
@@ -139808,9 +139907,14 @@ When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_U
|
|
|
139808
139907
|
)
|
|
139809
139908
|
] : [],
|
|
139810
139909
|
...run2.native ? [
|
|
139811
|
-
app ? startMacosLayer(app, device, params.bundleId) : device.platform === "android" ? startAndroidLayer(registry2, device, params.bundleId, port) : startIosLayer(registry2, device, params.bundleId, port, run2.js)
|
|
139910
|
+
app ? startMacosLayer(app, device, params.bundleId, port) : device.platform === "android" ? startAndroidLayer(registry2, device, params.bundleId, port) : startIosLayer(registry2, device, params.bundleId, port, run2.js)
|
|
139812
139911
|
] : []
|
|
139813
|
-
])
|
|
139912
|
+
]).then((started) => {
|
|
139913
|
+
if (!started.every((layer) => layer.unavailable)) {
|
|
139914
|
+
noteCaptureStart(params.udid, params.bundleId, started, nativeFloor);
|
|
139915
|
+
}
|
|
139916
|
+
return started;
|
|
139917
|
+
});
|
|
139814
139918
|
});
|
|
139815
139919
|
if (layers.every((layer) => layer.unavailable)) {
|
|
139816
139920
|
const error63 = unavailableError(params, layers);
|
|
@@ -139824,7 +139928,7 @@ When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_U
|
|
|
139824
139928
|
}
|
|
139825
139929
|
};
|
|
139826
139930
|
}
|
|
139827
|
-
async function startMacosLayer(app, device, bundleId) {
|
|
139931
|
+
async function startMacosLayer(app, device, bundleId, port) {
|
|
139828
139932
|
const notTurnedOn = (reason3) => {
|
|
139829
139933
|
app.forgetNetworkCaptureStart();
|
|
139830
139934
|
setNativeUnavailable(device.id, bundleId, reason3);
|
|
@@ -139838,7 +139942,7 @@ async function startMacosLayer(app, device, bundleId) {
|
|
|
139838
139942
|
const refusal = app.isConnected() ? void 0 : await macosLaunchRefusal(bundleId);
|
|
139839
139943
|
if (refusal) return notTurnedOn(refusal);
|
|
139840
139944
|
setNativeUnavailable(device.id, bundleId);
|
|
139841
|
-
const { armed, reason: reason2 } = await app.startNetworkCapture();
|
|
139945
|
+
const { armed, reason: reason2 } = await app.startNetworkCapture(port);
|
|
139842
139946
|
return { layer: "macos-native", armed, ...reason2 ? { reason: reason2 } : {} };
|
|
139843
139947
|
}
|
|
139844
139948
|
async function startChromiumLayer(registry2, device) {
|
|
@@ -139907,6 +140011,7 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
|
|
|
139907
140011
|
return lost ? unavailable2("js", text) : { layer: "js", armed: false, reason: text };
|
|
139908
140012
|
}
|
|
139909
140013
|
if (lost && recording) {
|
|
140014
|
+
dropJsMark(payload);
|
|
139910
140015
|
return {
|
|
139911
140016
|
layer: "js",
|
|
139912
140017
|
armed: false,
|
|
@@ -139923,7 +140028,6 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
|
|
|
139923
140028
|
setJsCapture(payload, {
|
|
139924
140029
|
bundleId,
|
|
139925
140030
|
intent: "started",
|
|
139926
|
-
mark: { install: null },
|
|
139927
140031
|
installed: installedHere,
|
|
139928
140032
|
physicalDeviceId: udid,
|
|
139929
140033
|
...installedHere && found?.paused ? { paused: true } : {}
|
|
@@ -139938,6 +140042,7 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
|
|
|
139938
140042
|
if (appId !== void 0 && appId !== bundleId) {
|
|
139939
140043
|
const notOurs = `the JS runtime on Metro port ${port} is ${appId}'s, not ${bundleId}'s`;
|
|
139940
140044
|
if (recording) {
|
|
140045
|
+
dropJsMark(payload);
|
|
139941
140046
|
return {
|
|
139942
140047
|
layer: "js",
|
|
139943
140048
|
armed: false,
|
|
@@ -139961,7 +140066,6 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
|
|
|
139961
140066
|
try {
|
|
139962
140067
|
capture.mark = await readMark(dbg);
|
|
139963
140068
|
} catch (err) {
|
|
139964
|
-
capture.mark = { install: null };
|
|
139965
140069
|
if (installedHere && found?.paused) capture.paused = true;
|
|
139966
140070
|
return {
|
|
139967
140071
|
layer: "js",
|
|
@@ -139993,6 +140097,10 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
|
|
|
139993
140097
|
};
|
|
139994
140098
|
}
|
|
139995
140099
|
}
|
|
140100
|
+
function dropJsMark(payload) {
|
|
140101
|
+
const kept = jsCapture(payload);
|
|
140102
|
+
if (kept) delete kept.mark;
|
|
140103
|
+
}
|
|
139996
140104
|
async function readMark(dbg) {
|
|
139997
140105
|
const answer = await dbg.cdp.evaluate(NETWORK_CAPTURE_MARK_SCRIPT, {
|
|
139998
140106
|
timeout: JS_ANSWER_WAIT_MS
|
|
@@ -140100,7 +140208,7 @@ function createNetworkCaptureStopTool(registry2) {
|
|
|
140100
140208
|
return {
|
|
140101
140209
|
id: "network-capture-stop",
|
|
140102
140210
|
description: `Stop network capture and keep the recorded requests. Use when you have the requests you need, before profiling, or to end capture in an e2e test.
|
|
140103
|
-
On Chromium, mark the end of the
|
|
140211
|
+
On Chromium, mark the end of the window for await-network-request. The existing connection keeps recording for view-network-logs. If no window was started, call network-capture-start before reproducing the request.
|
|
140104
140212
|
On other supported targets, read the retained requests with native-network-logs or view-network-logs. Use view-network-request-details with an ID from the log. JS request IDs expire on reload. Capture stays off until network-capture-start, including after relaunch. In-flight requests can finish in the log. Stopping Android native capture marks them failed in the log without interrupting the app's requests. Only bodies read before that stop remain available.
|
|
140105
140213
|
Returns { status, layers }. Check armed and reason to confirm the stop. If the stop fails to reach the JS runtime, retry once the app reconnects to Metro. total counts the retained requests, or is 0 when the stop cannot count them.`,
|
|
140106
140214
|
zodSchema: captureSchema,
|
|
@@ -140369,7 +140477,7 @@ async function stopChromiumLayer(registry2, device) {
|
|
|
140369
140477
|
layer: "chromium",
|
|
140370
140478
|
armed: false,
|
|
140371
140479
|
total: network.requests().length,
|
|
140372
|
-
reason: "view-network-logs keeps listing the tab's requests while argent is attached;
|
|
140480
|
+
reason: "view-network-logs keeps listing the tab's requests while argent is attached; await-network-request reads only the requests up to this stop"
|
|
140373
140481
|
};
|
|
140374
140482
|
}
|
|
140375
140483
|
async function stopAndroidLayer(registry2, device, bundleId, port) {
|
|
@@ -141811,14 +141919,586 @@ Fails with FILL_NO_FOCUSED_FIELD when nothing editable has focus, FILL_NOT_VERIF
|
|
|
141811
141919
|
};
|
|
141812
141920
|
}
|
|
141813
141921
|
|
|
141922
|
+
// ../tool-server/src/tools/await-network-request/index.ts
|
|
141923
|
+
init_zod();
|
|
141924
|
+
init_src2();
|
|
141925
|
+
init_device_info();
|
|
141926
|
+
init_capability();
|
|
141927
|
+
|
|
141928
|
+
// ../tool-server/src/tools/await-network-request/layers.ts
|
|
141929
|
+
var CAPTURE_ENDED = "its capture ended after the start (stop-all-simulator-servers, a stop of the device's services, or a tool-server restart); call network-capture-start again";
|
|
141930
|
+
async function liveService(registry2, ref) {
|
|
141931
|
+
return isLiveService(registry2, ref.urn) ? registry2.resolveService(ref.urn, ref.options) : void 0;
|
|
141932
|
+
}
|
|
141933
|
+
function unreadable(layer, note, stopped = false) {
|
|
141934
|
+
return { layer, readable: false, armed: false, stopped, records: [], note };
|
|
141935
|
+
}
|
|
141936
|
+
function recordNumber(id) {
|
|
141937
|
+
return Number(id.slice(id.lastIndexOf("-") + 1));
|
|
141938
|
+
}
|
|
141939
|
+
var LOST_ENDINGS = /* @__PURE__ */ new Set([
|
|
141940
|
+
STOPPED_BEFORE_FINISH,
|
|
141941
|
+
LOST_WHILE_DISCONNECTED,
|
|
141942
|
+
AGENT_GONE_REASON,
|
|
141943
|
+
NOT_RECONNECTED,
|
|
141944
|
+
PROCESS_ENDED,
|
|
141945
|
+
MACOS_CONNECTION_DROPPED
|
|
141946
|
+
]);
|
|
141947
|
+
function fromNative(record2) {
|
|
141948
|
+
const lost = record2.state === "failed" && record2.errorText !== void 0 && LOST_ENDINGS.has(record2.errorText);
|
|
141949
|
+
return {
|
|
141950
|
+
id: record2.id,
|
|
141951
|
+
layer: record2.layer,
|
|
141952
|
+
method: record2.request.method,
|
|
141953
|
+
url: record2.request.url,
|
|
141954
|
+
...record2.response ? { status: record2.response.status } : {},
|
|
141955
|
+
state: lost ? "lost" : record2.state,
|
|
141956
|
+
...record2.timing.durationMs !== void 0 ? { durationMs: Math.round(record2.timing.durationMs) } : {},
|
|
141957
|
+
...record2.errorText ? { errorText: record2.errorText } : {}
|
|
141958
|
+
};
|
|
141959
|
+
}
|
|
141960
|
+
function nativeAfter(records, floor) {
|
|
141961
|
+
return records.filter((r) => recordNumber(r.id) > floor).map(fromNative);
|
|
141962
|
+
}
|
|
141963
|
+
async function markedLayers(registry2, device, bundleId) {
|
|
141964
|
+
const layers = [];
|
|
141965
|
+
const start2 = lastCaptureStart(device.id, bundleId);
|
|
141966
|
+
const startWindow = {
|
|
141967
|
+
current: (layer, stopped) => !start2 || start2.layers.has(layer) || layer !== "js" && !stopped,
|
|
141968
|
+
floor: (mark) => Math.max(mark.lastRecord, start2?.nativeFloor ?? 0)
|
|
141969
|
+
};
|
|
141970
|
+
const native = device.platform === "chromium" ? await chromiumLayer(registry2, device) : device.platform === "android" ? await androidLayer(registry2, device, bundleId, startWindow) : device.platform === "macos" ? await macosLayer(registry2, device, startWindow) : await iosLayer(registry2, device, bundleId, startWindow);
|
|
141971
|
+
if (native) layers.push(native);
|
|
141972
|
+
if (device.platform !== "chromium") {
|
|
141973
|
+
const js = jsLayer(registry2, device, bundleId, startWindow);
|
|
141974
|
+
if (js) layers.push(js);
|
|
141975
|
+
}
|
|
141976
|
+
return layers;
|
|
141977
|
+
}
|
|
141978
|
+
async function iosLayer(registry2, device, bundleId, startWindow) {
|
|
141979
|
+
const ref = nativeDevtoolsRef(device);
|
|
141980
|
+
const resolve21 = () => liveService(registry2, ref);
|
|
141981
|
+
const found = await resolve21();
|
|
141982
|
+
if (!found?.networkCaptureMark(bundleId)) return void 0;
|
|
141983
|
+
if (!startWindow.current("ios-native", found.isNetworkCaptureStopped(bundleId))) return void 0;
|
|
141984
|
+
return {
|
|
141985
|
+
layer: "ios-native",
|
|
141986
|
+
async read() {
|
|
141987
|
+
const api = await resolve21();
|
|
141988
|
+
const mark = api?.networkCaptureMark(bundleId);
|
|
141989
|
+
if (!api || !mark) return unreadable("ios-native", CAPTURE_ENDED);
|
|
141990
|
+
const stopped = api.isNetworkCaptureStopped(bundleId);
|
|
141991
|
+
const store = api.networkRecords(bundleId);
|
|
141992
|
+
const state3 = store?.state();
|
|
141993
|
+
const armed = stopped || state3?.armed === true;
|
|
141994
|
+
return {
|
|
141995
|
+
layer: "ios-native",
|
|
141996
|
+
readable: true,
|
|
141997
|
+
armed,
|
|
141998
|
+
stopped,
|
|
141999
|
+
records: nativeAfter(
|
|
142000
|
+
store?.records(mark.metroPort, { includeHidden: true }) ?? [],
|
|
142001
|
+
startWindow.floor(mark)
|
|
142002
|
+
),
|
|
142003
|
+
...armed ? {} : { note: state3?.note ?? "the app has not connected yet; capture arms when it does" }
|
|
142004
|
+
};
|
|
142005
|
+
}
|
|
142006
|
+
};
|
|
142007
|
+
}
|
|
142008
|
+
async function androidLayer(registry2, device, bundleId, startWindow) {
|
|
142009
|
+
const ref = androidNetworkInspectorRef(device, bundleId, metroPort({ device_id: device.id }));
|
|
142010
|
+
const resolve21 = () => liveService(registry2, ref);
|
|
142011
|
+
const found = await resolve21();
|
|
142012
|
+
if (!found?.captureMark()) return void 0;
|
|
142013
|
+
if (!startWindow.current("android-native", found.isStopped())) return void 0;
|
|
142014
|
+
return {
|
|
142015
|
+
layer: "android-native",
|
|
142016
|
+
async read() {
|
|
142017
|
+
const api = await resolve21();
|
|
142018
|
+
const mark = api?.captureMark();
|
|
142019
|
+
if (!api || !mark) return unreadable("android-native", CAPTURE_ENDED);
|
|
142020
|
+
const stopped = api.isStopped();
|
|
142021
|
+
const state3 = api.state();
|
|
142022
|
+
const armed = stopped || state3.armed && state3.capture?.state !== "unavailable";
|
|
142023
|
+
return {
|
|
142024
|
+
layer: "android-native",
|
|
142025
|
+
readable: true,
|
|
142026
|
+
armed,
|
|
142027
|
+
stopped,
|
|
142028
|
+
records: nativeAfter(
|
|
142029
|
+
api.records(mark.metroPort, { includeHidden: true }),
|
|
142030
|
+
startWindow.floor(mark)
|
|
142031
|
+
),
|
|
142032
|
+
...armed ? {} : {
|
|
142033
|
+
note: state3.note ?? state3.capture?.detail ?? api.unavailableReason() ?? "the app's agent has not armed yet"
|
|
142034
|
+
}
|
|
142035
|
+
};
|
|
142036
|
+
}
|
|
142037
|
+
};
|
|
142038
|
+
}
|
|
142039
|
+
async function macosLayer(registry2, device, startWindow) {
|
|
142040
|
+
const ref = macosAppRef(device);
|
|
142041
|
+
const resolve21 = () => liveService(registry2, ref);
|
|
142042
|
+
const found = await resolve21();
|
|
142043
|
+
if (!found?.networkCaptureMark()) return void 0;
|
|
142044
|
+
if (!startWindow.current("macos-native", found.isNetworkCaptureStopped())) return void 0;
|
|
142045
|
+
return {
|
|
142046
|
+
layer: "macos-native",
|
|
142047
|
+
async read() {
|
|
142048
|
+
const app = await resolve21();
|
|
142049
|
+
const mark = app?.networkCaptureMark();
|
|
142050
|
+
if (!app || !mark) return unreadable("macos-native", CAPTURE_ENDED);
|
|
142051
|
+
const stopped = app.isNetworkCaptureStopped();
|
|
142052
|
+
const store = app.networkRecords();
|
|
142053
|
+
const state3 = store.state();
|
|
142054
|
+
const armed = stopped || state3.armed;
|
|
142055
|
+
return {
|
|
142056
|
+
layer: "macos-native",
|
|
142057
|
+
readable: true,
|
|
142058
|
+
armed,
|
|
142059
|
+
stopped,
|
|
142060
|
+
records: nativeAfter(
|
|
142061
|
+
store.records(mark.metroPort, { includeHidden: true }),
|
|
142062
|
+
startWindow.floor(mark)
|
|
142063
|
+
),
|
|
142064
|
+
...armed ? {} : { note: state3.note ?? "the app has not connected to argent yet" }
|
|
142065
|
+
};
|
|
142066
|
+
}
|
|
142067
|
+
};
|
|
142068
|
+
}
|
|
142069
|
+
function fromChromium(record2) {
|
|
142070
|
+
return {
|
|
142071
|
+
id: record2.requestId,
|
|
142072
|
+
layer: "chromium",
|
|
142073
|
+
method: record2.method,
|
|
142074
|
+
url: record2.url,
|
|
142075
|
+
...record2.status !== void 0 ? { status: record2.status } : {},
|
|
142076
|
+
state: record2.failed ? "failed" : record2.finished ? "complete" : record2.status !== void 0 ? "headers" : "pending",
|
|
142077
|
+
...record2.durationMs !== void 0 ? { durationMs: Math.round(record2.durationMs) } : {},
|
|
142078
|
+
...record2.errorText ? { errorText: record2.errorText } : {}
|
|
142079
|
+
};
|
|
142080
|
+
}
|
|
142081
|
+
async function chromiumLayer(registry2, device) {
|
|
142082
|
+
const ref = chromiumCdpRef(device);
|
|
142083
|
+
const resolve21 = () => liveService(registry2, ref);
|
|
142084
|
+
if (!(await resolve21())?.server.network.captureMark()) return void 0;
|
|
142085
|
+
return {
|
|
142086
|
+
layer: "chromium",
|
|
142087
|
+
async read() {
|
|
142088
|
+
const network = (await resolve21())?.server.network;
|
|
142089
|
+
const mark = network?.captureMark();
|
|
142090
|
+
if (!network || !mark) return unreadable("chromium", CAPTURE_ENDED);
|
|
142091
|
+
const stopped = mark.stoppedSeq !== void 0;
|
|
142092
|
+
return {
|
|
142093
|
+
layer: "chromium",
|
|
142094
|
+
readable: true,
|
|
142095
|
+
armed: true,
|
|
142096
|
+
stopped,
|
|
142097
|
+
records: network.requestsAfter(mark.lastSeq).filter(({ seq }) => mark.stoppedSeq === void 0 || seq <= mark.stoppedSeq).map(({ record: record2 }) => fromChromium(record2))
|
|
142098
|
+
};
|
|
142099
|
+
}
|
|
142100
|
+
};
|
|
142101
|
+
}
|
|
142102
|
+
function fromJs(entry) {
|
|
142103
|
+
const state3 = entry.state === "finished" ? "complete" : entry.state === "failed" ? "failed" : entry.status !== void 0 ? "headers" : "pending";
|
|
142104
|
+
return {
|
|
142105
|
+
id: entry.requestId ?? "",
|
|
142106
|
+
layer: "js",
|
|
142107
|
+
method: entry.method ?? "",
|
|
142108
|
+
url: entry.url ?? "",
|
|
142109
|
+
...typeof entry.status === "number" ? { status: entry.status } : {},
|
|
142110
|
+
state: state3,
|
|
142111
|
+
...typeof entry.durationMs === "number" ? { durationMs: Math.round(entry.durationMs) } : {},
|
|
142112
|
+
...entry.errorText ? { errorText: entry.errorText } : {}
|
|
142113
|
+
};
|
|
142114
|
+
}
|
|
142115
|
+
function jsLayer(registry2, device, bundleId, startWindow) {
|
|
142116
|
+
const found = findJsCaptureOfDevice(device.id, bundleId);
|
|
142117
|
+
if (!found?.capture.mark) return void 0;
|
|
142118
|
+
if (!startWindow.current("js", found.capture.intent === "stopped")) return void 0;
|
|
142119
|
+
return {
|
|
142120
|
+
layer: "js",
|
|
142121
|
+
async read(budgetMs) {
|
|
142122
|
+
const found2 = findJsCaptureOfDevice(device.id, bundleId);
|
|
142123
|
+
const mark = found2?.capture.mark;
|
|
142124
|
+
if (!found2 || !mark) return unreadable("js", CAPTURE_ENDED);
|
|
142125
|
+
const { payload, port, capture } = found2;
|
|
142126
|
+
let stopped = capture.intent === "stopped";
|
|
142127
|
+
if (!isLiveService(registry2, `${JS_RUNTIME_DEBUGGER_NAMESPACE}:${payload}`)) {
|
|
142128
|
+
return unreadable(
|
|
142129
|
+
"js",
|
|
142130
|
+
stopped ? "the app's JS runtime is not connected, and a stopped capture does not reconnect to it" : "argent's connection to the app's JS runtime ended (a relaunch, a Metro restart or a stop of the device's services); call network-capture-start again",
|
|
142131
|
+
stopped
|
|
142132
|
+
);
|
|
142133
|
+
}
|
|
142134
|
+
const physical = capture.physicalDeviceId ?? device.id;
|
|
142135
|
+
const target = payload.slice(payload.indexOf(":") + 1);
|
|
142136
|
+
try {
|
|
142137
|
+
const dbg = await resolveJsRuntime(
|
|
142138
|
+
registry2,
|
|
142139
|
+
physical,
|
|
142140
|
+
target !== physical ? target : void 0,
|
|
142141
|
+
port
|
|
142142
|
+
);
|
|
142143
|
+
const appId = dbg.runtimeApp?.appId;
|
|
142144
|
+
if (appId !== void 0 && appId !== bundleId) {
|
|
142145
|
+
return unreadable(
|
|
142146
|
+
"js",
|
|
142147
|
+
`the JS runtime on Metro port ${port} is ${appId}'s, not ${bundleId}'s`,
|
|
142148
|
+
stopped
|
|
142149
|
+
);
|
|
142150
|
+
}
|
|
142151
|
+
const answer = JSON.parse(
|
|
142152
|
+
String(
|
|
142153
|
+
await dbg.cdp.evaluate(makeNetworkWaitReadScript(mark, port), {
|
|
142154
|
+
timeout: Math.max(1, budgetMs)
|
|
142155
|
+
})
|
|
142156
|
+
)
|
|
142157
|
+
);
|
|
142158
|
+
const pauseMissed = stopped && answer.installed && answer.paused === false;
|
|
142159
|
+
if (pauseMissed) stopped = false;
|
|
142160
|
+
if (!answer.installed) {
|
|
142161
|
+
if (stopped) {
|
|
142162
|
+
return {
|
|
142163
|
+
layer: "js",
|
|
142164
|
+
readable: true,
|
|
142165
|
+
armed: true,
|
|
142166
|
+
stopped,
|
|
142167
|
+
records: [],
|
|
142168
|
+
note: "the app's JS runtime reloaded since the stop, which cleared its requests"
|
|
142169
|
+
};
|
|
142170
|
+
}
|
|
142171
|
+
return unreadable(
|
|
142172
|
+
"js",
|
|
142173
|
+
answer.xhr === true ? "the app's JS runtime has no interceptor, as after a reload; call network-capture-start again" : "the app's JavaScript has not loaded yet; call network-capture-start once it has"
|
|
142174
|
+
);
|
|
142175
|
+
}
|
|
142176
|
+
const records = (answer.entries ?? []).map(fromJs);
|
|
142177
|
+
if (!stopped && answer.paused === true) {
|
|
142178
|
+
return {
|
|
142179
|
+
layer: "js",
|
|
142180
|
+
readable: true,
|
|
142181
|
+
armed: false,
|
|
142182
|
+
stopped,
|
|
142183
|
+
records,
|
|
142184
|
+
note: "a stop's pause is still in the app's JS runtime, so it records nothing; call network-capture-start again"
|
|
142185
|
+
};
|
|
142186
|
+
}
|
|
142187
|
+
const note = mark.install !== null && answer.token !== mark.install ? "the app's JS runtime reloaded after the start, so its requests between the reload and the interceptor's reinstall are missing" : pauseMissed ? "the stop's pause did not reach the app's JS runtime, which still records: requests after the stop count" : void 0;
|
|
142188
|
+
return {
|
|
142189
|
+
layer: "js",
|
|
142190
|
+
readable: true,
|
|
142191
|
+
armed: true,
|
|
142192
|
+
stopped,
|
|
142193
|
+
records,
|
|
142194
|
+
...note ? { note } : {}
|
|
142195
|
+
};
|
|
142196
|
+
} catch (err) {
|
|
142197
|
+
const reason2 = classifyNotConnected(err);
|
|
142198
|
+
return unreadable(
|
|
142199
|
+
"js",
|
|
142200
|
+
reason2 !== void 0 ? jsNotReached(reason2, port, err) : `the app's JS runtime did not answer: ${errorMessage4(err)}`,
|
|
142201
|
+
stopped
|
|
142202
|
+
);
|
|
142203
|
+
}
|
|
142204
|
+
}
|
|
142205
|
+
};
|
|
142206
|
+
}
|
|
142207
|
+
|
|
142208
|
+
// ../tool-server/src/tools/await-network-request/match.ts
|
|
142209
|
+
var STATUS_CLASSES = ["1xx", "2xx", "3xx", "4xx", "5xx"];
|
|
142210
|
+
function urlMatches(criteria, url2) {
|
|
142211
|
+
switch (criteria.urlMatch) {
|
|
142212
|
+
case "equals":
|
|
142213
|
+
return url2.toLowerCase() === criteria.url.toLowerCase();
|
|
142214
|
+
case "matches":
|
|
142215
|
+
return (criteria.regex ??= new RegExp(criteria.url)).test(url2);
|
|
142216
|
+
default:
|
|
142217
|
+
return url2.toLowerCase().includes(criteria.url.toLowerCase());
|
|
142218
|
+
}
|
|
142219
|
+
}
|
|
142220
|
+
function statusMatches(wanted, status) {
|
|
142221
|
+
if (status === void 0) return false;
|
|
142222
|
+
if (typeof wanted === "number") return status === wanted;
|
|
142223
|
+
return Math.floor(status / 100) === Number(wanted[0]);
|
|
142224
|
+
}
|
|
142225
|
+
function outcomeMatches(outcome, state3) {
|
|
142226
|
+
if (outcome === "complete") return state3 === "complete";
|
|
142227
|
+
if (outcome === "failed") return state3 === "failed";
|
|
142228
|
+
return state3 === "complete" || state3 === "failed";
|
|
142229
|
+
}
|
|
142230
|
+
function mismatches(criteria, record2) {
|
|
142231
|
+
const failed3 = [];
|
|
142232
|
+
if (!urlMatches(criteria, record2.url)) failed3.push("url");
|
|
142233
|
+
if (criteria.method !== void 0 && record2.method.toLowerCase() !== criteria.method.toLowerCase()) {
|
|
142234
|
+
failed3.push("method");
|
|
142235
|
+
}
|
|
142236
|
+
if (criteria.status !== void 0 && !statusMatches(criteria.status, record2.status)) {
|
|
142237
|
+
failed3.push("status");
|
|
142238
|
+
}
|
|
142239
|
+
if (!outcomeMatches(criteria.outcome, record2.state)) failed3.push("outcome");
|
|
142240
|
+
return failed3;
|
|
142241
|
+
}
|
|
142242
|
+
function firstMatch(criteria, records) {
|
|
142243
|
+
return records.find((record2) => mismatches(criteria, record2).length === 0);
|
|
142244
|
+
}
|
|
142245
|
+
var NOTE_URL_CHARS = 120;
|
|
142246
|
+
function shortUrl(url2) {
|
|
142247
|
+
return url2.length > NOTE_URL_CHARS ? `${url2.slice(0, NOTE_URL_CHARS)}...` : url2;
|
|
142248
|
+
}
|
|
142249
|
+
function describeCriteria(criteria) {
|
|
142250
|
+
const url2 = criteria.urlMatch === "matches" ? `URL matching the regular expression "${shortUrl(criteria.url)}"` : `URL ${criteria.urlMatch === "equals" ? "equal to" : "containing"} "${shortUrl(criteria.url)}"`;
|
|
142251
|
+
return [
|
|
142252
|
+
criteria.method ? criteria.method.toUpperCase() : void 0,
|
|
142253
|
+
url2,
|
|
142254
|
+
criteria.status !== void 0 ? `status ${criteria.status}` : void 0,
|
|
142255
|
+
criteria.outcome === "any" ? "complete or failed" : criteria.outcome
|
|
142256
|
+
].filter(Boolean).join(", ");
|
|
142257
|
+
}
|
|
142258
|
+
|
|
142259
|
+
// ../tool-server/src/tools/await-network-request/index.ts
|
|
142260
|
+
var DEFAULT_TIMEOUT_MS4 = 1e4;
|
|
142261
|
+
var DEFAULT_POLL_INTERVAL_MS2 = 400;
|
|
142262
|
+
var MIN_JS_READ_MS = 1e3;
|
|
142263
|
+
var zodSchema44 = external_exports.object({
|
|
142264
|
+
udid: external_exports.string().min(1).describe(
|
|
142265
|
+
"Device ID passed as udid to network-capture-start, even if that call also used logicalDeviceId."
|
|
142266
|
+
),
|
|
142267
|
+
bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
|
|
142268
|
+
"App ID passed to network-capture-start<flag:macos-apps>. On macOS it must match the app named by udid</flag:macos-apps>. On Chromium, use a valid placeholder such as argent.capture."
|
|
142269
|
+
),
|
|
142270
|
+
url: external_exports.string().min(1).describe(
|
|
142271
|
+
'URL text or pattern, such as "/v1/auth/login". Do not include secrets. The result includes the matched URL, and {{secret:...}} placeholders are rejected.'
|
|
142272
|
+
),
|
|
142273
|
+
urlMatch: external_exports.enum(["contains", "equals", "matches"]).optional().describe(
|
|
142274
|
+
"contains (default) searches for a substring. equals compares the full URL. Both ignore case. matches uses a case-sensitive JavaScript regular expression without implicit anchors."
|
|
142275
|
+
),
|
|
142276
|
+
method: external_exports.string().min(1).optional().describe("HTTP method such as POST. Ignores case."),
|
|
142277
|
+
status: external_exports.union([
|
|
142278
|
+
external_exports.enum(STATUS_CLASSES),
|
|
142279
|
+
external_exports.coerce.number().int().min(100).max(599)
|
|
142280
|
+
]).optional().describe(
|
|
142281
|
+
'Exact HTTP status such as 200 or a class such as "2xx". A failed request matches a status only if it received response headers.'
|
|
142282
|
+
),
|
|
142283
|
+
outcome: external_exports.enum(["complete", "failed", "any"]).optional().describe(
|
|
142284
|
+
"complete (default) means the response finished, regardless of HTTP status. failed matches a request error such as an abort. any accepts either."
|
|
142285
|
+
),
|
|
142286
|
+
timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(`Wait limit in milliseconds. Default ${DEFAULT_TIMEOUT_MS4}.`),
|
|
142287
|
+
pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(
|
|
142288
|
+
`Interval between capture reads in milliseconds. Default ${DEFAULT_POLL_INTERVAL_MS2}.`
|
|
142289
|
+
)
|
|
142290
|
+
}).strict().superRefine((params, ctx) => {
|
|
142291
|
+
if (params.url.includes(SECRET_PLACEHOLDER_MARKER)) {
|
|
142292
|
+
ctx.addIssue({
|
|
142293
|
+
code: external_exports.ZodIssueCode.custom,
|
|
142294
|
+
path: ["url"],
|
|
142295
|
+
message: "url takes no {{secret:...}} placeholder: a matcher never resolves secrets, and the match is returned in the result. Match on another part of the URL."
|
|
142296
|
+
});
|
|
142297
|
+
}
|
|
142298
|
+
if (params.urlMatch === "matches") {
|
|
142299
|
+
try {
|
|
142300
|
+
new RegExp(params.url);
|
|
142301
|
+
} catch (err) {
|
|
142302
|
+
ctx.addIssue({
|
|
142303
|
+
code: external_exports.ZodIssueCode.custom,
|
|
142304
|
+
path: ["url"],
|
|
142305
|
+
message: `url is not a valid regular expression: ${err instanceof Error ? err.message : String(err)}`
|
|
142306
|
+
});
|
|
142307
|
+
}
|
|
142308
|
+
}
|
|
142309
|
+
});
|
|
142310
|
+
var CANCELLED_NOTE = "the wait was cancelled before a request matched";
|
|
142311
|
+
function criteriaOf(params) {
|
|
142312
|
+
return {
|
|
142313
|
+
url: params.url,
|
|
142314
|
+
urlMatch: params.urlMatch ?? "contains",
|
|
142315
|
+
...params.method !== void 0 ? { method: params.method } : {},
|
|
142316
|
+
...params.status !== void 0 ? { status: params.status } : {},
|
|
142317
|
+
outcome: params.outcome ?? "complete"
|
|
142318
|
+
};
|
|
142319
|
+
}
|
|
142320
|
+
function notStartedError(params) {
|
|
142321
|
+
return new FailureError(
|
|
142322
|
+
`Network capture is not started for ${params.bundleId} on ${params.udid}, so no request can be waited for. Call network-capture-start for ${params.bundleId}, repeat the action that sends the request, then call await-network-request. stop-all-simulator-servers, a stop of the device's services and a tool-server restart also end a capture.`,
|
|
142323
|
+
{
|
|
142324
|
+
error_code: FAILURE_CODES.NETWORK_CAPTURE_NOT_STARTED,
|
|
142325
|
+
failure_stage: "await_network_request_marks",
|
|
142326
|
+
failure_area: "tool_server",
|
|
142327
|
+
error_kind: "not_found"
|
|
142328
|
+
}
|
|
142329
|
+
);
|
|
142330
|
+
}
|
|
142331
|
+
function isOpen2(record2) {
|
|
142332
|
+
return record2.state === "pending" || record2.state === "headers";
|
|
142333
|
+
}
|
|
142334
|
+
function createAwaitNetworkRequestTool(registry2) {
|
|
142335
|
+
return {
|
|
142336
|
+
// A literal, so scripts/extract-tools.mjs finds the description it scores.
|
|
142337
|
+
id: "await-network-request",
|
|
142338
|
+
description: `Check whether a matching request finished. Use when an action should send a specific request. Call network-capture-start before the action, then call this tool. It searches requests started since the latest capture start and waits until a match finishes or the timeout expires. On Chromium, match the final URL, method and status after redirects.
|
|
142339
|
+
Returns the matching request. Pass match.id as requestId to view-network-request-details for headers and bodies. Requests whose outcome capture missed cannot match. When success is false, check cause. For unmet, check the action and criteria. For unreadable, use the layer notes to restore capture. For cancelled, retry if needed. A false result fails an e2e step and stops a run-sequence.
|
|
142340
|
+
If capture has no start for the target, the tool raises NETWORK_CAPTURE_NOT_STARTED. Start capture and repeat the action. After a JavaScript reload, start capture again once the runtime is ready.`,
|
|
142341
|
+
zodSchema: zodSchema44,
|
|
142342
|
+
searchHint: "wait await network request http api call fetch xhr response status url match after capture start e2e assert",
|
|
142343
|
+
readOnly: true,
|
|
142344
|
+
longRunning: true,
|
|
142345
|
+
capability: CAPTURE_CAPABILITY,
|
|
142346
|
+
interaction: {
|
|
142347
|
+
startedMsg: ({ params }) => `Waiting for a request to ${params.url}`,
|
|
142348
|
+
completedMsg: ({ params, result }) => result.success && result.match ? `Request matched: ${result.match.method} ${result.match.url}${result.match.status !== void 0 ? ` ${result.match.status}` : ""}` : `No request to ${params.url} matched (${result.cause ?? "unmet"})`,
|
|
142349
|
+
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed while waiting for a network request: ${failureSignal2.error_code}`
|
|
142350
|
+
},
|
|
142351
|
+
// Each layer looks its service up itself, so the wait creates no native service.
|
|
142352
|
+
services: () => ({}),
|
|
142353
|
+
async execute(_services, params, ctx) {
|
|
142354
|
+
const signal = ctx?.signal;
|
|
142355
|
+
const device = resolveDevice(params.udid);
|
|
142356
|
+
assertSupported(AWAIT_NETWORK_REQUEST_TOOL_ID, CAPTURE_CAPABILITY, device);
|
|
142357
|
+
if (device.platform === "macos") {
|
|
142358
|
+
assertMacosAppBundle(parseMacosAppBundleId(device.id) ?? device.id, params.bundleId);
|
|
142359
|
+
}
|
|
142360
|
+
const layers = await markedLayers(registry2, device, params.bundleId);
|
|
142361
|
+
if (layers.length === 0) throw notStartedError(params);
|
|
142362
|
+
const criteria = criteriaOf(params);
|
|
142363
|
+
const timeoutMs = params.timeoutMs ?? DEFAULT_TIMEOUT_MS4;
|
|
142364
|
+
const pollIntervalMs = params.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
|
|
142365
|
+
const start2 = Date.now();
|
|
142366
|
+
const deadline = start2 + timeoutMs;
|
|
142367
|
+
const elapsed = () => Date.now() - start2;
|
|
142368
|
+
const native = layers.filter((layer) => layer.layer !== "js");
|
|
142369
|
+
const js = layers.find((layer) => layer.layer === "js");
|
|
142370
|
+
const latest = /* @__PURE__ */ new Map();
|
|
142371
|
+
const latestReadable = /* @__PURE__ */ new Map();
|
|
142372
|
+
let lastArmedNativeAt;
|
|
142373
|
+
let lastArmedJsAt;
|
|
142374
|
+
const jsBound = Math.max(pollIntervalMs, MIN_JS_READ_MS);
|
|
142375
|
+
const notesSeen = /* @__PURE__ */ new Map();
|
|
142376
|
+
const keep = (read) => {
|
|
142377
|
+
latest.set(read.layer, read);
|
|
142378
|
+
if (read.note) {
|
|
142379
|
+
const seen = notesSeen.get(read.layer) ?? /* @__PURE__ */ new Set();
|
|
142380
|
+
notesSeen.set(read.layer, seen.add(read.note));
|
|
142381
|
+
}
|
|
142382
|
+
if (!read.readable) return;
|
|
142383
|
+
latestReadable.set(read.layer, read);
|
|
142384
|
+
if (!read.armed) return;
|
|
142385
|
+
if (read.layer === "js") lastArmedJsAt = read.at;
|
|
142386
|
+
else lastArmedNativeAt = Math.max(lastArmedNativeAt ?? 0, read.at);
|
|
142387
|
+
};
|
|
142388
|
+
let jsRead;
|
|
142389
|
+
const readJs = (layer, budgetMs) => {
|
|
142390
|
+
if (jsRead) return jsRead;
|
|
142391
|
+
const read = layer.read(budgetMs).then((answer) => ({ ...answer, at: Date.now() })).finally(() => {
|
|
142392
|
+
if (jsRead === read) jsRead = void 0;
|
|
142393
|
+
});
|
|
142394
|
+
jsRead = read;
|
|
142395
|
+
return read;
|
|
142396
|
+
};
|
|
142397
|
+
const success2 = (match) => {
|
|
142398
|
+
const notes = [...notesSeen].flatMap(
|
|
142399
|
+
([layer, seen]) => [...seen].map((note) => `${layer}: ${note}`)
|
|
142400
|
+
);
|
|
142401
|
+
return {
|
|
142402
|
+
success: true,
|
|
142403
|
+
elapsed: elapsed(),
|
|
142404
|
+
match,
|
|
142405
|
+
...notes.length > 0 ? { note: notes.join("; ") } : {}
|
|
142406
|
+
};
|
|
142407
|
+
};
|
|
142408
|
+
for (; ; ) {
|
|
142409
|
+
const atDeadline = Date.now() >= deadline;
|
|
142410
|
+
if (signal?.aborted) {
|
|
142411
|
+
return { success: false, elapsed: elapsed(), note: CANCELLED_NOTE, cause: "cancelled" };
|
|
142412
|
+
}
|
|
142413
|
+
const reads = [];
|
|
142414
|
+
for (const layer of native) {
|
|
142415
|
+
const read = { ...await layer.read(0), at: Date.now() };
|
|
142416
|
+
keep(read);
|
|
142417
|
+
reads.push(read);
|
|
142418
|
+
const match = firstMatch(criteria, read.records);
|
|
142419
|
+
if (match) return success2(match);
|
|
142420
|
+
}
|
|
142421
|
+
const remaining = deadline - Date.now();
|
|
142422
|
+
if (js && (remaining > 0 || !latest.has("js"))) {
|
|
142423
|
+
const bound = Math.min(jsBound, Math.max(1, remaining));
|
|
142424
|
+
const settled = await settleWithin(readJs(js, bound), bound, signal);
|
|
142425
|
+
if (settled.type === "aborted") {
|
|
142426
|
+
return { success: false, elapsed: elapsed(), note: CANCELLED_NOTE, cause: "cancelled" };
|
|
142427
|
+
}
|
|
142428
|
+
if (settled.type === "value") {
|
|
142429
|
+
keep(settled.value);
|
|
142430
|
+
reads.push(settled.value);
|
|
142431
|
+
const match = firstMatch(criteria, settled.value.records);
|
|
142432
|
+
if (match) return success2(match);
|
|
142433
|
+
} else if (settled.type === "timeout" && bound < jsBound && latest.has("js")) {
|
|
142434
|
+
} else {
|
|
142435
|
+
const note = settled.type === "timeout" ? `the app's JS runtime did not answer within ${bound} ms` : `the read of the app's JS runtime failed: ${settled.error}`;
|
|
142436
|
+
const read = {
|
|
142437
|
+
layer: "js",
|
|
142438
|
+
readable: false,
|
|
142439
|
+
armed: false,
|
|
142440
|
+
stopped: latest.get("js")?.stopped ?? false,
|
|
142441
|
+
records: [],
|
|
142442
|
+
note,
|
|
142443
|
+
at: Date.now()
|
|
142444
|
+
};
|
|
142445
|
+
keep(read);
|
|
142446
|
+
reads.push(read);
|
|
142447
|
+
}
|
|
142448
|
+
}
|
|
142449
|
+
if (reads.length === layers.length && reads.every((read) => read.readable && read.stopped && !read.records.some(isOpen2))) {
|
|
142450
|
+
return timedOut3("unmet", true);
|
|
142451
|
+
}
|
|
142452
|
+
if (atDeadline) break;
|
|
142453
|
+
if (Date.now() >= deadline) continue;
|
|
142454
|
+
const sleepMs = Math.min(pollIntervalMs, Math.max(0, deadline - Date.now()));
|
|
142455
|
+
if (!await sleepOrAbort(sleepMs, signal)) {
|
|
142456
|
+
return { success: false, elapsed: elapsed(), note: CANCELLED_NOTE, cause: "cancelled" };
|
|
142457
|
+
}
|
|
142458
|
+
}
|
|
142459
|
+
const now = Date.now();
|
|
142460
|
+
const tolerance = darkTailToleranceMs(pollIntervalMs);
|
|
142461
|
+
const fresh = lastArmedNativeAt !== void 0 && now - lastArmedNativeAt <= tolerance || lastArmedJsAt !== void 0 && now - lastArmedJsAt <= Math.max(tolerance, jsBound + pollIntervalMs);
|
|
142462
|
+
return timedOut3(fresh ? "unmet" : "unreadable", false);
|
|
142463
|
+
function timedOut3(cause, allStopped) {
|
|
142464
|
+
const summaries = layers.map(({ layer }) => {
|
|
142465
|
+
const last = latest.get(layer);
|
|
142466
|
+
const readable = latestReadable.get(layer);
|
|
142467
|
+
return {
|
|
142468
|
+
layer,
|
|
142469
|
+
armed: last?.readable === true ? last.armed : false,
|
|
142470
|
+
readable: readable !== void 0,
|
|
142471
|
+
...last?.stopped ? { stopped: true } : {},
|
|
142472
|
+
requests: readable?.records.length ?? 0,
|
|
142473
|
+
...last?.note ? { note: last.note } : {}
|
|
142474
|
+
};
|
|
142475
|
+
});
|
|
142476
|
+
const counts = summaries.map(
|
|
142477
|
+
(s) => `${s.layer} ${s.readable ? s.requests : "not read"}${s.armed ? "" : " (not armed)"}`
|
|
142478
|
+
).join(", ");
|
|
142479
|
+
const head = allStopped ? `No request matched (wanted: ${describeCriteria(criteria)}): capture is stopped on every marked layer, so only the requests captured between network-capture-start and network-capture-stop were searched.` : `No request since network-capture-start matched within this ${timeoutMs} ms wait (wanted: ${describeCriteria(criteria)}).`;
|
|
142480
|
+
const notes = summaries.filter((s) => s.note).map((s) => `${s.layer}: ${s.note}`).join("; ");
|
|
142481
|
+
const note = [head, `Requests since the start: ${counts}.`, notes ? `${notes}.` : void 0].filter(Boolean).join(" ");
|
|
142482
|
+
return {
|
|
142483
|
+
success: false,
|
|
142484
|
+
elapsed: elapsed(),
|
|
142485
|
+
cause,
|
|
142486
|
+
note,
|
|
142487
|
+
layers: summaries
|
|
142488
|
+
};
|
|
142489
|
+
}
|
|
142490
|
+
}
|
|
142491
|
+
};
|
|
142492
|
+
}
|
|
142493
|
+
|
|
141814
142494
|
// ../tool-server/src/tools/await-screen-idle/index.ts
|
|
141815
142495
|
init_zod();
|
|
141816
142496
|
init_device_info();
|
|
141817
142497
|
init_adb();
|
|
141818
142498
|
init_capability();
|
|
141819
142499
|
var AWAIT_SCREEN_IDLE_TOOL_ID = "await-screen-idle";
|
|
141820
|
-
var
|
|
141821
|
-
var
|
|
142500
|
+
var DEFAULT_TIMEOUT_MS5 = 3e3;
|
|
142501
|
+
var DEFAULT_POLL_INTERVAL_MS3 = 200;
|
|
141822
142502
|
var DEFAULT_MIN_STABLE_MS = 250;
|
|
141823
142503
|
var TV_NO_CURSOR_STABLE_MS = 1200;
|
|
141824
142504
|
var DARK_TAIL_POLLS = 2;
|
|
@@ -141860,14 +142540,14 @@ function unsettledNote(lastData, lastError, darkTailMs) {
|
|
|
141860
142540
|
if (lastData.hint) parts2.push(lastData.hint);
|
|
141861
142541
|
return parts2.join("; ");
|
|
141862
142542
|
}
|
|
141863
|
-
var
|
|
142543
|
+
var zodSchema45 = external_exports.object({
|
|
141864
142544
|
udid: external_exports.string().min(1).describe(
|
|
141865
142545
|
"Target device id from `list-devices` (iOS UDID, Android serial, Vega serial, <flag:harmonyos>HarmonyOS id, </flag:harmonyos><flag:macos-apps>Mac app id, </flag:macos-apps>or Chromium id)."
|
|
141866
142546
|
),
|
|
141867
142547
|
timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(
|
|
141868
|
-
`Max time to wait for the screen to settle before giving up (default ${
|
|
142548
|
+
`Max time to wait for the screen to settle before giving up (default ${DEFAULT_TIMEOUT_MS5}).`
|
|
141869
142549
|
),
|
|
141870
|
-
pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(`How often to re-read the tree (default ${
|
|
142550
|
+
pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(`How often to re-read the tree (default ${DEFAULT_POLL_INTERVAL_MS3}).`),
|
|
141871
142551
|
minStableMs: external_exports.number().int().min(0).max(1e4).optional().describe(
|
|
141872
142552
|
`The screen must hold the same content for at least this long to count as settled (default ${DEFAULT_MIN_STABLE_MS}); 0 settles on the first non-empty read.`
|
|
141873
142553
|
)
|
|
@@ -141900,7 +142580,7 @@ function createAwaitScreenIdleTool(registry2) {
|
|
|
141900
142580
|
description: `Block until the screen has rendered content and held it for minStableMs, or the timeout elapses. It polls the same element tree as \`describe\`.
|
|
141901
142581
|
Use when a launch or navigation must finish rendering before a screenshot or tap.
|
|
141902
142582
|
Returns { settled, waitedMs, polls, note? }. If that is not seen before timeoutMs, it returns settled=false instead of failing.<flag:harmonyos> A note on settled=true means the screen it settled on is not live: a suspended HarmonyOS panel settles instantly on its last frame, and taps land nowhere until it is woken.</flag:harmonyos>`,
|
|
141903
|
-
zodSchema:
|
|
142583
|
+
zodSchema: zodSchema45,
|
|
141904
142584
|
searchHint: "wait until screen settles idle stable stops changing animation transition rendered ready before screenshot",
|
|
141905
142585
|
readOnly: true,
|
|
141906
142586
|
interaction: {
|
|
@@ -141929,13 +142609,13 @@ Returns { settled, waitedMs, polls, note? }. If that is not seen before timeoutM
|
|
|
141929
142609
|
const tvApi = isTvOs ? await resolveTvApi(registry2, device.id) : null;
|
|
141930
142610
|
const androidIsTv = device.platform === "android" && await isAndroidTv(device.id);
|
|
141931
142611
|
const minStableMs = params.minStableMs ?? DEFAULT_MIN_STABLE_MS;
|
|
141932
|
-
const pollIntervalMs = params.pollIntervalMs ??
|
|
142612
|
+
const pollIntervalMs = params.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS3;
|
|
141933
142613
|
let stableSignature;
|
|
141934
142614
|
let stableSince = 0;
|
|
141935
142615
|
let lastReadAt = 0;
|
|
141936
142616
|
const poll = await pollDescribeTree({
|
|
141937
142617
|
fetchTree: (budgetMs) => fetchTree(device, services, tvApi, androidIsTv, budgetMs),
|
|
141938
|
-
timeoutMs: params.timeoutMs ??
|
|
142618
|
+
timeoutMs: params.timeoutMs ?? DEFAULT_TIMEOUT_MS5,
|
|
141939
142619
|
pollIntervalMs,
|
|
141940
142620
|
signal: ctx?.signal,
|
|
141941
142621
|
onSample: (data, nowMs) => {
|
|
@@ -142140,7 +142820,7 @@ function safeGetState(registry2, urn) {
|
|
|
142140
142820
|
return null;
|
|
142141
142821
|
}
|
|
142142
142822
|
}
|
|
142143
|
-
var
|
|
142823
|
+
var zodSchema46 = external_exports.object({
|
|
142144
142824
|
port: metroPortField,
|
|
142145
142825
|
device_id: external_exports.string().describe(
|
|
142146
142826
|
"Device ID from list-devices<flag:macos-apps>, including a Mac app ID</flag:macos-apps>. For iOS or Android on a shared Metro, use the target's logicalDeviceId if asked to disambiguate."
|
|
@@ -142158,7 +142838,7 @@ On an iOS simulator, Android device<flag:macos-apps>, or Mac app</flag:macos-app
|
|
|
142158
142838
|
After starting, ask the user to perform the interaction to profile, then call react-profiler-stop.
|
|
142159
142839
|
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.
|
|
142160
142840
|
Fails if the Hermes runtime is not reachable or the Metro CDP connection cannot be established.`,
|
|
142161
|
-
zodSchema:
|
|
142841
|
+
zodSchema: zodSchema46,
|
|
142162
142842
|
interaction: {
|
|
142163
142843
|
startedMsg: () => "Starting React profiler",
|
|
142164
142844
|
completedMsg: ({ result }) => result.already_running ? "React profiler was already running" : "Started React profiler",
|
|
@@ -143225,7 +143905,7 @@ function stopInProgressError() {
|
|
|
143225
143905
|
error_kind: "not_found"
|
|
143226
143906
|
});
|
|
143227
143907
|
}
|
|
143228
|
-
var
|
|
143908
|
+
var zodSchema47 = external_exports.object({
|
|
143229
143909
|
port: metroPortField,
|
|
143230
143910
|
device_id: external_exports.string().describe(
|
|
143231
143911
|
"Device ID passed to react-profiler-start<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>."
|
|
@@ -143240,7 +143920,7 @@ Call react-profiler-start first, then exercise the app, then call this.
|
|
|
143240
143920
|
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 }.
|
|
143241
143921
|
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.
|
|
143242
143922
|
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.`,
|
|
143243
|
-
zodSchema:
|
|
143923
|
+
zodSchema: zodSchema47,
|
|
143244
143924
|
// Collection can outlast the MCP client's 30 s abort. The client would then
|
|
143245
143925
|
// resend the call, and the resend fails on the stop still collecting.
|
|
143246
143926
|
longRunning: true,
|
|
@@ -143535,7 +144215,7 @@ Fails if no active profiling session exists, another stop is running, the CDP co
|
|
|
143535
144215
|
|
|
143536
144216
|
// ../tool-server/src/tools/profiler/react/react-profiler-status.ts
|
|
143537
144217
|
init_zod();
|
|
143538
|
-
var
|
|
144218
|
+
var zodSchema48 = external_exports.object({
|
|
143539
144219
|
port: metroPortField,
|
|
143540
144220
|
device_id: external_exports.string().describe(
|
|
143541
144221
|
"Device ID of the app to inspect<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>. During a recording, use the ID passed to react-profiler-start."
|
|
@@ -143553,7 +144233,7 @@ function createReactProfilerStatusTool(registry2) {
|
|
|
143553
144233
|
return {
|
|
143554
144234
|
id: "react-profiler-status",
|
|
143555
144235
|
description: `Check whether a React recording is running, saved, lost, or taken over. Use after an interruption to decide whether to collect the recording or start again. If the runtime is unavailable, session_status is no_react_runtime and note gives the reason.`,
|
|
143556
|
-
zodSchema:
|
|
144236
|
+
zodSchema: zodSchema48,
|
|
143557
144237
|
readOnly: true,
|
|
143558
144238
|
interaction: {
|
|
143559
144239
|
startedMsg: () => "Checking React profiler",
|
|
@@ -145232,7 +145912,7 @@ var annotationSchema = external_exports.object({
|
|
|
145232
145912
|
),
|
|
145233
145913
|
label: external_exports.string().describe("Description of the action performed")
|
|
145234
145914
|
});
|
|
145235
|
-
var
|
|
145915
|
+
var zodSchema49 = external_exports.object({
|
|
145236
145916
|
port: metroPortField,
|
|
145237
145917
|
device_id: external_exports.string().describe(
|
|
145238
145918
|
"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>."
|
|
@@ -145255,7 +145935,7 @@ After presenting the report, ask the user whether to investigate further (drill-
|
|
|
145255
145935
|
profiler-cpu-query / profiler-commit-query) or implement fixes and re-profile for comparison.
|
|
145256
145936
|
Use when the profiling session is complete and you need to interpret the collected data.
|
|
145257
145937
|
Fails if react-profiler-stop has not been called or no profiling data is stored.`,
|
|
145258
|
-
zodSchema:
|
|
145938
|
+
zodSchema: zodSchema49,
|
|
145259
145939
|
interaction: {
|
|
145260
145940
|
startedMsg: () => "Analyzing React profile",
|
|
145261
145941
|
completedMsg: () => "Analyzed React profile",
|
|
@@ -145440,7 +146120,7 @@ var import_fs6 = require("fs");
|
|
|
145440
146120
|
var fileInputs = [
|
|
145441
146121
|
{ target: "project_root", path: "${project_root}", kind: "directory" }
|
|
145442
146122
|
];
|
|
145443
|
-
var
|
|
146123
|
+
var zodSchema50 = external_exports.object({
|
|
145444
146124
|
component_name: external_exports.string().describe("Name of the React component to look up"),
|
|
145445
146125
|
project_root: external_exports.string().describe("Absolute path to the RN project root")
|
|
145446
146126
|
});
|
|
@@ -145450,7 +146130,7 @@ var reactProfilerComponentSourceTool = {
|
|
|
145450
146130
|
Call this per-finding after react-profiler-analyze to inspect source before proposing a fix.
|
|
145451
146131
|
Returns found: false if the component is not found in user-owned code (e.g. lives in node_modules).
|
|
145452
146132
|
When several files define a component with the same name (e.g. platform variants like List.tsx and List.web.tsx), returns the primary match and lists the rest under otherMatches[] (file/line/col). Check it before assuming the returned file is the one you meant.`,
|
|
145453
|
-
zodSchema:
|
|
146133
|
+
zodSchema: zodSchema50,
|
|
145454
146134
|
readOnly: true,
|
|
145455
146135
|
// react-profiler-analyze runs the same AST lookup for each component in its
|
|
145456
146136
|
// table (file, line and other matches) and adds the source of the located ones
|
|
@@ -145577,7 +146257,7 @@ function renderMarkdownTable(entries) {
|
|
|
145577
146257
|
);
|
|
145578
146258
|
return [header, sep11, ...rows].join("\n");
|
|
145579
146259
|
}
|
|
145580
|
-
var
|
|
146260
|
+
var zodSchema51 = external_exports.object({
|
|
145581
146261
|
port: metroPortField,
|
|
145582
146262
|
device_id: external_exports.string().describe(
|
|
145583
146263
|
"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>."
|
|
@@ -145592,7 +146272,7 @@ FOR DEDICATED CPU INVESTIGATION ONLY: do NOT call this as part of a normal profi
|
|
|
145592
146272
|
Use react-profiler-analyze instead; it covers all React rendering performance analysis.
|
|
145593
146273
|
Use when you specifically need to investigate JS CPU hotspots that are NOT tied to React rendering (e.g. regex slowness, cryptography, heavy computations).
|
|
145594
146274
|
Fails if react-profiler-stop has not been called or no CPU profile is stored.`,
|
|
145595
|
-
zodSchema:
|
|
146275
|
+
zodSchema: zodSchema51,
|
|
145596
146276
|
readOnly: true,
|
|
145597
146277
|
// Agents use profiler-cpu-query mode top_functions, which reads the same
|
|
145598
146278
|
// profile with per-sample intervals and idle filtered out, and has the same
|
|
@@ -145700,7 +146380,7 @@ function renderMarkdownTable2(entries) {
|
|
|
145700
146380
|
);
|
|
145701
146381
|
return [header, sep11, ...rows].join("\n");
|
|
145702
146382
|
}
|
|
145703
|
-
var
|
|
146383
|
+
var zodSchema52 = external_exports.object({
|
|
145704
146384
|
port: metroPortField,
|
|
145705
146385
|
device_id: external_exports.string().describe(
|
|
145706
146386
|
"Device ID of the app to inspect<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>. During a recording, use the ID passed to react-profiler-start."
|
|
@@ -145713,7 +146393,7 @@ var reactProfilerRendersTool = {
|
|
|
145713
146393
|
Returns a markdown table of the components with the longest total self render time. It reads the top 30 levels of the tree and does not count re-renders: record a profiling session for that.
|
|
145714
146394
|
Use when you want a quick look at what is mounted in a live connected app, without a profiling session.
|
|
145715
146395
|
Fails if the React DevTools hook is not present in the runtime or the app is not connected.`,
|
|
145716
|
-
zodSchema:
|
|
146396
|
+
zodSchema: zodSchema52,
|
|
145717
146397
|
readOnly: true,
|
|
145718
146398
|
// It walks only the top 30 fiber levels, above the screens of a real app
|
|
145719
146399
|
// (Bluesky's first feed item sits at depth 446), and counts mounts, not
|
|
@@ -145882,7 +146562,7 @@ function buildFiberTreeScript(maxDepth, filter) {
|
|
|
145882
146562
|
}
|
|
145883
146563
|
})()`;
|
|
145884
146564
|
}
|
|
145885
|
-
var
|
|
146565
|
+
var zodSchema53 = external_exports.object({
|
|
145886
146566
|
port: metroPortField,
|
|
145887
146567
|
device_id: external_exports.string().describe(
|
|
145888
146568
|
"Device ID of the app to inspect<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>. During a recording, use the ID passed to react-profiler-start."
|
|
@@ -145896,7 +146576,7 @@ var reactProfilerFiberTreeTool = {
|
|
|
145896
146576
|
Use when tracing the ancestry of a library component.
|
|
145897
146577
|
Returns a nested JSON tree of fiber nodes with name, tag, actualDuration, selfBaseDuration, and children.
|
|
145898
146578
|
Fails if the React DevTools hook is not present or no fiber roots have been committed yet.`,
|
|
145899
|
-
zodSchema:
|
|
146579
|
+
zodSchema: zodSchema53,
|
|
145900
146580
|
readOnly: true,
|
|
145901
146581
|
interaction: {
|
|
145902
146582
|
startedMsg: () => "Reading React fiber tree",
|
|
@@ -150485,7 +151165,7 @@ var capability31 = {
|
|
|
150485
151165
|
android: { emulator: true, device: true, unknown: true },
|
|
150486
151166
|
macos: { app: true, catalyst: true }
|
|
150487
151167
|
};
|
|
150488
|
-
var
|
|
151168
|
+
var zodSchema54 = external_exports.object({
|
|
150489
151169
|
device_id: metroDeviceIdParam(
|
|
150490
151170
|
"Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
|
|
150491
151171
|
),
|
|
@@ -150507,7 +151187,7 @@ var nativeProfilerStartTool = {
|
|
|
150507
151187
|
Start the target app first for an attach recording. Wait for this call to return before reproducing the scenario, then call native-profiler-stop while the app is still running.
|
|
150508
151188
|
On iOS and Android, a warning names apps whose timings may be affected by native network capture (started by network-capture-start).<flag:macos-apps> On a Mac app, a warning says when the app runs with malloc stack logging. Launch the app through Argent and use a development-signed build. If signing blocks profiling in a background session such as SSH, try the "Time Profiler" template for CPU and hangs without leak checks.
|
|
150509
151189
|
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>`,
|
|
150510
|
-
zodSchema:
|
|
151190
|
+
zodSchema: zodSchema54,
|
|
150511
151191
|
interaction: {
|
|
150512
151192
|
startedMsg: () => "Starting native profiler",
|
|
150513
151193
|
completedMsg: () => "Started native profiler",
|
|
@@ -150574,7 +151254,7 @@ async function exportedFilesToArtifacts(store, files) {
|
|
|
150574
151254
|
function registerTrace(store, traceFile) {
|
|
150575
151255
|
return store.register({ hostPath: traceFile, kind: "native-profile-trace", archive: "tar.gz" });
|
|
150576
151256
|
}
|
|
150577
|
-
var
|
|
151257
|
+
var zodSchema55 = external_exports.object({
|
|
150578
151258
|
device_id: metroDeviceIdParam(
|
|
150579
151259
|
"Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
|
|
150580
151260
|
)
|
|
@@ -150583,7 +151263,7 @@ var nativeProfilerStopTool = {
|
|
|
150583
151263
|
id: "native-profiler-stop",
|
|
150584
151264
|
description: `End a native profiling session started by native-profiler-start and save the trace as a downloadable artifact.
|
|
150585
151265
|
On iOS<flag:macos-apps> and Mac apps</flag:macos-apps>, export CPU, hangs, and leaks XML from Instruments. Check warning and exportDiagnostics for partial or skipped exports. On Android, save the Perfetto .pftrace.`,
|
|
150586
|
-
zodSchema:
|
|
151266
|
+
zodSchema: zodSchema55,
|
|
150587
151267
|
interaction: {
|
|
150588
151268
|
startedMsg: () => "Stopping native profiler",
|
|
150589
151269
|
completedMsg: ({ result }) => `Saved native profile ${result.traceFile.filename}`,
|
|
@@ -150632,7 +151312,7 @@ var capability33 = {
|
|
|
150632
151312
|
android: { emulator: true, device: true, unknown: true },
|
|
150633
151313
|
macos: { app: true, catalyst: true }
|
|
150634
151314
|
};
|
|
150635
|
-
var
|
|
151315
|
+
var zodSchema56 = external_exports.object({
|
|
150636
151316
|
device_id: metroDeviceIdParam(
|
|
150637
151317
|
"Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
|
|
150638
151318
|
)
|
|
@@ -150642,7 +151322,7 @@ var nativeProfilerAnalyzeTool = {
|
|
|
150642
151322
|
description: `Summarize a native trace saved by native-profiler-stop or restored with profiler-load. Returns a Markdown report with severity and suggested next steps.
|
|
150643
151323
|
Instruments reports CPU hotspots, UI hangs, and memory leaks on iOS<flag:macos-apps> and Mac apps</flag:macos-apps>. Android reports also include jank reasons, main-thread state, garbage collection, and memory growth as a weak leak signal.
|
|
150644
151324
|
Use profiler-stack-query for details behind a finding.`,
|
|
150645
|
-
zodSchema:
|
|
151325
|
+
zodSchema: zodSchema56,
|
|
150646
151326
|
interaction: {
|
|
150647
151327
|
startedMsg: () => "Analyzing native profile",
|
|
150648
151328
|
completedMsg: () => "Analyzed native profile",
|
|
@@ -151932,7 +152612,7 @@ var launchAnalysisMode = {
|
|
|
151932
152612
|
failed: "Failed to record iOS App Launch"
|
|
151933
152613
|
}
|
|
151934
152614
|
};
|
|
151935
|
-
var
|
|
152615
|
+
var zodSchema57 = external_exports.object({
|
|
151936
152616
|
mode: external_exports.enum(["measure", "profile"]).describe(
|
|
151937
152617
|
"measure: time five launches with XCTest. profile: record one Instruments App Launch trace."
|
|
151938
152618
|
),
|
|
@@ -151972,7 +152652,7 @@ Install a Release build of bundle_id before calling; the tool does not build or
|
|
|
151972
152652
|
Use when you need the iOS launch time or want to find what slows the app's startup.
|
|
151973
152653
|
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.
|
|
151974
152654
|
Fails if the app is not installed or no iPhone or allowed simulator is available.`,
|
|
151975
|
-
zodSchema:
|
|
152655
|
+
zodSchema: zodSchema57,
|
|
151976
152656
|
services: () => ({}),
|
|
151977
152657
|
async execute(_services, params, ctx) {
|
|
151978
152658
|
switch (params.mode) {
|
|
@@ -152335,7 +153015,7 @@ function resolveAudioSession(registry2, device) {
|
|
|
152335
153015
|
}
|
|
152336
153016
|
|
|
152337
153017
|
// ../tool-server/src/tools/audio/audio-input.ts
|
|
152338
|
-
var
|
|
153018
|
+
var zodSchema58 = external_exports.object({
|
|
152339
153019
|
udid: external_exports.string().describe("Target iOS Simulator UDID from `list-devices`."),
|
|
152340
153020
|
source: external_exports.enum(["file", "tone", "microphone"]).describe(
|
|
152341
153021
|
"`file` plays `path`, `tone` a sine wave, `microphone` restores the real microphone."
|
|
@@ -152363,7 +153043,7 @@ function createAudioInputTool(registry2) {
|
|
|
152363
153043
|
id: "audio-input",
|
|
152364
153044
|
description: `Set what apps in an iOS Simulator hear as microphone input: an audio file, a tone, or the real microphone.
|
|
152365
153045
|
A file starts playing on this call, so call it right before the action that makes the app record.`,
|
|
152366
|
-
zodSchema:
|
|
153046
|
+
zodSchema: zodSchema58,
|
|
152367
153047
|
searchHint: "audio microphone input mock fake inject voice speech sound file tone simulator mic",
|
|
152368
153048
|
interaction: {
|
|
152369
153049
|
startedMsg: ({ params }) => `Setting simulator audio input to ${params.source}`,
|
|
@@ -154270,7 +154950,7 @@ var capability34 = {
|
|
|
154270
154950
|
// argent's library records the app's window from inside the app.
|
|
154271
154951
|
macos: { app: true, catalyst: true }
|
|
154272
154952
|
};
|
|
154273
|
-
var
|
|
154953
|
+
var zodSchema59 = external_exports.object({
|
|
154274
154954
|
udid: external_exports.string().describe(
|
|
154275
154955
|
"Target ID from `list-devices`.<flag:macos-apps> For a Mac app, use its device ID, such as `macos-app-com.example.notes`.</flag:macos-apps>"
|
|
154276
154956
|
),
|
|
@@ -154291,7 +154971,7 @@ function createScreenRecordingStartTool(registry2) {
|
|
|
154291
154971
|
Recording continues across tool calls until stopped or until the time limit. Set a reminder as soon as recording starts. The start result returns \`outputFile\` on the tool-server host. Retrieve the video with \`screen-recording-stop\`, even after the time limit.
|
|
154292
154972
|
Start fails if the target is unavailable or already has a recording waiting to be stopped or retrieved. Local simulators, Android emulators and devices, and cabled iPhones require ffmpeg. On a physical iPhone, check for \`transportType: "wired"\` in \`list-devices\` and have the user allow camera access for \`ios-screen-stream\` if prompted on the first recording. tvOS, Chromium<flag:harmonyos>, HarmonyOS</flag:harmonyos>, and Vega are unsupported.<flag:macos-apps>
|
|
154293
154973
|
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>`,
|
|
154294
|
-
zodSchema:
|
|
154974
|
+
zodSchema: zodSchema59,
|
|
154295
154975
|
searchHint: "record video screen capture movie mp4 start filming screencast",
|
|
154296
154976
|
interaction: {
|
|
154297
154977
|
startedMsg: () => "Starting screen recording",
|
|
@@ -154435,7 +155115,7 @@ var capability35 = {
|
|
|
154435
155115
|
android: { emulator: true, device: true, unknown: true },
|
|
154436
155116
|
macos: { app: true, catalyst: true }
|
|
154437
155117
|
};
|
|
154438
|
-
var
|
|
155118
|
+
var zodSchema60 = external_exports.object({
|
|
154439
155119
|
udid: external_exports.string().describe(
|
|
154440
155120
|
"Target ID from `list-devices`.<flag:macos-apps> For a Mac app, use its device ID, such as `macos-app-com.example.notes`.</flag:macos-apps>"
|
|
154441
155121
|
)
|
|
@@ -154445,7 +155125,7 @@ var screenRecordingStopTool = {
|
|
|
154445
155125
|
description: `Stop a screen recording and retrieve its MP4. Call this even after the time limit or an early capture exit. The tool downloads recordings from remote simulators.
|
|
154446
155126
|
Returns the saved \`video\` and its \`durationMs\`. When trimming removes still sections, \`wallClockMs\` gives the original duration and \`trimmedMs\` gives the time removed. On a foldable simulator the video follows the active panel, keeps the first panel's size, and reports any \`panelSwitches\`.
|
|
154447
155127
|
Check \`warning\` for capture problems, such as an undetected foldable panel.<flag:macos-apps> On a Mac app, a warning can report when the video held its last frame or omitted a protected window. Quitting or restarting the app or connecting to it from another Argent tool-server during capture can discard the recording. A stop error can include a path to a recoverable video.</flag:macos-apps>`,
|
|
154448
|
-
zodSchema:
|
|
155128
|
+
zodSchema: zodSchema60,
|
|
154449
155129
|
searchHint: "stop end finish screen recording video capture save retrieve",
|
|
154450
155130
|
interaction: {
|
|
154451
155131
|
startedMsg: () => "Stopping screen recording",
|
|
@@ -154835,7 +155515,7 @@ var timeRangeSchema = external_exports.object({
|
|
|
154835
155515
|
start: external_exports.coerce.number().describe("Start of range in ms"),
|
|
154836
155516
|
end: external_exports.coerce.number().describe("End of range in ms")
|
|
154837
155517
|
});
|
|
154838
|
-
var
|
|
155518
|
+
var zodSchema61 = external_exports.object({
|
|
154839
155519
|
port: metroPortField,
|
|
154840
155520
|
device_id: metroDeviceIdParam(
|
|
154841
155521
|
"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>."
|
|
@@ -154861,7 +155541,7 @@ Modes:
|
|
|
154861
155541
|
Use when drilling into specific components or time windows after react-profiler-analyze.
|
|
154862
155542
|
Returns a markdown table or tree of commit data matching the requested mode.
|
|
154863
155543
|
Fails if react-profiler-stop has not been called.`,
|
|
154864
|
-
zodSchema:
|
|
155544
|
+
zodSchema: zodSchema61,
|
|
154865
155545
|
readOnly: true,
|
|
154866
155546
|
interaction: {
|
|
154867
155547
|
startedMsg: ({ params }) => `Querying React commits ${params.mode.replace(/^by_/, "by ").replaceAll("_", " ")}`,
|
|
@@ -155297,7 +155977,7 @@ var timeWindowSchema = external_exports.object({
|
|
|
155297
155977
|
start: external_exports.coerce.number().describe("Start of window in ms"),
|
|
155298
155978
|
end: external_exports.coerce.number().describe("End of window in ms")
|
|
155299
155979
|
});
|
|
155300
|
-
var
|
|
155980
|
+
var zodSchema62 = external_exports.object({
|
|
155301
155981
|
port: metroPortField,
|
|
155302
155982
|
device_id: metroDeviceIdParam(
|
|
155303
155983
|
"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>."
|
|
@@ -155329,7 +156009,7 @@ Each row is one call path, so a function can have several rows and top_n counts
|
|
|
155329
156009
|
Use when investigating JS CPU hotspots or correlating CPU cost with specific components.
|
|
155330
156010
|
Returns a markdown table of CPU hotspots, call tree, or per-component CPU breakdown.
|
|
155331
156011
|
Fails if no CPU profile is stored; run react-profiler-stop (and ideally react-profiler-analyze) first.`,
|
|
155332
|
-
zodSchema:
|
|
156012
|
+
zodSchema: zodSchema62,
|
|
155333
156013
|
readOnly: true,
|
|
155334
156014
|
interaction: {
|
|
155335
156015
|
startedMsg: ({ params }) => `Querying CPU profile by ${params.mode.replaceAll("_", " ")}`,
|
|
@@ -155716,7 +156396,7 @@ async function executeAndroid(api, params) {
|
|
|
155716
156396
|
topN: params.top_n
|
|
155717
156397
|
});
|
|
155718
156398
|
}
|
|
155719
|
-
var
|
|
156399
|
+
var zodSchema63 = external_exports.object({
|
|
155720
156400
|
device_id: metroDeviceIdParam(
|
|
155721
156401
|
"Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
|
|
155722
156402
|
),
|
|
@@ -155738,7 +156418,7 @@ Modes:
|
|
|
155738
156418
|
- function_callers: Who calls function_name and what it calls.
|
|
155739
156419
|
- thread_breakdown: CPU time split by thread, optionally filtered.
|
|
155740
156420
|
- leak_stacks: Memory leak details (iOS<flag:macos-apps> and Mac apps</flag:macos-apps> only). Requires a trace with leak data.`,
|
|
155741
|
-
zodSchema:
|
|
156421
|
+
zodSchema: zodSchema63,
|
|
155742
156422
|
readOnly: true,
|
|
155743
156423
|
interaction: {
|
|
155744
156424
|
startedMsg: ({ params }) => `Querying native stacks by ${stackQueryMode[params.mode]}`,
|
|
@@ -155816,7 +156496,7 @@ function buildPerfettoAnchor(wallClockStartMs) {
|
|
|
155816
156496
|
}
|
|
155817
156497
|
|
|
155818
156498
|
// ../tool-server/src/tools/profiler/combined/profiler-combined-report.ts
|
|
155819
|
-
var
|
|
156499
|
+
var zodSchema64 = external_exports.object({
|
|
155820
156500
|
port: metroPortField,
|
|
155821
156501
|
device_id: metroDeviceIdParam(
|
|
155822
156502
|
"Device ID from list-devices used for the native profile (iOS simulator UDID, Android serial<flag:macos-apps>, or Mac app ID</flag:macos-apps>)."
|
|
@@ -155829,7 +156509,7 @@ Maps native hangs to React commits using wall-clock time alignment.
|
|
|
155829
156509
|
Call this tool when both profilers were run in parallel on the same session.
|
|
155830
156510
|
Returns a markdown report correlating hangs with React commits, memory leaks, and investigation hints.
|
|
155831
156511
|
Fails if either react-profiler-analyze or native-profiler-analyze has not been called first, or if the session stored no React commits.`,
|
|
155832
|
-
zodSchema:
|
|
156512
|
+
zodSchema: zodSchema64,
|
|
155833
156513
|
readOnly: true,
|
|
155834
156514
|
interaction: {
|
|
155835
156515
|
startedMsg: () => "Building combined performance report",
|
|
@@ -156519,7 +157199,7 @@ var profilerLoadAction = {
|
|
|
156519
157199
|
failure: "load"
|
|
156520
157200
|
}
|
|
156521
157201
|
};
|
|
156522
|
-
var
|
|
157202
|
+
var zodSchema65 = external_exports.object({
|
|
156523
157203
|
mode: external_exports.enum(["list", "load_react", "load_native"]).describe("What to do; see Modes in the tool description."),
|
|
156524
157204
|
session_id: external_exports.string().regex(SESSION_ID_PATTERN, "session_id may only contain letters, digits, '_' and '-'").optional().describe("Timestamp-based session identifier (e.g. '20250313-143022') from the list output."),
|
|
156525
157205
|
port: metroPortField,
|
|
@@ -156541,7 +157221,7 @@ Modes:
|
|
|
156541
157221
|
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.
|
|
156542
157222
|
Returns a summary of the loaded session or a session list for the list mode.
|
|
156543
157223
|
Fails if the session_id is not found or the session's trace files are missing from disk.`,
|
|
156544
|
-
zodSchema:
|
|
157224
|
+
zodSchema: zodSchema65,
|
|
156545
157225
|
interaction: {
|
|
156546
157226
|
startedMsg: ({ params }) => profilerLoadAction[params.mode].started(params),
|
|
156547
157227
|
completedMsg: ({ params }) => profilerLoadAction[params.mode].completed(params),
|
|
@@ -156701,7 +157381,7 @@ function unnameableSessionUrns(urns) {
|
|
|
156701
157381
|
}
|
|
156702
157382
|
|
|
156703
157383
|
// ../tool-server/src/tools/simulator/stop-simulator-server.ts
|
|
156704
|
-
var
|
|
157384
|
+
var zodSchema66 = external_exports.object({
|
|
156705
157385
|
udid: external_exports.string().describe(
|
|
156706
157386
|
"Target device id (iOS UDID, Android serial, or Chromium id) whose transport session to stop"
|
|
156707
157387
|
)
|
|
@@ -156710,7 +157390,7 @@ function createStopSimulatorServerTool(registry2) {
|
|
|
156710
157390
|
return {
|
|
156711
157391
|
id: "stop-simulator-server",
|
|
156712
157392
|
description: `Stop the transport session for a specific device (iOS simulator / Android: simulator-server process; physical iOS: the on-device runner; Chromium: CDP WebSocket) and free its resources; on a TV target it also reaps that device's TV-control daemons. Use to restart a wedged transport, or when the user is done with one device but wants to keep others running - not just because a task on it finished, since the next task on that device would start cold again. On iOS / Android / TV it deliberately leaves this device's native-devtools, accessibility, profiler and debugger services running - to drain those as well, use stop-all-simulator-servers with \`devices\`. On CHROMIUM, stopping the transport also ends the JS-runtime debugger session and its captured console history - reconnect with debugger-connect afterwards.<flag:macos-apps> On a Mac app, this ends native capture and discards its records. Use network-capture-stop to stop JS capture or to keep records. Disconnecting the app also ends its screen recording. Retrieve the video first, or check the next screen-recording-stop error for the path to any saved video.</flag:macos-apps> Returns { stopped, udid }; \`stopped\` is false, not an error, when no session is open for the id.`,
|
|
156713
|
-
zodSchema:
|
|
157393
|
+
zodSchema: zodSchema66,
|
|
156714
157394
|
interaction: {
|
|
156715
157395
|
startedMsg: ({ params }) => `Stopping simulator server for ${params.udid}`,
|
|
156716
157396
|
completedMsg: ({ params }) => `Stopped simulator server for ${params.udid}`,
|
|
@@ -156745,7 +157425,7 @@ function createStopSimulatorServerTool(registry2) {
|
|
|
156745
157425
|
// ../tool-server/src/tools/simulator/stop-all-simulator-servers.ts
|
|
156746
157426
|
init_zod();
|
|
156747
157427
|
init_src2();
|
|
156748
|
-
var
|
|
157428
|
+
var zodSchema67 = external_exports.object({
|
|
156749
157429
|
devices: external_exports.array(external_exports.string()).optional().describe(
|
|
156750
157430
|
"Ids of the devices THIS session used (iOS UDID / Android serial / Chromium id), to scope the teardown to."
|
|
156751
157431
|
)
|
|
@@ -156758,7 +157438,7 @@ PASS \`devices\` with the device ids this session used: one tool-server serves e
|
|
|
156758
157438
|
A JS-runtime debugger session is keyed by the id you called \`debugger-connect\` with. On a Metro serving two or more devices that id can be a \`logicalDeviceId\`: connect refuses a udid or serial it cannot match to one Metro device by name, and tells you to re-target with the \`logicalDeviceId\` it returns. A scope built from \`list-devices\` ids cannot reach that session. Pass any such \`logicalDeviceId\` in \`devices\` ALONGSIDE the device id.
|
|
156759
157439
|
Returns { stopped }: the URNs of the live services that were shut down; empty means nothing was still running. { unmatched }, present only when a supplied id owns no service here, lists those ids, so a typo or a device NAME passed instead of an id does not read as a clean machine. It is NOT proof the id is wrong: a Vega device you only booted and drove with the remote registers no service and lands here, as does any device this session never started anything on. { left_running } lists the URNs of live debugger sessions (and the network inspectors / React profiler sessions riding on them) whose id no device scope can name; re-call with the id after each URN's \`<namespace>:<port>:\` prefix to reap them. { aborted: true } means the request was cancelled part-way: the rest was left untouched and \`unmatched\` / \`left_running\` were not computed.
|
|
156760
157440
|
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.`,
|
|
156761
|
-
zodSchema:
|
|
157441
|
+
zodSchema: zodSchema67,
|
|
156762
157442
|
interaction: {
|
|
156763
157443
|
// "all" only holds for the unscoped sweep; a scoped call touches just the
|
|
156764
157444
|
// ids it was given.
|
|
@@ -156961,13 +157641,13 @@ function listeningPids(port) {
|
|
|
156961
157641
|
}
|
|
156962
157642
|
return lines.map((s) => parseInt(s, 10));
|
|
156963
157643
|
}
|
|
156964
|
-
var
|
|
157644
|
+
var zodSchema68 = external_exports.object({
|
|
156965
157645
|
port: external_exports.number().int().min(1).max(65535).default(8081).describe("TCP port Metro is listening on")
|
|
156966
157646
|
});
|
|
156967
157647
|
var stopMetroTool = {
|
|
156968
157648
|
id: "stop-metro",
|
|
156969
157649
|
description: `Stop the Metro bundler process listening on \`port\`. Use when the user asks to stop Metro or when Metro must be restarted - do not offer it when a task wraps up, since the next task would wait on a cold Metro start. Returns { stopped, port, pids }: stopped=true when it sent SIGTERM to every listening pid it found (or the pid had already exited), stopped=false when it found none. Fails if the port lookup cannot run or times out, if it finds a listener but not the process that owns it, or if it cannot signal a listener it found (e.g. EPERM). On macOS another user's listener is detected only when no other listener on the port is visible, so it can survive stopped=true. This is DESTRUCTIVE: always ask the user for confirmation before calling this tool.`,
|
|
156970
|
-
zodSchema:
|
|
157650
|
+
zodSchema: zodSchema68,
|
|
156971
157651
|
interaction: {
|
|
156972
157652
|
startedMsg: ({ params }) => `Stopping Metro on port ${params.port}`,
|
|
156973
157653
|
completedMsg: ({ params }) => `Stopped Metro on port ${params.port}`,
|
|
@@ -159503,7 +160183,7 @@ var MACOS_PLATFORM_FLAG = { [FLAG_ENUM_META_KEY]: { macos: MACOS_APPS_FLAG } };
|
|
|
159503
160183
|
var fileInputs3 = [
|
|
159504
160184
|
{ target: "project_root", path: "${project_root}", kind: "probe" }
|
|
159505
160185
|
];
|
|
159506
|
-
var
|
|
160186
|
+
var zodSchema69 = external_exports.object({
|
|
159507
160187
|
name: external_exports.string().describe(
|
|
159508
160188
|
'Name for this e2e test (e.g. "settings-explore"): letters, digits, underscore and hyphen only.'
|
|
159509
160189
|
),
|
|
@@ -159550,7 +160230,7 @@ Call e2e-finish-recording when done.
|
|
|
159550
160230
|
To remove or reorder steps, edit the .yaml file after e2e-finish-recording, not
|
|
159551
160231
|
during the recording: over a link, the next recorded step writes over your edit,
|
|
159552
160232
|
and without a link, an edit that renumbers the steps drops their warnings.`,
|
|
159553
|
-
zodSchema:
|
|
160233
|
+
zodSchema: zodSchema69,
|
|
159554
160234
|
aliases: ["flow-start-recording"],
|
|
159555
160235
|
interaction: {
|
|
159556
160236
|
// Name the flow: concurrent recordings interleave in one log, and "flow
|
|
@@ -161607,7 +162287,7 @@ async function waitForIdle(env, step) {
|
|
|
161607
162287
|
if (left < MIN_ROUND_BUDGET_MS) break;
|
|
161608
162288
|
if (!await sleepOrAbort(Math.min(IDLE_POLL_MS, left), env.signal)) return ABORTED_OUTCOME;
|
|
161609
162289
|
}
|
|
161610
|
-
const
|
|
162290
|
+
const unreadable2 = (underlying) => ({
|
|
161611
162291
|
ok: false,
|
|
161612
162292
|
indeterminate: true,
|
|
161613
162293
|
// The underlying reader reports an instrumentation failure, whose remedy
|
|
@@ -161622,7 +162302,7 @@ async function waitForIdle(env, step) {
|
|
|
161622
162302
|
reason: `the UI tree read back empty and degraded while waiting for the screen to settle, so the screen was never observed \u2014 this is the reader reporting it could not see the app, not the app rendering nothing` + (blindHint === void 0 ? "" : `. ${blindHint}`)
|
|
161623
162303
|
});
|
|
161624
162304
|
if (readsSucceeded === 0) {
|
|
161625
|
-
if (treeErrorMessage !== void 0) return
|
|
162305
|
+
if (treeErrorMessage !== void 0) return unreadable2(treeErrorMessage);
|
|
161626
162306
|
if (treeReadBlind) return degraded();
|
|
161627
162307
|
return {
|
|
161628
162308
|
ok: false,
|
|
@@ -161631,7 +162311,7 @@ async function waitForIdle(env, step) {
|
|
|
161631
162311
|
};
|
|
161632
162312
|
}
|
|
161633
162313
|
if (treeErrorMessage !== void 0 && darkReads > IDLE_TOLERATED_DARK_READS) {
|
|
161634
|
-
return
|
|
162314
|
+
return unreadable2(treeErrorMessage);
|
|
161635
162315
|
}
|
|
161636
162316
|
if (treeReadBlind && darkReads > IDLE_TOLERATED_DARK_READS) {
|
|
161637
162317
|
return degraded();
|
|
@@ -162452,6 +163132,14 @@ function unmetWaitWarningFor(cause) {
|
|
|
162452
163132
|
if (cause === "cancelled") return CANCELLED_WAIT_WARNING;
|
|
162453
163133
|
return UNMET_WAIT_WARNING;
|
|
162454
163134
|
}
|
|
163135
|
+
var UNMET_NETWORK_WAIT_WARNING = "recorded, but the wait never held: `await-network-request` returned success:false, and at replay an unmet wait FAILS the step. `toolResult.note` counts the requests since the start per layer: fix the matcher, or record the action that sends the request, then record the wait again. Delete the failed step after `e2e-finish-recording`, not mid-recording";
|
|
163136
|
+
var UNREADABLE_NETWORK_WAIT_WARNING = "recorded, but no armed capture layer was read near the deadline, so the request was never judged and whether it is sent is UNKNOWN: `toolResult.layers` says why. Get the layer back (for example call network-capture-start again once the app's JavaScript has loaded) and record the wait again. Do not delete the step on this warning alone";
|
|
163137
|
+
var CANCELLED_NETWORK_WAIT_WARNING = "recorded, but this wait was cancelled before its deadline, so whether the request is sent is UNKNOWN: record the step again to find out";
|
|
163138
|
+
function unmetNetworkWaitWarningFor(cause) {
|
|
163139
|
+
if (cause === "unreadable") return UNREADABLE_NETWORK_WAIT_WARNING;
|
|
163140
|
+
if (cause === "cancelled") return CANCELLED_NETWORK_WAIT_WARNING;
|
|
163141
|
+
return UNMET_NETWORK_WAIT_WARNING;
|
|
163142
|
+
}
|
|
162455
163143
|
function indeterminateReasonCaveat(udid) {
|
|
162456
163144
|
if (platformOf(udid) !== "ios") return "";
|
|
162457
163145
|
return ". One thing that reason cannot see is this step: the probe predicts an `await:`/`assert:` directive, and no directive takes a bundleId, so neither this probe nor the runner accepts one (the `bundleId` on this step reached the live wait only)";
|
|
@@ -162858,7 +163546,7 @@ function withRecordedPanelKind(command, args, toolResult) {
|
|
|
162858
163546
|
var fileInputs4 = [
|
|
162859
163547
|
{ target: "project_root", path: "${project_root}", kind: "probe", collect: "step" }
|
|
162860
163548
|
];
|
|
162861
|
-
var
|
|
163549
|
+
var zodSchema70 = external_exports.object({
|
|
162862
163550
|
name: external_exports.string().describe("Name of the e2e test being recorded: the one passed to e2e-start-recording."),
|
|
162863
163551
|
project_root: external_exports.string().describe(
|
|
162864
163552
|
"Absolute path to the project root of the e2e test being recorded: the same value passed to e2e-start-recording."
|
|
@@ -162877,7 +163565,7 @@ function createFlowAddStepTool(registry2) {
|
|
|
162877
163565
|
description: `Execute one MCP tool and record its step in the e2e test named by \`name\` + \`project_root\`. Use when recording and you want each action run and captured; the recording must already be open.
|
|
162878
163566
|
A coordinate \`gesture-tap\` records as a portable \`tap\` selector step; \`restart-app\` as a \`launch\`.
|
|
162879
163567
|
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.`,
|
|
162880
|
-
zodSchema:
|
|
163568
|
+
zodSchema: zodSchema70,
|
|
162881
163569
|
aliases: ["flow-add-step"],
|
|
162882
163570
|
interaction: {
|
|
162883
163571
|
// Name the flow: recordings are concurrent, so several of these lines can
|
|
@@ -163016,16 +163704,15 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
|
|
|
163016
163704
|
);
|
|
163017
163705
|
}
|
|
163018
163706
|
let waitWarning;
|
|
163019
|
-
if (command
|
|
163020
|
-
|
|
163021
|
-
|
|
163022
|
-
|
|
163023
|
-
|
|
163024
|
-
|
|
163025
|
-
|
|
163026
|
-
|
|
163027
|
-
|
|
163028
|
-
}
|
|
163707
|
+
if (isUnmetWaitResult(command, toolResult)) {
|
|
163708
|
+
const cause = unmetWaitCause(command, toolResult);
|
|
163709
|
+
waitWarning = {
|
|
163710
|
+
warning: command === AWAIT_NETWORK_REQUEST_TOOL_ID ? unmetNetworkWaitWarningFor(cause) : unmetWaitWarningFor(cause),
|
|
163711
|
+
kind: "wait"
|
|
163712
|
+
};
|
|
163713
|
+
} else if (command === AWAIT_UI_ELEMENT_TOOL_ID) {
|
|
163714
|
+
const probed = (await probeAgainstRunnerTree(registry2, ctx, args)).warning;
|
|
163715
|
+
if (probed) waitWarning = { warning: probed, kind: "conversion" };
|
|
163029
163716
|
}
|
|
163030
163717
|
const runTarget = command === RUN_TARGET_COMMAND && params.delayMs === void 0 ? await captureRunTarget(session, args, project) : void 0;
|
|
163031
163718
|
const strippedArgs = stripDeviceKeys(args);
|
|
@@ -163120,7 +163807,7 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
|
|
|
163120
163807
|
|
|
163121
163808
|
// ../tool-server/src/tools/flows/flow-insert-echo.ts
|
|
163122
163809
|
init_zod();
|
|
163123
|
-
var
|
|
163810
|
+
var zodSchema71 = external_exports.object({
|
|
163124
163811
|
name: external_exports.string().describe("Name of the e2e test being recorded: the one passed to e2e-start-recording."),
|
|
163125
163812
|
project_root: external_exports.string().describe(
|
|
163126
163813
|
"Absolute path to the project root of the e2e test being recorded: the same value passed to e2e-start-recording."
|
|
@@ -163132,7 +163819,7 @@ var flowInsertEchoTool = {
|
|
|
163132
163819
|
description: `Record an echo step in the e2e test named by \`name\` + \`project_root\`. Echo steps print a message when the e2e test is replayed, useful as labels between tool calls.
|
|
163133
163820
|
Use when you want to annotate a recorded e2e test with a human-readable label or checkpoint message.
|
|
163134
163821
|
Returns { message, stepCount, savedTo }. Fails if that e2e test has no recording in progress.`,
|
|
163135
|
-
zodSchema:
|
|
163822
|
+
zodSchema: zodSchema71,
|
|
163136
163823
|
fileInputs: PROJECT_ROOT_INPUT,
|
|
163137
163824
|
aliases: ["flow-add-echo"],
|
|
163138
163825
|
interaction: {
|
|
@@ -164608,7 +165295,7 @@ function renderOutput(output2) {
|
|
|
164608
165295
|
const kept = bytes.subarray(0, utf8SafeCut(bytes, OUTPUT_RENDER_LIMIT_BYTES));
|
|
164609
165296
|
return { outputJson: kept.toString("utf8"), outputTruncated: true };
|
|
164610
165297
|
}
|
|
164611
|
-
var
|
|
165298
|
+
var zodSchema72 = external_exports.object({
|
|
164612
165299
|
name: external_exports.string().describe("E2E test name passed to e2e-start-recording."),
|
|
164613
165300
|
project_root: external_exports.string().describe("Absolute project root passed to e2e-start-recording."),
|
|
164614
165301
|
path: external_exports.string().describe(
|
|
@@ -164619,7 +165306,7 @@ var zodSchema71 = external_exports.object({
|
|
|
164619
165306
|
var flowAddScriptTool = {
|
|
164620
165307
|
id: "e2e-add-script",
|
|
164621
165308
|
description: `Run a local JavaScript (.mjs, .js) or TypeScript (.mts, .ts) file and record it as a \`script:\` step in an active e2e test. Use when the user requests a local script in the e2e test, and only then. Call it at the point in the recording where the script must run. Returns \`status\`, \`reason\` and \`stepCount\`. A failed script is not recorded. Check \`reason\` and the affected state before you retry. Over a link (argent link or ARGENT_TOOLS_URL), the tool refuses the call: record such an e2e test with no link.`,
|
|
164622
|
-
zodSchema:
|
|
165309
|
+
zodSchema: zodSchema72,
|
|
164623
165310
|
fileInputs: PROJECT_ROOT_INPUT,
|
|
164624
165311
|
aliases: ["flow-add-script"],
|
|
164625
165312
|
interaction: {
|
|
@@ -164763,7 +165450,7 @@ function anchoredWarnings(session, steps) {
|
|
|
164763
165450
|
}
|
|
164764
165451
|
return kept;
|
|
164765
165452
|
}
|
|
164766
|
-
var
|
|
165453
|
+
var zodSchema73 = external_exports.object({
|
|
164767
165454
|
name: external_exports.string().describe("Name of the e2e test being recorded: the one passed to e2e-start-recording."),
|
|
164768
165455
|
project_root: external_exports.string().describe(
|
|
164769
165456
|
"Absolute path to the project root of the e2e test being recorded: the same value passed to e2e-start-recording."
|
|
@@ -164774,7 +165461,7 @@ var flowFinishRecordingTool = {
|
|
|
164774
165461
|
description: `Finish recording the e2e test named by \`name\` + \`project_root\`, leaving recordings under any other key untouched. Returns { message, path, executionPrerequisite, steps, summary, e2eTestFile, savedTo } - a summary of all recorded steps plus the final YAML. Use when you have added all desired steps and want to finalize the e2e test file. Fails if that e2e test has no recording in progress.
|
|
164775
165462
|
A warning e2e-add-step raised on a recorded \`await-ui-element\` is repeated in \`summary\` as a \`warning:\` line right below its step, and \`message\` counts them by kind. Read them before you convert a wait to \`await:\`/\`assert:\` or replay the e2e test.
|
|
164776
165463
|
You can still edit the .yaml file directly afterwards to remove or reorder steps.`,
|
|
164777
|
-
zodSchema:
|
|
165464
|
+
zodSchema: zodSchema73,
|
|
164778
165465
|
fileInputs: PROJECT_ROOT_INPUT,
|
|
164779
165466
|
aliases: ["flow-finish-recording"],
|
|
164780
165467
|
interaction: {
|
|
@@ -167847,7 +168534,7 @@ Run the e2e test on the computer that runs the tool-server, with no link and no
|
|
|
167847
168534
|
}
|
|
167848
168535
|
);
|
|
167849
168536
|
}
|
|
167850
|
-
var
|
|
168537
|
+
var zodSchema74 = external_exports.object({
|
|
167851
168538
|
name: external_exports.string().optional().describe(
|
|
167852
168539
|
'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").'
|
|
167853
168540
|
),
|
|
@@ -167896,7 +168583,7 @@ a nested e2e-execute not called by name with an absolute project_root, a directo
|
|
|
167896
168583
|
argument, a file path built from several arguments, a relative path): it stops before the first step and the
|
|
167897
168584
|
error lists each such step. An absolute .png/.yaml argument from anywhere else fails only when its step runs.
|
|
167898
168585
|
Without a link, every step kind runs.`,
|
|
167899
|
-
zodSchema:
|
|
168586
|
+
zodSchema: zodSchema74,
|
|
167900
168587
|
aliases: ["flow-execute"],
|
|
167901
168588
|
interaction: {
|
|
167902
168589
|
startedMsg: ({ params }) => `Running e2e test ${displayFlowName(params)}`,
|
|
@@ -168982,7 +169669,7 @@ var fileInputs6 = [
|
|
|
168982
169669
|
},
|
|
168983
169670
|
...PROJECT_ROOT_INPUT
|
|
168984
169671
|
];
|
|
168985
|
-
var
|
|
169672
|
+
var zodSchema75 = external_exports.object({
|
|
168986
169673
|
name: external_exports.string().optional().describe(
|
|
168987
169674
|
'Name of a saved e2e test to inspect from `<project_root>/.argent/e2e`, or `.argent/flows` when it is not there (e.g. "settings-explore").'
|
|
168988
169675
|
),
|
|
@@ -169013,7 +169700,7 @@ correct account, correct screen) before committing to a run, or when relaying th
|
|
|
169013
169700
|
Touches no device and needs none booted: it only reads the file.
|
|
169014
169701
|
Fails if the e2e test file does not exist.
|
|
169015
169702
|
Address the e2e test exactly as you will address it in e2e-execute: name or e2e_test_path, one and only one; supplying both or neither is rejected.`,
|
|
169016
|
-
zodSchema:
|
|
169703
|
+
zodSchema: zodSchema75,
|
|
169017
169704
|
readOnly: true,
|
|
169018
169705
|
// When its gates pass, e2e-execute without prerequisiteAcknowledged returns
|
|
169019
169706
|
// the same executionPrerequisite, from the same resolveFlowSource, before any
|
|
@@ -169347,7 +170034,7 @@ async function readWorkspaceSnapshot(workspacePath) {
|
|
|
169347
170034
|
var fileInputs7 = [
|
|
169348
170035
|
{ target: "workspacePath", path: "${workspacePath}", kind: "directory" }
|
|
169349
170036
|
];
|
|
169350
|
-
var
|
|
170037
|
+
var zodSchema76 = external_exports.object({
|
|
169351
170038
|
workspacePath: external_exports.string().describe("Absolute path to the project root directory to inspect (e.g. /Users/dev/MyApp)")
|
|
169352
170039
|
});
|
|
169353
170040
|
var gatherWorkspaceDataTool = {
|
|
@@ -169362,7 +170049,7 @@ Makefile targets, lint-staged config, and a list of detected config files.
|
|
|
169362
170049
|
Use when a program needs the project type (React Native, Expo, Flutter, native iOS/Android,
|
|
169363
170050
|
or other), build commands, platform support, package manager or QA tooling.
|
|
169364
170051
|
Items it cannot read are null or empty collections. Fails if workspacePath is not a directory on the tool-server host.`,
|
|
169365
|
-
zodSchema:
|
|
170052
|
+
zodSchema: zodSchema76,
|
|
169366
170053
|
readOnly: true,
|
|
169367
170054
|
hideFromMcp: true,
|
|
169368
170055
|
interaction: {
|
|
@@ -169444,7 +170131,7 @@ function targetFlagsFor(target) {
|
|
|
169444
170131
|
return [`--${target}`];
|
|
169445
170132
|
}
|
|
169446
170133
|
var updateScheduled = false;
|
|
169447
|
-
var
|
|
170134
|
+
var zodSchema77 = external_exports.object({
|
|
169448
170135
|
target: external_exports.enum(["auto", "global", "local", "both"]).optional().describe(
|
|
169449
170136
|
"Which install to update. 'auto' (default) updates the install serving this session: the global PATH install or this project's local devDependency, whichever this server runs from. Pass 'global' / 'local' to force one, or 'both' when the user has both and wants each updated."
|
|
169450
170137
|
)
|
|
@@ -169452,7 +170139,7 @@ var zodSchema76 = external_exports.object({
|
|
|
169452
170139
|
var updateArgentTool = {
|
|
169453
170140
|
id: "update-argent",
|
|
169454
170141
|
description: "Apply a pending Argent update. Call this only when the user has explicitly consented in this conversation to updating Argent, e.g. after an update notification reports a new version. Returns { message } with the update status, version info, and whether the tool server restarts. Fails if no update is available or an update is already in progress.",
|
|
169455
|
-
zodSchema:
|
|
170142
|
+
zodSchema: zodSchema77,
|
|
169456
170143
|
interaction: {
|
|
169457
170144
|
startedMsg: () => `Updating Argent to ${getUpdateState().installableVersion ?? "latest"}`,
|
|
169458
170145
|
completedMsg: () => `Updated Argent to ${getUpdateState().installableVersion ?? "latest"}`,
|
|
@@ -169543,7 +170230,7 @@ var updateArgentTool = {
|
|
|
169543
170230
|
// ../tool-server/src/tools/system/dismiss-update.ts
|
|
169544
170231
|
init_zod();
|
|
169545
170232
|
var MAX_HOURS = 24 * 365 * 10;
|
|
169546
|
-
var
|
|
170233
|
+
var zodSchema78 = external_exports.object({
|
|
169547
170234
|
hours: external_exports.number().min(0).describe(
|
|
169548
170235
|
"Hours until reminders resume: 168 is a week, 87600 is the longest, 0 turns them back on"
|
|
169549
170236
|
)
|
|
@@ -169551,7 +170238,7 @@ var zodSchema77 = external_exports.object({
|
|
|
169551
170238
|
var dismissUpdateTool = {
|
|
169552
170239
|
id: "dismiss-update",
|
|
169553
170240
|
description: "Postpone the Argent update reminder, on every tool-server on this machine, when the user wants it later or tomorrow, wants it stopped, or never wants it (87600 hours). Installs nothing. A memory or a reminder of your own does not change it. Returns { message, remindersResumeAt, persisted, pendingVersion }: tell the user when reminders resume, and if persisted is false, that it did not fully hold.",
|
|
169554
|
-
zodSchema:
|
|
170241
|
+
zodSchema: zodSchema78,
|
|
169555
170242
|
interaction: {
|
|
169556
170243
|
startedMsg: () => "Dismissing Argent update",
|
|
169557
170244
|
completedMsg: () => "Dismissed Argent update",
|
|
@@ -169604,7 +170291,7 @@ var fileInputs8 = [
|
|
|
169604
170291
|
{ target: "currentPath", path: "${currentPath}", kind: "file", optional: true },
|
|
169605
170292
|
{ target: "outputDir", path: "${outputDir}", kind: "probe", optional: true }
|
|
169606
170293
|
];
|
|
169607
|
-
var
|
|
170294
|
+
var zodSchema79 = external_exports.object({
|
|
169608
170295
|
baselinePath: external_exports.string().min(1).optional().describe(
|
|
169609
170296
|
"Path to the saved baseline PNG file. Required unless captureBaseline is true; do not pass both."
|
|
169610
170297
|
),
|
|
@@ -169638,7 +170325,7 @@ Physical iPhones: live captures are device-wide and need no registered app.
|
|
|
169638
170325
|
</flag:macos-apps>Returns { summary, diffPath, contextDiffPath }. 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.
|
|
169639
170326
|
Ignores the fixed top status-bar band for both pixel and OCR text comparisons.
|
|
169640
170327
|
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.`,
|
|
169641
|
-
zodSchema:
|
|
170328
|
+
zodSchema: zodSchema79,
|
|
169642
170329
|
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>",
|
|
169643
170330
|
interaction: {
|
|
169644
170331
|
startedMsg: () => "Comparing screenshots",
|
|
@@ -169985,7 +170672,7 @@ async function captureElementFrame(registry2, udid, match, opts = {}) {
|
|
|
169985
170672
|
}
|
|
169986
170673
|
|
|
169987
170674
|
// ../tool-server/src/tools/variants/propose-variant.ts
|
|
169988
|
-
var
|
|
170675
|
+
var zodSchema80 = external_exports.object({
|
|
169989
170676
|
element: external_exports.string().min(1).max(200).describe(
|
|
169990
170677
|
'Human name of the on-screen element this variant targets, e.g. "Foo button" or "profile header". Repeated calls with the same element accumulate multiple variants on it. Used as the default screen matcher when `match` is omitted.'
|
|
169991
170678
|
),
|
|
@@ -170038,7 +170725,7 @@ arrives as a follow-up message (this is the case in an \`argent lens\` CLI sessi
|
|
|
170038
170725
|
|
|
170039
170726
|
Returns { round, elementId, variantId, element, variantCount, totalElements }: confirmation only;
|
|
170040
170727
|
it does not wait for the user.`,
|
|
170041
|
-
zodSchema:
|
|
170728
|
+
zodSchema: zodSchema80,
|
|
170042
170729
|
searchHint: "propose design variant alternative option for element non-blocking ab choice",
|
|
170043
170730
|
featureFlag: "argent-lens",
|
|
170044
170731
|
interaction: {
|
|
@@ -170069,7 +170756,7 @@ it does not wait for the user.`,
|
|
|
170069
170756
|
|
|
170070
170757
|
// ../tool-server/src/tools/variants/await-user-selection.ts
|
|
170071
170758
|
init_zod();
|
|
170072
|
-
var
|
|
170759
|
+
var zodSchema81 = external_exports.object({
|
|
170073
170760
|
timeoutSeconds: external_exports.number().int().min(5).max(86400).optional().describe(
|
|
170074
170761
|
"Max seconds to block this call before returning a re-awaitable { status: 'pending' } result (default 1800). The user's proposals stay live across timeouts; on 'pending' just call await_user_selection again. Lower this if your MCP client enforces a short request timeout."
|
|
170075
170762
|
)
|
|
@@ -170097,7 +170784,7 @@ Returns one of:
|
|
|
170097
170784
|
|
|
170098
170785
|
This tool is long-running; it intentionally holds the request open. It honors client
|
|
170099
170786
|
disconnects (aborts cleanly).`,
|
|
170100
|
-
zodSchema:
|
|
170787
|
+
zodSchema: zodSchema81,
|
|
170101
170788
|
searchHint: "await wait user selection choice variant blocking confirm picks complete",
|
|
170102
170789
|
featureFlag: "argent-lens",
|
|
170103
170790
|
// Hidden while an `argent lens` CLI session owns the preview window: there the
|
|
@@ -170150,7 +170837,7 @@ var tabAction = {
|
|
|
170150
170837
|
var capability37 = {
|
|
170151
170838
|
chromium: { app: true }
|
|
170152
170839
|
};
|
|
170153
|
-
var
|
|
170840
|
+
var zodSchema82 = external_exports.object({
|
|
170154
170841
|
udid: external_exports.string().describe("Chromium device id from `list-devices` (e.g. `chromium-cdp-9222`)."),
|
|
170155
170842
|
action: external_exports.enum(["list", "select", "new", "close"]).describe(
|
|
170156
170843
|
"list: enumerate tabs/windows. select: make a tab active. new: open a tab and activate it. close: close a tab; if it was active, another live tab becomes active."
|
|
@@ -170167,7 +170854,7 @@ var chromiumTabsTool = {
|
|
|
170167
170854
|
The active tab is what describe / gesture-tap / screenshot / debugger-evaluate / open-url all operate on, so select a tab before driving it. tabIds (\`t1\`, \`t2\`, \u2026) are stable for the session and never reused.
|
|
170168
170855
|
Use when an app exposes multiple windows or tabs and you need to inspect or drive one other than the current page, or to open/close a page during an e2e test.
|
|
170169
170856
|
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.`,
|
|
170170
|
-
zodSchema:
|
|
170857
|
+
zodSchema: zodSchema82,
|
|
170171
170858
|
searchHint: "tab tabs window windows switch select close new open multi-tab chromium electron",
|
|
170172
170859
|
interaction: {
|
|
170173
170860
|
startedMsg: ({ params }) => tabAction[params.action].started(params),
|
|
@@ -170284,7 +170971,7 @@ var cookieAction = {
|
|
|
170284
170971
|
var capability38 = {
|
|
170285
170972
|
chromium: { app: true }
|
|
170286
170973
|
};
|
|
170287
|
-
var
|
|
170974
|
+
var zodSchema83 = external_exports.object({
|
|
170288
170975
|
udid: external_exports.string().describe("Chromium device id from `list-devices` (e.g. `chromium-cdp-9222`)."),
|
|
170289
170976
|
action: external_exports.enum(["get", "set", "delete", "clear"]).describe(
|
|
170290
170977
|
"get: read cookies. set: create/update a cookie. delete: remove matching cookies. clear: remove ALL browser cookies."
|
|
@@ -170307,7 +170994,7 @@ var chromiumCookiesTool = {
|
|
|
170307
170994
|
\`set\` needs \`name\`, \`value\`, and \`url\` or \`domain\`; \`delete\` needs \`name\` and \`url\` or \`domain\`.
|
|
170308
170995
|
Use when seeding an authenticated session before an e2e test (set the session cookie, then navigate) or asserting cookie state after one.
|
|
170309
170996
|
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.`,
|
|
170310
|
-
zodSchema:
|
|
170997
|
+
zodSchema: zodSchema83,
|
|
170311
170998
|
searchHint: "cookies cookie get set delete clear httponly samesite session auth chromium",
|
|
170312
170999
|
interaction: {
|
|
170313
171000
|
startedMsg: ({ params }) => `${cookieAction[params.action].started} browser cookies`,
|
|
@@ -170388,7 +171075,7 @@ var storageAction = {
|
|
|
170388
171075
|
var capability39 = {
|
|
170389
171076
|
chromium: { app: true }
|
|
170390
171077
|
};
|
|
170391
|
-
var
|
|
171078
|
+
var zodSchema84 = external_exports.object({
|
|
170392
171079
|
udid: external_exports.string().describe("Chromium device id from `list-devices` (e.g. `chromium-cdp-9222`)."),
|
|
170393
171080
|
store: external_exports.enum(["local", "session"]).describe("`local`: localStorage. `session`: sessionStorage."),
|
|
170394
171081
|
action: external_exports.enum(["get", "set", "remove", "clear"]).describe(
|
|
@@ -170402,7 +171089,7 @@ var chromiumStorageTool = {
|
|
|
170402
171089
|
description: `Read and write localStorage / sessionStorage of a Chromium (CDP) app, for the origin of the active tab's page.
|
|
170403
171090
|
Use when seeding feature flags / auth tokens before an e2e test or asserting persisted app state after one.
|
|
170404
171091
|
Returns { value } for one key, { entries, count } for all keys, and { set } / { removed } / { cleared } for the writes. Fails if the device is not a Chromium (CDP) device, or the action is missing the \`key\` / \`value\` it needs.`,
|
|
170405
|
-
zodSchema:
|
|
171092
|
+
zodSchema: zodSchema84,
|
|
170406
171093
|
searchHint: "storage localstorage sessionstorage local session get set remove clear key value chromium",
|
|
170407
171094
|
// Agents read and write Web Storage with debugger-evaluate, which runs the same
|
|
170408
171095
|
// Runtime.evaluate on the active page. The SDK and the e2e-full suite still call it.
|
|
@@ -170621,7 +171308,7 @@ async function stub(app, params) {
|
|
|
170621
171308
|
});
|
|
170622
171309
|
return { armed, mode, panelKind };
|
|
170623
171310
|
}
|
|
170624
|
-
var
|
|
171311
|
+
var zodSchema85 = external_exports.object({
|
|
170625
171312
|
udid: external_exports.string().describe("Mac app id from `list-devices` (macos-app-<bundle id>)."),
|
|
170626
171313
|
action: external_exports.enum(["list", "choose", "cancel", "discard", "stub"]).describe(
|
|
170627
171314
|
"list: the open file panels. choose: answer a panel with path or paths. cancel: cancel a panel. discard: answer a panel with its Delete or Don't Save button. stub: arm an answer or a cancel for the next panel the app presents (stubMode)."
|
|
@@ -170654,7 +171341,7 @@ For stub, panelKind names the kind of panel the answer is for; without it, paths
|
|
|
170654
171341
|
A sandboxed app that argent started is given access to the chosen paths only. A save panel that lists file formats refuses a path whose extension matches none of them, also a path with no extension, unless it saves any file (public.data, public.item) or allows other file types. On macOS 15 and later, the extension picks the format. argent does not check a path for an open panel against the panel's allowed file types.
|
|
170655
171342
|
Returns { panels } for list, { chosen, panel, kind, paths } for choose, { cancelled, panel } for cancel, { discarded, panel } for discard, { armed, mode, panelKind? } for stub.
|
|
170656
171343
|
Fails if no panel appears within timeoutMs, if more than one panel is open and panel is not given, if a path is relative or does not exist (a save panel needs an existing folder), if a path for a save panel is an existing folder other than a document package the panel saves, if the path does not fit the panel choose finds (a folder for a panel of files, a file for a panel of folders, a refused extension), if discard finds no Delete or Don't Save button, or if the Mac app is not running.`,
|
|
170657
|
-
zodSchema:
|
|
171344
|
+
zodSchema: zodSchema85,
|
|
170658
171345
|
searchHint: "file panel dialog open save choose pick file folder nsopenpanel nssavepanel mac app",
|
|
170659
171346
|
featureFlag: "macos-apps",
|
|
170660
171347
|
interaction: {
|
|
@@ -170756,7 +171443,7 @@ function renderMenus(items, depth, lines) {
|
|
|
170756
171443
|
if (item.items) renderMenus(item.items, depth + 1, lines);
|
|
170757
171444
|
}
|
|
170758
171445
|
}
|
|
170759
|
-
var
|
|
171446
|
+
var zodSchema86 = external_exports.object({
|
|
170760
171447
|
udid: external_exports.string().describe("Mac app id from `list-devices` (macos-app-<bundle id>)."),
|
|
170761
171448
|
action: external_exports.enum(["list", "choose"]).describe(
|
|
170762
171449
|
"list: the app's menu bar, one line per item. choose: run one menu item, by path or identifier."
|
|
@@ -170772,7 +171459,7 @@ var menuBarTool = {
|
|
|
170772
171459
|
Use when a command lives in the app's menus. Use keyboard instead for a shortcut you already know, and file-panel for the open or save panel that a command shows.
|
|
170773
171460
|
list returns { menuBar }, one line per item indented under its menu: the title (a menu ends with " >"), [disabled] or [checked], the shortcut in keyboard syntax, and id="..." when the item has one. choose takes path (the titles from the menu bar down, e.g. ["File", "Export..."]) or identifier, and returns { chosen } with the path; the command runs right after the reply.
|
|
170774
171461
|
Fails if no item matches (the error lists the titles at that level), if the item is disabled or is a menu, if a menu of the app is open, or if the device is not a Mac app.`,
|
|
170775
|
-
zodSchema:
|
|
171462
|
+
zodSchema: zodSchema86,
|
|
170776
171463
|
searchHint: "menu bar main menu command item file edit view window help choose mac app",
|
|
170777
171464
|
featureFlag: "macos-apps",
|
|
170778
171465
|
interaction: {
|
|
@@ -170906,6 +171593,7 @@ function createRegistry() {
|
|
|
170906
171593
|
registry2.registerTool(networkRequestTool);
|
|
170907
171594
|
registry2.registerTool(createNetworkCaptureStartTool(registry2));
|
|
170908
171595
|
registry2.registerTool(createNetworkCaptureStopTool(registry2));
|
|
171596
|
+
registry2.registerTool(createAwaitNetworkRequestTool(registry2));
|
|
170909
171597
|
registry2.registerTool(createDescribeTool(registry2));
|
|
170910
171598
|
registry2.registerTool(createUiTreeTool(registry2));
|
|
170911
171599
|
registry2.registerTool(createForegroundAppTool(registry2));
|