@swmansion/argent 0.34.1-next.81 → 0.34.1-next.83
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 +973 -201
- 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.82";
|
|
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));
|
|
@@ -124749,6 +124795,10 @@ function forgetNativeUnavailableOf(devices2) {
|
|
|
124749
124795
|
if (!covered || covered.has(key2.slice(0, key2.lastIndexOf(":")))) nativeUnavailable.delete(key2);
|
|
124750
124796
|
}
|
|
124751
124797
|
}
|
|
124798
|
+
function captureSweepUnderWay(udid) {
|
|
124799
|
+
const device = lockDevice(udid);
|
|
124800
|
+
return [...captureSweeps].some((sweep) => !sweep.devices || sweep.devices.has(device));
|
|
124801
|
+
}
|
|
124752
124802
|
function withCaptureLock(udid, bundleId, fn) {
|
|
124753
124803
|
const device = lockDevice(udid);
|
|
124754
124804
|
const sweeps = [...captureSweeps].filter((sweep) => !sweep.devices || sweep.devices.has(device)).map((sweep) => sweep.done);
|
|
@@ -127529,17 +127579,10 @@ function makeNetworkLogReadScript(start2, limit, metroPort2) {
|
|
|
127529
127579
|
var log = globalThis.__argent_network_log;
|
|
127530
127580
|
if (!log) return JSON.stringify({ entries: [], total: 0, interceptorInstalled: false });
|
|
127531
127581
|
|
|
127532
|
-
|
|
127582
|
+
${metroFilter(metroPort2)}
|
|
127533
127583
|
var filtered = [];
|
|
127534
127584
|
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);
|
|
127585
|
+
if (!isMetro(log[i])) filtered.push(log[i]);
|
|
127543
127586
|
}
|
|
127544
127587
|
|
|
127545
127588
|
var total = filtered.length;
|
|
@@ -127574,6 +127617,50 @@ function makeNetworkLogReadScript(start2, limit, metroPort2) {
|
|
|
127574
127617
|
});
|
|
127575
127618
|
})()`;
|
|
127576
127619
|
}
|
|
127620
|
+
function metroFilter(metroPort2) {
|
|
127621
|
+
return `function isMetro(e) {
|
|
127622
|
+
var u = e.request && e.request.url;
|
|
127623
|
+
return typeof u === 'string' && (u.indexOf('://localhost:${metroPort2}') !== -1 || u.indexOf('://127.0.0.1:${metroPort2}') !== -1);
|
|
127624
|
+
}`;
|
|
127625
|
+
}
|
|
127626
|
+
function makeNetworkWaitReadScript(mark, metroPort2) {
|
|
127627
|
+
return `(function() {
|
|
127628
|
+
var g = globalThis;
|
|
127629
|
+
var xhr = typeof g.XMLHttpRequest === 'function';
|
|
127630
|
+
var log = g.__argent_network_log;
|
|
127631
|
+
if (typeof g.__argent_network_mark !== 'function' || !Array.isArray(log)) {
|
|
127632
|
+
return JSON.stringify({ installed: false, xhr: xhr });
|
|
127633
|
+
}
|
|
127634
|
+
${metroFilter(metroPort2)}
|
|
127635
|
+
var token = typeof g.__argent_network_install === 'string' ? g.__argent_network_install : null;
|
|
127636
|
+
var markToken = ${JSON.stringify(mark.install)};
|
|
127637
|
+
var lastId = ${mark.install === null ? 0 : mark.lastId};
|
|
127638
|
+
var sameContext = markToken !== null && token === markToken;
|
|
127639
|
+
var entries = [];
|
|
127640
|
+
for (var i = 0; i < log.length; i++) {
|
|
127641
|
+
var e = log[i];
|
|
127642
|
+
if (sameContext && !(e.id > lastId)) continue;
|
|
127643
|
+
if (isMetro(e)) continue;
|
|
127644
|
+
entries.push({
|
|
127645
|
+
requestId: e.requestId,
|
|
127646
|
+
state: e.state,
|
|
127647
|
+
method: e.request ? e.request.method : undefined,
|
|
127648
|
+
url: e.request ? e.request.url : undefined,
|
|
127649
|
+
status: e.response ? e.response.status : undefined,
|
|
127650
|
+
durationMs: e.durationMs,
|
|
127651
|
+
errorText: e.errorText,
|
|
127652
|
+
timestamp: e.timestamp
|
|
127653
|
+
});
|
|
127654
|
+
}
|
|
127655
|
+
return JSON.stringify({
|
|
127656
|
+
installed: true,
|
|
127657
|
+
xhr: xhr,
|
|
127658
|
+
token: token,
|
|
127659
|
+
paused: g.__argent_network_paused === true,
|
|
127660
|
+
entries: entries
|
|
127661
|
+
});
|
|
127662
|
+
})()`;
|
|
127663
|
+
}
|
|
127577
127664
|
function makeNetworkDetailReadScript(requestId) {
|
|
127578
127665
|
return `(function() {
|
|
127579
127666
|
var byId = globalThis.__argent_network_by_id;
|
|
@@ -127672,6 +127759,18 @@ function jsCapturesOn(device) {
|
|
|
127672
127759
|
function findJsCapture(device, bundleId) {
|
|
127673
127760
|
return jsCapturesOn(device).find((capture) => capture.bundleId === bundleId);
|
|
127674
127761
|
}
|
|
127762
|
+
function findJsCaptureOfDevice(udid, bundleId) {
|
|
127763
|
+
let byPhysical;
|
|
127764
|
+
for (const [payload, capture] of jsCaptures) {
|
|
127765
|
+
if (capture.bundleId !== bundleId) continue;
|
|
127766
|
+
const { port, device } = splitPayload(payload);
|
|
127767
|
+
if (sameDevice(device, udid)) return { payload, port, capture };
|
|
127768
|
+
if (capture.physicalDeviceId !== void 0 && sameDevice(capture.physicalDeviceId, udid)) {
|
|
127769
|
+
byPhysical ??= { payload, port, capture };
|
|
127770
|
+
}
|
|
127771
|
+
}
|
|
127772
|
+
return byPhysical;
|
|
127773
|
+
}
|
|
127675
127774
|
function jsCapturesOfAppOn(port, bundleId, exceptDevice) {
|
|
127676
127775
|
return [...jsCaptures].filter(([payload, capture]) => {
|
|
127677
127776
|
const { port: on, device } = splitPayload(payload);
|
|
@@ -136983,9 +137082,9 @@ async function invokeSubTool(registry2, ctx, toolId, args, extra) {
|
|
|
136983
137082
|
}
|
|
136984
137083
|
function describeNestedParamError(registry2, err, toolId, dispatchedArgs, authoredArgs) {
|
|
136985
137084
|
if (getFailureSignal(err)?.error_code !== FAILURE_CODES.TOOL_INPUT_INVALID) return void 0;
|
|
136986
|
-
const
|
|
136987
|
-
if (!
|
|
136988
|
-
const parsed2 =
|
|
137085
|
+
const zodSchema87 = registry2.getTool(toolId)?.zodSchema;
|
|
137086
|
+
if (!zodSchema87) return void 0;
|
|
137087
|
+
const parsed2 = zodSchema87.safeParse(dispatchedArgs ?? {});
|
|
136989
137088
|
if (parsed2.success) return void 0;
|
|
136990
137089
|
return `Invalid params for tool "${toolId}": ${describeParamIssues(parsed2.error, authoredArgs)}`;
|
|
136991
137090
|
}
|
|
@@ -137013,7 +137112,10 @@ var ALLOWED_TOOLS = /* @__PURE__ */ new Set([
|
|
|
137013
137112
|
// it returns state only; the capture comes once, after the last step.
|
|
137014
137113
|
"fold",
|
|
137015
137114
|
"tv-remote",
|
|
137016
|
-
AWAIT_UI_ELEMENT_TOOL_ID
|
|
137115
|
+
AWAIT_UI_ELEMENT_TOOL_ID,
|
|
137116
|
+
// Returns its match or near misses, never an image: after network-capture-start, an
|
|
137117
|
+
// action and its wait run as one sequence, and an unmet wait stops it.
|
|
137118
|
+
AWAIT_NETWORK_REQUEST_TOOL_ID
|
|
137017
137119
|
]);
|
|
137018
137120
|
var capability25 = {
|
|
137019
137121
|
// Physical iOS is a valid outer target. Unsupported steps fail at their own gate, not the whole sequence.
|
|
@@ -137049,7 +137151,7 @@ function createRunSequenceTool(registry2) {
|
|
|
137049
137151
|
id: "run-sequence",
|
|
137050
137152
|
description: `Execute several device interaction steps in one call.
|
|
137051
137153
|
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
|
-
|
|
137154
|
+
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
137155
|
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
137156
|
On a TV target (Apple TV / Android TV / Vega) use tv-remote for remote presses and keyboard for text.
|
|
137055
137157
|
|
|
@@ -137070,7 +137172,8 @@ Allowed tools, their args (? = optional) and targets. Positions and distances ar
|
|
|
137070
137172
|
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
137173
|
tv-remote: button (one button, or an array run as a path in one step), repeat? [apple tv/android tv/vega]
|
|
137072
137174
|
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]
|
|
137175
|
+
await-ui-element: condition: "exists"|"visible"|"hidden"|"text", selector: { text?, identifier?, role? }, expectedText? (for "text"), textMatch?, timeoutMs?, pollIntervalMs? [all]
|
|
137176
|
+
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
137177
|
zodSchema: zodSchema30,
|
|
137075
137178
|
alwaysLoad: true,
|
|
137076
137179
|
searchHint: "batch sequence multiple gesture steps sequentially",
|
|
@@ -137115,8 +137218,8 @@ Allowed tools, their args (? = optional) and targets. Positions and distances ar
|
|
|
137115
137218
|
const toolArgs = { ...step.args, udid };
|
|
137116
137219
|
try {
|
|
137117
137220
|
const result = await invokeSubTool(registry2, ctx, step.tool, toolArgs);
|
|
137118
|
-
if (
|
|
137119
|
-
results.push({ tool: step.tool, error: unmetWaitReason(result) });
|
|
137221
|
+
if (isUnmetWaitResult(step.tool, result)) {
|
|
137222
|
+
results.push({ tool: step.tool, error: unmetWaitReason(step.tool, result) });
|
|
137120
137223
|
break;
|
|
137121
137224
|
}
|
|
137122
137225
|
results.push({ tool: step.tool, result });
|
|
@@ -139750,9 +139853,9 @@ var JS_ANSWER_WAIT_MS = 5e3;
|
|
|
139750
139853
|
function createNetworkCaptureStartTool(registry2) {
|
|
139751
139854
|
return {
|
|
139752
139855
|
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
|
|
139755
|
-
The JavaScript layer needs an app connected to Metro.
|
|
139856
|
+
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.
|
|
139857
|
+
On Chromium, Argent connects if needed and marks the start of the wait window. The log records while connected.
|
|
139858
|
+
The JavaScript layer needs an app connected to Metro. After a reload or relaunch, start capture again once JavaScript loads and before triggering the request. 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
139859
|
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
139860
|
When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_UNAVAILABLE or TOOL_DEPENDENCY_MISSING.`,
|
|
139758
139861
|
zodSchema: captureSchema,
|
|
@@ -139790,6 +139893,7 @@ When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_U
|
|
|
139790
139893
|
}
|
|
139791
139894
|
const port = metroPort({ device_id: params.udid, port: params.port });
|
|
139792
139895
|
const layers = await withCaptureLock(params.udid, params.bundleId, async () => {
|
|
139896
|
+
const nativeFloor = device.platform === "android" ? lastAndroidRecordNumber() : lastIosRecordNumber();
|
|
139793
139897
|
const app = device.platform === "macos" ? await macosAppOfCall(registry2, device, "network-capture-start", params.bundleId) : void 0;
|
|
139794
139898
|
if (device.platform === "ios-remote") await ensureDeps(["sim-remote"]);
|
|
139795
139899
|
if (run2.native && device.platform === "ios" && isInjectableBundleId(params.bundleId)) {
|
|
@@ -139808,9 +139912,14 @@ When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_U
|
|
|
139808
139912
|
)
|
|
139809
139913
|
] : [],
|
|
139810
139914
|
...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)
|
|
139915
|
+
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
139916
|
] : []
|
|
139813
|
-
])
|
|
139917
|
+
]).then((started) => {
|
|
139918
|
+
if (!started.every((layer) => layer.unavailable)) {
|
|
139919
|
+
noteCaptureStart(params.udid, params.bundleId, started, nativeFloor);
|
|
139920
|
+
}
|
|
139921
|
+
return started;
|
|
139922
|
+
});
|
|
139814
139923
|
});
|
|
139815
139924
|
if (layers.every((layer) => layer.unavailable)) {
|
|
139816
139925
|
const error63 = unavailableError(params, layers);
|
|
@@ -139824,7 +139933,7 @@ When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_U
|
|
|
139824
139933
|
}
|
|
139825
139934
|
};
|
|
139826
139935
|
}
|
|
139827
|
-
async function startMacosLayer(app, device, bundleId) {
|
|
139936
|
+
async function startMacosLayer(app, device, bundleId, port) {
|
|
139828
139937
|
const notTurnedOn = (reason3) => {
|
|
139829
139938
|
app.forgetNetworkCaptureStart();
|
|
139830
139939
|
setNativeUnavailable(device.id, bundleId, reason3);
|
|
@@ -139838,7 +139947,7 @@ async function startMacosLayer(app, device, bundleId) {
|
|
|
139838
139947
|
const refusal = app.isConnected() ? void 0 : await macosLaunchRefusal(bundleId);
|
|
139839
139948
|
if (refusal) return notTurnedOn(refusal);
|
|
139840
139949
|
setNativeUnavailable(device.id, bundleId);
|
|
139841
|
-
const { armed, reason: reason2 } = await app.startNetworkCapture();
|
|
139950
|
+
const { armed, reason: reason2 } = await app.startNetworkCapture(port);
|
|
139842
139951
|
return { layer: "macos-native", armed, ...reason2 ? { reason: reason2 } : {} };
|
|
139843
139952
|
}
|
|
139844
139953
|
async function startChromiumLayer(registry2, device) {
|
|
@@ -139907,6 +140016,7 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
|
|
|
139907
140016
|
return lost ? unavailable2("js", text) : { layer: "js", armed: false, reason: text };
|
|
139908
140017
|
}
|
|
139909
140018
|
if (lost && recording) {
|
|
140019
|
+
dropJsMark(payload);
|
|
139910
140020
|
return {
|
|
139911
140021
|
layer: "js",
|
|
139912
140022
|
armed: false,
|
|
@@ -139923,7 +140033,6 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
|
|
|
139923
140033
|
setJsCapture(payload, {
|
|
139924
140034
|
bundleId,
|
|
139925
140035
|
intent: "started",
|
|
139926
|
-
mark: { install: null },
|
|
139927
140036
|
installed: installedHere,
|
|
139928
140037
|
physicalDeviceId: udid,
|
|
139929
140038
|
...installedHere && found?.paused ? { paused: true } : {}
|
|
@@ -139938,6 +140047,7 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
|
|
|
139938
140047
|
if (appId !== void 0 && appId !== bundleId) {
|
|
139939
140048
|
const notOurs = `the JS runtime on Metro port ${port} is ${appId}'s, not ${bundleId}'s`;
|
|
139940
140049
|
if (recording) {
|
|
140050
|
+
dropJsMark(payload);
|
|
139941
140051
|
return {
|
|
139942
140052
|
layer: "js",
|
|
139943
140053
|
armed: false,
|
|
@@ -139961,7 +140071,6 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
|
|
|
139961
140071
|
try {
|
|
139962
140072
|
capture.mark = await readMark(dbg);
|
|
139963
140073
|
} catch (err) {
|
|
139964
|
-
capture.mark = { install: null };
|
|
139965
140074
|
if (installedHere && found?.paused) capture.paused = true;
|
|
139966
140075
|
return {
|
|
139967
140076
|
layer: "js",
|
|
@@ -139993,6 +140102,10 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
|
|
|
139993
140102
|
};
|
|
139994
140103
|
}
|
|
139995
140104
|
}
|
|
140105
|
+
function dropJsMark(payload) {
|
|
140106
|
+
const kept = jsCapture(payload);
|
|
140107
|
+
if (kept) delete kept.mark;
|
|
140108
|
+
}
|
|
139996
140109
|
async function readMark(dbg) {
|
|
139997
140110
|
const answer = await dbg.cdp.evaluate(NETWORK_CAPTURE_MARK_SCRIPT, {
|
|
139998
140111
|
timeout: JS_ANSWER_WAIT_MS
|
|
@@ -140100,7 +140213,7 @@ function createNetworkCaptureStopTool(registry2) {
|
|
|
140100
140213
|
return {
|
|
140101
140214
|
id: "network-capture-stop",
|
|
140102
140215
|
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
|
|
140216
|
+
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
140217
|
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
140218
|
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
140219
|
zodSchema: captureSchema,
|
|
@@ -140369,7 +140482,7 @@ async function stopChromiumLayer(registry2, device) {
|
|
|
140369
140482
|
layer: "chromium",
|
|
140370
140483
|
armed: false,
|
|
140371
140484
|
total: network.requests().length,
|
|
140372
|
-
reason: "view-network-logs keeps listing the tab's requests while argent is attached;
|
|
140485
|
+
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
140486
|
};
|
|
140374
140487
|
}
|
|
140375
140488
|
async function stopAndroidLayer(registry2, device, bundleId, port) {
|
|
@@ -141811,14 +141924,665 @@ Fails with FILL_NO_FOCUSED_FIELD when nothing editable has focus, FILL_NOT_VERIF
|
|
|
141811
141924
|
};
|
|
141812
141925
|
}
|
|
141813
141926
|
|
|
141927
|
+
// ../tool-server/src/tools/await-network-request/index.ts
|
|
141928
|
+
init_zod();
|
|
141929
|
+
init_src2();
|
|
141930
|
+
init_device_info();
|
|
141931
|
+
init_capability();
|
|
141932
|
+
|
|
141933
|
+
// ../tool-server/src/tools/await-network-request/layers.ts
|
|
141934
|
+
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";
|
|
141935
|
+
var SWEEP_UNDER_WAY = "stop-all-simulator-servers or the tool-server's exit is ending the app's capture";
|
|
141936
|
+
var CAPTURE_CHANGED = "the app's capture changed during the read (a network-capture-start or -stop, or a teardown of the device), so the read left the app's JS runtime as it was";
|
|
141937
|
+
async function liveService(registry2, ref) {
|
|
141938
|
+
return isLiveService(registry2, ref.urn) ? registry2.resolveService(ref.urn, ref.options) : void 0;
|
|
141939
|
+
}
|
|
141940
|
+
function unreadable(layer, note, stopped = false) {
|
|
141941
|
+
return { layer, readable: false, armed: false, stopped, records: [], note };
|
|
141942
|
+
}
|
|
141943
|
+
function recordNumber(id) {
|
|
141944
|
+
return Number(id.slice(id.lastIndexOf("-") + 1));
|
|
141945
|
+
}
|
|
141946
|
+
var LOST_ENDINGS = /* @__PURE__ */ new Set([
|
|
141947
|
+
STOPPED_BEFORE_FINISH,
|
|
141948
|
+
LOST_WHILE_DISCONNECTED,
|
|
141949
|
+
AGENT_GONE_REASON,
|
|
141950
|
+
NOT_RECONNECTED,
|
|
141951
|
+
PROCESS_ENDED,
|
|
141952
|
+
MACOS_CONNECTION_DROPPED
|
|
141953
|
+
]);
|
|
141954
|
+
function fromNative(record2) {
|
|
141955
|
+
const lost = record2.state === "failed" && record2.errorText !== void 0 && LOST_ENDINGS.has(record2.errorText);
|
|
141956
|
+
return {
|
|
141957
|
+
id: record2.id,
|
|
141958
|
+
layer: record2.layer,
|
|
141959
|
+
method: record2.request.method,
|
|
141960
|
+
url: record2.request.url,
|
|
141961
|
+
...record2.response ? { status: record2.response.status } : {},
|
|
141962
|
+
state: lost ? "lost" : record2.state,
|
|
141963
|
+
...record2.timing.durationMs !== void 0 ? { durationMs: Math.round(record2.timing.durationMs) } : {},
|
|
141964
|
+
...record2.errorText ? { errorText: record2.errorText } : {},
|
|
141965
|
+
// From the agent's wallTime, on the app's clock, as the start of a JS request.
|
|
141966
|
+
startedAt: record2.timing.startedAt
|
|
141967
|
+
};
|
|
141968
|
+
}
|
|
141969
|
+
function nativeAfter(records, floor) {
|
|
141970
|
+
return records.filter((r) => recordNumber(r.id) > floor).map(fromNative);
|
|
141971
|
+
}
|
|
141972
|
+
async function markedLayers(registry2, device, bundleId) {
|
|
141973
|
+
const layers = [];
|
|
141974
|
+
const start2 = lastCaptureStart(device.id, bundleId);
|
|
141975
|
+
const startWindow = {
|
|
141976
|
+
current: (layer, stopped) => !start2 || start2.layers.has(layer) || layer !== "js" && !stopped,
|
|
141977
|
+
floor: (mark) => Math.max(mark.lastRecord, start2?.nativeFloor ?? 0)
|
|
141978
|
+
};
|
|
141979
|
+
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);
|
|
141980
|
+
if (native) layers.push(native);
|
|
141981
|
+
if (device.platform !== "chromium") {
|
|
141982
|
+
const js = jsLayer(registry2, device, bundleId, startWindow);
|
|
141983
|
+
if (js) layers.push(js);
|
|
141984
|
+
}
|
|
141985
|
+
return layers;
|
|
141986
|
+
}
|
|
141987
|
+
async function iosLayer(registry2, device, bundleId, startWindow) {
|
|
141988
|
+
const ref = nativeDevtoolsRef(device);
|
|
141989
|
+
const resolve21 = () => liveService(registry2, ref);
|
|
141990
|
+
const found = await resolve21();
|
|
141991
|
+
if (!found?.networkCaptureMark(bundleId)) return void 0;
|
|
141992
|
+
if (!startWindow.current("ios-native", found.isNetworkCaptureStopped(bundleId))) return void 0;
|
|
141993
|
+
return {
|
|
141994
|
+
layer: "ios-native",
|
|
141995
|
+
async read() {
|
|
141996
|
+
const api = await resolve21();
|
|
141997
|
+
const mark = api?.networkCaptureMark(bundleId);
|
|
141998
|
+
if (!api || !mark) return unreadable("ios-native", CAPTURE_ENDED);
|
|
141999
|
+
const stopped = api.isNetworkCaptureStopped(bundleId);
|
|
142000
|
+
const store = api.networkRecords(bundleId);
|
|
142001
|
+
const state3 = store?.state();
|
|
142002
|
+
const armed = stopped || state3?.armed === true;
|
|
142003
|
+
return {
|
|
142004
|
+
layer: "ios-native",
|
|
142005
|
+
readable: true,
|
|
142006
|
+
armed,
|
|
142007
|
+
stopped,
|
|
142008
|
+
records: nativeAfter(
|
|
142009
|
+
store?.records(mark.metroPort, { includeHidden: true }) ?? [],
|
|
142010
|
+
startWindow.floor(mark)
|
|
142011
|
+
),
|
|
142012
|
+
...armed ? {} : { note: state3?.note ?? "the app has not connected yet; capture arms when it does" }
|
|
142013
|
+
};
|
|
142014
|
+
}
|
|
142015
|
+
};
|
|
142016
|
+
}
|
|
142017
|
+
async function androidLayer(registry2, device, bundleId, startWindow) {
|
|
142018
|
+
const ref = androidNetworkInspectorRef(device, bundleId, metroPort({ device_id: device.id }));
|
|
142019
|
+
const resolve21 = () => liveService(registry2, ref);
|
|
142020
|
+
const found = await resolve21();
|
|
142021
|
+
if (!found?.captureMark()) return void 0;
|
|
142022
|
+
if (!startWindow.current("android-native", found.isStopped())) return void 0;
|
|
142023
|
+
return {
|
|
142024
|
+
layer: "android-native",
|
|
142025
|
+
async read() {
|
|
142026
|
+
const api = await resolve21();
|
|
142027
|
+
const mark = api?.captureMark();
|
|
142028
|
+
if (!api || !mark) return unreadable("android-native", CAPTURE_ENDED);
|
|
142029
|
+
const stopped = api.isStopped();
|
|
142030
|
+
const state3 = api.state();
|
|
142031
|
+
const armed = stopped || state3.armed && state3.capture?.state !== "unavailable";
|
|
142032
|
+
return {
|
|
142033
|
+
layer: "android-native",
|
|
142034
|
+
readable: true,
|
|
142035
|
+
armed,
|
|
142036
|
+
stopped,
|
|
142037
|
+
records: nativeAfter(
|
|
142038
|
+
api.records(mark.metroPort, { includeHidden: true }),
|
|
142039
|
+
startWindow.floor(mark)
|
|
142040
|
+
),
|
|
142041
|
+
...armed ? {} : {
|
|
142042
|
+
note: state3.note ?? state3.capture?.detail ?? api.unavailableReason() ?? "the app's agent has not armed yet"
|
|
142043
|
+
}
|
|
142044
|
+
};
|
|
142045
|
+
}
|
|
142046
|
+
};
|
|
142047
|
+
}
|
|
142048
|
+
async function macosLayer(registry2, device, startWindow) {
|
|
142049
|
+
const ref = macosAppRef(device);
|
|
142050
|
+
const resolve21 = () => liveService(registry2, ref);
|
|
142051
|
+
const found = await resolve21();
|
|
142052
|
+
if (!found?.networkCaptureMark()) return void 0;
|
|
142053
|
+
if (!startWindow.current("macos-native", found.isNetworkCaptureStopped())) return void 0;
|
|
142054
|
+
return {
|
|
142055
|
+
layer: "macos-native",
|
|
142056
|
+
async read() {
|
|
142057
|
+
const app = await resolve21();
|
|
142058
|
+
const mark = app?.networkCaptureMark();
|
|
142059
|
+
if (!app || !mark) return unreadable("macos-native", CAPTURE_ENDED);
|
|
142060
|
+
const stopped = app.isNetworkCaptureStopped();
|
|
142061
|
+
const store = app.networkRecords();
|
|
142062
|
+
const state3 = store.state();
|
|
142063
|
+
const armed = stopped || state3.armed;
|
|
142064
|
+
return {
|
|
142065
|
+
layer: "macos-native",
|
|
142066
|
+
readable: true,
|
|
142067
|
+
armed,
|
|
142068
|
+
stopped,
|
|
142069
|
+
records: nativeAfter(
|
|
142070
|
+
store.records(mark.metroPort, { includeHidden: true }),
|
|
142071
|
+
startWindow.floor(mark)
|
|
142072
|
+
),
|
|
142073
|
+
...armed ? {} : { note: state3.note ?? "the app has not connected to argent yet" }
|
|
142074
|
+
};
|
|
142075
|
+
}
|
|
142076
|
+
};
|
|
142077
|
+
}
|
|
142078
|
+
function fromChromium(record2) {
|
|
142079
|
+
return {
|
|
142080
|
+
id: record2.requestId,
|
|
142081
|
+
layer: "chromium",
|
|
142082
|
+
method: record2.method,
|
|
142083
|
+
url: record2.url,
|
|
142084
|
+
...record2.status !== void 0 ? { status: record2.status } : {},
|
|
142085
|
+
state: record2.failed ? "failed" : record2.finished ? "complete" : record2.status !== void 0 ? "headers" : "pending",
|
|
142086
|
+
...record2.durationMs !== void 0 ? { durationMs: Math.round(record2.durationMs) } : {},
|
|
142087
|
+
...record2.errorText ? { errorText: record2.errorText } : {}
|
|
142088
|
+
};
|
|
142089
|
+
}
|
|
142090
|
+
async function chromiumLayer(registry2, device) {
|
|
142091
|
+
const ref = chromiumCdpRef(device);
|
|
142092
|
+
const resolve21 = () => liveService(registry2, ref);
|
|
142093
|
+
if (!(await resolve21())?.server.network.captureMark()) return void 0;
|
|
142094
|
+
return {
|
|
142095
|
+
layer: "chromium",
|
|
142096
|
+
async read() {
|
|
142097
|
+
const network = (await resolve21())?.server.network;
|
|
142098
|
+
const mark = network?.captureMark();
|
|
142099
|
+
if (!network || !mark) return unreadable("chromium", CAPTURE_ENDED);
|
|
142100
|
+
const stopped = mark.stoppedSeq !== void 0;
|
|
142101
|
+
return {
|
|
142102
|
+
layer: "chromium",
|
|
142103
|
+
readable: true,
|
|
142104
|
+
armed: true,
|
|
142105
|
+
stopped,
|
|
142106
|
+
records: network.requestsAfter(mark.lastSeq).filter(({ seq }) => mark.stoppedSeq === void 0 || seq <= mark.stoppedSeq).map(({ record: record2 }) => fromChromium(record2))
|
|
142107
|
+
};
|
|
142108
|
+
}
|
|
142109
|
+
};
|
|
142110
|
+
}
|
|
142111
|
+
function fromJs(entry) {
|
|
142112
|
+
const state3 = entry.state === "finished" ? "complete" : entry.state === "failed" ? "failed" : entry.status !== void 0 ? "headers" : "pending";
|
|
142113
|
+
return {
|
|
142114
|
+
id: entry.requestId ?? "",
|
|
142115
|
+
layer: "js",
|
|
142116
|
+
method: entry.method ?? "",
|
|
142117
|
+
url: entry.url ?? "",
|
|
142118
|
+
...typeof entry.status === "number" ? { status: entry.status } : {},
|
|
142119
|
+
state: state3,
|
|
142120
|
+
...typeof entry.durationMs === "number" ? { durationMs: Math.round(entry.durationMs) } : {},
|
|
142121
|
+
...entry.errorText ? { errorText: entry.errorText } : {},
|
|
142122
|
+
...typeof entry.timestamp === "number" ? { startedAt: entry.timestamp * 1e3 } : {}
|
|
142123
|
+
};
|
|
142124
|
+
}
|
|
142125
|
+
function jsLayer(registry2, device, bundleId, startWindow) {
|
|
142126
|
+
const found = findJsCaptureOfDevice(device.id, bundleId);
|
|
142127
|
+
if (!found?.capture.mark) return void 0;
|
|
142128
|
+
if (!startWindow.current("js", found.capture.intent === "stopped")) return void 0;
|
|
142129
|
+
return {
|
|
142130
|
+
layer: "js",
|
|
142131
|
+
async read(budgetMs) {
|
|
142132
|
+
const found2 = findJsCaptureOfDevice(device.id, bundleId);
|
|
142133
|
+
const mark = found2?.capture.mark;
|
|
142134
|
+
if (!found2 || !mark) return unreadable("js", CAPTURE_ENDED);
|
|
142135
|
+
const { payload, port, capture } = found2;
|
|
142136
|
+
let stopped = capture.intent === "stopped";
|
|
142137
|
+
const physical = capture.physicalDeviceId ?? device.id;
|
|
142138
|
+
if (captureSweepUnderWay(physical)) return unreadable("js", SWEEP_UNDER_WAY, stopped);
|
|
142139
|
+
const urn = `${JS_RUNTIME_DEBUGGER_NAMESPACE}:${payload}`;
|
|
142140
|
+
const live = isLiveService(registry2, urn);
|
|
142141
|
+
if (stopped && !live) {
|
|
142142
|
+
return unreadable(
|
|
142143
|
+
"js",
|
|
142144
|
+
"the app's JS runtime is not connected, and a stopped capture does not reconnect to it",
|
|
142145
|
+
true
|
|
142146
|
+
);
|
|
142147
|
+
}
|
|
142148
|
+
const whileStarted = (change) => withCaptureLock(physical, bundleId, async () => {
|
|
142149
|
+
if (captureSweepUnderWay(physical)) return { note: SWEEP_UNDER_WAY };
|
|
142150
|
+
const now = findJsCaptureOfDevice(device.id, bundleId);
|
|
142151
|
+
if (!now?.capture.mark) return { note: CAPTURE_ENDED };
|
|
142152
|
+
if (now.capture !== capture || capture.intent !== "started") {
|
|
142153
|
+
return { note: CAPTURE_CHANGED };
|
|
142154
|
+
}
|
|
142155
|
+
return { value: await change() };
|
|
142156
|
+
});
|
|
142157
|
+
const target = payload.slice(payload.indexOf(":") + 1);
|
|
142158
|
+
try {
|
|
142159
|
+
const opened = live ? { value: await registry2.resolveService(urn) } : await whileStarted(
|
|
142160
|
+
() => resolveJsRuntime(registry2, physical, target !== physical ? target : void 0, port)
|
|
142161
|
+
);
|
|
142162
|
+
if ("note" in opened) return unreadable("js", opened.note);
|
|
142163
|
+
const dbg = opened.value;
|
|
142164
|
+
const appId = dbg.runtimeApp?.appId;
|
|
142165
|
+
if (appId !== void 0 && appId !== bundleId) {
|
|
142166
|
+
return unreadable(
|
|
142167
|
+
"js",
|
|
142168
|
+
`the JS runtime on Metro port ${port} is ${appId}'s, not ${bundleId}'s`,
|
|
142169
|
+
stopped
|
|
142170
|
+
);
|
|
142171
|
+
}
|
|
142172
|
+
const answer = JSON.parse(
|
|
142173
|
+
String(
|
|
142174
|
+
await dbg.cdp.evaluate(makeNetworkWaitReadScript(mark, port), {
|
|
142175
|
+
timeout: Math.max(1, budgetMs)
|
|
142176
|
+
})
|
|
142177
|
+
)
|
|
142178
|
+
);
|
|
142179
|
+
const pauseMissed = stopped && answer.installed && answer.paused === false;
|
|
142180
|
+
if (pauseMissed) stopped = false;
|
|
142181
|
+
const resume = !stopped && !pauseMissed && (!answer.installed || answer.paused === true);
|
|
142182
|
+
if (resume && answer.xhr !== true) {
|
|
142183
|
+
return unreadable("js", "the app's JavaScript has not loaded yet", stopped);
|
|
142184
|
+
}
|
|
142185
|
+
if (!answer.installed) {
|
|
142186
|
+
if (stopped) {
|
|
142187
|
+
return {
|
|
142188
|
+
layer: "js",
|
|
142189
|
+
readable: true,
|
|
142190
|
+
armed: true,
|
|
142191
|
+
stopped,
|
|
142192
|
+
records: [],
|
|
142193
|
+
note: "the app's JS runtime reloaded since the stop, which cleared its requests"
|
|
142194
|
+
};
|
|
142195
|
+
}
|
|
142196
|
+
const installed = await whileStarted(
|
|
142197
|
+
() => installNetworkInterceptor(dbg.cdp, payload, dbg.runtimeApp)
|
|
142198
|
+
);
|
|
142199
|
+
if ("note" in installed) return unreadable("js", installed.note);
|
|
142200
|
+
const install = installed.value;
|
|
142201
|
+
return unreadable(
|
|
142202
|
+
"js",
|
|
142203
|
+
install.installed ? "the app's JS runtime had no interceptor (it reloaded, or its JavaScript had not loaded at the start), so the wait installed it: requests from now on are recorded, earlier ones in that runtime are missing" : `the interceptor did not install: ${install.reason}`
|
|
142204
|
+
);
|
|
142205
|
+
}
|
|
142206
|
+
let note;
|
|
142207
|
+
if (resume) {
|
|
142208
|
+
const resumed = await whileStarted(
|
|
142209
|
+
() => installNetworkInterceptor(dbg.cdp, payload, dbg.runtimeApp)
|
|
142210
|
+
);
|
|
142211
|
+
if ("note" in resumed) return unreadable("js", resumed.note);
|
|
142212
|
+
const install = resumed.value;
|
|
142213
|
+
note = install.installed ? "a stop's pause was still in the app's JS runtime, so the wait resumed the capture: requests sent while it was paused are missing" : `a stop's pause is still in the app's JS runtime, and the wait could not resume it: ${install.reason}`;
|
|
142214
|
+
if (!install.installed) {
|
|
142215
|
+
return {
|
|
142216
|
+
layer: "js",
|
|
142217
|
+
readable: true,
|
|
142218
|
+
armed: false,
|
|
142219
|
+
stopped,
|
|
142220
|
+
records: (answer.entries ?? []).map(fromJs),
|
|
142221
|
+
note
|
|
142222
|
+
};
|
|
142223
|
+
}
|
|
142224
|
+
} else if (mark.install !== null && answer.token !== mark.install) {
|
|
142225
|
+
note = "the app's JS runtime reloaded after the start, so its requests between the reload and the interceptor's reinstall are missing";
|
|
142226
|
+
} else if (pauseMissed) {
|
|
142227
|
+
note = "the stop's pause did not reach the app's JS runtime, which still records: requests after the stop count";
|
|
142228
|
+
}
|
|
142229
|
+
return {
|
|
142230
|
+
layer: "js",
|
|
142231
|
+
readable: true,
|
|
142232
|
+
armed: true,
|
|
142233
|
+
stopped,
|
|
142234
|
+
records: (answer.entries ?? []).map(fromJs),
|
|
142235
|
+
...note ? { note } : {}
|
|
142236
|
+
};
|
|
142237
|
+
} catch (err) {
|
|
142238
|
+
const reason2 = classifyNotConnected(err);
|
|
142239
|
+
return unreadable(
|
|
142240
|
+
"js",
|
|
142241
|
+
reason2 !== void 0 ? jsNotReached(reason2, port, err) : `the app's JS runtime did not answer: ${errorMessage4(err)}`,
|
|
142242
|
+
stopped
|
|
142243
|
+
);
|
|
142244
|
+
}
|
|
142245
|
+
}
|
|
142246
|
+
};
|
|
142247
|
+
}
|
|
142248
|
+
|
|
142249
|
+
// ../tool-server/src/tools/await-network-request/match.ts
|
|
142250
|
+
function withoutStart({ startedAt: _, ...record2 }) {
|
|
142251
|
+
return record2;
|
|
142252
|
+
}
|
|
142253
|
+
var STATUS_CLASSES = ["1xx", "2xx", "3xx", "4xx", "5xx"];
|
|
142254
|
+
function urlMatches(criteria, url2) {
|
|
142255
|
+
switch (criteria.urlMatch) {
|
|
142256
|
+
case "equals":
|
|
142257
|
+
return url2.toLowerCase() === criteria.url.toLowerCase();
|
|
142258
|
+
case "matches":
|
|
142259
|
+
return (criteria.regex ??= new RegExp(criteria.url)).test(url2);
|
|
142260
|
+
default:
|
|
142261
|
+
return url2.toLowerCase().includes(criteria.url.toLowerCase());
|
|
142262
|
+
}
|
|
142263
|
+
}
|
|
142264
|
+
function statusMatches(wanted, status) {
|
|
142265
|
+
if (status === void 0) return false;
|
|
142266
|
+
if (typeof wanted === "number") return status === wanted;
|
|
142267
|
+
return Math.floor(status / 100) === Number(wanted[0]);
|
|
142268
|
+
}
|
|
142269
|
+
function outcomeMatches(outcome, state3) {
|
|
142270
|
+
if (outcome === "complete") return state3 === "complete";
|
|
142271
|
+
if (outcome === "failed") return state3 === "failed";
|
|
142272
|
+
return state3 === "complete" || state3 === "failed";
|
|
142273
|
+
}
|
|
142274
|
+
function mismatches(criteria, record2) {
|
|
142275
|
+
const failed3 = [];
|
|
142276
|
+
if (!urlMatches(criteria, record2.url)) failed3.push("url");
|
|
142277
|
+
if (criteria.method !== void 0 && record2.method.toLowerCase() !== criteria.method.toLowerCase()) {
|
|
142278
|
+
failed3.push("method");
|
|
142279
|
+
}
|
|
142280
|
+
if (criteria.status !== void 0 && !statusMatches(criteria.status, record2.status)) {
|
|
142281
|
+
failed3.push("status");
|
|
142282
|
+
}
|
|
142283
|
+
if (!outcomeMatches(criteria.outcome, record2.state)) failed3.push("outcome");
|
|
142284
|
+
return failed3;
|
|
142285
|
+
}
|
|
142286
|
+
function firstMatch(criteria, records) {
|
|
142287
|
+
const found = records.find((record2) => mismatches(criteria, record2).length === 0);
|
|
142288
|
+
return found && withoutStart(found);
|
|
142289
|
+
}
|
|
142290
|
+
var MAX_NEAR_MISSES = 3;
|
|
142291
|
+
var SAME_REQUEST_MS = 1e3;
|
|
142292
|
+
function sameRequest(a, b) {
|
|
142293
|
+
return a.layer !== b.layer && a.method.toLowerCase() === b.method.toLowerCase() && a.url === b.url && a.status === b.status && a.state === b.state && // A retry with the same fields starts later.
|
|
142294
|
+
(a.startedAt === void 0 || b.startedAt === void 0 || Math.abs(a.startedAt - b.startedAt) <= SAME_REQUEST_MS);
|
|
142295
|
+
}
|
|
142296
|
+
function nearMisses(criteria, records) {
|
|
142297
|
+
const ranked = records.map((record2, index) => ({ record: record2, mismatch: mismatches(criteria, record2), index })).sort(
|
|
142298
|
+
(a, b) => Number(a.mismatch.includes("url")) - Number(b.mismatch.includes("url")) || a.mismatch.length - b.mismatch.length || // A record without a start counts as the oldest; NaN, when neither has one, falls through.
|
|
142299
|
+
(b.record.startedAt ?? -Infinity) - (a.record.startedAt ?? -Infinity) || b.index - a.index
|
|
142300
|
+
);
|
|
142301
|
+
const listed = [];
|
|
142302
|
+
for (const { record: record2, mismatch: mismatch2 } of ranked) {
|
|
142303
|
+
if (listed.length === MAX_NEAR_MISSES) break;
|
|
142304
|
+
const of = listed.find((entry) => !entry.twin && sameRequest(entry.record, record2));
|
|
142305
|
+
if (of) of.twin = true;
|
|
142306
|
+
else listed.push({ record: record2, mismatch: mismatch2, twin: false });
|
|
142307
|
+
}
|
|
142308
|
+
return listed.map(({ record: record2, mismatch: mismatch2 }) => ({ ...withoutStart(record2), mismatch: mismatch2 }));
|
|
142309
|
+
}
|
|
142310
|
+
var NOTE_URL_CHARS = 120;
|
|
142311
|
+
function shortUrl(url2) {
|
|
142312
|
+
return url2.length > NOTE_URL_CHARS ? `${url2.slice(0, NOTE_URL_CHARS)}...` : url2;
|
|
142313
|
+
}
|
|
142314
|
+
function describeCriteria(criteria) {
|
|
142315
|
+
const url2 = criteria.urlMatch === "matches" ? `URL matching the regular expression "${shortUrl(criteria.url)}"` : `URL ${criteria.urlMatch === "equals" ? "equal to" : "containing"} "${shortUrl(criteria.url)}"`;
|
|
142316
|
+
return [
|
|
142317
|
+
criteria.method ? criteria.method.toUpperCase() : void 0,
|
|
142318
|
+
url2,
|
|
142319
|
+
criteria.status !== void 0 ? `status ${criteria.status}` : void 0,
|
|
142320
|
+
criteria.outcome === "any" ? "complete or failed" : criteria.outcome
|
|
142321
|
+
].filter(Boolean).join(", ");
|
|
142322
|
+
}
|
|
142323
|
+
function describeRecord(record2) {
|
|
142324
|
+
const parts2 = [
|
|
142325
|
+
`${record2.method || "?"} ${shortUrl(record2.url)}`,
|
|
142326
|
+
record2.status !== void 0 ? String(record2.status) : void 0,
|
|
142327
|
+
record2.state,
|
|
142328
|
+
record2.errorText ? `"${shortUrl(record2.errorText)}"` : void 0,
|
|
142329
|
+
`[${record2.layer} ${record2.id}]`
|
|
142330
|
+
];
|
|
142331
|
+
const mismatch2 = "mismatch" in record2 ? ` (mismatch: ${record2.mismatch.join(", ")})` : "";
|
|
142332
|
+
return `${parts2.filter(Boolean).join(" ")}${mismatch2}`;
|
|
142333
|
+
}
|
|
142334
|
+
|
|
142335
|
+
// ../tool-server/src/tools/await-network-request/index.ts
|
|
142336
|
+
var DEFAULT_TIMEOUT_MS4 = 1e4;
|
|
142337
|
+
var DEFAULT_POLL_INTERVAL_MS2 = 400;
|
|
142338
|
+
var MIN_JS_READ_MS = 1e3;
|
|
142339
|
+
var zodSchema44 = external_exports.object({
|
|
142340
|
+
udid: external_exports.string().min(1).describe(
|
|
142341
|
+
"Device ID passed as udid to network-capture-start, even if that call also used logicalDeviceId."
|
|
142342
|
+
),
|
|
142343
|
+
bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
|
|
142344
|
+
"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."
|
|
142345
|
+
),
|
|
142346
|
+
url: external_exports.string().min(1).describe(
|
|
142347
|
+
'URL text or pattern, such as "/v1/auth/login". Do not include secrets. The result includes the matched URL, and {{secret:...}} placeholders are rejected.'
|
|
142348
|
+
),
|
|
142349
|
+
urlMatch: external_exports.enum(["contains", "equals", "matches"]).optional().describe(
|
|
142350
|
+
"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."
|
|
142351
|
+
),
|
|
142352
|
+
method: external_exports.string().min(1).optional().describe("HTTP method such as POST. Ignores case."),
|
|
142353
|
+
status: external_exports.union([
|
|
142354
|
+
external_exports.enum(STATUS_CLASSES),
|
|
142355
|
+
external_exports.coerce.number().int().min(100).max(599)
|
|
142356
|
+
]).optional().describe(
|
|
142357
|
+
'Exact HTTP status such as 200 or a class such as "2xx". A failed request matches a status only if it received response headers.'
|
|
142358
|
+
),
|
|
142359
|
+
outcome: external_exports.enum(["complete", "failed", "any"]).optional().describe(
|
|
142360
|
+
"complete (default) means the response finished, regardless of HTTP status. failed matches a request error such as an abort. any accepts either."
|
|
142361
|
+
),
|
|
142362
|
+
timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(`Wait limit in milliseconds. Default ${DEFAULT_TIMEOUT_MS4}.`),
|
|
142363
|
+
pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(
|
|
142364
|
+
`Interval between capture reads in milliseconds. Default ${DEFAULT_POLL_INTERVAL_MS2}.`
|
|
142365
|
+
)
|
|
142366
|
+
}).strict().superRefine((params, ctx) => {
|
|
142367
|
+
if (params.url.includes(SECRET_PLACEHOLDER_MARKER)) {
|
|
142368
|
+
ctx.addIssue({
|
|
142369
|
+
code: external_exports.ZodIssueCode.custom,
|
|
142370
|
+
path: ["url"],
|
|
142371
|
+
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."
|
|
142372
|
+
});
|
|
142373
|
+
}
|
|
142374
|
+
if (params.urlMatch === "matches") {
|
|
142375
|
+
try {
|
|
142376
|
+
new RegExp(params.url);
|
|
142377
|
+
} catch (err) {
|
|
142378
|
+
ctx.addIssue({
|
|
142379
|
+
code: external_exports.ZodIssueCode.custom,
|
|
142380
|
+
path: ["url"],
|
|
142381
|
+
message: `url is not a valid regular expression: ${err instanceof Error ? err.message : String(err)}`
|
|
142382
|
+
});
|
|
142383
|
+
}
|
|
142384
|
+
}
|
|
142385
|
+
});
|
|
142386
|
+
var CANCELLED_NOTE = "the wait was cancelled before a request matched";
|
|
142387
|
+
function criteriaOf(params) {
|
|
142388
|
+
return {
|
|
142389
|
+
url: params.url,
|
|
142390
|
+
urlMatch: params.urlMatch ?? "contains",
|
|
142391
|
+
...params.method !== void 0 ? { method: params.method } : {},
|
|
142392
|
+
...params.status !== void 0 ? { status: params.status } : {},
|
|
142393
|
+
outcome: params.outcome ?? "complete"
|
|
142394
|
+
};
|
|
142395
|
+
}
|
|
142396
|
+
function notStartedError(params) {
|
|
142397
|
+
return new FailureError(
|
|
142398
|
+
`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.`,
|
|
142399
|
+
{
|
|
142400
|
+
error_code: FAILURE_CODES.NETWORK_CAPTURE_NOT_STARTED,
|
|
142401
|
+
failure_stage: "await_network_request_marks",
|
|
142402
|
+
failure_area: "tool_server",
|
|
142403
|
+
error_kind: "not_found"
|
|
142404
|
+
}
|
|
142405
|
+
);
|
|
142406
|
+
}
|
|
142407
|
+
function isOpen2(record2) {
|
|
142408
|
+
return record2.state === "pending" || record2.state === "headers";
|
|
142409
|
+
}
|
|
142410
|
+
function createAwaitNetworkRequestTool(registry2) {
|
|
142411
|
+
return {
|
|
142412
|
+
// A literal, so scripts/extract-tools.mjs finds the description it scores.
|
|
142413
|
+
id: "await-network-request",
|
|
142414
|
+
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.
|
|
142415
|
+
Pass match.id as requestId to view-network-request-details for headers and bodies. A request can match only if Argent saw its outcome. When success is false, check cause. For unmet or unreadable, nearMisses can show which criteria captured requests missed. For unreadable, follow the layer notes to restore capture and repeat the action. For cancelled, retry if needed. A false result fails an e2e step and stops a run-sequence.
|
|
142416
|
+
If the tool raises NETWORK_CAPTURE_NOT_STARTED, start capture and repeat the action. While the JavaScript capture window is active, the wait can reconnect to the runtime and restore recording. Requests sent before recording resumes may be missing.`,
|
|
142417
|
+
zodSchema: zodSchema44,
|
|
142418
|
+
searchHint: "wait await network request http api call fetch xhr response status url match after capture start e2e assert",
|
|
142419
|
+
readOnly: true,
|
|
142420
|
+
longRunning: true,
|
|
142421
|
+
capability: CAPTURE_CAPABILITY,
|
|
142422
|
+
interaction: {
|
|
142423
|
+
startedMsg: ({ params }) => `Waiting for a request to ${params.url}`,
|
|
142424
|
+
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"})`,
|
|
142425
|
+
failedMsg: ({ failureSignal: failureSignal2 }) => `Failed while waiting for a network request: ${failureSignal2.error_code}`
|
|
142426
|
+
},
|
|
142427
|
+
// Each layer looks its service up itself, so the wait creates no native service.
|
|
142428
|
+
services: () => ({}),
|
|
142429
|
+
async execute(_services, params, ctx) {
|
|
142430
|
+
const signal = ctx?.signal;
|
|
142431
|
+
const device = resolveDevice(params.udid);
|
|
142432
|
+
assertSupported(AWAIT_NETWORK_REQUEST_TOOL_ID, CAPTURE_CAPABILITY, device);
|
|
142433
|
+
if (device.platform === "macos") {
|
|
142434
|
+
assertMacosAppBundle(parseMacosAppBundleId(device.id) ?? device.id, params.bundleId);
|
|
142435
|
+
}
|
|
142436
|
+
const layers = await markedLayers(registry2, device, params.bundleId);
|
|
142437
|
+
if (layers.length === 0) throw notStartedError(params);
|
|
142438
|
+
const criteria = criteriaOf(params);
|
|
142439
|
+
const timeoutMs = params.timeoutMs ?? DEFAULT_TIMEOUT_MS4;
|
|
142440
|
+
const pollIntervalMs = params.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
|
|
142441
|
+
const start2 = Date.now();
|
|
142442
|
+
const deadline = start2 + timeoutMs;
|
|
142443
|
+
const elapsed = () => Date.now() - start2;
|
|
142444
|
+
const native = layers.filter((layer) => layer.layer !== "js");
|
|
142445
|
+
const js = layers.find((layer) => layer.layer === "js");
|
|
142446
|
+
const latest = /* @__PURE__ */ new Map();
|
|
142447
|
+
const latestReadable = /* @__PURE__ */ new Map();
|
|
142448
|
+
let lastArmedNativeAt;
|
|
142449
|
+
let lastArmedJsAt;
|
|
142450
|
+
const jsBound = Math.max(pollIntervalMs, MIN_JS_READ_MS);
|
|
142451
|
+
const notesSeen = /* @__PURE__ */ new Map();
|
|
142452
|
+
const keep = (read) => {
|
|
142453
|
+
latest.set(read.layer, read);
|
|
142454
|
+
if (read.note) {
|
|
142455
|
+
const seen = notesSeen.get(read.layer) ?? /* @__PURE__ */ new Set();
|
|
142456
|
+
notesSeen.set(read.layer, seen.add(read.note));
|
|
142457
|
+
}
|
|
142458
|
+
if (!read.readable) return;
|
|
142459
|
+
latestReadable.set(read.layer, read);
|
|
142460
|
+
if (!read.armed) return;
|
|
142461
|
+
if (read.layer === "js") lastArmedJsAt = read.at;
|
|
142462
|
+
else lastArmedNativeAt = Math.max(lastArmedNativeAt ?? 0, read.at);
|
|
142463
|
+
};
|
|
142464
|
+
let jsRead;
|
|
142465
|
+
const readJs = (layer, budgetMs) => {
|
|
142466
|
+
if (jsRead) return jsRead;
|
|
142467
|
+
const read = layer.read(budgetMs).then((answer) => ({ ...answer, at: Date.now() })).finally(() => {
|
|
142468
|
+
if (jsRead === read) jsRead = void 0;
|
|
142469
|
+
});
|
|
142470
|
+
jsRead = read;
|
|
142471
|
+
return read;
|
|
142472
|
+
};
|
|
142473
|
+
const success2 = (match) => {
|
|
142474
|
+
const notes = [...notesSeen].flatMap(
|
|
142475
|
+
([layer, seen]) => [...seen].map((note) => `${layer}: ${note}`)
|
|
142476
|
+
);
|
|
142477
|
+
return {
|
|
142478
|
+
success: true,
|
|
142479
|
+
elapsed: elapsed(),
|
|
142480
|
+
match,
|
|
142481
|
+
...notes.length > 0 ? { note: notes.join("; ") } : {}
|
|
142482
|
+
};
|
|
142483
|
+
};
|
|
142484
|
+
for (; ; ) {
|
|
142485
|
+
const atDeadline = Date.now() >= deadline;
|
|
142486
|
+
if (signal?.aborted) {
|
|
142487
|
+
return { success: false, elapsed: elapsed(), note: CANCELLED_NOTE, cause: "cancelled" };
|
|
142488
|
+
}
|
|
142489
|
+
const reads = [];
|
|
142490
|
+
for (const layer of native) {
|
|
142491
|
+
const read = { ...await layer.read(0), at: Date.now() };
|
|
142492
|
+
keep(read);
|
|
142493
|
+
reads.push(read);
|
|
142494
|
+
const match = firstMatch(criteria, read.records);
|
|
142495
|
+
if (match) return success2(match);
|
|
142496
|
+
}
|
|
142497
|
+
const remaining = deadline - Date.now();
|
|
142498
|
+
if (js && (remaining > 0 || !latest.has("js"))) {
|
|
142499
|
+
const bound = Math.min(jsBound, Math.max(1, remaining));
|
|
142500
|
+
const settled = await settleWithin(readJs(js, bound), bound, signal);
|
|
142501
|
+
if (settled.type === "aborted") {
|
|
142502
|
+
return { success: false, elapsed: elapsed(), note: CANCELLED_NOTE, cause: "cancelled" };
|
|
142503
|
+
}
|
|
142504
|
+
if (settled.type === "value") {
|
|
142505
|
+
keep(settled.value);
|
|
142506
|
+
reads.push(settled.value);
|
|
142507
|
+
const match = firstMatch(criteria, settled.value.records);
|
|
142508
|
+
if (match) return success2(match);
|
|
142509
|
+
} else if (settled.type === "timeout" && bound < jsBound && latest.has("js")) {
|
|
142510
|
+
} else {
|
|
142511
|
+
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}`;
|
|
142512
|
+
const read = {
|
|
142513
|
+
layer: "js",
|
|
142514
|
+
readable: false,
|
|
142515
|
+
armed: false,
|
|
142516
|
+
stopped: latest.get("js")?.stopped ?? false,
|
|
142517
|
+
records: [],
|
|
142518
|
+
note,
|
|
142519
|
+
at: Date.now()
|
|
142520
|
+
};
|
|
142521
|
+
keep(read);
|
|
142522
|
+
reads.push(read);
|
|
142523
|
+
}
|
|
142524
|
+
}
|
|
142525
|
+
if (reads.length === layers.length && reads.every((read) => read.readable && read.stopped && !read.records.some(isOpen2))) {
|
|
142526
|
+
return timedOut3("unmet", true);
|
|
142527
|
+
}
|
|
142528
|
+
if (atDeadline) break;
|
|
142529
|
+
if (Date.now() >= deadline) continue;
|
|
142530
|
+
const sleepMs = Math.min(pollIntervalMs, Math.max(0, deadline - Date.now()));
|
|
142531
|
+
if (!await sleepOrAbort(sleepMs, signal)) {
|
|
142532
|
+
return { success: false, elapsed: elapsed(), note: CANCELLED_NOTE, cause: "cancelled" };
|
|
142533
|
+
}
|
|
142534
|
+
}
|
|
142535
|
+
const now = Date.now();
|
|
142536
|
+
const tolerance = darkTailToleranceMs(pollIntervalMs);
|
|
142537
|
+
const fresh = lastArmedNativeAt !== void 0 && now - lastArmedNativeAt <= tolerance || lastArmedJsAt !== void 0 && now - lastArmedJsAt <= Math.max(tolerance, jsBound + pollIntervalMs);
|
|
142538
|
+
return timedOut3(fresh ? "unmet" : "unreadable", false);
|
|
142539
|
+
function timedOut3(cause, allStopped) {
|
|
142540
|
+
const summaries = layers.map(({ layer }) => {
|
|
142541
|
+
const last = latest.get(layer);
|
|
142542
|
+
const readable = latestReadable.get(layer);
|
|
142543
|
+
return {
|
|
142544
|
+
layer,
|
|
142545
|
+
armed: last?.readable === true ? last.armed : false,
|
|
142546
|
+
readable: readable !== void 0,
|
|
142547
|
+
...last?.stopped ? { stopped: true } : {},
|
|
142548
|
+
requests: readable?.records.length ?? 0,
|
|
142549
|
+
...last?.note ? { note: last.note } : {}
|
|
142550
|
+
};
|
|
142551
|
+
});
|
|
142552
|
+
const seen = [...latestReadable.values()].flatMap((read) => read.records);
|
|
142553
|
+
const misses = nearMisses(criteria, seen);
|
|
142554
|
+
const counts = summaries.map(
|
|
142555
|
+
(s) => `${s.layer} ${s.readable ? s.requests : "not read"}${s.armed ? "" : " (not armed)"}`
|
|
142556
|
+
).join(", ");
|
|
142557
|
+
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)}).`;
|
|
142558
|
+
const notes = summaries.filter((s) => s.note).map((s) => `${s.layer}: ${s.note}`).join("; ");
|
|
142559
|
+
const note = [
|
|
142560
|
+
head,
|
|
142561
|
+
`Requests since the start: ${counts}.`,
|
|
142562
|
+
notes ? `${notes}.` : void 0,
|
|
142563
|
+
misses.length > 0 ? `Nearest: ${misses.map(describeRecord).join("; ")}.` : void 0
|
|
142564
|
+
].filter(Boolean).join(" ");
|
|
142565
|
+
return {
|
|
142566
|
+
success: false,
|
|
142567
|
+
elapsed: elapsed(),
|
|
142568
|
+
cause,
|
|
142569
|
+
note,
|
|
142570
|
+
nearMisses: misses,
|
|
142571
|
+
layers: summaries
|
|
142572
|
+
};
|
|
142573
|
+
}
|
|
142574
|
+
}
|
|
142575
|
+
};
|
|
142576
|
+
}
|
|
142577
|
+
|
|
141814
142578
|
// ../tool-server/src/tools/await-screen-idle/index.ts
|
|
141815
142579
|
init_zod();
|
|
141816
142580
|
init_device_info();
|
|
141817
142581
|
init_adb();
|
|
141818
142582
|
init_capability();
|
|
141819
142583
|
var AWAIT_SCREEN_IDLE_TOOL_ID = "await-screen-idle";
|
|
141820
|
-
var
|
|
141821
|
-
var
|
|
142584
|
+
var DEFAULT_TIMEOUT_MS5 = 3e3;
|
|
142585
|
+
var DEFAULT_POLL_INTERVAL_MS3 = 200;
|
|
141822
142586
|
var DEFAULT_MIN_STABLE_MS = 250;
|
|
141823
142587
|
var TV_NO_CURSOR_STABLE_MS = 1200;
|
|
141824
142588
|
var DARK_TAIL_POLLS = 2;
|
|
@@ -141860,14 +142624,14 @@ function unsettledNote(lastData, lastError, darkTailMs) {
|
|
|
141860
142624
|
if (lastData.hint) parts2.push(lastData.hint);
|
|
141861
142625
|
return parts2.join("; ");
|
|
141862
142626
|
}
|
|
141863
|
-
var
|
|
142627
|
+
var zodSchema45 = external_exports.object({
|
|
141864
142628
|
udid: external_exports.string().min(1).describe(
|
|
141865
142629
|
"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
142630
|
),
|
|
141867
142631
|
timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(
|
|
141868
|
-
`Max time to wait for the screen to settle before giving up (default ${
|
|
142632
|
+
`Max time to wait for the screen to settle before giving up (default ${DEFAULT_TIMEOUT_MS5}).`
|
|
141869
142633
|
),
|
|
141870
|
-
pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(`How often to re-read the tree (default ${
|
|
142634
|
+
pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(`How often to re-read the tree (default ${DEFAULT_POLL_INTERVAL_MS3}).`),
|
|
141871
142635
|
minStableMs: external_exports.number().int().min(0).max(1e4).optional().describe(
|
|
141872
142636
|
`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
142637
|
)
|
|
@@ -141900,7 +142664,7 @@ function createAwaitScreenIdleTool(registry2) {
|
|
|
141900
142664
|
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
142665
|
Use when a launch or navigation must finish rendering before a screenshot or tap.
|
|
141902
142666
|
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:
|
|
142667
|
+
zodSchema: zodSchema45,
|
|
141904
142668
|
searchHint: "wait until screen settles idle stable stops changing animation transition rendered ready before screenshot",
|
|
141905
142669
|
readOnly: true,
|
|
141906
142670
|
interaction: {
|
|
@@ -141929,13 +142693,13 @@ Returns { settled, waitedMs, polls, note? }. If that is not seen before timeoutM
|
|
|
141929
142693
|
const tvApi = isTvOs ? await resolveTvApi(registry2, device.id) : null;
|
|
141930
142694
|
const androidIsTv = device.platform === "android" && await isAndroidTv(device.id);
|
|
141931
142695
|
const minStableMs = params.minStableMs ?? DEFAULT_MIN_STABLE_MS;
|
|
141932
|
-
const pollIntervalMs = params.pollIntervalMs ??
|
|
142696
|
+
const pollIntervalMs = params.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS3;
|
|
141933
142697
|
let stableSignature;
|
|
141934
142698
|
let stableSince = 0;
|
|
141935
142699
|
let lastReadAt = 0;
|
|
141936
142700
|
const poll = await pollDescribeTree({
|
|
141937
142701
|
fetchTree: (budgetMs) => fetchTree(device, services, tvApi, androidIsTv, budgetMs),
|
|
141938
|
-
timeoutMs: params.timeoutMs ??
|
|
142702
|
+
timeoutMs: params.timeoutMs ?? DEFAULT_TIMEOUT_MS5,
|
|
141939
142703
|
pollIntervalMs,
|
|
141940
142704
|
signal: ctx?.signal,
|
|
141941
142705
|
onSample: (data, nowMs) => {
|
|
@@ -142140,7 +142904,7 @@ function safeGetState(registry2, urn) {
|
|
|
142140
142904
|
return null;
|
|
142141
142905
|
}
|
|
142142
142906
|
}
|
|
142143
|
-
var
|
|
142907
|
+
var zodSchema46 = external_exports.object({
|
|
142144
142908
|
port: metroPortField,
|
|
142145
142909
|
device_id: external_exports.string().describe(
|
|
142146
142910
|
"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 +142922,7 @@ On an iOS simulator, Android device<flag:macos-apps>, or Mac app</flag:macos-app
|
|
|
142158
142922
|
After starting, ask the user to perform the interaction to profile, then call react-profiler-stop.
|
|
142159
142923
|
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
142924
|
Fails if the Hermes runtime is not reachable or the Metro CDP connection cannot be established.`,
|
|
142161
|
-
zodSchema:
|
|
142925
|
+
zodSchema: zodSchema46,
|
|
142162
142926
|
interaction: {
|
|
142163
142927
|
startedMsg: () => "Starting React profiler",
|
|
142164
142928
|
completedMsg: ({ result }) => result.already_running ? "React profiler was already running" : "Started React profiler",
|
|
@@ -143225,7 +143989,7 @@ function stopInProgressError() {
|
|
|
143225
143989
|
error_kind: "not_found"
|
|
143226
143990
|
});
|
|
143227
143991
|
}
|
|
143228
|
-
var
|
|
143992
|
+
var zodSchema47 = external_exports.object({
|
|
143229
143993
|
port: metroPortField,
|
|
143230
143994
|
device_id: external_exports.string().describe(
|
|
143231
143995
|
"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 +144004,7 @@ Call react-profiler-start first, then exercise the app, then call this.
|
|
|
143240
144004
|
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
144005
|
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
144006
|
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:
|
|
144007
|
+
zodSchema: zodSchema47,
|
|
143244
144008
|
// Collection can outlast the MCP client's 30 s abort. The client would then
|
|
143245
144009
|
// resend the call, and the resend fails on the stop still collecting.
|
|
143246
144010
|
longRunning: true,
|
|
@@ -143535,7 +144299,7 @@ Fails if no active profiling session exists, another stop is running, the CDP co
|
|
|
143535
144299
|
|
|
143536
144300
|
// ../tool-server/src/tools/profiler/react/react-profiler-status.ts
|
|
143537
144301
|
init_zod();
|
|
143538
|
-
var
|
|
144302
|
+
var zodSchema48 = external_exports.object({
|
|
143539
144303
|
port: metroPortField,
|
|
143540
144304
|
device_id: external_exports.string().describe(
|
|
143541
144305
|
"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 +144317,7 @@ function createReactProfilerStatusTool(registry2) {
|
|
|
143553
144317
|
return {
|
|
143554
144318
|
id: "react-profiler-status",
|
|
143555
144319
|
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:
|
|
144320
|
+
zodSchema: zodSchema48,
|
|
143557
144321
|
readOnly: true,
|
|
143558
144322
|
interaction: {
|
|
143559
144323
|
startedMsg: () => "Checking React profiler",
|
|
@@ -145232,7 +145996,7 @@ var annotationSchema = external_exports.object({
|
|
|
145232
145996
|
),
|
|
145233
145997
|
label: external_exports.string().describe("Description of the action performed")
|
|
145234
145998
|
});
|
|
145235
|
-
var
|
|
145999
|
+
var zodSchema49 = external_exports.object({
|
|
145236
146000
|
port: metroPortField,
|
|
145237
146001
|
device_id: external_exports.string().describe(
|
|
145238
146002
|
"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 +146019,7 @@ After presenting the report, ask the user whether to investigate further (drill-
|
|
|
145255
146019
|
profiler-cpu-query / profiler-commit-query) or implement fixes and re-profile for comparison.
|
|
145256
146020
|
Use when the profiling session is complete and you need to interpret the collected data.
|
|
145257
146021
|
Fails if react-profiler-stop has not been called or no profiling data is stored.`,
|
|
145258
|
-
zodSchema:
|
|
146022
|
+
zodSchema: zodSchema49,
|
|
145259
146023
|
interaction: {
|
|
145260
146024
|
startedMsg: () => "Analyzing React profile",
|
|
145261
146025
|
completedMsg: () => "Analyzed React profile",
|
|
@@ -145440,7 +146204,7 @@ var import_fs6 = require("fs");
|
|
|
145440
146204
|
var fileInputs = [
|
|
145441
146205
|
{ target: "project_root", path: "${project_root}", kind: "directory" }
|
|
145442
146206
|
];
|
|
145443
|
-
var
|
|
146207
|
+
var zodSchema50 = external_exports.object({
|
|
145444
146208
|
component_name: external_exports.string().describe("Name of the React component to look up"),
|
|
145445
146209
|
project_root: external_exports.string().describe("Absolute path to the RN project root")
|
|
145446
146210
|
});
|
|
@@ -145450,7 +146214,7 @@ var reactProfilerComponentSourceTool = {
|
|
|
145450
146214
|
Call this per-finding after react-profiler-analyze to inspect source before proposing a fix.
|
|
145451
146215
|
Returns found: false if the component is not found in user-owned code (e.g. lives in node_modules).
|
|
145452
146216
|
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:
|
|
146217
|
+
zodSchema: zodSchema50,
|
|
145454
146218
|
readOnly: true,
|
|
145455
146219
|
// react-profiler-analyze runs the same AST lookup for each component in its
|
|
145456
146220
|
// table (file, line and other matches) and adds the source of the located ones
|
|
@@ -145577,7 +146341,7 @@ function renderMarkdownTable(entries) {
|
|
|
145577
146341
|
);
|
|
145578
146342
|
return [header, sep11, ...rows].join("\n");
|
|
145579
146343
|
}
|
|
145580
|
-
var
|
|
146344
|
+
var zodSchema51 = external_exports.object({
|
|
145581
146345
|
port: metroPortField,
|
|
145582
146346
|
device_id: external_exports.string().describe(
|
|
145583
146347
|
"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 +146356,7 @@ FOR DEDICATED CPU INVESTIGATION ONLY: do NOT call this as part of a normal profi
|
|
|
145592
146356
|
Use react-profiler-analyze instead; it covers all React rendering performance analysis.
|
|
145593
146357
|
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
146358
|
Fails if react-profiler-stop has not been called or no CPU profile is stored.`,
|
|
145595
|
-
zodSchema:
|
|
146359
|
+
zodSchema: zodSchema51,
|
|
145596
146360
|
readOnly: true,
|
|
145597
146361
|
// Agents use profiler-cpu-query mode top_functions, which reads the same
|
|
145598
146362
|
// profile with per-sample intervals and idle filtered out, and has the same
|
|
@@ -145700,7 +146464,7 @@ function renderMarkdownTable2(entries) {
|
|
|
145700
146464
|
);
|
|
145701
146465
|
return [header, sep11, ...rows].join("\n");
|
|
145702
146466
|
}
|
|
145703
|
-
var
|
|
146467
|
+
var zodSchema52 = external_exports.object({
|
|
145704
146468
|
port: metroPortField,
|
|
145705
146469
|
device_id: external_exports.string().describe(
|
|
145706
146470
|
"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 +146477,7 @@ var reactProfilerRendersTool = {
|
|
|
145713
146477
|
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
146478
|
Use when you want a quick look at what is mounted in a live connected app, without a profiling session.
|
|
145715
146479
|
Fails if the React DevTools hook is not present in the runtime or the app is not connected.`,
|
|
145716
|
-
zodSchema:
|
|
146480
|
+
zodSchema: zodSchema52,
|
|
145717
146481
|
readOnly: true,
|
|
145718
146482
|
// It walks only the top 30 fiber levels, above the screens of a real app
|
|
145719
146483
|
// (Bluesky's first feed item sits at depth 446), and counts mounts, not
|
|
@@ -145882,7 +146646,7 @@ function buildFiberTreeScript(maxDepth, filter) {
|
|
|
145882
146646
|
}
|
|
145883
146647
|
})()`;
|
|
145884
146648
|
}
|
|
145885
|
-
var
|
|
146649
|
+
var zodSchema53 = external_exports.object({
|
|
145886
146650
|
port: metroPortField,
|
|
145887
146651
|
device_id: external_exports.string().describe(
|
|
145888
146652
|
"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 +146660,7 @@ var reactProfilerFiberTreeTool = {
|
|
|
145896
146660
|
Use when tracing the ancestry of a library component.
|
|
145897
146661
|
Returns a nested JSON tree of fiber nodes with name, tag, actualDuration, selfBaseDuration, and children.
|
|
145898
146662
|
Fails if the React DevTools hook is not present or no fiber roots have been committed yet.`,
|
|
145899
|
-
zodSchema:
|
|
146663
|
+
zodSchema: zodSchema53,
|
|
145900
146664
|
readOnly: true,
|
|
145901
146665
|
interaction: {
|
|
145902
146666
|
startedMsg: () => "Reading React fiber tree",
|
|
@@ -150485,7 +151249,7 @@ var capability31 = {
|
|
|
150485
151249
|
android: { emulator: true, device: true, unknown: true },
|
|
150486
151250
|
macos: { app: true, catalyst: true }
|
|
150487
151251
|
};
|
|
150488
|
-
var
|
|
151252
|
+
var zodSchema54 = external_exports.object({
|
|
150489
151253
|
device_id: metroDeviceIdParam(
|
|
150490
151254
|
"Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
|
|
150491
151255
|
),
|
|
@@ -150507,7 +151271,7 @@ var nativeProfilerStartTool = {
|
|
|
150507
151271
|
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
151272
|
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
151273
|
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:
|
|
151274
|
+
zodSchema: zodSchema54,
|
|
150511
151275
|
interaction: {
|
|
150512
151276
|
startedMsg: () => "Starting native profiler",
|
|
150513
151277
|
completedMsg: () => "Started native profiler",
|
|
@@ -150574,7 +151338,7 @@ async function exportedFilesToArtifacts(store, files) {
|
|
|
150574
151338
|
function registerTrace(store, traceFile) {
|
|
150575
151339
|
return store.register({ hostPath: traceFile, kind: "native-profile-trace", archive: "tar.gz" });
|
|
150576
151340
|
}
|
|
150577
|
-
var
|
|
151341
|
+
var zodSchema55 = external_exports.object({
|
|
150578
151342
|
device_id: metroDeviceIdParam(
|
|
150579
151343
|
"Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
|
|
150580
151344
|
)
|
|
@@ -150583,7 +151347,7 @@ var nativeProfilerStopTool = {
|
|
|
150583
151347
|
id: "native-profiler-stop",
|
|
150584
151348
|
description: `End a native profiling session started by native-profiler-start and save the trace as a downloadable artifact.
|
|
150585
151349
|
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:
|
|
151350
|
+
zodSchema: zodSchema55,
|
|
150587
151351
|
interaction: {
|
|
150588
151352
|
startedMsg: () => "Stopping native profiler",
|
|
150589
151353
|
completedMsg: ({ result }) => `Saved native profile ${result.traceFile.filename}`,
|
|
@@ -150632,7 +151396,7 @@ var capability33 = {
|
|
|
150632
151396
|
android: { emulator: true, device: true, unknown: true },
|
|
150633
151397
|
macos: { app: true, catalyst: true }
|
|
150634
151398
|
};
|
|
150635
|
-
var
|
|
151399
|
+
var zodSchema56 = external_exports.object({
|
|
150636
151400
|
device_id: metroDeviceIdParam(
|
|
150637
151401
|
"Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
|
|
150638
151402
|
)
|
|
@@ -150642,7 +151406,7 @@ var nativeProfilerAnalyzeTool = {
|
|
|
150642
151406
|
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
151407
|
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
151408
|
Use profiler-stack-query for details behind a finding.`,
|
|
150645
|
-
zodSchema:
|
|
151409
|
+
zodSchema: zodSchema56,
|
|
150646
151410
|
interaction: {
|
|
150647
151411
|
startedMsg: () => "Analyzing native profile",
|
|
150648
151412
|
completedMsg: () => "Analyzed native profile",
|
|
@@ -151932,7 +152696,7 @@ var launchAnalysisMode = {
|
|
|
151932
152696
|
failed: "Failed to record iOS App Launch"
|
|
151933
152697
|
}
|
|
151934
152698
|
};
|
|
151935
|
-
var
|
|
152699
|
+
var zodSchema57 = external_exports.object({
|
|
151936
152700
|
mode: external_exports.enum(["measure", "profile"]).describe(
|
|
151937
152701
|
"measure: time five launches with XCTest. profile: record one Instruments App Launch trace."
|
|
151938
152702
|
),
|
|
@@ -151972,7 +152736,7 @@ Install a Release build of bundle_id before calling; the tool does not build or
|
|
|
151972
152736
|
Use when you need the iOS launch time or want to find what slows the app's startup.
|
|
151973
152737
|
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
152738
|
Fails if the app is not installed or no iPhone or allowed simulator is available.`,
|
|
151975
|
-
zodSchema:
|
|
152739
|
+
zodSchema: zodSchema57,
|
|
151976
152740
|
services: () => ({}),
|
|
151977
152741
|
async execute(_services, params, ctx) {
|
|
151978
152742
|
switch (params.mode) {
|
|
@@ -152335,7 +153099,7 @@ function resolveAudioSession(registry2, device) {
|
|
|
152335
153099
|
}
|
|
152336
153100
|
|
|
152337
153101
|
// ../tool-server/src/tools/audio/audio-input.ts
|
|
152338
|
-
var
|
|
153102
|
+
var zodSchema58 = external_exports.object({
|
|
152339
153103
|
udid: external_exports.string().describe("Target iOS Simulator UDID from `list-devices`."),
|
|
152340
153104
|
source: external_exports.enum(["file", "tone", "microphone"]).describe(
|
|
152341
153105
|
"`file` plays `path`, `tone` a sine wave, `microphone` restores the real microphone."
|
|
@@ -152363,7 +153127,7 @@ function createAudioInputTool(registry2) {
|
|
|
152363
153127
|
id: "audio-input",
|
|
152364
153128
|
description: `Set what apps in an iOS Simulator hear as microphone input: an audio file, a tone, or the real microphone.
|
|
152365
153129
|
A file starts playing on this call, so call it right before the action that makes the app record.`,
|
|
152366
|
-
zodSchema:
|
|
153130
|
+
zodSchema: zodSchema58,
|
|
152367
153131
|
searchHint: "audio microphone input mock fake inject voice speech sound file tone simulator mic",
|
|
152368
153132
|
interaction: {
|
|
152369
153133
|
startedMsg: ({ params }) => `Setting simulator audio input to ${params.source}`,
|
|
@@ -154270,7 +155034,7 @@ var capability34 = {
|
|
|
154270
155034
|
// argent's library records the app's window from inside the app.
|
|
154271
155035
|
macos: { app: true, catalyst: true }
|
|
154272
155036
|
};
|
|
154273
|
-
var
|
|
155037
|
+
var zodSchema59 = external_exports.object({
|
|
154274
155038
|
udid: external_exports.string().describe(
|
|
154275
155039
|
"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
155040
|
),
|
|
@@ -154291,7 +155055,7 @@ function createScreenRecordingStartTool(registry2) {
|
|
|
154291
155055
|
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
155056
|
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
155057
|
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:
|
|
155058
|
+
zodSchema: zodSchema59,
|
|
154295
155059
|
searchHint: "record video screen capture movie mp4 start filming screencast",
|
|
154296
155060
|
interaction: {
|
|
154297
155061
|
startedMsg: () => "Starting screen recording",
|
|
@@ -154435,7 +155199,7 @@ var capability35 = {
|
|
|
154435
155199
|
android: { emulator: true, device: true, unknown: true },
|
|
154436
155200
|
macos: { app: true, catalyst: true }
|
|
154437
155201
|
};
|
|
154438
|
-
var
|
|
155202
|
+
var zodSchema60 = external_exports.object({
|
|
154439
155203
|
udid: external_exports.string().describe(
|
|
154440
155204
|
"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
155205
|
)
|
|
@@ -154445,7 +155209,7 @@ var screenRecordingStopTool = {
|
|
|
154445
155209
|
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
155210
|
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
155211
|
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:
|
|
155212
|
+
zodSchema: zodSchema60,
|
|
154449
155213
|
searchHint: "stop end finish screen recording video capture save retrieve",
|
|
154450
155214
|
interaction: {
|
|
154451
155215
|
startedMsg: () => "Stopping screen recording",
|
|
@@ -154835,7 +155599,7 @@ var timeRangeSchema = external_exports.object({
|
|
|
154835
155599
|
start: external_exports.coerce.number().describe("Start of range in ms"),
|
|
154836
155600
|
end: external_exports.coerce.number().describe("End of range in ms")
|
|
154837
155601
|
});
|
|
154838
|
-
var
|
|
155602
|
+
var zodSchema61 = external_exports.object({
|
|
154839
155603
|
port: metroPortField,
|
|
154840
155604
|
device_id: metroDeviceIdParam(
|
|
154841
155605
|
"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 +155625,7 @@ Modes:
|
|
|
154861
155625
|
Use when drilling into specific components or time windows after react-profiler-analyze.
|
|
154862
155626
|
Returns a markdown table or tree of commit data matching the requested mode.
|
|
154863
155627
|
Fails if react-profiler-stop has not been called.`,
|
|
154864
|
-
zodSchema:
|
|
155628
|
+
zodSchema: zodSchema61,
|
|
154865
155629
|
readOnly: true,
|
|
154866
155630
|
interaction: {
|
|
154867
155631
|
startedMsg: ({ params }) => `Querying React commits ${params.mode.replace(/^by_/, "by ").replaceAll("_", " ")}`,
|
|
@@ -155297,7 +156061,7 @@ var timeWindowSchema = external_exports.object({
|
|
|
155297
156061
|
start: external_exports.coerce.number().describe("Start of window in ms"),
|
|
155298
156062
|
end: external_exports.coerce.number().describe("End of window in ms")
|
|
155299
156063
|
});
|
|
155300
|
-
var
|
|
156064
|
+
var zodSchema62 = external_exports.object({
|
|
155301
156065
|
port: metroPortField,
|
|
155302
156066
|
device_id: metroDeviceIdParam(
|
|
155303
156067
|
"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 +156093,7 @@ Each row is one call path, so a function can have several rows and top_n counts
|
|
|
155329
156093
|
Use when investigating JS CPU hotspots or correlating CPU cost with specific components.
|
|
155330
156094
|
Returns a markdown table of CPU hotspots, call tree, or per-component CPU breakdown.
|
|
155331
156095
|
Fails if no CPU profile is stored; run react-profiler-stop (and ideally react-profiler-analyze) first.`,
|
|
155332
|
-
zodSchema:
|
|
156096
|
+
zodSchema: zodSchema62,
|
|
155333
156097
|
readOnly: true,
|
|
155334
156098
|
interaction: {
|
|
155335
156099
|
startedMsg: ({ params }) => `Querying CPU profile by ${params.mode.replaceAll("_", " ")}`,
|
|
@@ -155716,7 +156480,7 @@ async function executeAndroid(api, params) {
|
|
|
155716
156480
|
topN: params.top_n
|
|
155717
156481
|
});
|
|
155718
156482
|
}
|
|
155719
|
-
var
|
|
156483
|
+
var zodSchema63 = external_exports.object({
|
|
155720
156484
|
device_id: metroDeviceIdParam(
|
|
155721
156485
|
"Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
|
|
155722
156486
|
),
|
|
@@ -155738,7 +156502,7 @@ Modes:
|
|
|
155738
156502
|
- function_callers: Who calls function_name and what it calls.
|
|
155739
156503
|
- thread_breakdown: CPU time split by thread, optionally filtered.
|
|
155740
156504
|
- leak_stacks: Memory leak details (iOS<flag:macos-apps> and Mac apps</flag:macos-apps> only). Requires a trace with leak data.`,
|
|
155741
|
-
zodSchema:
|
|
156505
|
+
zodSchema: zodSchema63,
|
|
155742
156506
|
readOnly: true,
|
|
155743
156507
|
interaction: {
|
|
155744
156508
|
startedMsg: ({ params }) => `Querying native stacks by ${stackQueryMode[params.mode]}`,
|
|
@@ -155816,7 +156580,7 @@ function buildPerfettoAnchor(wallClockStartMs) {
|
|
|
155816
156580
|
}
|
|
155817
156581
|
|
|
155818
156582
|
// ../tool-server/src/tools/profiler/combined/profiler-combined-report.ts
|
|
155819
|
-
var
|
|
156583
|
+
var zodSchema64 = external_exports.object({
|
|
155820
156584
|
port: metroPortField,
|
|
155821
156585
|
device_id: metroDeviceIdParam(
|
|
155822
156586
|
"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 +156593,7 @@ Maps native hangs to React commits using wall-clock time alignment.
|
|
|
155829
156593
|
Call this tool when both profilers were run in parallel on the same session.
|
|
155830
156594
|
Returns a markdown report correlating hangs with React commits, memory leaks, and investigation hints.
|
|
155831
156595
|
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:
|
|
156596
|
+
zodSchema: zodSchema64,
|
|
155833
156597
|
readOnly: true,
|
|
155834
156598
|
interaction: {
|
|
155835
156599
|
startedMsg: () => "Building combined performance report",
|
|
@@ -156519,7 +157283,7 @@ var profilerLoadAction = {
|
|
|
156519
157283
|
failure: "load"
|
|
156520
157284
|
}
|
|
156521
157285
|
};
|
|
156522
|
-
var
|
|
157286
|
+
var zodSchema65 = external_exports.object({
|
|
156523
157287
|
mode: external_exports.enum(["list", "load_react", "load_native"]).describe("What to do; see Modes in the tool description."),
|
|
156524
157288
|
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
157289
|
port: metroPortField,
|
|
@@ -156541,7 +157305,7 @@ Modes:
|
|
|
156541
157305
|
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
157306
|
Returns a summary of the loaded session or a session list for the list mode.
|
|
156543
157307
|
Fails if the session_id is not found or the session's trace files are missing from disk.`,
|
|
156544
|
-
zodSchema:
|
|
157308
|
+
zodSchema: zodSchema65,
|
|
156545
157309
|
interaction: {
|
|
156546
157310
|
startedMsg: ({ params }) => profilerLoadAction[params.mode].started(params),
|
|
156547
157311
|
completedMsg: ({ params }) => profilerLoadAction[params.mode].completed(params),
|
|
@@ -156701,7 +157465,7 @@ function unnameableSessionUrns(urns) {
|
|
|
156701
157465
|
}
|
|
156702
157466
|
|
|
156703
157467
|
// ../tool-server/src/tools/simulator/stop-simulator-server.ts
|
|
156704
|
-
var
|
|
157468
|
+
var zodSchema66 = external_exports.object({
|
|
156705
157469
|
udid: external_exports.string().describe(
|
|
156706
157470
|
"Target device id (iOS UDID, Android serial, or Chromium id) whose transport session to stop"
|
|
156707
157471
|
)
|
|
@@ -156710,7 +157474,7 @@ function createStopSimulatorServerTool(registry2) {
|
|
|
156710
157474
|
return {
|
|
156711
157475
|
id: "stop-simulator-server",
|
|
156712
157476
|
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:
|
|
157477
|
+
zodSchema: zodSchema66,
|
|
156714
157478
|
interaction: {
|
|
156715
157479
|
startedMsg: ({ params }) => `Stopping simulator server for ${params.udid}`,
|
|
156716
157480
|
completedMsg: ({ params }) => `Stopped simulator server for ${params.udid}`,
|
|
@@ -156745,7 +157509,7 @@ function createStopSimulatorServerTool(registry2) {
|
|
|
156745
157509
|
// ../tool-server/src/tools/simulator/stop-all-simulator-servers.ts
|
|
156746
157510
|
init_zod();
|
|
156747
157511
|
init_src2();
|
|
156748
|
-
var
|
|
157512
|
+
var zodSchema67 = external_exports.object({
|
|
156749
157513
|
devices: external_exports.array(external_exports.string()).optional().describe(
|
|
156750
157514
|
"Ids of the devices THIS session used (iOS UDID / Android serial / Chromium id), to scope the teardown to."
|
|
156751
157515
|
)
|
|
@@ -156758,7 +157522,7 @@ PASS \`devices\` with the device ids this session used: one tool-server serves e
|
|
|
156758
157522
|
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
157523
|
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
157524
|
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:
|
|
157525
|
+
zodSchema: zodSchema67,
|
|
156762
157526
|
interaction: {
|
|
156763
157527
|
// "all" only holds for the unscoped sweep; a scoped call touches just the
|
|
156764
157528
|
// ids it was given.
|
|
@@ -156961,13 +157725,13 @@ function listeningPids(port) {
|
|
|
156961
157725
|
}
|
|
156962
157726
|
return lines.map((s) => parseInt(s, 10));
|
|
156963
157727
|
}
|
|
156964
|
-
var
|
|
157728
|
+
var zodSchema68 = external_exports.object({
|
|
156965
157729
|
port: external_exports.number().int().min(1).max(65535).default(8081).describe("TCP port Metro is listening on")
|
|
156966
157730
|
});
|
|
156967
157731
|
var stopMetroTool = {
|
|
156968
157732
|
id: "stop-metro",
|
|
156969
157733
|
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:
|
|
157734
|
+
zodSchema: zodSchema68,
|
|
156971
157735
|
interaction: {
|
|
156972
157736
|
startedMsg: ({ params }) => `Stopping Metro on port ${params.port}`,
|
|
156973
157737
|
completedMsg: ({ params }) => `Stopped Metro on port ${params.port}`,
|
|
@@ -159503,7 +160267,7 @@ var MACOS_PLATFORM_FLAG = { [FLAG_ENUM_META_KEY]: { macos: MACOS_APPS_FLAG } };
|
|
|
159503
160267
|
var fileInputs3 = [
|
|
159504
160268
|
{ target: "project_root", path: "${project_root}", kind: "probe" }
|
|
159505
160269
|
];
|
|
159506
|
-
var
|
|
160270
|
+
var zodSchema69 = external_exports.object({
|
|
159507
160271
|
name: external_exports.string().describe(
|
|
159508
160272
|
'Name for this e2e test (e.g. "settings-explore"): letters, digits, underscore and hyphen only.'
|
|
159509
160273
|
),
|
|
@@ -159550,7 +160314,7 @@ Call e2e-finish-recording when done.
|
|
|
159550
160314
|
To remove or reorder steps, edit the .yaml file after e2e-finish-recording, not
|
|
159551
160315
|
during the recording: over a link, the next recorded step writes over your edit,
|
|
159552
160316
|
and without a link, an edit that renumbers the steps drops their warnings.`,
|
|
159553
|
-
zodSchema:
|
|
160317
|
+
zodSchema: zodSchema69,
|
|
159554
160318
|
aliases: ["flow-start-recording"],
|
|
159555
160319
|
interaction: {
|
|
159556
160320
|
// Name the flow: concurrent recordings interleave in one log, and "flow
|
|
@@ -161607,7 +162371,7 @@ async function waitForIdle(env, step) {
|
|
|
161607
162371
|
if (left < MIN_ROUND_BUDGET_MS) break;
|
|
161608
162372
|
if (!await sleepOrAbort(Math.min(IDLE_POLL_MS, left), env.signal)) return ABORTED_OUTCOME;
|
|
161609
162373
|
}
|
|
161610
|
-
const
|
|
162374
|
+
const unreadable2 = (underlying) => ({
|
|
161611
162375
|
ok: false,
|
|
161612
162376
|
indeterminate: true,
|
|
161613
162377
|
// The underlying reader reports an instrumentation failure, whose remedy
|
|
@@ -161622,7 +162386,7 @@ async function waitForIdle(env, step) {
|
|
|
161622
162386
|
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
162387
|
});
|
|
161624
162388
|
if (readsSucceeded === 0) {
|
|
161625
|
-
if (treeErrorMessage !== void 0) return
|
|
162389
|
+
if (treeErrorMessage !== void 0) return unreadable2(treeErrorMessage);
|
|
161626
162390
|
if (treeReadBlind) return degraded();
|
|
161627
162391
|
return {
|
|
161628
162392
|
ok: false,
|
|
@@ -161631,7 +162395,7 @@ async function waitForIdle(env, step) {
|
|
|
161631
162395
|
};
|
|
161632
162396
|
}
|
|
161633
162397
|
if (treeErrorMessage !== void 0 && darkReads > IDLE_TOLERATED_DARK_READS) {
|
|
161634
|
-
return
|
|
162398
|
+
return unreadable2(treeErrorMessage);
|
|
161635
162399
|
}
|
|
161636
162400
|
if (treeReadBlind && darkReads > IDLE_TOLERATED_DARK_READS) {
|
|
161637
162401
|
return degraded();
|
|
@@ -162452,6 +163216,14 @@ function unmetWaitWarningFor(cause) {
|
|
|
162452
163216
|
if (cause === "cancelled") return CANCELLED_WAIT_WARNING;
|
|
162453
163217
|
return UNMET_WAIT_WARNING;
|
|
162454
163218
|
}
|
|
163219
|
+
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.nearMisses` lists the closest requests and the criteria each missed: 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";
|
|
163220
|
+
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";
|
|
163221
|
+
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";
|
|
163222
|
+
function unmetNetworkWaitWarningFor(cause) {
|
|
163223
|
+
if (cause === "unreadable") return UNREADABLE_NETWORK_WAIT_WARNING;
|
|
163224
|
+
if (cause === "cancelled") return CANCELLED_NETWORK_WAIT_WARNING;
|
|
163225
|
+
return UNMET_NETWORK_WAIT_WARNING;
|
|
163226
|
+
}
|
|
162455
163227
|
function indeterminateReasonCaveat(udid) {
|
|
162456
163228
|
if (platformOf(udid) !== "ios") return "";
|
|
162457
163229
|
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 +163630,7 @@ function withRecordedPanelKind(command, args, toolResult) {
|
|
|
162858
163630
|
var fileInputs4 = [
|
|
162859
163631
|
{ target: "project_root", path: "${project_root}", kind: "probe", collect: "step" }
|
|
162860
163632
|
];
|
|
162861
|
-
var
|
|
163633
|
+
var zodSchema70 = external_exports.object({
|
|
162862
163634
|
name: external_exports.string().describe("Name of the e2e test being recorded: the one passed to e2e-start-recording."),
|
|
162863
163635
|
project_root: external_exports.string().describe(
|
|
162864
163636
|
"Absolute path to the project root of the e2e test being recorded: the same value passed to e2e-start-recording."
|
|
@@ -162877,7 +163649,7 @@ function createFlowAddStepTool(registry2) {
|
|
|
162877
163649
|
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
163650
|
A coordinate \`gesture-tap\` records as a portable \`tap\` selector step; \`restart-app\` as a \`launch\`.
|
|
162879
163651
|
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:
|
|
163652
|
+
zodSchema: zodSchema70,
|
|
162881
163653
|
aliases: ["flow-add-step"],
|
|
162882
163654
|
interaction: {
|
|
162883
163655
|
// Name the flow: recordings are concurrent, so several of these lines can
|
|
@@ -163016,16 +163788,15 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
|
|
|
163016
163788
|
);
|
|
163017
163789
|
}
|
|
163018
163790
|
let waitWarning;
|
|
163019
|
-
if (command
|
|
163020
|
-
|
|
163021
|
-
|
|
163022
|
-
|
|
163023
|
-
|
|
163024
|
-
|
|
163025
|
-
|
|
163026
|
-
|
|
163027
|
-
|
|
163028
|
-
}
|
|
163791
|
+
if (isUnmetWaitResult(command, toolResult)) {
|
|
163792
|
+
const cause = unmetWaitCause(command, toolResult);
|
|
163793
|
+
waitWarning = {
|
|
163794
|
+
warning: command === AWAIT_NETWORK_REQUEST_TOOL_ID ? unmetNetworkWaitWarningFor(cause) : unmetWaitWarningFor(cause),
|
|
163795
|
+
kind: "wait"
|
|
163796
|
+
};
|
|
163797
|
+
} else if (command === AWAIT_UI_ELEMENT_TOOL_ID) {
|
|
163798
|
+
const probed = (await probeAgainstRunnerTree(registry2, ctx, args)).warning;
|
|
163799
|
+
if (probed) waitWarning = { warning: probed, kind: "conversion" };
|
|
163029
163800
|
}
|
|
163030
163801
|
const runTarget = command === RUN_TARGET_COMMAND && params.delayMs === void 0 ? await captureRunTarget(session, args, project) : void 0;
|
|
163031
163802
|
const strippedArgs = stripDeviceKeys(args);
|
|
@@ -163120,7 +163891,7 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
|
|
|
163120
163891
|
|
|
163121
163892
|
// ../tool-server/src/tools/flows/flow-insert-echo.ts
|
|
163122
163893
|
init_zod();
|
|
163123
|
-
var
|
|
163894
|
+
var zodSchema71 = external_exports.object({
|
|
163124
163895
|
name: external_exports.string().describe("Name of the e2e test being recorded: the one passed to e2e-start-recording."),
|
|
163125
163896
|
project_root: external_exports.string().describe(
|
|
163126
163897
|
"Absolute path to the project root of the e2e test being recorded: the same value passed to e2e-start-recording."
|
|
@@ -163132,7 +163903,7 @@ var flowInsertEchoTool = {
|
|
|
163132
163903
|
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
163904
|
Use when you want to annotate a recorded e2e test with a human-readable label or checkpoint message.
|
|
163134
163905
|
Returns { message, stepCount, savedTo }. Fails if that e2e test has no recording in progress.`,
|
|
163135
|
-
zodSchema:
|
|
163906
|
+
zodSchema: zodSchema71,
|
|
163136
163907
|
fileInputs: PROJECT_ROOT_INPUT,
|
|
163137
163908
|
aliases: ["flow-add-echo"],
|
|
163138
163909
|
interaction: {
|
|
@@ -164608,7 +165379,7 @@ function renderOutput(output2) {
|
|
|
164608
165379
|
const kept = bytes.subarray(0, utf8SafeCut(bytes, OUTPUT_RENDER_LIMIT_BYTES));
|
|
164609
165380
|
return { outputJson: kept.toString("utf8"), outputTruncated: true };
|
|
164610
165381
|
}
|
|
164611
|
-
var
|
|
165382
|
+
var zodSchema72 = external_exports.object({
|
|
164612
165383
|
name: external_exports.string().describe("E2E test name passed to e2e-start-recording."),
|
|
164613
165384
|
project_root: external_exports.string().describe("Absolute project root passed to e2e-start-recording."),
|
|
164614
165385
|
path: external_exports.string().describe(
|
|
@@ -164619,7 +165390,7 @@ var zodSchema71 = external_exports.object({
|
|
|
164619
165390
|
var flowAddScriptTool = {
|
|
164620
165391
|
id: "e2e-add-script",
|
|
164621
165392
|
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:
|
|
165393
|
+
zodSchema: zodSchema72,
|
|
164623
165394
|
fileInputs: PROJECT_ROOT_INPUT,
|
|
164624
165395
|
aliases: ["flow-add-script"],
|
|
164625
165396
|
interaction: {
|
|
@@ -164763,7 +165534,7 @@ function anchoredWarnings(session, steps) {
|
|
|
164763
165534
|
}
|
|
164764
165535
|
return kept;
|
|
164765
165536
|
}
|
|
164766
|
-
var
|
|
165537
|
+
var zodSchema73 = external_exports.object({
|
|
164767
165538
|
name: external_exports.string().describe("Name of the e2e test being recorded: the one passed to e2e-start-recording."),
|
|
164768
165539
|
project_root: external_exports.string().describe(
|
|
164769
165540
|
"Absolute path to the project root of the e2e test being recorded: the same value passed to e2e-start-recording."
|
|
@@ -164774,7 +165545,7 @@ var flowFinishRecordingTool = {
|
|
|
164774
165545
|
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
165546
|
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
165547
|
You can still edit the .yaml file directly afterwards to remove or reorder steps.`,
|
|
164777
|
-
zodSchema:
|
|
165548
|
+
zodSchema: zodSchema73,
|
|
164778
165549
|
fileInputs: PROJECT_ROOT_INPUT,
|
|
164779
165550
|
aliases: ["flow-finish-recording"],
|
|
164780
165551
|
interaction: {
|
|
@@ -167847,7 +168618,7 @@ Run the e2e test on the computer that runs the tool-server, with no link and no
|
|
|
167847
168618
|
}
|
|
167848
168619
|
);
|
|
167849
168620
|
}
|
|
167850
|
-
var
|
|
168621
|
+
var zodSchema74 = external_exports.object({
|
|
167851
168622
|
name: external_exports.string().optional().describe(
|
|
167852
168623
|
'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
168624
|
),
|
|
@@ -167896,7 +168667,7 @@ a nested e2e-execute not called by name with an absolute project_root, a directo
|
|
|
167896
168667
|
argument, a file path built from several arguments, a relative path): it stops before the first step and the
|
|
167897
168668
|
error lists each such step. An absolute .png/.yaml argument from anywhere else fails only when its step runs.
|
|
167898
168669
|
Without a link, every step kind runs.`,
|
|
167899
|
-
zodSchema:
|
|
168670
|
+
zodSchema: zodSchema74,
|
|
167900
168671
|
aliases: ["flow-execute"],
|
|
167901
168672
|
interaction: {
|
|
167902
168673
|
startedMsg: ({ params }) => `Running e2e test ${displayFlowName(params)}`,
|
|
@@ -168982,7 +169753,7 @@ var fileInputs6 = [
|
|
|
168982
169753
|
},
|
|
168983
169754
|
...PROJECT_ROOT_INPUT
|
|
168984
169755
|
];
|
|
168985
|
-
var
|
|
169756
|
+
var zodSchema75 = external_exports.object({
|
|
168986
169757
|
name: external_exports.string().optional().describe(
|
|
168987
169758
|
'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
169759
|
),
|
|
@@ -169013,7 +169784,7 @@ correct account, correct screen) before committing to a run, or when relaying th
|
|
|
169013
169784
|
Touches no device and needs none booted: it only reads the file.
|
|
169014
169785
|
Fails if the e2e test file does not exist.
|
|
169015
169786
|
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:
|
|
169787
|
+
zodSchema: zodSchema75,
|
|
169017
169788
|
readOnly: true,
|
|
169018
169789
|
// When its gates pass, e2e-execute without prerequisiteAcknowledged returns
|
|
169019
169790
|
// the same executionPrerequisite, from the same resolveFlowSource, before any
|
|
@@ -169347,7 +170118,7 @@ async function readWorkspaceSnapshot(workspacePath) {
|
|
|
169347
170118
|
var fileInputs7 = [
|
|
169348
170119
|
{ target: "workspacePath", path: "${workspacePath}", kind: "directory" }
|
|
169349
170120
|
];
|
|
169350
|
-
var
|
|
170121
|
+
var zodSchema76 = external_exports.object({
|
|
169351
170122
|
workspacePath: external_exports.string().describe("Absolute path to the project root directory to inspect (e.g. /Users/dev/MyApp)")
|
|
169352
170123
|
});
|
|
169353
170124
|
var gatherWorkspaceDataTool = {
|
|
@@ -169362,7 +170133,7 @@ Makefile targets, lint-staged config, and a list of detected config files.
|
|
|
169362
170133
|
Use when a program needs the project type (React Native, Expo, Flutter, native iOS/Android,
|
|
169363
170134
|
or other), build commands, platform support, package manager or QA tooling.
|
|
169364
170135
|
Items it cannot read are null or empty collections. Fails if workspacePath is not a directory on the tool-server host.`,
|
|
169365
|
-
zodSchema:
|
|
170136
|
+
zodSchema: zodSchema76,
|
|
169366
170137
|
readOnly: true,
|
|
169367
170138
|
hideFromMcp: true,
|
|
169368
170139
|
interaction: {
|
|
@@ -169444,7 +170215,7 @@ function targetFlagsFor(target) {
|
|
|
169444
170215
|
return [`--${target}`];
|
|
169445
170216
|
}
|
|
169446
170217
|
var updateScheduled = false;
|
|
169447
|
-
var
|
|
170218
|
+
var zodSchema77 = external_exports.object({
|
|
169448
170219
|
target: external_exports.enum(["auto", "global", "local", "both"]).optional().describe(
|
|
169449
170220
|
"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
170221
|
)
|
|
@@ -169452,7 +170223,7 @@ var zodSchema76 = external_exports.object({
|
|
|
169452
170223
|
var updateArgentTool = {
|
|
169453
170224
|
id: "update-argent",
|
|
169454
170225
|
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:
|
|
170226
|
+
zodSchema: zodSchema77,
|
|
169456
170227
|
interaction: {
|
|
169457
170228
|
startedMsg: () => `Updating Argent to ${getUpdateState().installableVersion ?? "latest"}`,
|
|
169458
170229
|
completedMsg: () => `Updated Argent to ${getUpdateState().installableVersion ?? "latest"}`,
|
|
@@ -169543,7 +170314,7 @@ var updateArgentTool = {
|
|
|
169543
170314
|
// ../tool-server/src/tools/system/dismiss-update.ts
|
|
169544
170315
|
init_zod();
|
|
169545
170316
|
var MAX_HOURS = 24 * 365 * 10;
|
|
169546
|
-
var
|
|
170317
|
+
var zodSchema78 = external_exports.object({
|
|
169547
170318
|
hours: external_exports.number().min(0).describe(
|
|
169548
170319
|
"Hours until reminders resume: 168 is a week, 87600 is the longest, 0 turns them back on"
|
|
169549
170320
|
)
|
|
@@ -169551,7 +170322,7 @@ var zodSchema77 = external_exports.object({
|
|
|
169551
170322
|
var dismissUpdateTool = {
|
|
169552
170323
|
id: "dismiss-update",
|
|
169553
170324
|
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:
|
|
170325
|
+
zodSchema: zodSchema78,
|
|
169555
170326
|
interaction: {
|
|
169556
170327
|
startedMsg: () => "Dismissing Argent update",
|
|
169557
170328
|
completedMsg: () => "Dismissed Argent update",
|
|
@@ -169604,7 +170375,7 @@ var fileInputs8 = [
|
|
|
169604
170375
|
{ target: "currentPath", path: "${currentPath}", kind: "file", optional: true },
|
|
169605
170376
|
{ target: "outputDir", path: "${outputDir}", kind: "probe", optional: true }
|
|
169606
170377
|
];
|
|
169607
|
-
var
|
|
170378
|
+
var zodSchema79 = external_exports.object({
|
|
169608
170379
|
baselinePath: external_exports.string().min(1).optional().describe(
|
|
169609
170380
|
"Path to the saved baseline PNG file. Required unless captureBaseline is true; do not pass both."
|
|
169610
170381
|
),
|
|
@@ -169638,7 +170409,7 @@ Physical iPhones: live captures are device-wide and need no registered app.
|
|
|
169638
170409
|
</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
170410
|
Ignores the fixed top status-bar band for both pixel and OCR text comparisons.
|
|
169640
170411
|
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:
|
|
170412
|
+
zodSchema: zodSchema79,
|
|
169642
170413
|
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
170414
|
interaction: {
|
|
169644
170415
|
startedMsg: () => "Comparing screenshots",
|
|
@@ -169985,7 +170756,7 @@ async function captureElementFrame(registry2, udid, match, opts = {}) {
|
|
|
169985
170756
|
}
|
|
169986
170757
|
|
|
169987
170758
|
// ../tool-server/src/tools/variants/propose-variant.ts
|
|
169988
|
-
var
|
|
170759
|
+
var zodSchema80 = external_exports.object({
|
|
169989
170760
|
element: external_exports.string().min(1).max(200).describe(
|
|
169990
170761
|
'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
170762
|
),
|
|
@@ -170038,7 +170809,7 @@ arrives as a follow-up message (this is the case in an \`argent lens\` CLI sessi
|
|
|
170038
170809
|
|
|
170039
170810
|
Returns { round, elementId, variantId, element, variantCount, totalElements }: confirmation only;
|
|
170040
170811
|
it does not wait for the user.`,
|
|
170041
|
-
zodSchema:
|
|
170812
|
+
zodSchema: zodSchema80,
|
|
170042
170813
|
searchHint: "propose design variant alternative option for element non-blocking ab choice",
|
|
170043
170814
|
featureFlag: "argent-lens",
|
|
170044
170815
|
interaction: {
|
|
@@ -170069,7 +170840,7 @@ it does not wait for the user.`,
|
|
|
170069
170840
|
|
|
170070
170841
|
// ../tool-server/src/tools/variants/await-user-selection.ts
|
|
170071
170842
|
init_zod();
|
|
170072
|
-
var
|
|
170843
|
+
var zodSchema81 = external_exports.object({
|
|
170073
170844
|
timeoutSeconds: external_exports.number().int().min(5).max(86400).optional().describe(
|
|
170074
170845
|
"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
170846
|
)
|
|
@@ -170097,7 +170868,7 @@ Returns one of:
|
|
|
170097
170868
|
|
|
170098
170869
|
This tool is long-running; it intentionally holds the request open. It honors client
|
|
170099
170870
|
disconnects (aborts cleanly).`,
|
|
170100
|
-
zodSchema:
|
|
170871
|
+
zodSchema: zodSchema81,
|
|
170101
170872
|
searchHint: "await wait user selection choice variant blocking confirm picks complete",
|
|
170102
170873
|
featureFlag: "argent-lens",
|
|
170103
170874
|
// Hidden while an `argent lens` CLI session owns the preview window: there the
|
|
@@ -170150,7 +170921,7 @@ var tabAction = {
|
|
|
170150
170921
|
var capability37 = {
|
|
170151
170922
|
chromium: { app: true }
|
|
170152
170923
|
};
|
|
170153
|
-
var
|
|
170924
|
+
var zodSchema82 = external_exports.object({
|
|
170154
170925
|
udid: external_exports.string().describe("Chromium device id from `list-devices` (e.g. `chromium-cdp-9222`)."),
|
|
170155
170926
|
action: external_exports.enum(["list", "select", "new", "close"]).describe(
|
|
170156
170927
|
"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 +170938,7 @@ var chromiumTabsTool = {
|
|
|
170167
170938
|
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
170939
|
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
170940
|
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:
|
|
170941
|
+
zodSchema: zodSchema82,
|
|
170171
170942
|
searchHint: "tab tabs window windows switch select close new open multi-tab chromium electron",
|
|
170172
170943
|
interaction: {
|
|
170173
170944
|
startedMsg: ({ params }) => tabAction[params.action].started(params),
|
|
@@ -170284,7 +171055,7 @@ var cookieAction = {
|
|
|
170284
171055
|
var capability38 = {
|
|
170285
171056
|
chromium: { app: true }
|
|
170286
171057
|
};
|
|
170287
|
-
var
|
|
171058
|
+
var zodSchema83 = external_exports.object({
|
|
170288
171059
|
udid: external_exports.string().describe("Chromium device id from `list-devices` (e.g. `chromium-cdp-9222`)."),
|
|
170289
171060
|
action: external_exports.enum(["get", "set", "delete", "clear"]).describe(
|
|
170290
171061
|
"get: read cookies. set: create/update a cookie. delete: remove matching cookies. clear: remove ALL browser cookies."
|
|
@@ -170307,7 +171078,7 @@ var chromiumCookiesTool = {
|
|
|
170307
171078
|
\`set\` needs \`name\`, \`value\`, and \`url\` or \`domain\`; \`delete\` needs \`name\` and \`url\` or \`domain\`.
|
|
170308
171079
|
Use when seeding an authenticated session before an e2e test (set the session cookie, then navigate) or asserting cookie state after one.
|
|
170309
171080
|
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:
|
|
171081
|
+
zodSchema: zodSchema83,
|
|
170311
171082
|
searchHint: "cookies cookie get set delete clear httponly samesite session auth chromium",
|
|
170312
171083
|
interaction: {
|
|
170313
171084
|
startedMsg: ({ params }) => `${cookieAction[params.action].started} browser cookies`,
|
|
@@ -170388,7 +171159,7 @@ var storageAction = {
|
|
|
170388
171159
|
var capability39 = {
|
|
170389
171160
|
chromium: { app: true }
|
|
170390
171161
|
};
|
|
170391
|
-
var
|
|
171162
|
+
var zodSchema84 = external_exports.object({
|
|
170392
171163
|
udid: external_exports.string().describe("Chromium device id from `list-devices` (e.g. `chromium-cdp-9222`)."),
|
|
170393
171164
|
store: external_exports.enum(["local", "session"]).describe("`local`: localStorage. `session`: sessionStorage."),
|
|
170394
171165
|
action: external_exports.enum(["get", "set", "remove", "clear"]).describe(
|
|
@@ -170402,7 +171173,7 @@ var chromiumStorageTool = {
|
|
|
170402
171173
|
description: `Read and write localStorage / sessionStorage of a Chromium (CDP) app, for the origin of the active tab's page.
|
|
170403
171174
|
Use when seeding feature flags / auth tokens before an e2e test or asserting persisted app state after one.
|
|
170404
171175
|
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:
|
|
171176
|
+
zodSchema: zodSchema84,
|
|
170406
171177
|
searchHint: "storage localstorage sessionstorage local session get set remove clear key value chromium",
|
|
170407
171178
|
// Agents read and write Web Storage with debugger-evaluate, which runs the same
|
|
170408
171179
|
// Runtime.evaluate on the active page. The SDK and the e2e-full suite still call it.
|
|
@@ -170621,7 +171392,7 @@ async function stub(app, params) {
|
|
|
170621
171392
|
});
|
|
170622
171393
|
return { armed, mode, panelKind };
|
|
170623
171394
|
}
|
|
170624
|
-
var
|
|
171395
|
+
var zodSchema85 = external_exports.object({
|
|
170625
171396
|
udid: external_exports.string().describe("Mac app id from `list-devices` (macos-app-<bundle id>)."),
|
|
170626
171397
|
action: external_exports.enum(["list", "choose", "cancel", "discard", "stub"]).describe(
|
|
170627
171398
|
"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 +171425,7 @@ For stub, panelKind names the kind of panel the answer is for; without it, paths
|
|
|
170654
171425
|
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
171426
|
Returns { panels } for list, { chosen, panel, kind, paths } for choose, { cancelled, panel } for cancel, { discarded, panel } for discard, { armed, mode, panelKind? } for stub.
|
|
170656
171427
|
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:
|
|
171428
|
+
zodSchema: zodSchema85,
|
|
170658
171429
|
searchHint: "file panel dialog open save choose pick file folder nsopenpanel nssavepanel mac app",
|
|
170659
171430
|
featureFlag: "macos-apps",
|
|
170660
171431
|
interaction: {
|
|
@@ -170756,7 +171527,7 @@ function renderMenus(items, depth, lines) {
|
|
|
170756
171527
|
if (item.items) renderMenus(item.items, depth + 1, lines);
|
|
170757
171528
|
}
|
|
170758
171529
|
}
|
|
170759
|
-
var
|
|
171530
|
+
var zodSchema86 = external_exports.object({
|
|
170760
171531
|
udid: external_exports.string().describe("Mac app id from `list-devices` (macos-app-<bundle id>)."),
|
|
170761
171532
|
action: external_exports.enum(["list", "choose"]).describe(
|
|
170762
171533
|
"list: the app's menu bar, one line per item. choose: run one menu item, by path or identifier."
|
|
@@ -170772,7 +171543,7 @@ var menuBarTool = {
|
|
|
170772
171543
|
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
171544
|
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
171545
|
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:
|
|
171546
|
+
zodSchema: zodSchema86,
|
|
170776
171547
|
searchHint: "menu bar main menu command item file edit view window help choose mac app",
|
|
170777
171548
|
featureFlag: "macos-apps",
|
|
170778
171549
|
interaction: {
|
|
@@ -170906,6 +171677,7 @@ function createRegistry() {
|
|
|
170906
171677
|
registry2.registerTool(networkRequestTool);
|
|
170907
171678
|
registry2.registerTool(createNetworkCaptureStartTool(registry2));
|
|
170908
171679
|
registry2.registerTool(createNetworkCaptureStopTool(registry2));
|
|
171680
|
+
registry2.registerTool(createAwaitNetworkRequestTool(registry2));
|
|
170909
171681
|
registry2.registerTool(createDescribeTool(registry2));
|
|
170910
171682
|
registry2.registerTool(createUiTreeTool(registry2));
|
|
170911
171683
|
registry2.registerTool(createForegroundAppTool(registry2));
|