@swmansion/argent 0.34.1-next.95 → 0.34.1-next.96

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.
Binary file
Binary file
Binary file
Binary file
Binary file
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.94";
38578
+ return "0.34.1-next.96";
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.94";
17001
+ return "0.34.1-next.96";
17002
17002
  }
17003
17003
  return "0.0.0";
17004
17004
  }
@@ -36495,8 +36495,141 @@ async function toMcpContent(result, outputHint, ctx, args) {
36495
36495
  }
36496
36496
  return [{ type: "text", text: stringifyForText(result) }];
36497
36497
  }
36498
+ var LINE_BREAK_THRESHOLD = 160;
36499
+ function isJsonOmitted(value) {
36500
+ return value === void 0 || typeof value === "function" || typeof value === "symbol";
36501
+ }
36502
+ function isObjectWithoutToJson(value) {
36503
+ return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.toJSON !== "function";
36504
+ }
36505
+ function isMultilineText(value) {
36506
+ return typeof value === "string" && value.includes("\n") && value.trim().length > 0;
36507
+ }
36508
+ function formatJsonNode(rootValue, rootTopLevel) {
36509
+ const stack = [];
36510
+ const ancestors = /* @__PURE__ */ new Set();
36511
+ const enter = (value, topLevel) => {
36512
+ if (isJsonOmitted(value)) return { text: "null", multiline: false };
36513
+ if (Array.isArray(value)) {
36514
+ if (value.length === 0) return { text: "[]", multiline: false };
36515
+ if (ancestors.has(value)) throw new TypeError("Converting circular structure to JSON");
36516
+ ancestors.add(value);
36517
+ stack.push({
36518
+ kind: "array",
36519
+ source: value,
36520
+ nextIndex: 0,
36521
+ items: [],
36522
+ hasStructured: false
36523
+ });
36524
+ return void 0;
36525
+ }
36526
+ if (isObjectWithoutToJson(value)) {
36527
+ const entries = Object.entries(value).filter(([, v]) => !isJsonOmitted(v));
36528
+ if (entries.length === 0) return { text: "{}", multiline: false };
36529
+ if (ancestors.has(value)) throw new TypeError("Converting circular structure to JSON");
36530
+ ancestors.add(value);
36531
+ stack.push({
36532
+ kind: "object",
36533
+ source: value,
36534
+ entries,
36535
+ nextIndex: 0,
36536
+ parts: [],
36537
+ topLevel,
36538
+ pendingKey: "",
36539
+ pendingStructured: false
36540
+ });
36541
+ return void 0;
36542
+ }
36543
+ return { text: JSON.stringify(value) ?? "null", multiline: false };
36544
+ };
36545
+ const rootLeaf = enter(rootValue, rootTopLevel);
36546
+ if (rootLeaf !== void 0) return rootLeaf;
36547
+ while (stack.length > 0) {
36548
+ const frame = stack[stack.length - 1];
36549
+ let completed;
36550
+ if (frame.kind === "array") {
36551
+ if (frame.nextIndex < frame.source.length) {
36552
+ const el = frame.source[frame.nextIndex++];
36553
+ if (el !== null && typeof el === "object") frame.hasStructured = true;
36554
+ const leaf = enter(el, false);
36555
+ if (leaf !== void 0) frame.items.push(leaf);
36556
+ continue;
36557
+ }
36558
+ stack.pop();
36559
+ ancestors.delete(frame.source);
36560
+ const anyMultiline = frame.items.some((item) => item.multiline);
36561
+ let flatLen = 2 + frame.items.length - 1;
36562
+ for (const item of frame.items) flatLen += item.text.length;
36563
+ completed = !anyMultiline && (flatLen <= LINE_BREAK_THRESHOLD || !frame.hasStructured) ? { text: `[${frame.items.map((i) => i.text).join(",")}]`, multiline: false } : { text: `[
36564
+ ${frame.items.map((i) => i.text).join(",\n")}
36565
+ ]`, multiline: true };
36566
+ } else {
36567
+ if (frame.nextIndex < frame.entries.length) {
36568
+ const [k, v] = frame.entries[frame.nextIndex++];
36569
+ const key = JSON.stringify(k);
36570
+ const structured = v !== null && typeof v === "object";
36571
+ const leaf = enter(v, false);
36572
+ if (leaf !== void 0) {
36573
+ frame.parts.push({ key, val: leaf, structured });
36574
+ } else {
36575
+ frame.pendingKey = key;
36576
+ frame.pendingStructured = structured;
36577
+ }
36578
+ continue;
36579
+ }
36580
+ stack.pop();
36581
+ ancestors.delete(frame.source);
36582
+ const anyMultiline = frame.parts.some((p) => p.val.multiline);
36583
+ const hasBigNested = frame.parts.some(
36584
+ (p) => p.val.multiline || p.structured && p.val.text.length > LINE_BREAK_THRESHOLD
36585
+ );
36586
+ let flatLen = 2 + frame.parts.length - 1;
36587
+ for (const p of frame.parts) flatLen += p.key.length + 1 + p.val.text.length;
36588
+ completed = !anyMultiline && (flatLen <= LINE_BREAK_THRESHOLD || !frame.topLevel && !hasBigNested) ? {
36589
+ text: `{${frame.parts.map((p) => `${p.key}:${p.val.text}`).join(",")}}`,
36590
+ multiline: false
36591
+ } : {
36592
+ text: `{
36593
+ ${frame.parts.map((p) => `${p.key}:${p.val.text}`).join(",\n")}
36594
+ }`,
36595
+ multiline: true
36596
+ };
36597
+ }
36598
+ const parent = stack[stack.length - 1];
36599
+ if (!parent) return completed;
36600
+ if (parent.kind === "array") {
36601
+ parent.items.push(completed);
36602
+ } else {
36603
+ parent.parts.push({
36604
+ key: parent.pendingKey,
36605
+ val: completed,
36606
+ structured: parent.pendingStructured
36607
+ });
36608
+ }
36609
+ }
36610
+ return { text: "null", multiline: false };
36611
+ }
36498
36612
  function stringifyForText(value) {
36499
- return JSON.stringify(value ?? null, null, 2);
36613
+ if (typeof value === "string") {
36614
+ return value.length > 0 ? value : '""';
36615
+ }
36616
+ if (isObjectWithoutToJson(value)) {
36617
+ const entries = Object.entries(value).filter(([, v]) => !isJsonOmitted(v));
36618
+ const multiline = entries.filter(([, v]) => isMultilineText(v));
36619
+ if (multiline.length > 0) {
36620
+ const rest = Object.fromEntries(entries.filter(([, v]) => !isMultilineText(v)));
36621
+ const sections = [];
36622
+ if (Object.keys(rest).length > 0) {
36623
+ sections.push(formatJsonNode(rest, true).text);
36624
+ }
36625
+ for (const [k, v] of multiline) {
36626
+ sections.push(`${k}:
36627
+ ${v}`);
36628
+ }
36629
+ return sections.join("\n\n");
36630
+ }
36631
+ }
36632
+ return formatJsonNode(value, true).text;
36500
36633
  }
36501
36634
  async function legacyImageContent(result, suppressImage, signal) {
36502
36635
  if (result && typeof result === "object" && "url" in result) {
@@ -36515,7 +36648,7 @@ async function legacyImageContent(result, suppressImage, signal) {
36515
36648
  }
36516
36649
  ];
36517
36650
  }
36518
- return [{ type: "text", text: JSON.stringify(result, null, 2) }];
36651
+ return [{ type: "text", text: stringifyForText(result) }];
36519
36652
  }
36520
36653
  function isRecord3(value) {
36521
36654
  return value !== null && typeof value === "object";
@@ -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.94";
72951
+ return "0.34.1-next.96";
72952
72952
  }
72953
72953
  return "0.0.0";
72954
72954
  }
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.34.1-next.95",
3
+ "version": "0.34.1-next.96",
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": "8d1ae61f2e6fdf7191b6159bd089520aa8ab38e0"
101
+ "gitHead": "698324b75329ff5f5a6f0b110dd30fd10cb03446"
102
102
  }