@swmansion/argent 0.24.1-next.0 → 0.24.1-next.2

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
@@ -7253,7 +7253,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
7253
7253
  var SESSION_ID2 = randomUUID5();
7254
7254
  function readCliVersion() {
7255
7255
  if (true) {
7256
- return "0.24.1-next.0";
7256
+ return "0.24.1-next.2";
7257
7257
  }
7258
7258
  return "0.0.0";
7259
7259
  }
@@ -8588,10 +8588,13 @@ chromium (a lone \`{ chromium: ... }\` target, or --platform chromium); a
8588
8588
  multi-platform launch auto-detects a device instead. Pass --device to attach to
8589
8589
  a running instance.
8590
8590
 
8591
- A directory run prints only failing steps plus a final flow summary;
8592
- --recursive walks subdirectories too (dot-directories and node_modules are
8593
- skipped). An invalid flow file fails alone and the batch continues; an infra
8594
- error stops the batch and counts the remaining flows skipped.
8591
+ A directory run prints each flow's failing steps and warnings, then its outcome,
8592
+ then a final flow summary; --recursive walks subdirectories too (dot-directories
8593
+ and node_modules are skipped). A flow that fails its steps keeps the batch
8594
+ running, as does one the server rejects up front \u2014 an invalid file, or a device
8595
+ it cannot resolve. A transport failure, a rejection the server does not mark as
8596
+ validation, or a reply that is not a report stops the batch and counts the
8597
+ remaining flows skipped.
8595
8598
 
8596
8599
  Runs require the auto-started local tool server;
8597
8600
  ARGENT_TOOLS_URL and \`argent link\` routing are not supported.
@@ -8614,8 +8617,10 @@ Options (run):
8614
8617
  instead (with a warning), so no flow's evidence is
8615
8618
  overwritten
8616
8619
  -r, --recursive With a directory path, also run flows in subdirectories
8617
- --json Print the raw JSON report
8618
- --json-stream Print progress and the final report as NDJSON (single flow only)
8620
+ --json Print the flow's JSON report, or a directory run's JSON
8621
+ aggregate
8622
+ --json-stream Print each step and the final report as NDJSON (single
8623
+ flow only, never with --json)
8619
8624
  --help, -h Show this help
8620
8625
  -- End of options \u2014 only needed for a flow whose name
8621
8626
  starts with "-" (\`argent flow run -- -nightly\`)
@@ -8981,14 +8986,16 @@ function buildRunPayload(flowPath, projectRoot, args) {
8981
8986
  function writeJsonStreamRecord(record) {
8982
8987
  console.log(JSON.stringify(record));
8983
8988
  }
8989
+ function failureSignal2(err) {
8990
+ if (!(err instanceof ToolInvocationError)) return {};
8991
+ return {
8992
+ ...err.errorCode ? { error_code: err.errorCode } : {},
8993
+ ...err.errorKind ? { error_kind: err.errorKind } : {}
8994
+ };
8995
+ }
8984
8996
  function writeJsonStreamError(err) {
8985
8997
  const message = err instanceof Error ? err.message : String(err);
8986
- writeJsonStreamRecord({
8987
- event: "error",
8988
- error: message,
8989
- ...err instanceof ToolInvocationError && err.errorCode ? { error_code: err.errorCode } : {},
8990
- ...err instanceof ToolInvocationError && err.errorKind ? { error_kind: err.errorKind } : {}
8991
- });
8998
+ writeJsonStreamRecord({ event: "error", error: message, ...failureSignal2(err) });
8992
8999
  }
8993
9000
  async function exportAndResolveArtifacts(report, outputDir, flowPath, baseUrl) {
8994
9001
  if (outputDir) {
@@ -8997,6 +9004,22 @@ async function exportAndResolveArtifacts(report, outputDir, flowPath, baseUrl) {
8997
9004
  }
8998
9005
  resolveArtifactDisplayPaths(report);
8999
9006
  }
9007
+ function rejectionVerdict(code) {
9008
+ switch (code) {
9009
+ case FAILURE_CODES.FLOW_FILE_INVALID:
9010
+ case FAILURE_CODES.FLOW_ENTRY_UNRECOGNIZED:
9011
+ case FAILURE_CODES.FLOW_E2E_HAS_PREREQUISITE:
9012
+ return "not run (invalid flow)";
9013
+ case FAILURE_CODES.FLOW_DEVICE_RESOLUTION:
9014
+ return "not run (no device resolved)";
9015
+ default:
9016
+ return "not run (rejected)";
9017
+ }
9018
+ }
9019
+ function isFlowReport(data) {
9020
+ const steps = data?.steps;
9021
+ return Array.isArray(steps) && steps.every((step) => !!step && typeof step === "object");
9022
+ }
9000
9023
  async function runFlowDirectory(dir, args, projectRoot, options) {
9001
9024
  let flows;
9002
9025
  try {
@@ -9032,18 +9055,24 @@ async function runFlowDirectory(dir, args, projectRoot, options) {
9032
9055
  "flow-execute",
9033
9056
  buildRunPayload(path14.join(dir, rel), projectRoot, args)
9034
9057
  );
9035
- const data = resp.data;
9036
- if (data && typeof data === "object" && "steps" in data) report = data;
9058
+ if (isFlowReport(resp.data)) report = resp.data;
9037
9059
  } catch (err) {
9038
9060
  const message = err instanceof Error ? err.message : String(err);
9061
+ const toolErr = err instanceof ToolInvocationError ? err : void 0;
9062
+ const rejectedThisFlowOnly = toolErr?.errorKind === "validation";
9063
+ if (!args.json) {
9064
+ console.log(
9065
+ ` ${STATUS_GLYPH.error} ` + (rejectedThisFlowOnly ? rejectionVerdict(toolErr?.errorCode) : "did not finish (run error)")
9066
+ );
9067
+ }
9039
9068
  console.error(message);
9040
- results.push({ path: rel, status: "fail", error: message });
9041
- const rejectedThisFlowOnly = err instanceof ToolInvocationError && err.errorKind === "validation";
9069
+ results.push({ path: rel, status: "fail", error: message, ...failureSignal2(err) });
9042
9070
  if (!rejectedThisFlowOnly) stopped = true;
9043
9071
  continue;
9044
9072
  }
9045
9073
  if (!report) {
9046
9074
  const message = `"${rel}" did not produce a run report.`;
9075
+ if (!args.json) console.log(` ${STATUS_GLYPH.error} did not finish (no run report)`);
9047
9076
  console.error(message);
9048
9077
  results.push({ path: rel, status: "fail", error: message });
9049
9078
  stopped = true;
@@ -9268,9 +9297,19 @@ ${recovery}`,
9268
9297
  );
9269
9298
  report = resp.data;
9270
9299
  } catch (err) {
9300
+ if (!args.json && !args.jsonStream) {
9301
+ if (liveSteps === 0) console.log(`Flow "${flowName}"`);
9302
+ console.log(
9303
+ ` ${STATUS_GLYPH.error} ` + (err instanceof ToolInvocationError && err.errorKind === "validation" ? rejectionVerdict(err.errorCode) : "did not finish (run error)")
9304
+ );
9305
+ }
9271
9306
  return fail(err instanceof Error ? err.message : String(err), 1, err);
9272
9307
  }
9273
- if (!report || typeof report !== "object" || !("steps" in report)) {
9308
+ if (!isFlowReport(report)) {
9309
+ if (!args.json && !args.jsonStream) {
9310
+ if (liveSteps === 0) console.log(`Flow "${flowName}"`);
9311
+ console.log(` ${STATUS_GLYPH.error} did not finish (no run report)`);
9312
+ }
9274
9313
  return fail(`"${flowName}" did not produce a run report.`, 2);
9275
9314
  }
9276
9315
  try {
@@ -16625,7 +16625,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16625
16625
  var SESSION_ID = randomUUID4();
16626
16626
  function readCliVersion() {
16627
16627
  if (true) {
16628
- return "0.24.1-next.0";
16628
+ return "0.24.1-next.2";
16629
16629
  }
16630
16630
  return "0.0.0";
16631
16631
  }
@@ -93916,7 +93916,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
93916
93916
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
93917
93917
  function readCliVersion() {
93918
93918
  if (true) {
93919
- return "0.24.1-next.0";
93919
+ return "0.24.1-next.2";
93920
93920
  }
93921
93921
  return "0.0.0";
93922
93922
  }
@@ -121871,7 +121871,7 @@ init_zod();
121871
121871
 
121872
121872
  // ../tool-server/src/utils/chromium-visibility.ts
121873
121873
  init_src();
121874
- async function assertChromiumWindowVisible(chromium, action, failureStage) {
121874
+ async function assertChromiumWindowVisible(chromium, action) {
121875
121875
  let value;
121876
121876
  try {
121877
121877
  const raw = await chromium.cdp.send("Runtime.evaluate", {
@@ -121887,7 +121887,7 @@ async function assertChromiumWindowVisible(chromium, action, failureStage) {
121887
121887
  `Cannot ${action}: the Chromium window is hidden (minimized or fully occluded), so the renderer will not process mouse input. Bring the window to the foreground and retry.`,
121888
121888
  {
121889
121889
  error_code: FAILURE_CODES.CHROMIUM_WINDOW_HIDDEN,
121890
- failure_stage: failureStage,
121890
+ failure_stage: `chromium_${action}_window_hidden`,
121891
121891
  failure_area: "tool_server",
121892
121892
  error_kind: "validation"
121893
121893
  }
@@ -121964,7 +121964,7 @@ Before tapping, determine the correct coordinates by using discovery tools \u201
121964
121964
  const clickCount = params.clickCount ?? 1;
121965
121965
  if (device.platform === "chromium") {
121966
121966
  const chromium = services.chromium;
121967
- await assertChromiumWindowVisible(chromium, "tap", "chromium_tap_window_hidden");
121967
+ await assertChromiumWindowVisible(chromium, "tap");
121968
121968
  await tapChromium(chromium, params.x, params.y, clickCount);
121969
121969
  return { tapped: true, timestampMs };
121970
121970
  }
@@ -122200,7 +122200,7 @@ Returns { scrolled: true, timestampMs }. Fails if the Chromium CDP session is no
122200
122200
  async execute(services, params) {
122201
122201
  const timestampMs = Date.now();
122202
122202
  const chromium = services.chromium;
122203
- await assertChromiumWindowVisible(chromium, "scroll", "chromium_scroll_window_hidden");
122203
+ await assertChromiumWindowVisible(chromium, "scroll");
122204
122204
  const vp = chromium.getViewport();
122205
122205
  const totalDx = (params.deltaX ?? 0) * vp.width;
122206
122206
  const totalDy = (params.deltaY ?? 0) * vp.height;
@@ -122266,7 +122266,7 @@ Pass momentum:false for a momentum-free drag that decelerates into the release,
122266
122266
  async execute(services, params, ctx) {
122267
122267
  const timestampMs = Date.now();
122268
122268
  const chromium = services.chromium;
122269
- await assertChromiumWindowVisible(chromium, "drag", "chromium_drag_window_hidden");
122269
+ await assertChromiumWindowVisible(chromium, "drag");
122270
122270
  const vp = chromium.getViewport();
122271
122271
  const clampPx2 = (px, size) => Math.min(Math.max(px, 0), size - 1);
122272
122272
  const startPx = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.24.1-next.0",
3
+ "version": "0.24.1-next.2",
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",