@swmansion/argent 0.34.1-next.105 → 0.34.1-next.106

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 CHANGED
@@ -38575,7 +38575,7 @@ function isCi(env = process.env) {
38575
38575
  var SESSION_ID2 = randomUUID5();
38576
38576
  function readCliVersion() {
38577
38577
  if (true) {
38578
- return "0.34.1-next.105";
38578
+ return "0.34.1-next.106";
38579
38579
  }
38580
38580
  return "0.0.0";
38581
38581
  }
@@ -16998,7 +16998,7 @@ function isCi(env = process.env) {
16998
16998
  var SESSION_ID = randomUUID4();
16999
16999
  function readCliVersion() {
17000
17000
  if (true) {
17001
- return "0.34.1-next.105";
17001
+ return "0.34.1-next.106";
17002
17002
  }
17003
17003
  return "0.0.0";
17004
17004
  }
@@ -72948,7 +72948,7 @@ function isCi(env = process.env) {
72948
72948
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
72949
72949
  function readCliVersion() {
72950
72950
  if (true) {
72951
- return "0.34.1-next.105";
72951
+ return "0.34.1-next.106";
72952
72952
  }
72953
72953
  return "0.0.0";
72954
72954
  }
@@ -101345,6 +101345,22 @@ function createTabsManager(deps) {
101345
101345
  // ../tool-server/src/chromium-server/network.ts
101346
101346
  var MAX_RECORDS2 = 1e3;
101347
101347
  var shapesTraffic = (c) => c.offline || c.latency > 0 || c.downloadThroughput >= 0 || c.uploadThroughput >= 0;
101348
+ function unreadBodyLength(headers) {
101349
+ let length;
101350
+ let noStore = false;
101351
+ for (const [name, value] of Object.entries(headers ?? {})) {
101352
+ const header = name.toLowerCase();
101353
+ if (header === "transfer-encoding") return void 0;
101354
+ if (header === "content-encoding" && value.trim().toLowerCase() !== "identity") {
101355
+ return void 0;
101356
+ }
101357
+ if (header === "content-length") length = value.trim();
101358
+ if (header === "cache-control") {
101359
+ noStore ||= value.split(/[,\n]/).some((d) => d.trim().toLowerCase() === "no-store");
101360
+ }
101361
+ }
101362
+ return noStore && length !== void 0 && /^\d+$/.test(length) ? Number(length) : void 0;
101363
+ }
101348
101364
  function createNetworkManager(deps) {
101349
101365
  const { cdp } = deps;
101350
101366
  const order = [];
@@ -101353,6 +101369,7 @@ function createNetworkManager(deps) {
101353
101369
  let lastSeq = 0;
101354
101370
  let mark;
101355
101371
  let conditions = null;
101372
+ const bodyBytesLeft = /* @__PURE__ */ new WeakMap();
101356
101373
  function record2(requestId) {
101357
101374
  let rec = byId.get(requestId);
101358
101375
  if (!rec) {
@@ -101396,6 +101413,25 @@ function createNetworkManager(deps) {
101396
101413
  if (resp.headers) rec.responseHeaders = { ...rec.responseHeaders ?? {}, ...resp.headers };
101397
101414
  rec.fromCache = resp.fromDiskCache;
101398
101415
  rec.resourceType = params.type ?? rec.resourceType;
101416
+ const length = params.type === "Fetch" ? unreadBodyLength(resp.headers) : void 0;
101417
+ if (length !== void 0) bodyBytesLeft.set(rec, length);
101418
+ break;
101419
+ }
101420
+ // For a fetch() whose response is not stored (Cache-Control: no-store), Chrome
101421
+ // sends loadingFinished only once the page reads the body to its end, and never
101422
+ // for a body the page leaves unread. Such a body ended once the page got all of it.
101423
+ case "Network.dataReceived": {
101424
+ const rec = byId.get(params.requestId);
101425
+ const left = rec ? bodyBytesLeft.get(rec) : void 0;
101426
+ if (rec && left !== void 0) {
101427
+ const after = left - params.dataLength;
101428
+ bodyBytesLeft.set(rec, after);
101429
+ if (after <= 0 && !rec.finished) {
101430
+ rec.finished = true;
101431
+ const at = params.timestamp;
101432
+ if (rec.startTs && at !== void 0) rec.durationMs = (at - rec.startTs) * 1e3;
101433
+ }
101434
+ }
101399
101435
  break;
101400
101436
  }
101401
101437
  // The *ExtraInfo events carry on-the-wire headers (Authorization, Set-Cookie, …)
@@ -140849,6 +140885,22 @@ function truncateBody(body, mimeType) {
140849
140885
  return body.length > MAX_BODY_SIZE ? `${cutMarker(`${body.length} chars`, mimeType)}
140850
140886
  ${body.slice(0, MAX_BODY_SIZE)}...` : body;
140851
140887
  }
140888
+ async function chromiumResponseBody(cdp, rec) {
140889
+ try {
140890
+ const out = await cdp.send("Network.getResponseBody", { requestId: rec.requestId });
140891
+ if (out.body != null) return { body: out.body, base64Encoded: out.base64Encoded === true };
140892
+ } catch {
140893
+ }
140894
+ if (!rec.finished || rec.failed) return void 0;
140895
+ try {
140896
+ const out = await cdp.send("Network.streamResourceContent", {
140897
+ requestId: rec.requestId
140898
+ });
140899
+ if (out.bufferedData != null) return { body: out.bufferedData, base64Encoded: true };
140900
+ } catch {
140901
+ }
140902
+ return void 0;
140903
+ }
140852
140904
  function utf8Text(bytes) {
140853
140905
  try {
140854
140906
  return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
@@ -140940,19 +140992,14 @@ If the ID is not found, the tool returns a message. Refresh the log if that happ
140940
140992
  mimeType: rec.mimeType ?? ""
140941
140993
  };
140942
140994
  if (params.includeBody) {
140943
- try {
140944
- const out = await chromium.cdp.send("Network.getResponseBody", {
140945
- requestId: rec.requestId
140946
- });
140947
- if (out.body != null) {
140948
- const body = out.base64Encoded ? utf8Text(Buffer.from(out.body, "base64")) : out.body;
140949
- if (typeof body !== "string") {
140950
- resp.body = `[body omitted: binary ${resp.mimeType || "data"}, ${body.length} bytes]`;
140951
- } else {
140952
- resp.body = truncateBody(body, resp.mimeType);
140953
- }
140995
+ const out = await chromiumResponseBody(chromium.cdp, rec);
140996
+ if (out) {
140997
+ const body = out.base64Encoded ? utf8Text(Buffer.from(out.body, "base64")) : out.body;
140998
+ if (typeof body !== "string") {
140999
+ resp.body = `[body omitted: binary ${resp.mimeType || "data"}, ${body.length} bytes]`;
141000
+ } else {
141001
+ resp.body = truncateBody(body, resp.mimeType);
140954
141002
  }
140955
- } catch {
140956
141003
  }
140957
141004
  }
140958
141005
  details2.response = resp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.34.1-next.105",
3
+ "version": "0.34.1-next.106",
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": "c89f0f6d8b61a8cd09c9264a21ebae1c753936c9"
101
+ "gitHead": "5a2f357fce11287e8d398318d115299294bf0454"
102
102
  }