@swmansion/argent 0.35.1-next.20 → 0.35.1-next.22
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/README.md +2 -0
- 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 +1 -1
- package/dist/tool-server.cjs +463 -275
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
<p align="center"><b>English</b> | <a href="README.ja.md">日本語</a> | <a href="README.zh-CN.md">简体中文</a></p>
|
|
5
5
|
|
|
6
|
+
<p align="center"><a href="https://glama.ai/mcp/servers/software-mansion/argent"><img alt="software-mansion/argent MCP server" src="https://glama.ai/mcp/servers/software-mansion/argent/badges/score.svg" /></a></p>
|
|
7
|
+
|
|
6
8
|
[](https://swm-delivery.com/www/delivery/ck-slug.php?zoneid=zone-gh-argent-1&n=1)
|
|
7
9
|
[](https://swm-delivery.com/www/delivery/ck-slug.php?zoneid=zone-gh-argent-2&n=1)
|
|
8
10
|
[](https://swm-delivery.com/www/delivery/ck-slug.php?zoneid=zone-gh-argent-3&n=1)
|
package/dist/cli-cmds.mjs
CHANGED
|
@@ -38595,7 +38595,7 @@ function isCi(env = process.env) {
|
|
|
38595
38595
|
var SESSION_ID2 = randomUUID5();
|
|
38596
38596
|
function readCliVersion() {
|
|
38597
38597
|
if (true) {
|
|
38598
|
-
return "0.35.1-next.
|
|
38598
|
+
return "0.35.1-next.22";
|
|
38599
38599
|
}
|
|
38600
38600
|
return "0.0.0";
|
|
38601
38601
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -17117,7 +17117,7 @@ function isCi(env = process.env) {
|
|
|
17117
17117
|
var SESSION_ID = randomUUID4();
|
|
17118
17118
|
function readCliVersion() {
|
|
17119
17119
|
if (true) {
|
|
17120
|
-
return "0.35.1-next.
|
|
17120
|
+
return "0.35.1-next.22";
|
|
17121
17121
|
}
|
|
17122
17122
|
return "0.0.0";
|
|
17123
17123
|
}
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -38067,7 +38067,7 @@ async function startMcpServer(options) {
|
|
|
38067
38067
|
const autoDescribeOn = autoDescribeEnabled();
|
|
38068
38068
|
const whatsNewOn = whatsNewEnabled();
|
|
38069
38069
|
const installedVersion = getInstalledVersion();
|
|
38070
|
-
const highlightsVersion = true ? "0.35.1-next.
|
|
38070
|
+
const highlightsVersion = true ? "0.35.1-next.22" : installedVersion;
|
|
38071
38071
|
const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
|
|
38072
38072
|
const trees = createTreeMemory();
|
|
38073
38073
|
const screenshots = createScreenshotMemory();
|
|
@@ -20,7 +20,7 @@ export interface ArgentToolArgs {
|
|
|
20
20
|
udid: string;
|
|
21
21
|
/** `bundleId` used in `network-capture-start` (Chromium: placeholder like `argent.capture`). */
|
|
22
22
|
bundleId: string;
|
|
23
|
-
/** URL text/regex to match (no `{{secret:...}}` placeholders
|
|
23
|
+
/** URL text/regex to match (no `{{secret:...}}` placeholders). */
|
|
24
24
|
url: string;
|
|
25
25
|
/** `contains` (default) / `equals` (case-insensitive) or `matches` (case-sensitive JS regex). */
|
|
26
26
|
urlMatch?: "contains" | "equals" | "matches";
|
package/dist/tool-server.cjs
CHANGED
|
@@ -72978,7 +72978,7 @@ function isCi(env = process.env) {
|
|
|
72978
72978
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
72979
72979
|
function readCliVersion() {
|
|
72980
72980
|
if (true) {
|
|
72981
|
-
return "0.35.1-next.
|
|
72981
|
+
return "0.35.1-next.22";
|
|
72982
72982
|
}
|
|
72983
72983
|
return "0.0.0";
|
|
72984
72984
|
}
|
|
@@ -75630,25 +75630,55 @@ var MIN_FRAGMENT = 6;
|
|
|
75630
75630
|
function redactSecrets(text, secrets) {
|
|
75631
75631
|
return secretRedactor(secrets)(text);
|
|
75632
75632
|
}
|
|
75633
|
-
function secretRedactor(secrets) {
|
|
75633
|
+
function secretRedactor(secrets, options = {}) {
|
|
75634
|
+
const whole = options.wholeValues === true;
|
|
75634
75635
|
const ordered = secrets.filter(({ value }) => value.length > 0).sort((a, b) => b.value.length - a.value.length || (a.name < b.name ? -1 : +(a.name > b.name)));
|
|
75635
75636
|
const none = ordered.length;
|
|
75636
|
-
const spellings = ordered.map(({ value }) => [
|
|
75637
|
+
const spellings = ordered.map(({ value }) => [
|
|
75638
|
+
...whole ? dataSpellingsOf(value) : spellingsOf(value)
|
|
75639
|
+
]);
|
|
75637
75640
|
const windows = /* @__PURE__ */ new Map();
|
|
75638
|
-
|
|
75639
|
-
|
|
75640
|
-
for (
|
|
75641
|
-
|
|
75642
|
-
|
|
75641
|
+
if (!whole)
|
|
75642
|
+
spellings.forEach((forms, id) => {
|
|
75643
|
+
for (const spelling of forms) {
|
|
75644
|
+
for (let i = 0; i + MIN_FRAGMENT <= spelling.length; i++) {
|
|
75645
|
+
const window2 = spelling.slice(i, i + MIN_FRAGMENT);
|
|
75646
|
+
if (!windows.has(window2)) windows.set(window2, id);
|
|
75647
|
+
}
|
|
75643
75648
|
}
|
|
75649
|
+
});
|
|
75650
|
+
const wholeClaims = (text, cut, owner, claim2) => {
|
|
75651
|
+
spellings.forEach((forms, id) => {
|
|
75652
|
+
const short = ordered[id].value.length < MIN_FRAGMENT;
|
|
75653
|
+
for (const spelling of forms) {
|
|
75654
|
+
for (let at = text.indexOf(spelling); at !== -1; at = text.indexOf(spelling, at + 1)) {
|
|
75655
|
+
if (!short || standsAlone(text, at, at + spelling.length)) {
|
|
75656
|
+
claim2(at, at + spelling.length, id);
|
|
75657
|
+
}
|
|
75658
|
+
}
|
|
75659
|
+
if (!cut) continue;
|
|
75660
|
+
for (let n = Math.min(spelling.length - 1, text.length); n > 0; n--) {
|
|
75661
|
+
const at = text.length - n;
|
|
75662
|
+
if (!text.endsWith(spelling.slice(0, n))) continue;
|
|
75663
|
+
if (n >= MIN_FRAGMENT && !short || startsAlone(text, at)) claim2(at, text.length, id);
|
|
75664
|
+
break;
|
|
75665
|
+
}
|
|
75666
|
+
}
|
|
75667
|
+
});
|
|
75668
|
+
for (const marker of text.matchAll(SECRET_PLACEHOLDER_RE)) {
|
|
75669
|
+
owner.fill(none, marker.index, marker.index + marker[0].length);
|
|
75644
75670
|
}
|
|
75645
|
-
}
|
|
75671
|
+
};
|
|
75646
75672
|
const claims = (text, opts = {}) => {
|
|
75647
75673
|
const owner = new Int32Array(text.length).fill(none);
|
|
75648
75674
|
if (none === 0) return owner;
|
|
75649
75675
|
const claim2 = (from2, to, id) => {
|
|
75650
75676
|
for (let i = from2; i < to; i++) owner[i] = Math.min(owner[i], id);
|
|
75651
75677
|
};
|
|
75678
|
+
if (whole) {
|
|
75679
|
+
wholeClaims(text, opts.cut === true, owner, claim2);
|
|
75680
|
+
return owner;
|
|
75681
|
+
}
|
|
75652
75682
|
spellings.forEach((forms, id) => {
|
|
75653
75683
|
for (const spelling of forms) {
|
|
75654
75684
|
if (spelling.length >= MIN_FRAGMENT) continue;
|
|
@@ -75708,6 +75738,49 @@ function secretRedactor(secrets) {
|
|
|
75708
75738
|
names: new Set(ordered.map(({ name }) => name))
|
|
75709
75739
|
});
|
|
75710
75740
|
}
|
|
75741
|
+
function isAsciiAlnum(code) {
|
|
75742
|
+
return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122;
|
|
75743
|
+
}
|
|
75744
|
+
function standsAlone(text, from2, to) {
|
|
75745
|
+
return startsAlone(text, from2) && (to === text.length || !isAsciiAlnum(text.charCodeAt(to)));
|
|
75746
|
+
}
|
|
75747
|
+
function startsAlone(text, from2) {
|
|
75748
|
+
if (from2 === 0 || !isAsciiAlnum(text.charCodeAt(from2 - 1))) return true;
|
|
75749
|
+
const before = text.slice(Math.max(0, from2 - 6), from2);
|
|
75750
|
+
return /(?:\\[bfnrt]|\\u[0-9a-fA-F]{4}|%[0-9a-fA-F]{2})$/.test(before);
|
|
75751
|
+
}
|
|
75752
|
+
function dataSpellingsOf(value) {
|
|
75753
|
+
const spellings = spellingsOf(value);
|
|
75754
|
+
const json2 = JSON.stringify(value).slice(1, -1);
|
|
75755
|
+
const unicodeEscape = (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`;
|
|
75756
|
+
spellings.add(json2.replaceAll("/", "\\/"));
|
|
75757
|
+
spellings.add(json2.replace(/[<>&='\u2028\u2029]/g, unicodeEscape));
|
|
75758
|
+
spellings.add(json2.replace(/[\u007f-\uffff]/g, unicodeEscape));
|
|
75759
|
+
spellings.add(new URLSearchParams([["", value]]).toString().slice(1));
|
|
75760
|
+
for (const escaped of URL_ESCAPED) spellings.add(urlSerialized(value, escaped));
|
|
75761
|
+
return spellings;
|
|
75762
|
+
}
|
|
75763
|
+
var URL_ESCAPED = [/[ "#<>']/, /[ "#<>?`{}]/, /[ "#<>?`{}^]/, /[ "#<>?`{}/:;=@[\\\]^|]/];
|
|
75764
|
+
function urlSerialized(value, escaped) {
|
|
75765
|
+
let out = "";
|
|
75766
|
+
for (const char of value) {
|
|
75767
|
+
const code = char.codePointAt(0);
|
|
75768
|
+
if (code > 32 && code < 127 && !escaped.test(char)) {
|
|
75769
|
+
out += char;
|
|
75770
|
+
continue;
|
|
75771
|
+
}
|
|
75772
|
+
if (code < 128) {
|
|
75773
|
+
out += `%${code.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
75774
|
+
continue;
|
|
75775
|
+
}
|
|
75776
|
+
try {
|
|
75777
|
+
out += encodeURIComponent(char);
|
|
75778
|
+
} catch {
|
|
75779
|
+
out += "%EF%BF%BD";
|
|
75780
|
+
}
|
|
75781
|
+
}
|
|
75782
|
+
return out;
|
|
75783
|
+
}
|
|
75711
75784
|
function spellingsOf(value) {
|
|
75712
75785
|
const spellings = /* @__PURE__ */ new Set([value, JSON.stringify(value).slice(1, -1)]);
|
|
75713
75786
|
try {
|
|
@@ -114678,6 +114751,14 @@ function noteTypedSecrets(deviceId, secrets) {
|
|
|
114678
114751
|
if (values.size > MAX_VALUES) values.delete(values.keys().next().value);
|
|
114679
114752
|
}
|
|
114680
114753
|
}
|
|
114754
|
+
function typedSecrets() {
|
|
114755
|
+
return [...devices.values()].flatMap(
|
|
114756
|
+
(values) => [...values].map(([value, placeholder]) => ({
|
|
114757
|
+
name: placeholder.slice(SECRET_PLACEHOLDER_MARKER.length, -2),
|
|
114758
|
+
value
|
|
114759
|
+
}))
|
|
114760
|
+
);
|
|
114761
|
+
}
|
|
114681
114762
|
function secretTypedOn(deviceId) {
|
|
114682
114763
|
return devices.has(deviceKey(deviceId));
|
|
114683
114764
|
}
|
|
@@ -128673,6 +128754,51 @@ Fails if the simulator server is not running for the given UDID.`,
|
|
|
128673
128754
|
|
|
128674
128755
|
// ../tool-server/src/tools/native-devtools/native-network-logs.ts
|
|
128675
128756
|
init_zod();
|
|
128757
|
+
|
|
128758
|
+
// ../tool-server/src/tools/network/network-secrets.ts
|
|
128759
|
+
init_src();
|
|
128760
|
+
function networkSecrets(ctx) {
|
|
128761
|
+
const secrets = [];
|
|
128762
|
+
for (const [name, value] of ctx?.clientSecrets ?? []) secrets.push({ name, value });
|
|
128763
|
+
for (const source of secretSources()) {
|
|
128764
|
+
for (const [name, value] of source.values) secrets.push({ name, value });
|
|
128765
|
+
}
|
|
128766
|
+
return [...secrets, ...typedSecrets()];
|
|
128767
|
+
}
|
|
128768
|
+
function networkRedactorOf(secrets) {
|
|
128769
|
+
const byValue = /* @__PURE__ */ new Map();
|
|
128770
|
+
for (const { name, value } of secrets) {
|
|
128771
|
+
if (value.length > 0 && !byValue.has(value)) byValue.set(value, name);
|
|
128772
|
+
}
|
|
128773
|
+
return secretRedactor(
|
|
128774
|
+
[...byValue].map(([value, name]) => ({ name, value })),
|
|
128775
|
+
{ wholeValues: true }
|
|
128776
|
+
);
|
|
128777
|
+
}
|
|
128778
|
+
function networkSecretRedactor(ctx) {
|
|
128779
|
+
return networkRedactorOf(networkSecrets(ctx));
|
|
128780
|
+
}
|
|
128781
|
+
function redactNetworkResult(result, redact2, keep = []) {
|
|
128782
|
+
if (redact2.names.size === 0) return result;
|
|
128783
|
+
const kept = keep.map((path76) => path76.split("."));
|
|
128784
|
+
const walk = (node2, path76) => {
|
|
128785
|
+
if (typeof node2 === "string") {
|
|
128786
|
+
return kept.some(
|
|
128787
|
+
(k) => k.length === path76.length && k.every((p, i) => p === "*" ? /^\d+$/.test(path76[i]) : p === path76[i])
|
|
128788
|
+
) ? node2 : redact2(node2);
|
|
128789
|
+
}
|
|
128790
|
+
if (Array.isArray(node2)) return node2.map((item, i) => walk(item, [...path76, String(i)]));
|
|
128791
|
+
if (node2 === null || typeof node2 !== "object") return node2;
|
|
128792
|
+
const out = {};
|
|
128793
|
+
for (const [key2, value] of Object.entries(node2)) {
|
|
128794
|
+
out[redact2(key2)] = walk(value, [...path76, key2]);
|
|
128795
|
+
}
|
|
128796
|
+
return out;
|
|
128797
|
+
};
|
|
128798
|
+
return walk(result, []);
|
|
128799
|
+
}
|
|
128800
|
+
|
|
128801
|
+
// ../tool-server/src/tools/native-devtools/native-network-logs.ts
|
|
128676
128802
|
init_src2();
|
|
128677
128803
|
init_device_info();
|
|
128678
128804
|
|
|
@@ -129052,74 +129178,74 @@ Returns recent requests oldest-first with capture status in \`header\` (or a pre
|
|
|
129052
129178
|
const ref = nativeDevtoolsRef(device);
|
|
129053
129179
|
return live(ref.urn) ? { nativeDevtools: ref } : {};
|
|
129054
129180
|
},
|
|
129055
|
-
async execute(services, params) {
|
|
129056
|
-
|
|
129057
|
-
|
|
129058
|
-
|
|
129059
|
-
|
|
129060
|
-
|
|
129061
|
-
|
|
129062
|
-
|
|
129063
|
-
|
|
129064
|
-
);
|
|
129065
|
-
if (!isInjectableBundleId(params.bundleId)) throw macosNotInjectable(params.bundleId);
|
|
129066
|
-
return listMacosNative(
|
|
129067
|
-
app,
|
|
129068
|
-
params,
|
|
129069
|
-
port,
|
|
129070
|
-
nativeUnavailableReason(device.id, params.bundleId)
|
|
129071
|
-
);
|
|
129072
|
-
}
|
|
129073
|
-
if (device.platform === "android") {
|
|
129074
|
-
const api2 = services.androidNetwork;
|
|
129075
|
-
if (!api2 || !api2.isStarted() && !api2.isStopped()) {
|
|
129076
|
-
const reason2 = api2?.unavailableReason() ?? nativeUnavailableReason(device.id, params.bundleId);
|
|
129077
|
-
return reason2 ? {
|
|
129078
|
-
...unavailableListing("android-native", reason2),
|
|
129079
|
-
capture: "unavailable",
|
|
129080
|
-
captureDetail: reason2
|
|
129081
|
-
} : notStarted("android-native", params.bundleId);
|
|
129082
|
-
}
|
|
129083
|
-
return listAndroidNative(api2, params, port);
|
|
129084
|
-
}
|
|
129085
|
-
if (!isInjectableBundleId(params.bundleId)) throw nonInjectableError(params.bundleId);
|
|
129086
|
-
const api = services.nativeDevtools;
|
|
129087
|
-
const unavailable3 = nativeUnavailableReason(device.id, params.bundleId);
|
|
129088
|
-
if (api?.isNetworkCaptureStopped(params.bundleId)) {
|
|
129089
|
-
return listStopped(
|
|
129090
|
-
"ios-native",
|
|
129091
|
-
api.networkRecords(params.bundleId),
|
|
129092
|
-
params,
|
|
129093
|
-
port,
|
|
129094
|
-
stoppedDetail(liveIosNetworkCaptures(params.udid).includes(params.bundleId), unavailable3)
|
|
129095
|
-
);
|
|
129096
|
-
}
|
|
129097
|
-
if (!api?.isNetworkCaptureStarted(params.bundleId)) {
|
|
129098
|
-
return unavailable3 ? unavailableListing("ios-native", unavailable3) : notStarted("ios-native", params.bundleId);
|
|
129099
|
-
}
|
|
129100
|
-
await ensureDeps(device.platform === "ios-remote" ? ["sim-remote"] : ["xcrun"]);
|
|
129101
|
-
const blocked = await precheckNativeDevtools(api, params.udid, params.bundleId);
|
|
129102
|
-
if (blocked) return blocked;
|
|
129103
|
-
if (!api.isConnected(params.bundleId)) throw notConnected(api, params.bundleId);
|
|
129104
|
-
await api.refreshLentNetworkCapture(params.bundleId);
|
|
129105
|
-
const store = api.networkRecords(params.bundleId);
|
|
129106
|
-
if (!store) throw notConnected(api, params.bundleId);
|
|
129107
|
-
const all = store.records(port);
|
|
129108
|
-
const state3 = store.state();
|
|
129109
|
-
const detail = [];
|
|
129110
|
-
if (state3.pid !== void 0) detail.push(`pid ${state3.pid}`);
|
|
129111
|
-
if (state3.note) detail.push(state3.note);
|
|
129112
|
-
if (api.takeCaptureGap(params.bundleId)) detail.push(captureGapNote(api.armsEnv));
|
|
129113
|
-
const listing = listNative("ios-native", all, params.limit, {
|
|
129114
|
-
armed: state3.armed,
|
|
129115
|
-
state: state3.armed ? "armed" : "not armed",
|
|
129116
|
-
detail
|
|
129117
|
-
});
|
|
129118
|
-
if (params.clear) store.clear();
|
|
129119
|
-
return listing;
|
|
129181
|
+
async execute(services, params, ctx) {
|
|
129182
|
+
return redactNetworkResult(await readListing2(services, params), networkSecretRedactor(ctx), [
|
|
129183
|
+
"status",
|
|
129184
|
+
"header",
|
|
129185
|
+
"capture",
|
|
129186
|
+
"captureDetail",
|
|
129187
|
+
"requests.*.id",
|
|
129188
|
+
"requests.*.state"
|
|
129189
|
+
]);
|
|
129120
129190
|
}
|
|
129121
129191
|
};
|
|
129122
129192
|
}
|
|
129193
|
+
async function readListing2(services, params) {
|
|
129194
|
+
const device = resolveDevice(params.udid);
|
|
129195
|
+
const port = metroPort({ device_id: params.udid, port: params.port });
|
|
129196
|
+
if (device.platform === "macos") {
|
|
129197
|
+
const app = requireMacosAppOfBundle(services, device, "native-network-logs", params.bundleId);
|
|
129198
|
+
if (!isInjectableBundleId(params.bundleId)) throw macosNotInjectable(params.bundleId);
|
|
129199
|
+
return listMacosNative(app, params, port, nativeUnavailableReason(device.id, params.bundleId));
|
|
129200
|
+
}
|
|
129201
|
+
if (device.platform === "android") {
|
|
129202
|
+
const api2 = services.androidNetwork;
|
|
129203
|
+
if (!api2 || !api2.isStarted() && !api2.isStopped()) {
|
|
129204
|
+
const reason2 = api2?.unavailableReason() ?? nativeUnavailableReason(device.id, params.bundleId);
|
|
129205
|
+
return reason2 ? {
|
|
129206
|
+
...unavailableListing("android-native", reason2),
|
|
129207
|
+
capture: "unavailable",
|
|
129208
|
+
captureDetail: reason2
|
|
129209
|
+
} : notStarted("android-native", params.bundleId);
|
|
129210
|
+
}
|
|
129211
|
+
return listAndroidNative(api2, params, port);
|
|
129212
|
+
}
|
|
129213
|
+
if (!isInjectableBundleId(params.bundleId)) throw nonInjectableError(params.bundleId);
|
|
129214
|
+
const api = services.nativeDevtools;
|
|
129215
|
+
const unavailable3 = nativeUnavailableReason(device.id, params.bundleId);
|
|
129216
|
+
if (api?.isNetworkCaptureStopped(params.bundleId)) {
|
|
129217
|
+
return listStopped(
|
|
129218
|
+
"ios-native",
|
|
129219
|
+
api.networkRecords(params.bundleId),
|
|
129220
|
+
params,
|
|
129221
|
+
port,
|
|
129222
|
+
stoppedDetail(liveIosNetworkCaptures(params.udid).includes(params.bundleId), unavailable3)
|
|
129223
|
+
);
|
|
129224
|
+
}
|
|
129225
|
+
if (!api?.isNetworkCaptureStarted(params.bundleId)) {
|
|
129226
|
+
return unavailable3 ? unavailableListing("ios-native", unavailable3) : notStarted("ios-native", params.bundleId);
|
|
129227
|
+
}
|
|
129228
|
+
await ensureDeps(device.platform === "ios-remote" ? ["sim-remote"] : ["xcrun"]);
|
|
129229
|
+
const blocked = await precheckNativeDevtools(api, params.udid, params.bundleId);
|
|
129230
|
+
if (blocked) return blocked;
|
|
129231
|
+
if (!api.isConnected(params.bundleId)) throw notConnected(api, params.bundleId);
|
|
129232
|
+
await api.refreshLentNetworkCapture(params.bundleId);
|
|
129233
|
+
const store = api.networkRecords(params.bundleId);
|
|
129234
|
+
if (!store) throw notConnected(api, params.bundleId);
|
|
129235
|
+
const all = store.records(port);
|
|
129236
|
+
const state3 = store.state();
|
|
129237
|
+
const detail = [];
|
|
129238
|
+
if (state3.pid !== void 0) detail.push(`pid ${state3.pid}`);
|
|
129239
|
+
if (state3.note) detail.push(state3.note);
|
|
129240
|
+
if (api.takeCaptureGap(params.bundleId)) detail.push(captureGapNote(api.armsEnv));
|
|
129241
|
+
const listing = listNative("ios-native", all, params.limit, {
|
|
129242
|
+
armed: state3.armed,
|
|
129243
|
+
state: state3.armed ? "armed" : "not armed",
|
|
129244
|
+
detail
|
|
129245
|
+
});
|
|
129246
|
+
if (params.clear) store.clear();
|
|
129247
|
+
return listing;
|
|
129248
|
+
}
|
|
129123
129249
|
var STOPPED_DETAIL = "capture stopped by network-capture-stop; network-capture-start turns it on again";
|
|
129124
129250
|
function listStopped(layer, store, params, port, detail = [STOPPED_DETAIL]) {
|
|
129125
129251
|
const listing = listNative(layer, store?.records(port) ?? [], params.limit, {
|
|
@@ -144719,35 +144845,61 @@ function isRedirect(requestUrl, finalUrl) {
|
|
|
144719
144845
|
if (!finalUrl || requestUrl === void 0 || finalUrl === requestUrl) return false;
|
|
144720
144846
|
return comparableUrl(finalUrl) !== comparableUrl(requestUrl);
|
|
144721
144847
|
}
|
|
144848
|
+
function onOtherHost(url2, from2) {
|
|
144849
|
+
if (from2 === void 0) return false;
|
|
144850
|
+
try {
|
|
144851
|
+
return new URL(from2).host !== url2.host;
|
|
144852
|
+
} catch {
|
|
144853
|
+
return true;
|
|
144854
|
+
}
|
|
144855
|
+
}
|
|
144722
144856
|
function shortName(url2, from2) {
|
|
144723
144857
|
try {
|
|
144724
144858
|
const parsed2 = new URL(url2);
|
|
144725
144859
|
const path76 = parsed2.pathname === "/" ? "" : parsed2.pathname;
|
|
144726
|
-
|
|
144727
|
-
try {
|
|
144728
|
-
sameHost = from2 === void 0 || new URL(from2).host === parsed2.host;
|
|
144729
|
-
} catch {
|
|
144730
|
-
sameHost = false;
|
|
144731
|
-
}
|
|
144732
|
-
if (sameHost) return path76 || parsed2.hostname;
|
|
144860
|
+
if (!onOtherHost(parsed2, from2)) return path76 || parsed2.hostname;
|
|
144733
144861
|
return parsed2.host + path76;
|
|
144734
144862
|
} catch {
|
|
144735
144863
|
return url2;
|
|
144736
144864
|
}
|
|
144737
144865
|
}
|
|
144738
|
-
function
|
|
144739
|
-
const
|
|
144866
|
+
function redactedName(url2, redact2, from2) {
|
|
144867
|
+
const owner = redact2.claims(url2);
|
|
144868
|
+
if (redact2.render(url2, owner) === url2) return redact2(shortName(url2, from2));
|
|
144869
|
+
const query = url2.search(/[?#]/);
|
|
144870
|
+
let end = query === -1 ? url2.length : query;
|
|
144871
|
+
const claimed = (i) => redact2.render(url2[i], owner.subarray(i, i + 1)) !== url2[i];
|
|
144872
|
+
if (end > 0 && end < url2.length && claimed(end - 1) && owner[end] === owner[end - 1]) {
|
|
144873
|
+
while (end < url2.length && owner[end] === owner[end - 1]) end++;
|
|
144874
|
+
}
|
|
144875
|
+
const beforeQuery = redact2.render(url2.slice(0, end), owner.subarray(0, end));
|
|
144876
|
+
const scheme = /^[a-z][a-z0-9+.-]*:\/\//i.exec(beforeQuery)?.[0];
|
|
144877
|
+
if (scheme === void 0) return beforeQuery;
|
|
144878
|
+
const rest = beforeQuery.slice(scheme.length);
|
|
144879
|
+
const slash = rest.indexOf("/");
|
|
144880
|
+
const authority = slash === -1 ? rest : rest.slice(0, slash);
|
|
144881
|
+
const host = authority.slice(authority.lastIndexOf("@") + 1);
|
|
144882
|
+
const path76 = slash === -1 || rest.slice(slash) === "/" ? "" : rest.slice(slash);
|
|
144883
|
+
let otherHost = from2 !== void 0;
|
|
144884
|
+
try {
|
|
144885
|
+
otherHost = onOtherHost(new URL(url2), from2);
|
|
144886
|
+
} catch {
|
|
144887
|
+
}
|
|
144888
|
+
return otherHost ? host + path76 : path76 || host;
|
|
144889
|
+
}
|
|
144890
|
+
function formatEntry(entry, redact2) {
|
|
144891
|
+
const method = redact2(entry.request?.method ?? "???");
|
|
144740
144892
|
const url2 = entry.request?.url ?? "unknown";
|
|
144741
|
-
const name =
|
|
144893
|
+
const name = redactedName(url2, redact2);
|
|
144742
144894
|
const finalUrl = entry.response?.url;
|
|
144743
|
-
const redirect = finalUrl && isRedirect(url2, finalUrl) ? `\u2192 ${
|
|
144895
|
+
const redirect = finalUrl && isRedirect(url2, finalUrl) ? `\u2192 ${redactedName(finalUrl, redact2, url2)}` : "";
|
|
144744
144896
|
let status;
|
|
144745
144897
|
if (entry.state === "failed") {
|
|
144746
|
-
status = entry.errorText
|
|
144898
|
+
status = entry.errorText ? redact2(entry.errorText) : "failed";
|
|
144747
144899
|
} else if (entry.response) {
|
|
144748
144900
|
status = [
|
|
144749
144901
|
entry.response.status,
|
|
144750
|
-
entry.response.statusText,
|
|
144902
|
+
redact2(entry.response.statusText),
|
|
144751
144903
|
entry.state === "pending" ? "(pending)" : ""
|
|
144752
144904
|
].filter((part) => part !== "").join(" ");
|
|
144753
144905
|
} else {
|
|
@@ -144771,7 +144923,7 @@ function recordToLogEntry(r, id) {
|
|
|
144771
144923
|
errorText: r.errorText
|
|
144772
144924
|
};
|
|
144773
144925
|
}
|
|
144774
|
-
function renderChromiumPage(records, pageIndexParam) {
|
|
144926
|
+
function renderChromiumPage(records, pageIndexParam, redact2) {
|
|
144775
144927
|
const total = records.length;
|
|
144776
144928
|
if (total === 0) {
|
|
144777
144929
|
return "No network traffic captured. Recording is active on the active tab. Navigate or reload the page to populate it (requests made before the device was attached are not captured).";
|
|
@@ -144782,7 +144934,7 @@ function renderChromiumPage(records, pageIndexParam) {
|
|
|
144782
144934
|
return `Page index out of range. Valid range: 0-${pageCount - 1} (${pageCount} pages, ${total} total requests).`;
|
|
144783
144935
|
}
|
|
144784
144936
|
const start2 = pageIndex * ITEMS_PER_PAGE;
|
|
144785
|
-
const lines = records.slice(start2, start2 + ITEMS_PER_PAGE).map((r, i) => formatEntry(recordToLogEntry(r, start2 + i)));
|
|
144937
|
+
const lines = records.slice(start2, start2 + ITEMS_PER_PAGE).map((r, i) => formatEntry(recordToLogEntry(r, start2 + i), redact2));
|
|
144786
144938
|
return `=== NETWORK LOGS (page ${pageIndex + 1}/${pageCount}, ${total} total) ===
|
|
144787
144939
|
|
|
144788
144940
|
${lines.join("\n")}`;
|
|
@@ -144819,11 +144971,12 @@ Returns a paginated list of request IDs, status, size, and timing. Fails if Chro
|
|
|
144819
144971
|
const capture = jsCapture(payload);
|
|
144820
144972
|
return capture ? { debugger: jsCaptureDebuggerRef(params, capture) } : {};
|
|
144821
144973
|
},
|
|
144822
|
-
async execute(services, params) {
|
|
144974
|
+
async execute(services, params, ctx) {
|
|
144975
|
+
const redact2 = networkSecretRedactor(ctx);
|
|
144823
144976
|
const device = resolveDevice(params.device_id);
|
|
144824
144977
|
if (device.platform === "chromium") {
|
|
144825
144978
|
const chromium = services.chromium;
|
|
144826
|
-
return renderChromiumPage(chromium.server.network.requests(), params.pageIndex);
|
|
144979
|
+
return renderChromiumPage(chromium.server.network.requests(), params.pageIndex, redact2);
|
|
144827
144980
|
}
|
|
144828
144981
|
const port = jsReadPort(params);
|
|
144829
144982
|
if (device.platform === "vega") {
|
|
@@ -144832,7 +144985,7 @@ Returns a paginated list of request IDs, status, size, and timing. Fails if Chro
|
|
|
144832
144985
|
() => void 0,
|
|
144833
144986
|
(err) => err instanceof Error ? err.message : String(err)
|
|
144834
144987
|
);
|
|
144835
|
-
return renderJsLog(api.cdp, port, params.pageIndex, {
|
|
144988
|
+
return renderJsLog(api.cdp, port, params.pageIndex, redact2, {
|
|
144836
144989
|
noLog: () => notInstalled(installError),
|
|
144837
144990
|
empty: "No network traffic captured. Make sure the app is running and making HTTP requests. Network interception is active: it records XMLHttpRequest (axios included), React Native's fetch, Expo's fetch, and a fetch library that sends through React Native's network module, but not requests sent before capture started (at the first network-tool call)."
|
|
144838
144991
|
});
|
|
@@ -144842,7 +144995,7 @@ Returns a paginated list of request IDs, status, size, and timing. Fails if Chro
|
|
|
144842
144995
|
const capture = dbg && jsCaptureForRead(jsCapturePayload(port, deviceId), dbg.runtimeApp);
|
|
144843
144996
|
if (!dbg || !capture) return jsNotStarted(deviceId, port);
|
|
144844
144997
|
const stopped = capture.intent === "stopped";
|
|
144845
|
-
return renderJsLog(dbg.cdp, port, params.pageIndex, {
|
|
144998
|
+
return renderJsLog(dbg.cdp, port, params.pageIndex, redact2, {
|
|
144846
144999
|
noLog: () => jsNoLog(capture),
|
|
144847
145000
|
empty: stopped ? `No network traffic captured: network capture is stopped for ${capture.bundleId} (network-capture-stop). Call network-capture-start to capture again, then repeat the action.` : "No network traffic captured. Make sure the app is running and making HTTP requests. Network interception is active: it records XMLHttpRequest (axios included), React Native's fetch, Expo's fetch, and a fetch library that sends through React Native's network module, but not requests sent before network-capture-start.",
|
|
144848
145001
|
headerNote: stopped ? "capture stopped" : void 0,
|
|
@@ -144854,7 +145007,7 @@ Returns a paginated list of request IDs, status, size, and timing. Fails if Chro
|
|
|
144854
145007
|
});
|
|
144855
145008
|
}
|
|
144856
145009
|
};
|
|
144857
|
-
async function renderJsLog(cdp, port, pageIndexParam, texts) {
|
|
145010
|
+
async function renderJsLog(cdp, port, pageIndexParam, redact2, texts) {
|
|
144858
145011
|
const countRaw = await cdp.evaluate(makeNetworkLogReadScript(0, 0, port));
|
|
144859
145012
|
const { total, interceptorInstalled, paused } = JSON.parse(countRaw);
|
|
144860
145013
|
if (!interceptorInstalled) return texts.noLog();
|
|
@@ -144874,7 +145027,8 @@ async function renderJsLog(cdp, port, pageIndexParam, texts) {
|
|
|
144874
145027
|
entry.response ? {
|
|
144875
145028
|
...entry,
|
|
144876
145029
|
response: { ...entry.response, statusText: reasonPhrase(entry.response.status) }
|
|
144877
|
-
} : entry
|
|
145030
|
+
} : entry,
|
|
145031
|
+
redact2
|
|
144878
145032
|
)
|
|
144879
145033
|
);
|
|
144880
145034
|
const note = shown.headerNote ? `; ${shown.headerNote}` : "";
|
|
@@ -144931,9 +145085,12 @@ function cutMarker(fullSize, mimeType, shown = MAX_BODY_SIZE) {
|
|
|
144931
145085
|
const mime = mimeType ? `, MIME: ${mimeType}` : "";
|
|
144932
145086
|
return `[TRUNCATED: first ${shown} chars shown, full size: ${fullSize}${mime}]`;
|
|
144933
145087
|
}
|
|
144934
|
-
function
|
|
144935
|
-
return
|
|
144936
|
-
|
|
145088
|
+
function shownText(text, shown, redact2) {
|
|
145089
|
+
return redact2(text.slice(0, shown), { cut: true });
|
|
145090
|
+
}
|
|
145091
|
+
function truncateBody(body, mimeType, redact2) {
|
|
145092
|
+
return body.length > MAX_BODY_SIZE ? `${cutMarker(`${body.length} chars`, redact2(mimeType))}
|
|
145093
|
+
${shownText(body, MAX_BODY_SIZE, redact2)}...` : redact2(body);
|
|
144937
145094
|
}
|
|
144938
145095
|
async function chromiumResponseBody(cdp, rec) {
|
|
144939
145096
|
try {
|
|
@@ -144958,11 +145115,12 @@ function utf8Text(bytes) {
|
|
|
144958
145115
|
return bytes;
|
|
144959
145116
|
}
|
|
144960
145117
|
}
|
|
144961
|
-
function truncatePostData(postData, truncated) {
|
|
144962
|
-
if (postData == null
|
|
145118
|
+
function truncatePostData(postData, truncated, redact2) {
|
|
145119
|
+
if (postData == null) return postData;
|
|
145120
|
+
if (postData.length <= MAX_BODY_SIZE) return redact2(postData);
|
|
144963
145121
|
const fullSize = truncated ? `more than ${postData.length} chars` : `${postData.length} chars`;
|
|
144964
145122
|
return `${cutMarker(fullSize)}
|
|
144965
|
-
${postData
|
|
145123
|
+
${shownText(postData, MAX_BODY_SIZE, redact2)}...`;
|
|
144966
145124
|
}
|
|
144967
145125
|
var zodSchema40 = external_exports.object({
|
|
144968
145126
|
port: metroPortField,
|
|
@@ -144976,7 +145134,7 @@ var zodSchema40 = external_exports.object({
|
|
|
144976
145134
|
});
|
|
144977
145135
|
var networkRequestTool = {
|
|
144978
145136
|
id: "view-network-request-details",
|
|
144979
|
-
description: `Read full details (status, timing, redacted headers, and bodies truncated to 1000 chars) for one captured HTTP request ID.
|
|
145137
|
+
description: `Read full details (status, timing, redacted headers, and bodies truncated to 1000 chars) for one captured HTTP request ID. Secret values exposed to Argent show as their {{secret:NAME}} placeholders; other credentials do not.
|
|
144980
145138
|
Use when inspecting payloads or headers of a request from a network log or \`await-network-request\`.
|
|
144981
145139
|
Returns request/response details, or a not-found message (refresh the log after JS reloads). Fails if the backing debugger/CDP target is unreachable.`,
|
|
144982
145140
|
zodSchema: zodSchema40,
|
|
@@ -144999,142 +145157,153 @@ Returns request/response details, or a not-found message (refresh the log after
|
|
|
144999
145157
|
const capture = jsCapture(payload);
|
|
145000
145158
|
return capture ? { debugger: jsCaptureDebuggerRef(params, capture) } : {};
|
|
145001
145159
|
},
|
|
145002
|
-
async execute(services, params) {
|
|
145003
|
-
|
|
145004
|
-
|
|
145005
|
-
|
|
145006
|
-
|
|
145007
|
-
|
|
145008
|
-
|
|
145009
|
-
|
|
145010
|
-
|
|
145011
|
-
|
|
145012
|
-
|
|
145013
|
-
|
|
145014
|
-
|
|
145015
|
-
|
|
145016
|
-
|
|
145017
|
-
|
|
145018
|
-
|
|
145019
|
-
|
|
145020
|
-
|
|
145021
|
-
|
|
145022
|
-
|
|
145023
|
-
|
|
145024
|
-
|
|
145025
|
-
|
|
145026
|
-
|
|
145027
|
-
|
|
145028
|
-
|
|
145029
|
-
|
|
145030
|
-
|
|
145031
|
-
|
|
145032
|
-
|
|
145033
|
-
|
|
145034
|
-
|
|
145035
|
-
|
|
145036
|
-
|
|
145037
|
-
|
|
145038
|
-
|
|
145039
|
-
|
|
145040
|
-
|
|
145041
|
-
|
|
145042
|
-
|
|
145043
|
-
|
|
145044
|
-
|
|
145045
|
-
|
|
145046
|
-
|
|
145047
|
-
|
|
145048
|
-
|
|
145049
|
-
|
|
145050
|
-
|
|
145051
|
-
|
|
145052
|
-
|
|
145053
|
-
|
|
145054
|
-
|
|
145160
|
+
async execute(services, params, ctx) {
|
|
145161
|
+
const redact2 = networkSecretRedactor(ctx);
|
|
145162
|
+
const details = await readDetails(services, params, redact2);
|
|
145163
|
+
if (typeof details === "string") return details;
|
|
145164
|
+
return redactNetworkResult(details, redact2, [
|
|
145165
|
+
"requestId",
|
|
145166
|
+
"state",
|
|
145167
|
+
"request.postData",
|
|
145168
|
+
"response.body"
|
|
145169
|
+
]);
|
|
145170
|
+
}
|
|
145171
|
+
};
|
|
145172
|
+
async function readDetails(services, params, redact2) {
|
|
145173
|
+
if (ANDROID_NATIVE_REQUEST_ID.test(params.requestId)) {
|
|
145174
|
+
const found = findAndroidNativeRecord(params.requestId);
|
|
145175
|
+
return found ? nativeRequestDetails(found.record, found.inspector, params.includeBody, redact2) : nativeNotFound(params.requestId, params.device_id, "android");
|
|
145176
|
+
}
|
|
145177
|
+
if (IOS_NATIVE_REQUEST_ID.test(params.requestId)) {
|
|
145178
|
+
const found = findIosNativeRecord(params.requestId);
|
|
145179
|
+
return found ? nativeRequestDetails(found.record, found.records, params.includeBody, redact2) : nativeNotFound(params.requestId, params.device_id, "ios");
|
|
145180
|
+
}
|
|
145181
|
+
if (MACOS_NATIVE_REQUEST_ID.test(params.requestId)) {
|
|
145182
|
+
const found = findMacosNativeRecord(params.requestId);
|
|
145183
|
+
return found ? nativeRequestDetails(found.record, found.records, params.includeBody, redact2) : nativeNotFound(params.requestId, params.device_id, "macos");
|
|
145184
|
+
}
|
|
145185
|
+
const device = resolveDevice(params.device_id);
|
|
145186
|
+
if (device.platform === "chromium") {
|
|
145187
|
+
const chromium = services.chromium;
|
|
145188
|
+
const rec = chromium.server.network.get(params.requestId);
|
|
145189
|
+
if (!rec) {
|
|
145190
|
+
return `Request ${params.requestId} not found. Use view-network-logs to list available requests.`;
|
|
145191
|
+
}
|
|
145192
|
+
const details2 = {
|
|
145193
|
+
requestId: rec.requestId,
|
|
145194
|
+
state: rec.failed ? "failed" : rec.status != null ? "complete" : "pending",
|
|
145195
|
+
resourceType: rec.resourceType,
|
|
145196
|
+
durationMs: rec.durationMs != null ? Math.round(rec.durationMs) : void 0,
|
|
145197
|
+
encodedDataLength: rec.encodedDataLength,
|
|
145198
|
+
errorText: rec.errorText,
|
|
145199
|
+
initiator: rec.initiator
|
|
145200
|
+
};
|
|
145201
|
+
if (rec.url) {
|
|
145202
|
+
details2.request = {
|
|
145203
|
+
url: rec.url,
|
|
145204
|
+
method: rec.method,
|
|
145205
|
+
headers: redactHeaders(rec.requestHeaders),
|
|
145206
|
+
postData: truncatePostData(rec.postData, false, redact2)
|
|
145207
|
+
};
|
|
145208
|
+
}
|
|
145209
|
+
if (rec.status != null) {
|
|
145210
|
+
const resp = {
|
|
145211
|
+
status: rec.status,
|
|
145212
|
+
statusText: rec.statusText ?? "",
|
|
145213
|
+
headers: redactHeaders(rec.responseHeaders),
|
|
145214
|
+
mimeType: rec.mimeType ?? ""
|
|
145215
|
+
};
|
|
145216
|
+
if (params.includeBody) {
|
|
145217
|
+
const out = await chromiumResponseBody(chromium.cdp, rec);
|
|
145218
|
+
if (out) {
|
|
145219
|
+
const body = out.base64Encoded ? utf8Text(Buffer.from(out.body, "base64")) : out.body;
|
|
145220
|
+
if (typeof body !== "string") {
|
|
145221
|
+
resp.body = `[body omitted: binary ${redact2(resp.mimeType) || "data"}, ${body.length} bytes]`;
|
|
145222
|
+
} else {
|
|
145223
|
+
resp.body = truncateBody(body, resp.mimeType, redact2);
|
|
145055
145224
|
}
|
|
145056
145225
|
}
|
|
145057
|
-
details2.response = resp;
|
|
145058
145226
|
}
|
|
145059
|
-
|
|
145227
|
+
details2.response = resp;
|
|
145060
145228
|
}
|
|
145061
|
-
|
|
145062
|
-
|
|
145063
|
-
|
|
145064
|
-
|
|
145065
|
-
|
|
145066
|
-
|
|
145067
|
-
|
|
145068
|
-
|
|
145069
|
-
|
|
145070
|
-
}
|
|
145071
|
-
|
|
145072
|
-
|
|
145073
|
-
|
|
145074
|
-
|
|
145075
|
-
|
|
145076
|
-
|
|
145077
|
-
|
|
145078
|
-
|
|
145079
|
-
|
|
145080
|
-
|
|
145081
|
-
|
|
145082
|
-
|
|
145083
|
-
|
|
145084
|
-
|
|
145085
|
-
|
|
145086
|
-
|
|
145087
|
-
|
|
145088
|
-
|
|
145089
|
-
|
|
145090
|
-
|
|
145091
|
-
|
|
145092
|
-
|
|
145093
|
-
|
|
145094
|
-
|
|
145095
|
-
|
|
145096
|
-
|
|
145097
|
-
|
|
145098
|
-
|
|
145099
|
-
|
|
145100
|
-
|
|
145101
|
-
|
|
145102
|
-
|
|
145103
|
-
|
|
145104
|
-
|
|
145105
|
-
|
|
145106
|
-
|
|
145107
|
-
|
|
145108
|
-
|
|
145109
|
-
|
|
145110
|
-
|
|
145111
|
-
|
|
145112
|
-
|
|
145113
|
-
|
|
145114
|
-
|
|
145115
|
-
|
|
145116
|
-
|
|
145117
|
-
|
|
145118
|
-
|
|
145119
|
-
|
|
145120
|
-
|
|
145121
|
-
|
|
145122
|
-
|
|
145123
|
-
|
|
145124
|
-
|
|
145125
|
-
|
|
145126
|
-
|
|
145127
|
-
|
|
145128
|
-
${body.
|
|
145129
|
-
|
|
145130
|
-
|
|
145131
|
-
|
|
145229
|
+
return details2;
|
|
145230
|
+
}
|
|
145231
|
+
const nativePlatform = nativeIdPlatform2(params.requestId);
|
|
145232
|
+
if (nativePlatform) return nativeNotFound(params.requestId, params.device_id, nativePlatform);
|
|
145233
|
+
let cdp;
|
|
145234
|
+
let noLog;
|
|
145235
|
+
if (device.platform === "vega") {
|
|
145236
|
+
const api = services.inspector;
|
|
145237
|
+
await api.cdp.evaluate(NETWORK_INTERCEPTOR_SCRIPT).catch(() => {
|
|
145238
|
+
});
|
|
145239
|
+
cdp = api.cdp;
|
|
145240
|
+
} else {
|
|
145241
|
+
const port = jsReadPort(params);
|
|
145242
|
+
const deviceId = canonicalDeviceId(params.device_id);
|
|
145243
|
+
const dbg = services.debugger;
|
|
145244
|
+
const capture = dbg && jsCaptureForRead(jsCapturePayload(port, deviceId), dbg.runtimeApp);
|
|
145245
|
+
if (!dbg || !capture) {
|
|
145246
|
+
return jsNotStarted(
|
|
145247
|
+
deviceId,
|
|
145248
|
+
port,
|
|
145249
|
+
"list the requests with view-network-logs",
|
|
145250
|
+
`Request ${params.requestId} not found. `
|
|
145251
|
+
);
|
|
145252
|
+
}
|
|
145253
|
+
cdp = dbg.cdp;
|
|
145254
|
+
noLog = `Request ${params.requestId} not found. ${jsNoLog(capture)}`;
|
|
145255
|
+
}
|
|
145256
|
+
const script = makeNetworkDetailReadScript(params.requestId);
|
|
145257
|
+
const raw = await cdp.evaluate(script);
|
|
145258
|
+
const data = JSON.parse(raw);
|
|
145259
|
+
if ("error" in data) {
|
|
145260
|
+
if (data.installed === false && noLog) return noLog;
|
|
145261
|
+
return `${data.error}. Use view-network-logs to list available requests.`;
|
|
145262
|
+
}
|
|
145263
|
+
const entry = data;
|
|
145264
|
+
const details = {
|
|
145265
|
+
requestId: entry.requestId,
|
|
145266
|
+
state: entry.state,
|
|
145267
|
+
resourceType: entry.resourceType,
|
|
145268
|
+
durationMs: entry.durationMs,
|
|
145269
|
+
encodedDataLength: entry.encodedDataLength,
|
|
145270
|
+
errorText: entry.errorText
|
|
145271
|
+
};
|
|
145272
|
+
if (entry.request) {
|
|
145273
|
+
details.request = {
|
|
145274
|
+
url: entry.request.url,
|
|
145275
|
+
method: entry.request.method,
|
|
145276
|
+
headers: redactHeaders(entry.request.headers),
|
|
145277
|
+
postData: truncatePostData(entry.request.postData, entry.request.postDataTruncated, redact2)
|
|
145278
|
+
};
|
|
145279
|
+
}
|
|
145280
|
+
if (entry.response) {
|
|
145281
|
+
const resp = {
|
|
145282
|
+
status: entry.response.status,
|
|
145283
|
+
statusText: reasonPhrase(entry.response.status),
|
|
145284
|
+
headers: redactHeaders(entry.response.headers),
|
|
145285
|
+
mimeType: entry.response.mimeType
|
|
145286
|
+
};
|
|
145287
|
+
if (isRedirect(entry.request?.url, entry.response.url)) {
|
|
145288
|
+
resp.redirectedTo = entry.response.url;
|
|
145289
|
+
}
|
|
145290
|
+
if (params.includeBody && entry.bodyOmitted) {
|
|
145291
|
+
const size = entry.encodedDataLength != null ? `, ${entry.encodedDataLength} bytes` : entry.bodyLength != null ? `, ~${entry.bodyLength} bytes` : "";
|
|
145292
|
+
resp.body = `[body omitted: binary ${redact2(entry.response.mimeType) || "data"}${size}]`;
|
|
145293
|
+
} else if (params.includeBody && entry.responseBody != null) {
|
|
145294
|
+
const body = entry.responseBody;
|
|
145295
|
+
if (body.length > MAX_BODY_SIZE) {
|
|
145296
|
+
const fullSize = !entry.bodyTruncated ? `${body.length} chars` : entry.encodedDataLength != null ? `${entry.encodedDataLength} bytes` : entry.bodyLength != null ? `${entry.bodyLength} chars` : `more than ${body.length} chars`;
|
|
145297
|
+
resp.body = `${cutMarker(fullSize, redact2(entry.response.mimeType))}
|
|
145298
|
+
${shownText(body, MAX_BODY_SIZE, redact2)}...`;
|
|
145299
|
+
} else {
|
|
145300
|
+
resp.body = redact2(body);
|
|
145132
145301
|
}
|
|
145133
|
-
details.response = resp;
|
|
145134
145302
|
}
|
|
145135
|
-
|
|
145303
|
+
details.response = resp;
|
|
145136
145304
|
}
|
|
145137
|
-
|
|
145305
|
+
return details;
|
|
145306
|
+
}
|
|
145138
145307
|
function isNativeRequestId(requestId) {
|
|
145139
145308
|
return ANDROID_NATIVE_REQUEST_ID.test(requestId) || IOS_NATIVE_REQUEST_ID.test(requestId) || MACOS_NATIVE_REQUEST_ID.test(requestId);
|
|
145140
145309
|
}
|
|
@@ -145151,7 +145320,7 @@ function nativeNotFound(requestId, deviceId, layer) {
|
|
|
145151
145320
|
const captured = layer === "android" ? hasAndroidNetworkCapture() : layer === "ios" ? hasIosNetworkCapture() : hasMacosNetworkCapture();
|
|
145152
145321
|
return captured ? `Request ${requestId} not found. Use native-network-logs to list the requests the ${name} native layer recorded.` : `Request ${requestId} not found. Native network capture is not started, so no requests are recorded. Call network-capture-start with udid and bundleId, repeat the action, then list the requests with native-network-logs.`;
|
|
145153
145322
|
}
|
|
145154
|
-
async function nativeRequestDetails(record2, bodies, includeBody) {
|
|
145323
|
+
async function nativeRequestDetails(record2, bodies, includeBody, redact2) {
|
|
145155
145324
|
const { wireHeaders } = record2.request;
|
|
145156
145325
|
const bodyHeaders = record2.redirects?.[0]?.requestHeaders ?? wireHeaders ?? {};
|
|
145157
145326
|
const requestHeader = (name) => headerValue(bodyHeaders, name) || headerValue(record2.request.headers, name);
|
|
@@ -145163,14 +145332,18 @@ async function nativeRequestDetails(record2, bodies, includeBody) {
|
|
|
145163
145332
|
const headersNote = requestHeadersNote(record2);
|
|
145164
145333
|
if (headersNote) request4.headersNote = headersNote;
|
|
145165
145334
|
if (record2.request.hasPostData) {
|
|
145166
|
-
request4.postData = await readNativeBody(
|
|
145167
|
-
|
|
145168
|
-
|
|
145169
|
-
|
|
145170
|
-
|
|
145171
|
-
|
|
145172
|
-
|
|
145173
|
-
|
|
145335
|
+
request4.postData = await readNativeBody(
|
|
145336
|
+
() => bodies.requestPostData(record2.id),
|
|
145337
|
+
{
|
|
145338
|
+
contentType: requestHeader("content-type"),
|
|
145339
|
+
contentEncoding: requestHeader("content-encoding"),
|
|
145340
|
+
wholeSize: sizeInBytes(
|
|
145341
|
+
Number(requestHeader("content-length") || NaN),
|
|
145342
|
+
"as the app sent them"
|
|
145343
|
+
)
|
|
145344
|
+
},
|
|
145345
|
+
redact2
|
|
145346
|
+
);
|
|
145174
145347
|
}
|
|
145175
145348
|
const details = {
|
|
145176
145349
|
requestId: record2.id,
|
|
@@ -145201,13 +145374,17 @@ async function nativeRequestDetails(record2, bodies, includeBody) {
|
|
|
145201
145374
|
};
|
|
145202
145375
|
if (record2.response.fromCache) resp.fromCache = true;
|
|
145203
145376
|
if (includeBody) {
|
|
145204
|
-
resp.body = await readNativeBody(
|
|
145205
|
-
|
|
145206
|
-
|
|
145207
|
-
|
|
145208
|
-
|
|
145209
|
-
|
|
145210
|
-
|
|
145377
|
+
resp.body = await readNativeBody(
|
|
145378
|
+
() => bodies.responseBody(record2.id),
|
|
145379
|
+
{
|
|
145380
|
+
mimeType: record2.response.mimeType,
|
|
145381
|
+
contentType: headerValue(record2.response.headers, "content-type"),
|
|
145382
|
+
// An iOS or Mac app response body is read decoded, so its Content-Encoding is not applied again.
|
|
145383
|
+
contentEncoding: record2.layer === "ios-native" || record2.layer === "macos-native" ? "" : headerValue(record2.response.headers, "content-encoding"),
|
|
145384
|
+
wholeSize: sizeInBytes(record2.encodedDataLength ?? NaN, "as the app received them")
|
|
145385
|
+
},
|
|
145386
|
+
redact2
|
|
145387
|
+
);
|
|
145211
145388
|
}
|
|
145212
145389
|
details.response = resp;
|
|
145213
145390
|
}
|
|
@@ -145222,33 +145399,33 @@ function requestHeadersNote(record2) {
|
|
|
145222
145399
|
}
|
|
145223
145400
|
return "These are the headers the app set. The headers sent on the wire (such as Cookie and User-Agent) were not reported for this request.";
|
|
145224
145401
|
}
|
|
145225
|
-
async function readNativeBody(read, framing) {
|
|
145402
|
+
async function readNativeBody(read, framing, redact2) {
|
|
145226
145403
|
const mimeType = framing.mimeType ?? framing.contentType.split(";")[0].trim();
|
|
145227
145404
|
let body;
|
|
145228
145405
|
try {
|
|
145229
145406
|
body = await read();
|
|
145230
145407
|
} catch (err) {
|
|
145231
|
-
return `[unavailable: ${err instanceof Error ? err.message : String(err)}]`;
|
|
145408
|
+
return `[unavailable: ${redact2(err instanceof Error ? err.message : String(err))}]`;
|
|
145232
145409
|
}
|
|
145233
|
-
if (!body.available) return `[unavailable: ${body.reason ?? "no body"}]`;
|
|
145410
|
+
if (!body.available) return `[unavailable: ${redact2(body.reason ?? "no body")}]`;
|
|
145234
145411
|
if (body.incomplete) framing = { ...framing, wholeSize: void 0 };
|
|
145235
145412
|
if (body.inlineChars !== void 0) {
|
|
145236
|
-
return inlineBody(body.body, body.inlineChars, body.truncated, mimeType, framing);
|
|
145413
|
+
return inlineBody(body.body, body.inlineChars, body.truncated, mimeType, framing, redact2);
|
|
145237
145414
|
}
|
|
145238
145415
|
const asSent = () => {
|
|
145239
145416
|
const text2 = inDeclaredCharset(body.body, framing.contentType, body.truncated);
|
|
145240
|
-
return body.truncated ? cutByAgent(text2, mimeType, Buffer.byteLength(body.body), framing, body.incomplete) : truncateBody(text2, mimeType);
|
|
145417
|
+
return body.truncated ? cutByAgent(text2, mimeType, Buffer.byteLength(body.body), framing, redact2, body.incomplete) : truncateBody(text2, mimeType, redact2);
|
|
145241
145418
|
};
|
|
145242
145419
|
if (!body.base64Encoded && contentCodings(framing.contentEncoding).length === 0) return asSent();
|
|
145243
145420
|
const kept = Buffer.from(body.body, body.base64Encoded ? "base64" : "utf8");
|
|
145244
145421
|
const bytes = decodeContent2(kept, framing.contentEncoding, body.truncated);
|
|
145245
|
-
if (!bytes) return decodesTooLarge(framing);
|
|
145422
|
+
if (!bytes) return decodesTooLarge(framing, redact2);
|
|
145246
145423
|
if (!body.base64Encoded && bytes === kept) return asSent();
|
|
145247
145424
|
const text = decodeText(bytes, charsetOf(framing.contentType), body.truncated);
|
|
145248
145425
|
if (text === null) {
|
|
145249
|
-
return body.truncated ? `[body omitted: binary ${mimeType || "data"}, ${framing.wholeSize ?? "size unknown"}; ${agentKept(kept.length, body.incomplete)}]` : `[body omitted: binary ${mimeType || "data"}, ${bytes.length} bytes]`;
|
|
145426
|
+
return body.truncated ? `[body omitted: binary ${redact2(mimeType) || "data"}, ${framing.wholeSize ?? "size unknown"}; ${agentKept(kept.length, body.incomplete)}]` : `[body omitted: binary ${redact2(mimeType) || "data"}, ${bytes.length} bytes]`;
|
|
145250
145427
|
}
|
|
145251
|
-
return body.truncated ? cutByAgent(text, mimeType, kept.length, framing, body.incomplete) : truncateBody(text, mimeType);
|
|
145428
|
+
return body.truncated ? cutByAgent(text, mimeType, kept.length, framing, redact2, body.incomplete) : truncateBody(text, mimeType, redact2);
|
|
145252
145429
|
}
|
|
145253
145430
|
function inDeclaredCharset(text, contentType, truncated) {
|
|
145254
145431
|
if (namesUtf8(contentType)) return text;
|
|
@@ -145258,33 +145435,33 @@ function namesUtf8(contentType) {
|
|
|
145258
145435
|
const charset = charsetOf(contentType);
|
|
145259
145436
|
return !charset || /^utf-?8$/i.test(charset);
|
|
145260
145437
|
}
|
|
145261
|
-
function inlineBody(text, wholeChars, truncated, mimeType, framing) {
|
|
145438
|
+
function inlineBody(text, wholeChars, truncated, mimeType, framing, redact2) {
|
|
145262
145439
|
if (BINARY_BODY_TYPES.test(mimeType.toLowerCase())) {
|
|
145263
|
-
return `[body omitted: binary ${mimeType}, ${framing.wholeSize ?? "size unknown"}]`;
|
|
145440
|
+
return `[body omitted: binary ${redact2(mimeType)}, ${framing.wholeSize ?? "size unknown"}]`;
|
|
145264
145441
|
}
|
|
145265
145442
|
const sent = contentCodings(framing.contentEncoding).length ? Buffer.from(text, "utf8") : null;
|
|
145266
145443
|
const bytes = sent && decodeContent2(sent, framing.contentEncoding, truncated);
|
|
145267
|
-
if (sent && !bytes) return decodesTooLarge(framing);
|
|
145444
|
+
if (sent && !bytes) return decodesTooLarge(framing, redact2);
|
|
145268
145445
|
const encoded = bytes && bytes !== sent ? bytes : null;
|
|
145269
145446
|
const decoded2 = encoded ? decodeText(encoded, charsetOf(framing.contentType), truncated) : inDeclaredCharset(text, framing.contentType, truncated);
|
|
145270
145447
|
if (decoded2 === null) {
|
|
145271
145448
|
const size = truncated ? framing.wholeSize ?? "size unknown" : `${encoded.length} bytes`;
|
|
145272
|
-
return `[body omitted: binary ${mimeType || "data"}, ${size}]`;
|
|
145449
|
+
return `[body omitted: binary ${redact2(mimeType) || "data"}, ${size}]`;
|
|
145273
145450
|
}
|
|
145274
|
-
if (!truncated) return truncateBody(decoded2, mimeType);
|
|
145451
|
+
if (!truncated) return truncateBody(decoded2, mimeType, redact2);
|
|
145275
145452
|
const fullSize = !encoded && namesUtf8(framing.contentType) ? `${wholeChars} chars` : `more than ${decoded2.length} chars`;
|
|
145276
145453
|
const shown = Math.min(decoded2.length, MAX_BODY_SIZE);
|
|
145277
|
-
return `${cutMarker(fullSize, mimeType, shown)}
|
|
145278
|
-
${decoded2
|
|
145454
|
+
return `${cutMarker(fullSize, redact2(mimeType), shown)}
|
|
145455
|
+
${shownText(decoded2, shown, redact2)}${decoded2.length > shown ? "..." : ""}`;
|
|
145279
145456
|
}
|
|
145280
|
-
function decodesTooLarge(framing) {
|
|
145281
|
-
return `[unavailable: the ${framing.contentEncoding.trim()} body decodes to more than ${MAX_DECODED_BODY_BYTES / (1024 * 1024)} MiB]`;
|
|
145457
|
+
function decodesTooLarge(framing, redact2) {
|
|
145458
|
+
return `[unavailable: the ${redact2(framing.contentEncoding.trim())} body decodes to more than ${MAX_DECODED_BODY_BYTES / (1024 * 1024)} MiB]`;
|
|
145282
145459
|
}
|
|
145283
|
-
function cutByAgent(text, mimeType, keptBytes, framing, incomplete) {
|
|
145460
|
+
function cutByAgent(text, mimeType, keptBytes, framing, redact2, incomplete) {
|
|
145284
145461
|
const shown = Math.min(text.length, MAX_BODY_SIZE);
|
|
145285
145462
|
const fullSize = `${framing.wholeSize ?? "unknown"}; ${agentKept(keptBytes, incomplete)}`;
|
|
145286
|
-
return `${cutMarker(fullSize, mimeType, shown)}
|
|
145287
|
-
${text
|
|
145463
|
+
return `${cutMarker(fullSize, redact2(mimeType), shown)}
|
|
145464
|
+
${shownText(text, shown, redact2)}${text.length > shown ? "..." : ""}`;
|
|
145288
145465
|
}
|
|
145289
145466
|
function agentKept(keptBytes, incomplete) {
|
|
145290
145467
|
return incomplete ? `the upload ended after the first ${keptBytes} bytes, before the app's body stream reached its end` : `the agent kept only the first ${keptBytes} bytes`;
|
|
@@ -147363,9 +147540,7 @@ var zodSchema45 = external_exports.object({
|
|
|
147363
147540
|
bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
|
|
147364
147541
|
"`bundleId` used in `network-capture-start` (Chromium: placeholder like `argent.capture`)."
|
|
147365
147542
|
),
|
|
147366
|
-
url: external_exports.string().min(1).describe(
|
|
147367
|
-
"URL text/regex to match (no `{{secret:...}}` placeholders; full URL is returned)."
|
|
147368
|
-
),
|
|
147543
|
+
url: external_exports.string().min(1).describe("URL text/regex to match (no `{{secret:...}}` placeholders)."),
|
|
147369
147544
|
urlMatch: external_exports.enum(["contains", "equals", "matches"]).optional().describe(
|
|
147370
147545
|
"`contains` (default) / `equals` (case-insensitive) or `matches` (case-sensitive JS regex)."
|
|
147371
147546
|
),
|
|
@@ -147382,7 +147557,7 @@ var zodSchema45 = external_exports.object({
|
|
|
147382
147557
|
ctx.addIssue({
|
|
147383
147558
|
code: external_exports.ZodIssueCode.custom,
|
|
147384
147559
|
path: ["url"],
|
|
147385
|
-
message: "url takes no {{secret:...}} placeholder: a matcher never resolves secrets
|
|
147560
|
+
message: "url takes no {{secret:...}} placeholder: a matcher never resolves secrets. Match on another part of the URL."
|
|
147386
147561
|
});
|
|
147387
147562
|
}
|
|
147388
147563
|
if (params.urlMatch === "matches") {
|
|
@@ -147450,6 +147625,17 @@ Returns \`{ success, elapsed, match?, cause?, nearMisses?, layers? }\` (pass \`m
|
|
|
147450
147625
|
const layers = await markedLayers(registry2, device, params.bundleId);
|
|
147451
147626
|
if (layers.length === 0) throw notStartedError(params);
|
|
147452
147627
|
const criteria = criteriaOf(params);
|
|
147628
|
+
const atStart = networkSecrets(ctx);
|
|
147629
|
+
let redact2 = networkRedactorOf(atStart);
|
|
147630
|
+
const readSecretsAgain = () => {
|
|
147631
|
+
redact2 = networkRedactorOf([...networkSecrets(ctx), ...atStart]);
|
|
147632
|
+
};
|
|
147633
|
+
const shown = (record2) => ({
|
|
147634
|
+
...record2,
|
|
147635
|
+
method: redact2(record2.method),
|
|
147636
|
+
url: redact2(record2.url),
|
|
147637
|
+
...record2.errorText !== void 0 ? { errorText: redact2(record2.errorText) } : {}
|
|
147638
|
+
});
|
|
147453
147639
|
const timeoutMs = params.timeoutMs ?? DEFAULT_TIMEOUT_MS4;
|
|
147454
147640
|
const pollIntervalMs = params.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
|
|
147455
147641
|
const start2 = Date.now();
|
|
@@ -147485,13 +147671,14 @@ Returns \`{ success, elapsed, match?, cause?, nearMisses?, layers? }\` (pass \`m
|
|
|
147485
147671
|
return read;
|
|
147486
147672
|
};
|
|
147487
147673
|
const success2 = (match) => {
|
|
147674
|
+
readSecretsAgain();
|
|
147488
147675
|
const notes = [...notesSeen].flatMap(
|
|
147489
|
-
([layer, seen]) => [...seen].map((note) => `${layer}: ${note}`)
|
|
147676
|
+
([layer, seen]) => [...seen].map((note) => `${layer}: ${redact2(note)}`)
|
|
147490
147677
|
);
|
|
147491
147678
|
return {
|
|
147492
147679
|
success: true,
|
|
147493
147680
|
elapsed: elapsed(),
|
|
147494
|
-
match,
|
|
147681
|
+
match: shown(match),
|
|
147495
147682
|
...notes.length > 0 ? { note: notes.join("; ") } : {}
|
|
147496
147683
|
};
|
|
147497
147684
|
};
|
|
@@ -147551,6 +147738,7 @@ Returns \`{ success, elapsed, match?, cause?, nearMisses?, layers? }\` (pass \`m
|
|
|
147551
147738
|
const fresh = lastArmedNativeAt !== void 0 && now - lastArmedNativeAt <= tolerance || lastArmedJsAt !== void 0 && now - lastArmedJsAt <= Math.max(tolerance, jsBound + pollIntervalMs);
|
|
147552
147739
|
return timedOut3(fresh ? "unmet" : "unreadable", false);
|
|
147553
147740
|
function timedOut3(cause, allStopped) {
|
|
147741
|
+
readSecretsAgain();
|
|
147554
147742
|
const summaries = layers.map(({ layer }) => {
|
|
147555
147743
|
const last = latest.get(layer);
|
|
147556
147744
|
const readable = latestReadable.get(layer);
|
|
@@ -147560,11 +147748,11 @@ Returns \`{ success, elapsed, match?, cause?, nearMisses?, layers? }\` (pass \`m
|
|
|
147560
147748
|
readable: readable !== void 0,
|
|
147561
147749
|
...last?.stopped ? { stopped: true } : {},
|
|
147562
147750
|
requests: readable?.records.length ?? 0,
|
|
147563
|
-
...last?.note ? { note: last.note } : {}
|
|
147751
|
+
...last?.note ? { note: redact2(last.note) } : {}
|
|
147564
147752
|
};
|
|
147565
147753
|
});
|
|
147566
147754
|
const seen = [...latestReadable.values()].flatMap((read) => read.records);
|
|
147567
|
-
const misses = nearMisses(criteria, seen);
|
|
147755
|
+
const misses = nearMisses(criteria, seen).map(shown);
|
|
147568
147756
|
const counts = summaries.map(
|
|
147569
147757
|
(s) => `${s.layer} ${s.readable ? s.requests : "not read"}${s.armed ? "" : " (not armed)"}`
|
|
147570
147758
|
).join(", ");
|
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.22",
|
|
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": "5d68030a612e2b2c5bcae2db59de599caec47c09"
|
|
102
102
|
}
|