@swmansion/argent 0.25.2-next.3 → 0.25.2-next.5

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
@@ -21872,7 +21872,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
21872
21872
  var SESSION_ID2 = randomUUID5();
21873
21873
  function readCliVersion() {
21874
21874
  if (true) {
21875
- return "0.25.2-next.3";
21875
+ return "0.25.2-next.5";
21876
21876
  }
21877
21877
  return "0.0.0";
21878
21878
  }
@@ -16725,7 +16725,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16725
16725
  var SESSION_ID = randomUUID4();
16726
16726
  function readCliVersion() {
16727
16727
  if (true) {
16728
- return "0.25.2-next.3";
16728
+ return "0.25.2-next.5";
16729
16729
  }
16730
16730
  return "0.0.0";
16731
16731
  }
@@ -7599,51 +7599,51 @@ var init_he = __esm({
7599
7599
  }
7600
7600
  case "too_big": {
7601
7601
  const sizing = getSizing(issue2.origin);
7602
- const subject = withDefinite(issue2.origin ?? "value");
7602
+ const subject2 = withDefinite(issue2.origin ?? "value");
7603
7603
  if (issue2.origin === "string") {
7604
- return `${sizing?.longLabel ?? "\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${subject} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${issue2.maximum.toString()} ${sizing?.unit ?? ""} ${issue2.inclusive ? "\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA" : "\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();
7604
+ return `${sizing?.longLabel ?? "\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${subject2} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${issue2.maximum.toString()} ${sizing?.unit ?? ""} ${issue2.inclusive ? "\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA" : "\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();
7605
7605
  }
7606
7606
  if (issue2.origin === "number") {
7607
7607
  const comparison = issue2.inclusive ? `\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${issue2.maximum}` : `\u05E7\u05D8\u05DF \u05DE-${issue2.maximum}`;
7608
- return `\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${subject} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${comparison}`;
7608
+ return `\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${subject2} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${comparison}`;
7609
7609
  }
7610
7610
  if (issue2.origin === "array" || issue2.origin === "set") {
7611
7611
  const verb = issue2.origin === "set" ? "\u05E6\u05E8\u05D9\u05DB\u05D4" : "\u05E6\u05E8\u05D9\u05DA";
7612
7612
  const comparison = issue2.inclusive ? `${issue2.maximum} ${sizing?.unit ?? ""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA` : `\u05E4\u05D7\u05D5\u05EA \u05DE-${issue2.maximum} ${sizing?.unit ?? ""}`;
7613
- return `\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${subject} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${comparison}`.trim();
7613
+ return `\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${subject2} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${comparison}`.trim();
7614
7614
  }
7615
7615
  const adj = issue2.inclusive ? "<=" : "<";
7616
7616
  const be = verbFor(issue2.origin ?? "value");
7617
7617
  if (sizing?.unit) {
7618
- return `${sizing.longLabel} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.maximum.toString()} ${sizing.unit}`;
7618
+ return `${sizing.longLabel} \u05DE\u05D3\u05D9: ${subject2} ${be} ${adj}${issue2.maximum.toString()} ${sizing.unit}`;
7619
7619
  }
7620
- return `${sizing?.longLabel ?? "\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.maximum.toString()}`;
7620
+ return `${sizing?.longLabel ?? "\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${subject2} ${be} ${adj}${issue2.maximum.toString()}`;
7621
7621
  }
7622
7622
  case "too_small": {
7623
7623
  const sizing = getSizing(issue2.origin);
7624
- const subject = withDefinite(issue2.origin ?? "value");
7624
+ const subject2 = withDefinite(issue2.origin ?? "value");
7625
7625
  if (issue2.origin === "string") {
7626
- return `${sizing?.shortLabel ?? "\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${subject} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${issue2.minimum.toString()} ${sizing?.unit ?? ""} ${issue2.inclusive ? "\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8" : "\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();
7626
+ return `${sizing?.shortLabel ?? "\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${subject2} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${issue2.minimum.toString()} ${sizing?.unit ?? ""} ${issue2.inclusive ? "\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8" : "\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();
7627
7627
  }
7628
7628
  if (issue2.origin === "number") {
7629
7629
  const comparison = issue2.inclusive ? `\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${issue2.minimum}` : `\u05D2\u05D3\u05D5\u05DC \u05DE-${issue2.minimum}`;
7630
- return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${comparison}`;
7630
+ return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject2} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${comparison}`;
7631
7631
  }
7632
7632
  if (issue2.origin === "array" || issue2.origin === "set") {
7633
7633
  const verb = issue2.origin === "set" ? "\u05E6\u05E8\u05D9\u05DB\u05D4" : "\u05E6\u05E8\u05D9\u05DA";
7634
7634
  if (issue2.minimum === 1 && issue2.inclusive) {
7635
7635
  const singularPhrase = issue2.origin === "set" ? "\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3" : "\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3";
7636
- return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${singularPhrase}`;
7636
+ return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject2} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${singularPhrase}`;
7637
7637
  }
7638
7638
  const comparison = issue2.inclusive ? `${issue2.minimum} ${sizing?.unit ?? ""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8` : `\u05D9\u05D5\u05EA\u05E8 \u05DE-${issue2.minimum} ${sizing?.unit ?? ""}`;
7639
- return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${comparison}`.trim();
7639
+ return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject2} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${comparison}`.trim();
7640
7640
  }
7641
7641
  const adj = issue2.inclusive ? ">=" : ">";
7642
7642
  const be = verbFor(issue2.origin ?? "value");
7643
7643
  if (sizing?.unit) {
7644
- return `${sizing.shortLabel} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
7644
+ return `${sizing.shortLabel} \u05DE\u05D3\u05D9: ${subject2} ${be} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
7645
7645
  }
7646
- return `${sizing?.shortLabel ?? "\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.minimum.toString()}`;
7646
+ return `${sizing?.shortLabel ?? "\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${subject2} ${be} ${adj}${issue2.minimum.toString()}`;
7647
7647
  }
7648
7648
  case "invalid_format": {
7649
7649
  const _issue = issue2;
@@ -94799,7 +94799,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
94799
94799
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
94800
94800
  function readCliVersion() {
94801
94801
  if (true) {
94802
- return "0.25.2-next.3";
94802
+ return "0.25.2-next.5";
94803
94803
  }
94804
94804
  return "0.0.0";
94805
94805
  }
@@ -96335,8 +96335,8 @@ async function listCertificatePem(commonName) {
96335
96335
  }
96336
96336
  }
96337
96337
  var PEM_BLOCK_RE = /-----BEGIN CERTIFICATE-----[\s\S]*?-----END CERTIFICATE-----/g;
96338
- function subjectValue(subject, key2) {
96339
- for (const line of subject.split("\n")) {
96338
+ function subjectValue(subject2, key2) {
96339
+ for (const line of subject2.split("\n")) {
96340
96340
  if (line.startsWith(`${key2}=`)) {
96341
96341
  return line.slice(key2.length + 1).trim() || null;
96342
96342
  }
@@ -109688,23 +109688,34 @@ async function captureScreenshot(ctx, opts = {}) {
109688
109688
  let bytes = Buffer.from(cdpResult.data, "base64");
109689
109689
  const rotation = opts.rotation && opts.rotation !== "Portrait" ? opts.rotation : null;
109690
109690
  const scale = opts.scale != null && opts.scale > 0 && opts.scale < 1 ? opts.scale : null;
109691
+ const dropped = [];
109692
+ let dropReason;
109691
109693
  if (rotation || scale) {
109692
109694
  const sharp = tryLoadSharp();
109693
109695
  if (!sharp) {
109694
109696
  const features = [rotation && "rotation", scale && "scale"].filter(Boolean).join(" + ");
109695
109697
  warnSharpMissingOnce(features);
109698
+ if (rotation) dropped.push("rotation");
109699
+ if (scale) dropped.push("scale");
109700
+ dropReason = "sharp-missing";
109696
109701
  } else {
109697
109702
  let pipeline = sharp(bytes);
109698
109703
  if (rotation) pipeline = pipeline.rotate(ROTATION_DEGREES2[rotation]);
109699
109704
  if (scale) {
109700
109705
  const dims = readPngSize(bytes);
109701
109706
  if (dims) {
109702
- const targetW = Math.max(1, Math.round(dims.width * scale));
109703
- const targetH = Math.max(1, Math.round(dims.height * scale));
109707
+ const quarterTurn = rotation === "LandscapeLeft" || rotation === "LandscapeRight";
109708
+ const rotatedW = quarterTurn ? dims.height : dims.width;
109709
+ const rotatedH = quarterTurn ? dims.width : dims.height;
109710
+ const targetW = Math.max(1, Math.round(rotatedW * scale));
109711
+ const targetH = Math.max(1, Math.round(rotatedH * scale));
109704
109712
  pipeline = pipeline.resize(targetW, targetH, {
109705
109713
  kernel: DOWNSCALER_TO_KERNEL[opts.downscaler ?? "lanczos3"],
109706
109714
  fit: "fill"
109707
109715
  });
109716
+ } else {
109717
+ dropped.push("scale");
109718
+ dropReason = "png-header-unreadable";
109708
109719
  }
109709
109720
  }
109710
109721
  bytes = Buffer.from(await pipeline.png({ compressionLevel: 6 }).toBuffer());
@@ -109714,7 +109725,11 @@ async function captureScreenshot(ctx, opts = {}) {
109714
109725
  const safeDeviceId = ctx.deviceId.replace(/[^A-Za-z0-9_-]/g, "_");
109715
109726
  const filePath = path16.join(mediaDir(), `argent-screenshot-${safeDeviceId}-${stem}.png`);
109716
109727
  fs18.writeFileSync(filePath, bytes);
109717
- return { url: `file://${filePath}`, path: filePath };
109728
+ return {
109729
+ url: `file://${filePath}`,
109730
+ path: filePath,
109731
+ ...dropped.length > 0 ? { droppedFeatures: dropped, dropReason } : {}
109732
+ };
109718
109733
  }
109719
109734
  function readPngSize(buf) {
109720
109735
  const signature = [137, 80, 78, 71, 13, 10, 26, 10];
@@ -114635,6 +114650,31 @@ async function handleWsCommand(msg, server) {
114635
114650
 
114636
114651
  // ../tool-server/src/http.ts
114637
114652
  init_device_info();
114653
+
114654
+ // ../tool-server/src/tools/screenshot/dropped-geometry.ts
114655
+ var RESULT_NOTE_KEY = "__argentNote";
114656
+ function requestedGeometry(params) {
114657
+ const requested = [];
114658
+ if (params.rotation !== void 0 && params.rotation !== "Portrait") requested.push("rotation");
114659
+ if (params.scale !== void 0 && params.scale > 0 && params.scale < 1) requested.push("scale");
114660
+ return requested;
114661
+ }
114662
+ function subject(dropped) {
114663
+ return dropped.length === 2 ? "scale and rotation were" : `${dropped[0]} was`;
114664
+ }
114665
+ function chromiumDropNote(dropped, reason = "sharp-missing") {
114666
+ if (dropped.length === 0) return void 0;
114667
+ if (reason === "png-header-unreadable") {
114668
+ return `${subject(dropped)} not applied: the PNG header could not be read. Any rotation was applied.`;
114669
+ }
114670
+ return `${subject(dropped)} not applied: install the optional \`sharp\` package in the tool-server environment.`;
114671
+ }
114672
+ function unsupportedDropNote(dropped, target) {
114673
+ if (dropped.length === 0) return void 0;
114674
+ return `${subject(dropped)} not applied: ${target} screenshots cannot be rotated.`;
114675
+ }
114676
+
114677
+ // ../tool-server/src/http.ts
114638
114678
  var AUTO_SUPPRESS_MS = 30 * 60 * 1e3;
114639
114679
  var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
114640
114680
  var BEARER_PREFIX = "Bearer ";
@@ -114796,6 +114836,14 @@ function isWebsocketUpgradeAllowed(headers, policy) {
114796
114836
  var UPLOAD_TTL_MS = 15 * 60 * 1e3;
114797
114837
  var MAX_UPLOAD_STREAM_BYTES = 2 * 1024 * 1024 * 1024;
114798
114838
  var MAX_PENDING_UPLOAD_BYTES = 8 * 1024 * 1024 * 1024;
114839
+ function takeToolNote(data) {
114840
+ if (typeof data !== "object" || data === null) return void 0;
114841
+ const bag = data;
114842
+ if (!(RESULT_NOTE_KEY in bag)) return void 0;
114843
+ const note = bag[RESULT_NOTE_KEY];
114844
+ delete bag[RESULT_NOTE_KEY];
114845
+ return typeof note === "string" && note.length > 0 ? note : void 0;
114846
+ }
114799
114847
  function createHttpApp(registry2, options) {
114800
114848
  const app = (0, import_express3.default)();
114801
114849
  app.use(import_express3.default.json({ limit: "48mb" }));
@@ -115206,6 +115254,8 @@ function createHttpApp(registry2, options) {
115206
115254
  if (signingNote) {
115207
115255
  notes.push(signingNote);
115208
115256
  }
115257
+ const toolNote = takeToolNote(data);
115258
+ if (toolNote) notes.push(toolNote);
115209
115259
  const notePayload = notes.length > 0 ? { note: notes.join("\n\n") } : {};
115210
115260
  if (wantsStream) {
115211
115261
  writeLine({ event: "result", data, ...notePayload });
@@ -123413,17 +123463,20 @@ Fails if the simulator-server / emulator backend / Chromium CDP is not reachable
123413
123463
  if (device.platform === "chromium") {
123414
123464
  const ref2 = chromiumCdpRef(device);
123415
123465
  const chromium = await registry2.resolveService(ref2.urn, ref2.options);
123416
- const { path: capturedPath2 } = await chromium.captureScreenshot({
123466
+ const captured = await chromium.captureScreenshot({
123417
123467
  rotation: params.rotation,
123418
123468
  scale: params.scale,
123419
123469
  downscaler: params.downscaler
123420
123470
  });
123421
123471
  const image2 = await requireArtifacts(ctx).register({
123422
- hostPath: capturedPath2,
123472
+ hostPath: captured.path,
123423
123473
  kind: "screenshot",
123424
123474
  mimeType: "image/png"
123425
123475
  });
123426
- return { image: image2 };
123476
+ const requested = requestedGeometry(params);
123477
+ const dropped = (captured.droppedFeatures ?? []).filter((f) => requested.includes(f));
123478
+ const note = chromiumDropNote(dropped, captured.dropReason);
123479
+ return { image: image2, ...note ? { [RESULT_NOTE_KEY]: note } : {} };
123427
123480
  }
123428
123481
  if (isIosPhysicalDevice(device)) {
123429
123482
  const pngPath = await iosPhysicalScreenshot(registry2, device, scale);
@@ -123432,7 +123485,11 @@ Fails if the simulator-server / emulator backend / Chromium CDP is not reachable
123432
123485
  kind: "screenshot",
123433
123486
  mimeType: "image/png"
123434
123487
  });
123435
- return { image: image2 };
123488
+ const note = unsupportedDropNote(
123489
+ requestedGeometry(params).filter((f) => f === "rotation"),
123490
+ "physical iPhone"
123491
+ );
123492
+ return { image: image2, ...note ? { [RESULT_NOTE_KEY]: note } : {} };
123436
123493
  }
123437
123494
  if (device.platform === "ios" && await isTvOsSimulator(params.udid)) {
123438
123495
  const pngPath = await tvScreenshot(params.udid, scale, signal);
@@ -123441,7 +123498,11 @@ Fails if the simulator-server / emulator backend / Chromium CDP is not reachable
123441
123498
  kind: "screenshot",
123442
123499
  mimeType: "image/png"
123443
123500
  });
123444
- return { image: image2 };
123501
+ const note = unsupportedDropNote(
123502
+ requestedGeometry(params).filter((f) => f === "rotation"),
123503
+ "Apple TV"
123504
+ );
123505
+ return { image: image2, ...note ? { [RESULT_NOTE_KEY]: note } : {} };
123445
123506
  }
123446
123507
  if (device.platform === "vega") {
123447
123508
  const pngPath = await captureVegaScreenshotPng({ scale: params.scale });
@@ -123450,7 +123511,11 @@ Fails if the simulator-server / emulator backend / Chromium CDP is not reachable
123450
123511
  kind: "screenshot",
123451
123512
  mimeType: "image/png"
123452
123513
  });
123453
- return { image: image2 };
123514
+ const note = unsupportedDropNote(
123515
+ requestedGeometry(params).filter((f) => f === "rotation"),
123516
+ "Vega (Fire TV)"
123517
+ );
123518
+ return { image: image2, ...note ? { [RESULT_NOTE_KEY]: note } : {} };
123454
123519
  }
123455
123520
  const ref = simulatorServerRef(device);
123456
123521
  const api = await registry2.resolveService(ref.urn, ref.options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.25.2-next.3",
3
+ "version": "0.25.2-next.5",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator and Android Emulator control",
6
6
  "license": "Apache-2.0",