@swmansion/argent 0.35.1-next.41 → 0.35.1-next.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli-cmds.mjs +1 -1
- package/dist/installer.mjs +1 -1
- package/dist/mcp-server.mjs +1 -1
- package/dist/tool-args.generated.d.ts +15 -0
- package/dist/tool-server.cjs +137 -31
- package/package.json +2 -2
- package/skills/argent-create-e2e/references/live-authoring.md +1 -1
- package/skills/argent-metro-debugger/SKILL.md +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -38596,7 +38596,7 @@ function isCi(env = process.env) {
|
|
|
38596
38596
|
var SESSION_ID2 = randomUUID5();
|
|
38597
38597
|
function readCliVersion() {
|
|
38598
38598
|
if (true) {
|
|
38599
|
-
return "0.35.1-next.
|
|
38599
|
+
return "0.35.1-next.43";
|
|
38600
38600
|
}
|
|
38601
38601
|
return "0.0.0";
|
|
38602
38602
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -17118,7 +17118,7 @@ function isCi(env = process.env) {
|
|
|
17118
17118
|
var SESSION_ID = randomUUID4();
|
|
17119
17119
|
function readCliVersion() {
|
|
17120
17120
|
if (true) {
|
|
17121
|
-
return "0.35.1-next.
|
|
17121
|
+
return "0.35.1-next.43";
|
|
17122
17122
|
}
|
|
17123
17123
|
return "0.0.0";
|
|
17124
17124
|
}
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -38155,7 +38155,7 @@ async function startMcpServer(options) {
|
|
|
38155
38155
|
const autoDescribeOn = autoDescribeEnabled();
|
|
38156
38156
|
const whatsNewOn = whatsNewEnabled();
|
|
38157
38157
|
const installedVersion = getInstalledVersion();
|
|
38158
|
-
const highlightsVersion = true ? "0.35.1-next.
|
|
38158
|
+
const highlightsVersion = true ? "0.35.1-next.43" : installedVersion;
|
|
38159
38159
|
const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
|
|
38160
38160
|
const trees = createTreeMemory();
|
|
38161
38161
|
const screenshots = createScreenshotMemory();
|
|
@@ -30,6 +30,21 @@ export interface ArgentToolArgs {
|
|
|
30
30
|
status?: "1xx" | "2xx" | "3xx" | "4xx" | "5xx" | number;
|
|
31
31
|
/** `complete` includes HTTP error responses. `failed` matches network errors. `any` matches either. `sent` matches all states. Defaults to `sent` with `absent: true`, otherwise `complete`. */
|
|
32
32
|
outcome?: "complete" | "failed" | "any" | "sent";
|
|
33
|
+
/** Check one request header using exactly one of `equals`, `contains`, `matches`, or `exists`. */
|
|
34
|
+
header?: {
|
|
35
|
+
/** Case-insensitive header name, such as `authorization`. Names of only digits are invalid. */
|
|
36
|
+
name: string;
|
|
37
|
+
/** Dot-separated JWT payload claim, such as `consents.analytics`. Accepts a `Bearer ` prefix and reads the payload without validating the signature. */
|
|
38
|
+
claim?: string;
|
|
39
|
+
/** Exact, case-sensitive match. Compares numbers and booleans as text. */
|
|
40
|
+
equals?: string | number | boolean;
|
|
41
|
+
/** Case-sensitive substring. */
|
|
42
|
+
contains?: string;
|
|
43
|
+
/** Case-sensitive JavaScript regular expression. */
|
|
44
|
+
matches?: string;
|
|
45
|
+
/** Use true for a present value or false for a missing or null value. */
|
|
46
|
+
exists?: boolean;
|
|
47
|
+
};
|
|
33
48
|
/** Check a request body using exactly one of `equals`, `contains`, `matches`, or `exists`. */
|
|
34
49
|
requestBody?: {
|
|
35
50
|
/** JSON field specified as keys and array indexes joined by dots, e.g. `data.items.0.id`. Omit to use the whole body. */
|
package/dist/tool-server.cjs
CHANGED
|
@@ -72982,7 +72982,7 @@ function isCi(env = process.env) {
|
|
|
72982
72982
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
72983
72983
|
function readCliVersion() {
|
|
72984
72984
|
if (true) {
|
|
72985
|
-
return "0.35.1-next.
|
|
72985
|
+
return "0.35.1-next.43";
|
|
72986
72986
|
}
|
|
72987
72987
|
return "0.0.0";
|
|
72988
72988
|
}
|
|
@@ -105540,6 +105540,30 @@ function createNetworkManager(deps) {
|
|
|
105540
105540
|
let mark;
|
|
105541
105541
|
let conditions = null;
|
|
105542
105542
|
const bodyBytesLeft = /* @__PURE__ */ new WeakMap();
|
|
105543
|
+
const hopsOf = /* @__PURE__ */ new WeakMap();
|
|
105544
|
+
function noteHeaders(rec, change) {
|
|
105545
|
+
const of = hopsOf.get(rec) ?? { set: [], wire: [], noWire: /* @__PURE__ */ new Set() };
|
|
105546
|
+
hopsOf.set(rec, of);
|
|
105547
|
+
if (change.kind === "set") {
|
|
105548
|
+
of.set.push(change.headers ?? {});
|
|
105549
|
+
if (change.previousHasWire === false) of.noWire.add(of.set.length - 2);
|
|
105550
|
+
} else if (change.kind === "wire") {
|
|
105551
|
+
of.wire.push(change.headers ?? {});
|
|
105552
|
+
} else if (change.kind === "response") {
|
|
105553
|
+
of.responded = true;
|
|
105554
|
+
if (change.hasExtraInfo === false) of.none = true;
|
|
105555
|
+
}
|
|
105556
|
+
const hop = of.set.length - 1;
|
|
105557
|
+
if (hop < 0) return;
|
|
105558
|
+
let index = hop;
|
|
105559
|
+
for (const skipped of of.noWire) if (skipped < hop) index--;
|
|
105560
|
+
const wire = of.wire[index];
|
|
105561
|
+
rec.requestHeaders = { ...of.set[hop], ...wire };
|
|
105562
|
+
const ended = rec.finished || rec.failed;
|
|
105563
|
+
const pending = !ended && !of.none && (wire === void 0 || !of.responded);
|
|
105564
|
+
if (pending) rec.wireHeadersPending = true;
|
|
105565
|
+
else delete rec.wireHeadersPending;
|
|
105566
|
+
}
|
|
105543
105567
|
function record2(requestId) {
|
|
105544
105568
|
let rec = byId.get(requestId);
|
|
105545
105569
|
if (!rec) {
|
|
@@ -105565,7 +105589,6 @@ function createNetworkManager(deps) {
|
|
|
105565
105589
|
const rec = record2(params.requestId);
|
|
105566
105590
|
rec.method = r.method ?? rec.method;
|
|
105567
105591
|
rec.url = r.url ?? rec.url;
|
|
105568
|
-
if (r.headers) rec.requestHeaders = { ...rec.requestHeaders ?? {}, ...r.headers };
|
|
105569
105592
|
if (r.postData != null) rec.postData = r.postData;
|
|
105570
105593
|
if (r.hasPostData) rec.hasPostData = true;
|
|
105571
105594
|
rec.resourceType = params.type ?? rec.resourceType;
|
|
@@ -105574,6 +105597,11 @@ function createNetworkManager(deps) {
|
|
|
105574
105597
|
if (params.wallTime) {
|
|
105575
105598
|
rec.startedDateTime = new Date(params.wallTime * 1e3).toISOString();
|
|
105576
105599
|
}
|
|
105600
|
+
noteHeaders(rec, {
|
|
105601
|
+
kind: "set",
|
|
105602
|
+
headers: r.headers,
|
|
105603
|
+
...params.redirectResponse ? { previousHasWire: params.redirectHasExtraInfo } : {}
|
|
105604
|
+
});
|
|
105577
105605
|
break;
|
|
105578
105606
|
}
|
|
105579
105607
|
case "Network.responseReceived": {
|
|
@@ -105585,6 +105613,10 @@ function createNetworkManager(deps) {
|
|
|
105585
105613
|
if (resp.headers) rec.responseHeaders = { ...rec.responseHeaders ?? {}, ...resp.headers };
|
|
105586
105614
|
rec.fromCache = resp.fromDiskCache;
|
|
105587
105615
|
rec.resourceType = params.type ?? rec.resourceType;
|
|
105616
|
+
noteHeaders(rec, {
|
|
105617
|
+
kind: "response",
|
|
105618
|
+
hasExtraInfo: params.hasExtraInfo
|
|
105619
|
+
});
|
|
105588
105620
|
const length = params.type === "Fetch" ? unreadBodyLength(resp.headers) : void 0;
|
|
105589
105621
|
if (length !== void 0) bodyBytesLeft.set(rec, length);
|
|
105590
105622
|
break;
|
|
@@ -105600,6 +105632,7 @@ function createNetworkManager(deps) {
|
|
|
105600
105632
|
bodyBytesLeft.set(rec, after);
|
|
105601
105633
|
if (after <= 0 && !rec.finished) {
|
|
105602
105634
|
rec.finished = true;
|
|
105635
|
+
noteHeaders(rec, { kind: "ended" });
|
|
105603
105636
|
const at = params.timestamp;
|
|
105604
105637
|
if (rec.startTs && at !== void 0) rec.durationMs = (at - rec.startTs) * 1e3;
|
|
105605
105638
|
}
|
|
@@ -105609,11 +105642,11 @@ function createNetworkManager(deps) {
|
|
|
105609
105642
|
// The *ExtraInfo events carry on-the-wire headers (Authorization, Set-Cookie, …)
|
|
105610
105643
|
// the base events omit, and may arrive before them — hence `record()`, not `get()`.
|
|
105611
105644
|
case "Network.requestWillBeSentExtraInfo": {
|
|
105612
|
-
const
|
|
105613
|
-
|
|
105614
|
-
|
|
105615
|
-
|
|
105616
|
-
}
|
|
105645
|
+
const rec = record2(params.requestId);
|
|
105646
|
+
noteHeaders(rec, {
|
|
105647
|
+
kind: "wire",
|
|
105648
|
+
headers: params.headers
|
|
105649
|
+
});
|
|
105617
105650
|
break;
|
|
105618
105651
|
}
|
|
105619
105652
|
case "Network.responseReceivedExtraInfo": {
|
|
@@ -105628,6 +105661,7 @@ function createNetworkManager(deps) {
|
|
|
105628
105661
|
const rec = byId.get(params.requestId);
|
|
105629
105662
|
if (rec) {
|
|
105630
105663
|
rec.finished = true;
|
|
105664
|
+
noteHeaders(rec, { kind: "ended" });
|
|
105631
105665
|
rec.encodedDataLength = params.encodedDataLength;
|
|
105632
105666
|
if (rec.startTs) rec.durationMs = (params.timestamp - rec.startTs) * 1e3;
|
|
105633
105667
|
}
|
|
@@ -105637,6 +105671,7 @@ function createNetworkManager(deps) {
|
|
|
105637
105671
|
const rec = byId.get(params.requestId);
|
|
105638
105672
|
if (rec) {
|
|
105639
105673
|
rec.failed = true;
|
|
105674
|
+
noteHeaders(rec, { kind: "ended" });
|
|
105640
105675
|
rec.errorText = params.errorText;
|
|
105641
105676
|
rec.resourceType = params.type ?? rec.resourceType;
|
|
105642
105677
|
}
|
|
@@ -132166,7 +132201,7 @@ function metroFilter(metroPort2) {
|
|
|
132166
132201
|
return typeof u === 'string' && (u.indexOf('://localhost:${metroPort2}') !== -1 || u.indexOf('://127.0.0.1:${metroPort2}') !== -1);
|
|
132167
132202
|
}`;
|
|
132168
132203
|
}
|
|
132169
|
-
function makeNetworkWaitReadScript(mark, metroPort2) {
|
|
132204
|
+
function makeNetworkWaitReadScript(mark, metroPort2, withHeaders = false) {
|
|
132170
132205
|
return `(function() {
|
|
132171
132206
|
var g = globalThis;
|
|
132172
132207
|
var xhr = typeof g.XMLHttpRequest === 'function';
|
|
@@ -132204,7 +132239,7 @@ function makeNetworkWaitReadScript(mark, metroPort2) {
|
|
|
132204
132239
|
status: e.response ? e.response.status : undefined,
|
|
132205
132240
|
durationMs: e.durationMs,
|
|
132206
132241
|
errorText: e.errorText,
|
|
132207
|
-
timestamp: e.timestamp
|
|
132242
|
+
timestamp: e.timestamp${withHeaders ? ",\n headers: e.request ? e.request.headers : undefined" : ""}
|
|
132208
132243
|
});
|
|
132209
132244
|
}
|
|
132210
132245
|
return JSON.stringify({
|
|
@@ -147724,7 +147759,11 @@ function fromNative(record2) {
|
|
|
147724
147759
|
...record2.timing.durationMs !== void 0 ? { durationMs: Math.round(record2.timing.durationMs) } : {},
|
|
147725
147760
|
...record2.errorText ? { errorText: record2.errorText } : {},
|
|
147726
147761
|
// From the agent's wallTime, on the app's clock, as the start of a JS request.
|
|
147727
|
-
startedAt: record2.timing.startedAt
|
|
147762
|
+
startedAt: record2.timing.startedAt,
|
|
147763
|
+
// The headers sent on the wire hold what the app's HTTP stack added, so they come first.
|
|
147764
|
+
requestHeaders: record2.request.wireHeaders ? [record2.request.wireHeaders, record2.request.headers] : [record2.request.headers],
|
|
147765
|
+
// The Android agent reports them in a later event, before the response or a failure.
|
|
147766
|
+
...record2.layer === "android-native" && record2.state === "pending" && !record2.request.wireHeaders ? { headersPending: true } : {}
|
|
147728
147767
|
};
|
|
147729
147768
|
}
|
|
147730
147769
|
function windowNote(armed, stopped, unarmed, missed, evicted) {
|
|
@@ -147736,7 +147775,7 @@ function windowNote(armed, stopped, unarmed, missed, evicted) {
|
|
|
147736
147775
|
function nativeAfter(records, floor) {
|
|
147737
147776
|
return records.filter((r) => recordNumber(r.id) > floor).map(fromNative);
|
|
147738
147777
|
}
|
|
147739
|
-
async function markedLayers(registry2, device, bundleId) {
|
|
147778
|
+
async function markedLayers(registry2, device, bundleId, options = {}) {
|
|
147740
147779
|
const layers = [];
|
|
147741
147780
|
const start2 = lastCaptureStart(device.id, bundleId);
|
|
147742
147781
|
const startWindow = {
|
|
@@ -147755,7 +147794,7 @@ async function markedLayers(registry2, device, bundleId) {
|
|
|
147755
147794
|
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);
|
|
147756
147795
|
if (native) layers.push(native);
|
|
147757
147796
|
if (device.platform !== "chromium") {
|
|
147758
|
-
const js = jsLayer(registry2, device, bundleId, startWindow);
|
|
147797
|
+
const js = jsLayer(registry2, device, bundleId, startWindow, options.headers === true);
|
|
147759
147798
|
if (js) layers.push(js);
|
|
147760
147799
|
}
|
|
147761
147800
|
return layers;
|
|
@@ -147883,7 +147922,9 @@ function fromChromium(record2) {
|
|
|
147883
147922
|
...record2.status !== void 0 ? { status: record2.status } : {},
|
|
147884
147923
|
state: record2.failed ? "failed" : record2.finished ? "complete" : record2.status !== void 0 ? "headers" : "pending",
|
|
147885
147924
|
...record2.durationMs !== void 0 ? { durationMs: Math.round(record2.durationMs) } : {},
|
|
147886
|
-
...record2.errorText ? { errorText: record2.errorText } : {}
|
|
147925
|
+
...record2.errorText ? { errorText: record2.errorText } : {},
|
|
147926
|
+
requestHeaders: [record2.requestHeaders ?? {}],
|
|
147927
|
+
...record2.wireHeadersPending ? { headersPending: true } : {}
|
|
147887
147928
|
};
|
|
147888
147929
|
}
|
|
147889
147930
|
async function chromiumLayer(registry2, device) {
|
|
@@ -147929,10 +147970,11 @@ function fromJs(entry, install) {
|
|
|
147929
147970
|
...typeof entry.durationMs === "number" ? { durationMs: Math.round(entry.durationMs) } : {},
|
|
147930
147971
|
...entry.errorText ? { errorText: entry.errorText } : {},
|
|
147931
147972
|
...typeof entry.timestamp === "number" ? { startedAt: entry.timestamp * 1e3 } : {},
|
|
147973
|
+
..."headers" in entry ? { requestHeaders: [entry.headers ?? {}] } : {},
|
|
147932
147974
|
...install ? { install } : {}
|
|
147933
147975
|
};
|
|
147934
147976
|
}
|
|
147935
|
-
function jsLayer(registry2, device, bundleId, startWindow) {
|
|
147977
|
+
function jsLayer(registry2, device, bundleId, startWindow, withHeaders) {
|
|
147936
147978
|
const found = findJsCaptureOfDevice(device.id, bundleId);
|
|
147937
147979
|
if (!found?.capture.mark) return void 0;
|
|
147938
147980
|
if (!startWindow.current("js", found.capture.intent === "stopped")) return void 0;
|
|
@@ -148009,7 +148051,7 @@ function jsLayer(registry2, device, bundleId, startWindow) {
|
|
|
148009
148051
|
}
|
|
148010
148052
|
const answer = JSON.parse(
|
|
148011
148053
|
String(
|
|
148012
|
-
await dbg.cdp.evaluate(makeNetworkWaitReadScript(mark, port), {
|
|
148054
|
+
await dbg.cdp.evaluate(makeNetworkWaitReadScript(mark, port, withHeaders), {
|
|
148013
148055
|
timeout: Math.max(1, budgetMs)
|
|
148014
148056
|
})
|
|
148015
148057
|
)
|
|
@@ -148101,7 +148143,7 @@ init_zod();
|
|
|
148101
148143
|
init_src();
|
|
148102
148144
|
var COMPARATORS = ["equals", "contains", "matches", "exists"];
|
|
148103
148145
|
var PATH_HELP = "keys and array indexes joined by dots, e.g. `data.items.0.id`";
|
|
148104
|
-
var
|
|
148146
|
+
var valueFields = {
|
|
148105
148147
|
path: external_exports.string().optional().describe(`JSON field specified as ${PATH_HELP}. Omit to use the whole body.`),
|
|
148106
148148
|
claim: external_exports.string().optional().describe(
|
|
148107
148149
|
"Dot-separated JWT payload claim, such as `consents.analytics`. Accepts a `Bearer ` prefix and reads the payload without validating the signature."
|
|
@@ -148110,7 +148152,8 @@ var valueCheckSchema = external_exports.object({
|
|
|
148110
148152
|
contains: external_exports.string().optional().describe("Case-sensitive substring."),
|
|
148111
148153
|
matches: external_exports.string().optional().describe("Case-sensitive JavaScript regular expression."),
|
|
148112
148154
|
exists: external_exports.boolean().optional().describe("Use true for a present value or false for a missing or null value.")
|
|
148113
|
-
}
|
|
148155
|
+
};
|
|
148156
|
+
function refineValueCheck(check3, ctx) {
|
|
148114
148157
|
const given = COMPARATORS.filter((name) => check3[name] !== void 0);
|
|
148115
148158
|
if (given.length !== 1) {
|
|
148116
148159
|
ctx.addIssue({
|
|
@@ -148127,12 +148170,22 @@ var valueCheckSchema = external_exports.object({
|
|
|
148127
148170
|
});
|
|
148128
148171
|
}
|
|
148129
148172
|
}
|
|
148130
|
-
if (check3.matches
|
|
148173
|
+
if (typeof check3.matches === "string") {
|
|
148131
148174
|
const problem = regexProblem(check3.matches);
|
|
148132
|
-
if (problem)
|
|
148133
|
-
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["matches"], message: problem });
|
|
148175
|
+
if (problem) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["matches"], message: problem });
|
|
148134
148176
|
}
|
|
148135
|
-
}
|
|
148177
|
+
}
|
|
148178
|
+
var valueCheckSchema = external_exports.object(valueFields).strict().superRefine(refineValueCheck);
|
|
148179
|
+
var headerCheckSchema = external_exports.object({
|
|
148180
|
+
name: external_exports.string().min(1).regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/, "a header name, such as authorization").refine((name) => !/^\d+$/.test(name), "a header name, not a number").describe(
|
|
148181
|
+
"Case-insensitive header name, such as `authorization`. Names of only digits are invalid."
|
|
148182
|
+
),
|
|
148183
|
+
claim: valueFields.claim,
|
|
148184
|
+
equals: valueFields.equals,
|
|
148185
|
+
contains: valueFields.contains,
|
|
148186
|
+
matches: valueFields.matches,
|
|
148187
|
+
exists: valueFields.exists
|
|
148188
|
+
}).strict().superRefine(refineValueCheck);
|
|
148136
148189
|
function regexProblem(pattern) {
|
|
148137
148190
|
try {
|
|
148138
148191
|
new RegExp(pattern.replace(SECRET_PLACEHOLDER_RE, "x"));
|
|
@@ -148151,6 +148204,39 @@ function fillSecrets(text, regex, options) {
|
|
|
148151
148204
|
function escapeRegExp2(text) {
|
|
148152
148205
|
return text.replace(/[.*+?^${}()|[\]\\/-]/g, "\\$&");
|
|
148153
148206
|
}
|
|
148207
|
+
function headerCheckOf(params, options, sensitive) {
|
|
148208
|
+
const { name, ...check3 } = params;
|
|
148209
|
+
const lower = name.toLowerCase();
|
|
148210
|
+
return { ...valueCheckOf(check3, options), name: lower, sensitive: sensitive(lower) };
|
|
148211
|
+
}
|
|
148212
|
+
function headerIn(headers, name) {
|
|
148213
|
+
for (const map2 of headers) {
|
|
148214
|
+
for (const [key2, value] of Object.entries(map2)) {
|
|
148215
|
+
if (key2.toLowerCase() === name) return String(value);
|
|
148216
|
+
if (/^\d+$/.test(key2) && typeof value === "string") {
|
|
148217
|
+
const comma = value.indexOf(",");
|
|
148218
|
+
if (comma > 0 && value.slice(0, comma).trim().toLowerCase() === name) {
|
|
148219
|
+
return value.slice(comma + 1);
|
|
148220
|
+
}
|
|
148221
|
+
}
|
|
148222
|
+
}
|
|
148223
|
+
}
|
|
148224
|
+
return void 0;
|
|
148225
|
+
}
|
|
148226
|
+
function checkHeader(check3, headers) {
|
|
148227
|
+
const label = `header ${check3.name}`;
|
|
148228
|
+
if (!headers) return { verdict: "unknown", reason: `${label}: the layer gave no headers` };
|
|
148229
|
+
const value = headerIn(headers, check3.name);
|
|
148230
|
+
const source = value === void 0 ? { kind: "none" } : { kind: "text", text: value };
|
|
148231
|
+
const verdict = checkValue(check3, source, label);
|
|
148232
|
+
if (value === void 0) {
|
|
148233
|
+
const reason2 = `${label} was not sent`;
|
|
148234
|
+
return verdict.verdict === "pass" ? { verdict: "pass", reason: reason2, value: "" } : { verdict: "fail", reason: reason2 };
|
|
148235
|
+
}
|
|
148236
|
+
if (!check3.sensitive || check3.claim !== void 0) return verdict;
|
|
148237
|
+
const hidden = `the value of the sensitive ${label} stays hidden`;
|
|
148238
|
+
return verdict.verdict === "pass" ? { verdict: "pass", reason: hidden, value: "[REDACTED]" } : { verdict: verdict.verdict, reason: `${label} does not match (${hidden})` };
|
|
148239
|
+
}
|
|
148154
148240
|
function valueCheckOf(params, options) {
|
|
148155
148241
|
const test = COMPARATORS.find((name) => params[name] !== void 0);
|
|
148156
148242
|
const raw = params[test];
|
|
@@ -148239,10 +148325,16 @@ function checkValue(check3, source, label) {
|
|
|
148239
148325
|
}
|
|
148240
148326
|
|
|
148241
148327
|
// ../tool-server/src/tools/await-network-request/match.ts
|
|
148242
|
-
function withoutStart({
|
|
148328
|
+
function withoutStart({
|
|
148329
|
+
startedAt: _,
|
|
148330
|
+
requestHeaders: __,
|
|
148331
|
+
install: ___,
|
|
148332
|
+
headersPending: ____,
|
|
148333
|
+
...record2
|
|
148334
|
+
}) {
|
|
148243
148335
|
return record2;
|
|
148244
148336
|
}
|
|
148245
|
-
var BODY_CRITERIA = ["requestBody", "responseBody"];
|
|
148337
|
+
var BODY_CRITERIA = ["header", "requestBody", "responseBody"];
|
|
148246
148338
|
var STATUS_CLASSES = ["1xx", "2xx", "3xx", "4xx", "5xx"];
|
|
148247
148339
|
function urlMatches(criteria, url2) {
|
|
148248
148340
|
switch (criteria.urlMatch) {
|
|
@@ -148322,6 +148414,7 @@ function describeCriteria(criteria) {
|
|
|
148322
148414
|
url2,
|
|
148323
148415
|
criteria.status !== void 0 ? `status ${criteria.status}` : void 0,
|
|
148324
148416
|
criteria.outcome === "any" ? "complete or failed" : criteria.outcome === "sent" ? "sent (in any state)" : criteria.outcome,
|
|
148417
|
+
criteria.header ? `header ${criteria.header.name}${criteria.header.description ? ` ${criteria.header.description}` : ""}` : void 0,
|
|
148325
148418
|
criteria.requestBody ? `request body ${criteria.requestBody.description}` : void 0,
|
|
148326
148419
|
criteria.responseBody ? `response body ${criteria.responseBody.description}` : void 0
|
|
148327
148420
|
].filter(Boolean).join(", ");
|
|
@@ -148362,6 +148455,9 @@ var zodSchema45 = external_exports.object({
|
|
|
148362
148455
|
outcome: external_exports.enum(["complete", "failed", "any", "sent"]).optional().describe(
|
|
148363
148456
|
"`complete` includes HTTP error responses. `failed` matches network errors. `any` matches either. `sent` matches all states. Defaults to `sent` with `absent: true`, otherwise `complete`."
|
|
148364
148457
|
),
|
|
148458
|
+
header: headerCheckSchema.optional().describe(
|
|
148459
|
+
"Check one request header using exactly one of `equals`, `contains`, `matches`, or `exists`."
|
|
148460
|
+
),
|
|
148365
148461
|
requestBody: valueCheckSchema.optional().describe(
|
|
148366
148462
|
"Check a request body using exactly one of `equals`, `contains`, `matches`, or `exists`."
|
|
148367
148463
|
),
|
|
@@ -148388,6 +148484,7 @@ function criteriaOf(params, ctx) {
|
|
|
148388
148484
|
...params.method !== void 0 ? { method: params.method } : {},
|
|
148389
148485
|
...params.status !== void 0 ? { status: params.status } : {},
|
|
148390
148486
|
outcome: params.outcome ?? (params.absent ? "sent" : "complete"),
|
|
148487
|
+
...params.header ? { header: headerCheckOf(params.header, secrets, (name) => isSensitiveHeader(name)) } : {},
|
|
148391
148488
|
...params.requestBody ? { requestBody: valueCheckOf(params.requestBody, secrets) } : {},
|
|
148392
148489
|
...params.responseBody ? { responseBody: valueCheckOf(params.responseBody, secrets) } : {}
|
|
148393
148490
|
};
|
|
@@ -148411,7 +148508,7 @@ function createAwaitNetworkRequestTool(registry2) {
|
|
|
148411
148508
|
// A literal, so scripts/extract-tools.mjs finds the description it scores.
|
|
148412
148509
|
id: "await-network-request",
|
|
148413
148510
|
description: `Wait for an HTTP request or check for no match with \`absent: true\`. Requires a \`network-capture-start\` window for the target. Unavailable on physical iPhones and Vega. On Chromium, match the final URL and method after redirects.
|
|
148414
|
-
Pass \`match.id\` to \`view-network-request-details\`. \`values\` shows previews of matched
|
|
148511
|
+
Pass \`match.id\` to \`view-network-request-details\`. \`values\` shows previews of matched values and redacts sensitive headers. A header claim check can show the claim. Check \`cause\` and \`note\` on failure. \`success: false\` fails an e2e step and stops \`run-sequence\`.`,
|
|
148415
148512
|
zodSchema: zodSchema45,
|
|
148416
148513
|
searchHint: "wait await network request http api call fetch xhr response status url match after capture start e2e assert",
|
|
148417
148514
|
readOnly: true,
|
|
@@ -148438,7 +148535,9 @@ Pass \`match.id\` to \`view-network-request-details\`. \`values\` shows previews
|
|
|
148438
148535
|
if (device.platform === "macos") {
|
|
148439
148536
|
assertMacosAppBundle(parseMacosAppBundleId(device.id) ?? device.id, params.bundleId);
|
|
148440
148537
|
}
|
|
148441
|
-
const layers = await markedLayers(registry2, device, params.bundleId
|
|
148538
|
+
const layers = await markedLayers(registry2, device, params.bundleId, {
|
|
148539
|
+
headers: params.header !== void 0
|
|
148540
|
+
});
|
|
148442
148541
|
if (layers.length === 0) throw notStartedError(params);
|
|
148443
148542
|
const criteria = criteriaOf(params, ctx);
|
|
148444
148543
|
const atStart = networkSecrets(ctx);
|
|
@@ -148539,12 +148638,19 @@ Pass \`match.id\` to \`view-network-request-details\`. \`values\` shows previews
|
|
|
148539
148638
|
const judge = async (layer, record2) => {
|
|
148540
148639
|
const verdicts = [];
|
|
148541
148640
|
for (const name of bodyChecks) {
|
|
148542
|
-
|
|
148543
|
-
|
|
148544
|
-
|
|
148545
|
-
|
|
148546
|
-
|
|
148547
|
-
|
|
148641
|
+
if (name === "header") {
|
|
148642
|
+
verdicts.push({
|
|
148643
|
+
name,
|
|
148644
|
+
verdict: record2.headersPending ? {
|
|
148645
|
+
verdict: "unknown",
|
|
148646
|
+
reason: `header ${criteria.header.name}: the headers sent on the wire are not known yet`
|
|
148647
|
+
} : checkHeader(criteria.header, record2.requestHeaders)
|
|
148648
|
+
});
|
|
148649
|
+
} else {
|
|
148650
|
+
const kind = name === "requestBody" ? "request" : "response";
|
|
148651
|
+
const body = await readBody(layer, record2, kind);
|
|
148652
|
+
verdicts.push({ name, verdict: checkValue(criteria[name], body, `${kind} body`) });
|
|
148653
|
+
}
|
|
148548
148654
|
if (verdicts.at(-1).verdict.verdict === "fail") break;
|
|
148549
148655
|
}
|
|
148550
148656
|
const failed3 = verdicts.filter(({ verdict }) => verdict.verdict === "fail");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swmansion/argent",
|
|
3
|
-
"version": "0.35.1-next.
|
|
3
|
+
"version": "0.35.1-next.43",
|
|
4
4
|
"mcpName": "io.github.software-mansion/argent",
|
|
5
5
|
"description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"vitest": "^5.0.5",
|
|
99
99
|
"yaml": "^2.9.1"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "62ec07e8a69c9465d2e9ca80decce1af295dbf2f"
|
|
102
102
|
}
|
|
@@ -158,7 +158,7 @@ A warning does not reject the step. If `e2e-finish-recording` reports dropped wa
|
|
|
158
158
|
On iOS simulators, Android, Mac apps, and Chromium, use `e2e-add-step` to record `network-capture-start`, the action, `await-network-request`, and `network-capture-stop` in that order. Put capture start after launch and the first-screen wait. A start before `launch:` makes the test a fragment. Use [Inspect network requests](../../argent-metro-debugger/SKILL.md#inspect-network-requests) for platform setup.
|
|
159
159
|
|
|
160
160
|
- Use `absent: true` for a check that should fail on a match. Keep start before the action to catch requests the action sends. For later traffic only, record the action first and allow any earlier native requests to reach capture before starting a new window.
|
|
161
|
-
- When recording a URL or
|
|
161
|
+
- When recording a URL, body, or header comparison against a secret, use `{{secret:NAME}}` in the step.
|
|
162
162
|
- Keep the wait as a raw `tool:` step. A log listing can pass with an empty log. On Android, capture can slow the app: start just before the action and stop right after the wait. When collecting several related requests, stop after the last check.
|
|
163
163
|
- If the recorder reports `NETWORK_CAPTURE_NOT_STARTED`, record the missing start, then repeat and record the action and the wait. Replay only uses recorded steps.
|
|
164
164
|
- If a recorded wait reports `unmet`, inspect `toolResult.nearMisses` for a missing match or `toolResult.match` for a forbidden request. For `unreadable`, restore capture from the result's notes and record a new window with the action and wait. Record a new wait if cancelled. Remove superseded steps after `e2e-finish-recording`.
|
|
@@ -44,7 +44,7 @@ If `debugger-reload-metro` fails to reload the Mac app, use `restart-app` for an
|
|
|
44
44
|
|
|
45
45
|
1. Choose the log. Use `view-network-logs` for JavaScript or the active Chromium tab and `native-network-logs` for OkHttp or URLSession. The two logs can show the same request.
|
|
46
46
|
2. Open the capture window with `network-capture-start`. Start before the action to include its requests, or after it to check only later traffic. Allow earlier native requests to reach capture first in that case. Select `layer: "js"` or `layer: "native"` if you need only one, and check that it armed. On Vega, read the JS log to start capture. On Chromium, use a placeholder bundle ID such as `argent.capture` for start, stop, and wait. Read the log directly to attach without a window.
|
|
47
|
-
3. Use `await-network-request` to check for a match, or set `absent: true` to check that none appears. Add a body check when the URL and status alone cannot identify the expected call. For Chromium redirects, match the final URL and method. On Vega or when exploring traffic, read the log. Chromium logs include traffic outside the window.
|
|
47
|
+
3. Use `await-network-request` to check for a match, or set `absent: true` to check that none appears. Add a body or request header check when the URL and status alone cannot identify the expected call. For Chromium redirects, match the final URL and method. On Vega or when exploring traffic, read the log. Chromium logs include traffic outside the window.
|
|
48
48
|
4. For `unmet`, check `nearMisses` for a missing match or `match` for a forbidden request. For `unreadable`, use `note` to find what Argent could not verify. If capture had a gap, start a new window once capture is ready and repeat the check. A JavaScript reconnection can resume capture with a gap.
|
|
49
49
|
5. Pass an ID from the log or wait to `view-network-request-details`. Read Android native bodies you need before stopping. Stop the capture you started with `network-capture-stop`. Check `armed` and `reason` to confirm what stopped. On Chromium, a stop closes the window and leaves tab logging active.
|
|
50
50
|
|