@swmansion/argent 0.18.1-next.15 → 0.18.1-next.17

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
@@ -9179,8 +9179,10 @@ function renderUnderStepLine(s, n2, text2) {
9179
9179
  function renderSummary(report, opts = {}) {
9180
9180
  const warnings = report.steps.filter((s) => s.warning).length;
9181
9181
  const warningsNote = warnings ? `, ${warnings} warning${warnings === 1 ? "" : "s"}` : "";
9182
- const where = opts.withDevice ? ` on ${report.device}` : "";
9183
- return `${report.ok ? "PASS" : "FAIL"}${where} \u2014 ${report.passed} passed, ${report.failed} failed, ${report.errored} errored, ${report.skipped} skipped${warningsNote}`;
9182
+ const where = opts.withDevice && report.device ? ` on ${report.device}` : "";
9183
+ const nothingCounted = report.ok && report.passed + report.failed + report.errored + report.skipped === 0;
9184
+ const note = nothingCounted ? " (no test steps)" : "";
9185
+ return `${report.ok ? "PASS" : "FAIL"}${where} \u2014 ${report.passed} passed, ${report.failed} failed, ${report.errored} errored, ${report.skipped} skipped${warningsNote}${note}`;
9184
9186
  }
9185
9187
  function renderArtifactLines(report) {
9186
9188
  const lines = [];
@@ -9248,7 +9250,7 @@ function exitAfterFlush(code, streams = [process.stdout, process.stderr]) {
9248
9250
  }
9249
9251
  function renderReport(report) {
9250
9252
  const lines = [];
9251
- lines.push(`Flow "${report.flow}" on ${report.device}`);
9253
+ lines.push(`Flow "${report.flow}"${report.device ? ` on ${report.device}` : ""}`);
9252
9254
  if (report.executionPrerequisite) {
9253
9255
  lines.push(` assumes: ${report.executionPrerequisite}`);
9254
9256
  }
@@ -19293,9 +19293,11 @@ async function flowRunToMcpContent(result, ctx) {
19293
19293
  }
19294
19294
  }
19295
19295
  if (result.ok !== void 0) {
19296
+ const counted = (result.passed ?? 0) + (result.failed ?? 0) + (result.errored ?? 0) + (result.skipped ?? 0);
19297
+ const note = result.ok && counted === 0 ? " (no test steps)" : "";
19296
19298
  blocks.push({
19297
19299
  type: "text",
19298
- text: `${result.ok ? "PASS" : "FAIL"} \u2014 ${result.passed ?? 0} passed, ${result.failed ?? 0} failed, ${result.errored ?? 0} errored, ${result.skipped ?? 0} skipped`
19300
+ text: `${result.ok ? "PASS" : "FAIL"} \u2014 ${result.passed ?? 0} passed, ${result.failed ?? 0} failed, ${result.errored ?? 0} errored, ${result.skipped ?? 0} skipped${note}`
19299
19301
  });
19300
19302
  } else {
19301
19303
  blocks.push({ type: "text", text: `Flow "${result.flow}" complete.` });
@@ -4746,8 +4746,8 @@ var init_az = __esm({
4746
4746
  });
4747
4747
 
4748
4748
  // ../../node_modules/zod/v4/locales/be.js
4749
- function getBelarusianPlural(count, one, few, many) {
4750
- const absCount = Math.abs(count);
4749
+ function getBelarusianPlural(count2, one, few, many) {
4750
+ const absCount = Math.abs(count2);
4751
4751
  const lastDigit = absCount % 10;
4752
4752
  const lastTwoDigits = absCount % 100;
4753
4753
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -6927,8 +6927,8 @@ var init_hu = __esm({
6927
6927
  });
6928
6928
 
6929
6929
  // ../../node_modules/zod/v4/locales/hy.js
6930
- function getArmenianPlural(count, one, many) {
6931
- return Math.abs(count) === 1 ? one : many;
6930
+ function getArmenianPlural(count2, one, many) {
6931
+ return Math.abs(count2) === 1 ? one : many;
6932
6932
  }
6933
6933
  function withDefiniteArticle(word) {
6934
6934
  if (!word)
@@ -9169,8 +9169,8 @@ var init_ro = __esm({
9169
9169
  });
9170
9170
 
9171
9171
  // ../../node_modules/zod/v4/locales/ru.js
9172
- function getRussianPlural(count, one, few, many) {
9173
- const absCount = Math.abs(count);
9172
+ function getRussianPlural(count2, one, few, many) {
9173
+ const absCount = Math.abs(count2);
9174
9174
  const lastDigit = absCount % 10;
9175
9175
  const lastTwoDigits = absCount % 100;
9176
9176
  if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
@@ -16840,8 +16840,8 @@ var require_depd = __commonJS({
16840
16840
  return deprecate;
16841
16841
  }
16842
16842
  function eehaslisteners(emitter, type) {
16843
- var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type);
16844
- return count > 0;
16843
+ var count2 = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type);
16844
+ return count2 > 0;
16845
16845
  }
16846
16846
  function isignored(namespace) {
16847
16847
  if (process.noDeprecation) {
@@ -34606,14 +34606,14 @@ var require_urlencoded = __commonJS({
34606
34606
  };
34607
34607
  }
34608
34608
  function parameterCount(body, limit) {
34609
- let count = 0;
34609
+ let count2 = 0;
34610
34610
  let index = -1;
34611
34611
  do {
34612
- count++;
34613
- if (count > limit) return void 0;
34612
+ count2++;
34613
+ if (count2 > limit) return void 0;
34614
34614
  index = body.indexOf("&", index + 1);
34615
34615
  } while (index !== -1);
34616
- return count;
34616
+ return count2;
34617
34617
  }
34618
34618
  }
34619
34619
  });
@@ -47419,13 +47419,13 @@ var require_mediaType = __commonJS({
47419
47419
  return spec.q > 0;
47420
47420
  }
47421
47421
  function quoteCount(string4) {
47422
- var count = 0;
47422
+ var count2 = 0;
47423
47423
  var index = 0;
47424
47424
  while ((index = string4.indexOf('"', index)) !== -1) {
47425
- count++;
47425
+ count2++;
47426
47426
  index++;
47427
47427
  }
47428
- return count;
47428
+ return count2;
47429
47429
  }
47430
47430
  function splitKeyValuePair(str) {
47431
47431
  var index = str.indexOf("=");
@@ -67740,8 +67740,8 @@ var require_send = __commonJS({
67740
67740
  }
67741
67741
  }
67742
67742
  function hasListeners(emitter, type) {
67743
- var count = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type);
67744
- return count > 0;
67743
+ var count2 = typeof emitter.listenerCount !== "function" ? emitter.listeners(type).length : emitter.listenerCount(type);
67744
+ return count2 > 0;
67745
67745
  }
67746
67746
  function normalizeList(val, name) {
67747
67747
  var list = [].concat(val || []);
@@ -71526,8 +71526,8 @@ async function encode4(w, namespace) {
71526
71526
  }
71527
71527
  async function decode4(r) {
71528
71528
  const parts = [];
71529
- const count = await r.u53();
71530
- for (let i = 0; i < count; i++) {
71529
+ const count2 = await r.u53();
71530
+ for (let i = 0; i < count2; i++) {
71531
71531
  parts.push(await r.string());
71532
71532
  }
71533
71533
  return from(...parts);
@@ -71709,9 +71709,9 @@ var init_parameters = __esm({
71709
71709
  }
71710
71710
  }
71711
71711
  } else {
71712
- const count = await r.u53();
71712
+ const count2 = await r.u53();
71713
71713
  let prevType = 0n;
71714
- for (let i = 0; i < count; i++) {
71714
+ for (let i = 0; i < count2; i++) {
71715
71715
  let id;
71716
71716
  if (version4 === Version.DRAFT_16) {
71717
71717
  const delta = await r.u62();
@@ -71864,10 +71864,10 @@ var init_parameters = __esm({
71864
71864
  }
71865
71865
  }
71866
71866
  static async decode(r, version4) {
71867
- const count = await r.u53();
71867
+ const count2 = await r.u53();
71868
71868
  const params = new _Parameters();
71869
71869
  let prevType = 0n;
71870
- for (let i = 0; i < count; i++) {
71870
+ for (let i = 0; i < count2; i++) {
71871
71871
  let id;
71872
71872
  if (version4 === Version.DRAFT_14 || version4 === Version.DRAFT_15) {
71873
71873
  id = await r.u62();
@@ -89110,19 +89110,19 @@ var require_chunkstream = __commonJS({
89110
89110
  ChunkStream.prototype._processRead = function(read) {
89111
89111
  this._reads.shift();
89112
89112
  let pos = 0;
89113
- let count = 0;
89113
+ let count2 = 0;
89114
89114
  let data = Buffer.alloc(read.length);
89115
89115
  while (pos < read.length) {
89116
- let buf = this._buffers[count++];
89116
+ let buf = this._buffers[count2++];
89117
89117
  let len = Math.min(buf.length, read.length - pos);
89118
89118
  buf.copy(data, pos, 0, len);
89119
89119
  pos += len;
89120
89120
  if (len !== buf.length) {
89121
- this._buffers[--count] = buf.slice(len);
89121
+ this._buffers[--count2] = buf.slice(len);
89122
89122
  }
89123
89123
  }
89124
- if (count > 0) {
89125
- this._buffers.splice(0, count);
89124
+ if (count2 > 0) {
89125
+ this._buffers.splice(0, count2);
89126
89126
  }
89127
89127
  this._buffered -= read.length;
89128
89128
  read.func.call(this, data);
@@ -89854,12 +89854,12 @@ var require_bitmapper = __commonJS({
89854
89854
  }
89855
89855
  }
89856
89856
  return {
89857
- get: function(count) {
89858
- while (leftOver.length < count) {
89857
+ get: function(count2) {
89858
+ while (leftOver.length < count2) {
89859
89859
  split();
89860
89860
  }
89861
- let returner = leftOver.slice(0, count);
89862
- leftOver = leftOver.slice(count);
89861
+ let returner = leftOver.slice(0, count2);
89862
+ leftOver = leftOver.slice(count2);
89863
89863
  return returner;
89864
89864
  },
89865
89865
  resetAfterLine: function() {
@@ -91667,8 +91667,8 @@ var require_Node = __commonJS({
91667
91667
  };
91668
91668
  const res = toJS.toJS(this, "", ctx);
91669
91669
  if (typeof onAnchor === "function")
91670
- for (const { count, res: res2 } of ctx.anchors.values())
91671
- onAnchor(res2, count);
91670
+ for (const { count: count2, res: res2 } of ctx.anchors.values())
91671
+ onAnchor(res2, count2);
91672
91672
  return typeof reviver === "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res;
91673
91673
  }
91674
91674
  };
@@ -91774,13 +91774,13 @@ var require_Alias = __commonJS({
91774
91774
  const anchor = anchors2 && source && anchors2.get(source);
91775
91775
  return anchor ? anchor.count * anchor.aliasCount : 0;
91776
91776
  } else if (identity.isCollection(node)) {
91777
- let count = 0;
91777
+ let count2 = 0;
91778
91778
  for (const item of node.items) {
91779
91779
  const c = getAliasCount(doc, item, anchors2);
91780
- if (c > count)
91781
- count = c;
91780
+ if (c > count2)
91781
+ count2 = c;
91782
91782
  }
91783
- return count;
91783
+ return count2;
91784
91784
  } else if (identity.isPair(node)) {
91785
91785
  const kc = getAliasCount(doc, node.key, anchors2);
91786
91786
  const vc = getAliasCount(doc, node.value, anchors2);
@@ -94733,8 +94733,8 @@ var require_Document = __commonJS({
94733
94733
  };
94734
94734
  const res = toJS.toJS(this.contents, jsonArg ?? "", ctx);
94735
94735
  if (typeof onAnchor === "function")
94736
- for (const { count, res: res2 } of ctx.anchors.values())
94737
- onAnchor(res2, count);
94736
+ for (const { count: count2, res: res2 } of ctx.anchors.values())
94737
+ onAnchor(res2, count2);
94738
94738
  return typeof reviver === "function" ? applyReviver.applyReviver(reviver, { "": res }, "", res) : res;
94739
94739
  }
94740
94740
  /**
@@ -94811,12 +94811,12 @@ var require_errors = __commonJS({
94811
94811
  lineStr = prev + lineStr;
94812
94812
  }
94813
94813
  if (/[^ ]/.test(lineStr)) {
94814
- let count = 1;
94814
+ let count2 = 1;
94815
94815
  const end = error52.linePos[1];
94816
94816
  if (end?.line === line && end.col > col) {
94817
- count = Math.max(1, Math.min(end.col - col, 80 - ci));
94817
+ count2 = Math.max(1, Math.min(end.col - col, 80 - ci));
94818
94818
  }
94819
- const pointer = " ".repeat(ci) + "^".repeat(count);
94819
+ const pointer = " ".repeat(ci) + "^".repeat(count2);
94820
94820
  error52.message += `:
94821
94821
 
94822
94822
  ${lineStr}
@@ -102890,8 +102890,8 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
102890
102890
  onError: (err) => {
102891
102891
  this._events.emit("error", err);
102892
102892
  },
102893
- onLoad: (count) => {
102894
- this._events.emit("localEvaluationFlagsLoaded", count);
102893
+ onLoad: (count2) => {
102894
+ this._events.emit("localEvaluationFlagsLoaded", count2);
102895
102895
  },
102896
102896
  customHeaders: this.getCustomHeaders(),
102897
102897
  cacheProvider: normalizedOptions.flagDefinitionCacheProvider,
@@ -103086,10 +103086,10 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
103086
103086
  cleanup();
103087
103087
  resolve8(false);
103088
103088
  }, timeoutMs);
103089
- const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
103089
+ const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
103090
103090
  clearTimeout(timeout);
103091
103091
  cleanup();
103092
- resolve8(count > 0);
103092
+ resolve8(count2 > 0);
103093
103093
  });
103094
103094
  });
103095
103095
  }
@@ -110842,19 +110842,19 @@ var Announce = class _Announce {
110842
110842
  case Version2.DRAFT_02:
110843
110843
  break;
110844
110844
  case Version2.DRAFT_03: {
110845
- const count = await r.u53();
110846
- if (count > MAX_HOPS)
110847
- throw new Error(`hop count ${count} exceeds maximum ${MAX_HOPS}`);
110845
+ const count2 = await r.u53();
110846
+ if (count2 > MAX_HOPS)
110847
+ throw new Error(`hop count ${count2} exceeds maximum ${MAX_HOPS}`);
110848
110848
  const placeholder = OriginSchema.parse(0n);
110849
- hops = new Array(count).fill(placeholder);
110849
+ hops = new Array(count2).fill(placeholder);
110850
110850
  break;
110851
110851
  }
110852
110852
  default: {
110853
- const count = await r.u53();
110854
- if (count > MAX_HOPS)
110855
- throw new Error(`hop count ${count} exceeds maximum ${MAX_HOPS}`);
110853
+ const count2 = await r.u53();
110854
+ if (count2 > MAX_HOPS)
110855
+ throw new Error(`hop count ${count2} exceeds maximum ${MAX_HOPS}`);
110856
110856
  hops = [];
110857
- for (let i = 0; i < count; i++) {
110857
+ for (let i = 0; i < count2; i++) {
110858
110858
  hops.push(OriginSchema.parse(await r.u62()));
110859
110859
  }
110860
110860
  break;
@@ -110935,9 +110935,9 @@ var AnnounceInit = class _AnnounceInit {
110935
110935
  }
110936
110936
  }
110937
110937
  static async #decode(r) {
110938
- const count = await r.u53();
110938
+ const count2 = await r.u53();
110939
110939
  const suffixes = [];
110940
- for (let i = 0; i < count; i++) {
110940
+ for (let i = 0; i < count2; i++) {
110941
110941
  suffixes.push(from(await r.string()));
110942
110942
  }
110943
110943
  return new _AnnounceInit(suffixes);
@@ -122232,8 +122232,8 @@ var nativeFindViewsTool = {
122232
122232
  interaction: {
122233
122233
  startedMsg: ({ params }) => `Searching native views in ${params.bundleId}`,
122234
122234
  completedMsg: ({ params, result }) => {
122235
- const count = result.status === "ok" ? result.matches.length : 0;
122236
- return `Found ${count} native ${count === 1 ? "view" : "views"} in ${params.bundleId}`;
122235
+ const count2 = result.status === "ok" ? result.matches.length : 0;
122236
+ return `Found ${count2} native ${count2 === 1 ? "view" : "views"} in ${params.bundleId}`;
122237
122237
  },
122238
122238
  failedMsg: ({ params, failureSignal: failureSignal2 }) => `Failed to search native views in ${params.bundleId}: ${failureSignal2.error_code}`
122239
122239
  },
@@ -126858,8 +126858,8 @@ var zodSchema16 = external_exports.object({
126858
126858
  )
126859
126859
  });
126860
126860
  function tapDescription(params, tense) {
126861
- const count = params.clickCount ?? 1;
126862
- const action = count === 1 ? tense === "present" ? "Tapping" : "Tapped" : count === 2 ? tense === "present" ? "Double-tapping" : "Double-tapped" : `${tense === "present" ? "Tapping" : "Tapped"} ${count} times`;
126861
+ const count2 = params.clickCount ?? 1;
126862
+ const action = count2 === 1 ? tense === "present" ? "Tapping" : "Tapped" : count2 === 2 ? tense === "present" ? "Double-tapping" : "Double-tapped" : `${tense === "present" ? "Tapping" : "Tapped"} ${count2} times`;
126863
126863
  return `${action} at (${Math.round(params.x * 100)}%, ${Math.round(params.y * 100)}%)`;
126864
126864
  }
126865
126865
  var capability8 = {
@@ -129235,9 +129235,9 @@ function validateAmpersand(xmlData, i) {
129235
129235
  i++;
129236
129236
  return validateNumberAmpersand(xmlData, i);
129237
129237
  }
129238
- let count = 0;
129239
- for (; i < xmlData.length; i++, count++) {
129240
- if (xmlData[i].match(/\w/) && count < 20)
129238
+ let count2 = 0;
129239
+ for (; i < xmlData.length; i++, count2++) {
129240
+ if (xmlData[i].match(/\w/) && count2 < 20)
129241
129241
  continue;
129242
129242
  if (xmlData[i] === ";")
129243
129243
  break;
@@ -132122,8 +132122,8 @@ var Matcher = class {
132122
132122
  const siblingKey = namespace ? `${namespace}:${tagName}` : tagName;
132123
132123
  const counter = siblings.get(siblingKey) || 0;
132124
132124
  let position = 0;
132125
- for (const count of siblings.values()) {
132126
- position += count;
132125
+ for (const count2 of siblings.values()) {
132126
+ position += count2;
132127
132127
  }
132128
132128
  siblings.set(siblingKey, counter + 1);
132129
132129
  const node = {
@@ -134341,16 +134341,16 @@ function fullConsumptionRegex(selector) {
134341
134341
  return selector.textMatches === void 0 ? void 0 : uiTreeMatchInternals.createRegExp(`^(?:${selector.textMatches})$`);
134342
134342
  }
134343
134343
  function exactFieldCount(node, selector, fullTextRegex) {
134344
- let count = 0;
134344
+ let count2 = 0;
134345
134345
  if (selector.text !== void 0 && (equalsCI(node.label, selector.text) || equalsCI(node.value, selector.text))) {
134346
- count++;
134346
+ count2++;
134347
134347
  }
134348
134348
  if (fullTextRegex !== void 0 && (regexMatchesNonEmpty(fullTextRegex, node.label) || regexMatchesNonEmpty(fullTextRegex, node.value))) {
134349
- count++;
134349
+ count2++;
134350
134350
  }
134351
- if (selector.identifier !== void 0 && equalsCI(node.identifier, selector.identifier)) count++;
134352
- if (selector.role !== void 0 && equalsCI(node.role, selector.role)) count++;
134353
- return count;
134351
+ if (selector.identifier !== void 0 && equalsCI(node.identifier, selector.identifier)) count2++;
134352
+ if (selector.role !== void 0 && equalsCI(node.role, selector.role)) count2++;
134353
+ return count2;
134354
134354
  }
134355
134355
  function selectorToFrame(root2, selector) {
134356
134356
  const visible = findAll(root2, selector).filter(isVisible);
@@ -135718,13 +135718,13 @@ function buildTextTree(data, opts) {
135718
135718
  }
135719
135719
  if (data.skippedCounts && Object.keys(data.skippedCounts).length > 0) {
135720
135720
  const jsTotal = Object.values(data.skippedCounts).reduce((a, b) => a + b, 0);
135721
- const top = Object.entries(data.skippedCounts).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([name, count]) => `${name}: ${count}`).join(", ");
135721
+ const top = Object.entries(data.skippedCounts).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([name, count2]) => `${name}: ${count2}`).join(", ");
135722
135722
  lines.push(`JS-side skipped: ${jsTotal} (${top})`);
135723
135723
  }
135724
135724
  if (tsTotal > 0) {
135725
135725
  lines.push(`TS-side removed: ${tsTotal}`);
135726
135726
  if (filterStats.sameNameDedup.count > 0) {
135727
- const detail = Array.from(filterStats.sameNameDedup.names.entries()).map(([name, count]) => `${name} x${count}`).join(", ");
135727
+ const detail = Array.from(filterStats.sameNameDedup.names.entries()).map(([name, count2]) => `${name} x${count2}`).join(", ");
135728
135728
  lines.push(` Same-name dedup: ${filterStats.sameNameDedup.count} (${detail})`);
135729
135729
  }
135730
135730
  if (filterStats.offScreen.count > 0) {
@@ -137784,8 +137784,8 @@ Fails if no active profiling session exists or the CDP connection was lost durin
137784
137784
  if (unattributedByCommit.length > 0) {
137785
137785
  let totalMs = 0;
137786
137786
  let totalFibers = 0;
137787
- for (const [, count, ms] of unattributedByCommit) {
137788
- totalFibers += count;
137787
+ for (const [, count2, ms] of unattributedByCommit) {
137788
+ totalFibers += count2;
137789
137789
  totalMs += ms;
137790
137790
  }
137791
137791
  response["unattributed_ms"] = Math.round(totalMs * 100) / 100;
@@ -138094,8 +138094,8 @@ function buildHotCommitSummaries(commits, hotCommitIndices, unattributedByCommit
138094
138094
  const hotSet = new Set(hotCommitIndices);
138095
138095
  const unattributedMap = /* @__PURE__ */ new Map();
138096
138096
  if (unattributedByCommit) {
138097
- for (const [commitIndex, count, ms] of unattributedByCommit) {
138098
- unattributedMap.set(commitIndex, { count, ms });
138097
+ for (const [commitIndex, count2, ms] of unattributedByCommit) {
138098
+ unattributedMap.set(commitIndex, { count: count2, ms });
138099
138099
  }
138100
138100
  }
138101
138101
  const byCommit = /* @__PURE__ */ new Map();
@@ -138139,7 +138139,7 @@ function buildHotCommitSummaries(commits, hotCommitIndices, unattributedByCommit
138139
138139
  }
138140
138140
  }
138141
138141
  const totalComponentCount = componentMap.size;
138142
- const componentEntries = Array.from(componentMap.entries()).sort((a, b) => b[1].totalSelf - a[1].totalSelf).slice(0, MAX_COMPONENT_ENTRIES).map(([name, { totalSelf, totalActual, count, firstEntry, isFirstMount }]) => {
138142
+ const componentEntries = Array.from(componentMap.entries()).sort((a, b) => b[1].totalSelf - a[1].totalSelf).slice(0, MAX_COMPONENT_ENTRIES).map(([name, { totalSelf, totalActual, count: count2, firstEntry, isFirstMount }]) => {
138143
138143
  const cd = firstEntry.changeDescription;
138144
138144
  const reason = !isFirstMount && cd ? deriveReason(cd, firstEntry.hookTypes) : void 0;
138145
138145
  let topChangedHookNames;
@@ -138159,7 +138159,7 @@ function buildHotCommitSummaries(commits, hotCommitIndices, unattributedByCommit
138159
138159
  name,
138160
138160
  selfDurationMs: Math.round(totalSelf * 100) / 100,
138161
138161
  actualDurationMs: Math.round(totalActual * 100) / 100,
138162
- count,
138162
+ count: count2,
138163
138163
  ...isFirstMount && { isFirstMount: true },
138164
138164
  ...reason !== void 0 && { reason },
138165
138165
  ...!isFirstMount && cd?.props && cd.props.length > 0 && { topChangedProps: cd.props.slice(0, 3) },
@@ -138471,9 +138471,9 @@ function topN(freq, n) {
138471
138471
  function dominantReason(histogram) {
138472
138472
  let best = "unknown";
138473
138473
  let bestCount = -1;
138474
- for (const [reason, count] of Object.entries(histogram)) {
138475
- if (count > bestCount) {
138476
- bestCount = count;
138474
+ for (const [reason, count2] of Object.entries(histogram)) {
138475
+ if (count2 > bestCount) {
138476
+ bestCount = count2;
138477
138477
  best = reason;
138478
138478
  }
138479
138479
  }
@@ -138482,9 +138482,9 @@ function dominantReason(histogram) {
138482
138482
  function topParent(parentFreq) {
138483
138483
  let best;
138484
138484
  let bestCount = -1;
138485
- for (const [name, count] of parentFreq) {
138486
- if (count > bestCount) {
138487
- bestCount = count;
138485
+ for (const [name, count2] of parentFreq) {
138486
+ if (count2 > bestCount) {
138487
+ bestCount = count2;
138488
138488
  best = name;
138489
138489
  }
138490
138490
  }
@@ -140716,13 +140716,13 @@ function parseLeaksXml(xml) {
140716
140716
  const responsibleFrame = attr(rm6[0], "responsible-frame") ?? "Unknown";
140717
140717
  const responsibleLibrary = attr(rm6[0], "responsible-library") ?? "";
140718
140718
  const countStr = attr(rm6[0], "count");
140719
- const count = countStr ? parseInt(countStr, 10) : 1;
140719
+ const count2 = countStr ? parseInt(countStr, 10) : 1;
140720
140720
  leaks.push({
140721
140721
  objectType,
140722
140722
  sizeBytes,
140723
140723
  responsibleFrame,
140724
140724
  responsibleLibrary,
140725
- count
140725
+ count: count2
140726
140726
  });
140727
140727
  }
140728
140728
  return leaks;
@@ -140779,19 +140779,19 @@ function aggregateCpuHotspots(rows, options) {
140779
140779
  existing.sampleCount += row.timestampsNs.length;
140780
140780
  existing.timestamps.push(...row.timestampsNs);
140781
140781
  }
140782
- for (const { chain, count } of row.callChains) {
140782
+ for (const { chain, count: count2 } of row.callChains) {
140783
140783
  const chainKey = chain.join(" > ");
140784
140784
  const cc = existing.chainCounts.get(chainKey);
140785
140785
  if (cc) {
140786
- cc.count += count;
140786
+ cc.count += count2;
140787
140787
  } else {
140788
- existing.chainCounts.set(chainKey, { chain, count });
140788
+ existing.chainCounts.set(chainKey, { chain, count: count2 });
140789
140789
  }
140790
140790
  }
140791
140791
  } else {
140792
140792
  const chainCounts = /* @__PURE__ */ new Map();
140793
- for (const { chain, count } of row.callChains) {
140794
- chainCounts.set(chain.join(" > "), { chain, count });
140793
+ for (const { chain, count: count2 } of row.callChains) {
140794
+ chainCounts.set(chain.join(" > "), { chain, count: count2 });
140795
140795
  }
140796
140796
  groups.set(key, {
140797
140797
  sampleCount: isPre ? row.sampleCount ?? 0 : row.timestampsNs.length,
@@ -140816,7 +140816,7 @@ function aggregateCpuHotspots(rows, options) {
140816
140816
  const [dominantFunction] = key.split("|||");
140817
140817
  const sortedChains = [...acc.chainCounts.values()].sort((a, b) => b.count - a.count).slice(0, 3);
140818
140818
  const topCallChain = sortedChains[0]?.chain ?? [];
140819
- const topCallChains = sortedChains.map(({ chain, count }) => ({ chain, count }));
140819
+ const topCallChains = sortedChains.map(({ chain, count: count2 }) => ({ chain, count: count2 }));
140820
140820
  const duringHang = hangSampleTimestamps.size > 0 && acc.timestamps.some((ts) => hangSampleTimestamps.has(ts));
140821
140821
  let firstMs;
140822
140822
  let lastMs;
@@ -140969,7 +140969,7 @@ function correlateHangsWithCpu(hangs, cpuSamples) {
140969
140969
  }
140970
140970
  }
140971
140971
  const suspectedFunctions = [...funcCounts.entries()].sort((a, b) => b[1] - a[1]).slice(0, TOP_N_FUNCTIONS).map(([fn]) => fn);
140972
- const appCallChains = [...chainCounts.values()].sort((a, b) => b.count - a.count).slice(0, TOP_N_CHAINS).map(({ chain, count }) => ({ chain, sampleCount: count }));
140972
+ const appCallChains = [...chainCounts.values()].sort((a, b) => b.count - a.count).slice(0, TOP_N_CHAINS).map(({ chain, count: count2 }) => ({ chain, sampleCount: count2 }));
140973
140973
  const durationMs = Math.round(hang.durationNs / 1e6);
140974
140974
  const severity = classifyHangSeverity(hang.hangType);
140975
140975
  const totalMs = Math.round(hang.startNs / 1e6);
@@ -141503,8 +141503,8 @@ function renderFullReport(payload, exportErrors, cap = { hotspotLimit: Infinity,
141503
141503
  lines.push(``);
141504
141504
  if (b.topCallChains && b.topCallChains.length > 0) {
141505
141505
  lines.push(`**Call chains:**`);
141506
- for (const { chain, count } of b.topCallChains) {
141507
- lines.push(`- (${count}\xD7) \`${chain.map(demangleSymbol).join(" > ")}\``);
141506
+ for (const { chain, count: count2 } of b.topCallChains) {
141507
+ lines.push(`- (${count2}\xD7) \`${chain.map(demangleSymbol).join(" > ")}\``);
141508
141508
  }
141509
141509
  lines.push(``);
141510
141510
  } else if (b.topCallChain.length > 0) {
@@ -143158,9 +143158,9 @@ async function renderHangStacksAndroid(opts, target) {
143158
143158
  if (uniqueStacks.size > 0) {
143159
143159
  lines.push("### Main-thread Samples During Hang", "");
143160
143160
  const sorted = [...uniqueStacks.values()].sort((a, b) => b.count - a.count).slice(0, opts.topN);
143161
- for (const { stack, count } of sorted) {
143161
+ for (const { stack, count: count2 } of sorted) {
143162
143162
  lines.push("```");
143163
- lines.push(`(${count}\xD7)`);
143163
+ lines.push(`(${count2}\xD7)`);
143164
143164
  lines.push(stack);
143165
143165
  lines.push("```");
143166
143166
  }
@@ -145416,10 +145416,10 @@ function renderCascadeTree(commits, commitIndex) {
145416
145416
  rendered.add(`${name}:${depth}`);
145417
145417
  const instances = matching.filter((c) => c.componentName === name);
145418
145418
  const totalSelf = instances.reduce((s, c) => s + c.selfDuration, 0);
145419
- const count = instances.length;
145419
+ const count2 = instances.length;
145420
145420
  const reason = instances[0] ? formatReason2(instances[0]) : "";
145421
145421
  const indent = " ".repeat(depth);
145422
- const countStr = count > 1 ? ` \xD7${count}` : "";
145422
+ const countStr = count2 > 1 ? ` \xD7${count2}` : "";
145423
145423
  lines.push(`${indent}- \`${name}\`${countStr} self=${totalSelf.toFixed(1)}ms \u2014 ${reason}`);
145424
145424
  const childCommits = children.get(name) ?? [];
145425
145425
  const childNames = new Set(childCommits.map((c) => c.componentName));
@@ -145444,9 +145444,9 @@ function getTopComponents(entries, topN2) {
145444
145444
  byName.set(e.componentName, { count: 1, totalDuration: e.actualDuration, first: e });
145445
145445
  }
145446
145446
  }
145447
- return [...byName.entries()].sort((a, b) => b[1].totalDuration - a[1].totalDuration).slice(0, topN2).map(([name, { count, totalDuration, first }]) => ({
145447
+ return [...byName.entries()].sort((a, b) => b[1].totalDuration - a[1].totalDuration).slice(0, topN2).map(([name, { count: count2, totalDuration, first }]) => ({
145448
145448
  name,
145449
- count,
145449
+ count: count2,
145450
145450
  totalDuration,
145451
145451
  reason: formatReason2(first)
145452
145452
  }));
@@ -145620,8 +145620,8 @@ function renderHangStacksIos(cpuSamples, uiHangs, hangIndex, topN2) {
145620
145620
  }
145621
145621
  }
145622
145622
  const sorted = [...uniqueStacks.values()].sort((a, b) => b.count - a.count).slice(0, topN2);
145623
- for (const { stack, count } of sorted) {
145624
- lines.push(`- (${count}\xD7) ${stack.map((f) => `\`${demangleSymbol(f)}\``).join(" \u2192 ")}`);
145623
+ for (const { stack, count: count2 } of sorted) {
145624
+ lines.push(`- (${count2}\xD7) ${stack.map((f) => `\`${demangleSymbol(f)}\``).join(" \u2192 ")}`);
145625
145625
  }
145626
145626
  }
145627
145627
  return lines.join("\n");
@@ -145661,8 +145661,8 @@ function renderFunctionCallersIos(cpuSamples, functionName, topN2) {
145661
145661
  lines.push("");
145662
145662
  lines.push("| Function | Samples |");
145663
145663
  lines.push("|---|---|");
145664
- for (const [name, count] of sortedCallers) {
145665
- lines.push(`| \`${escapeMarkdownTableCell(demangleSymbol(name))}\` | ${count} |`);
145664
+ for (const [name, count2] of sortedCallers) {
145665
+ lines.push(`| \`${escapeMarkdownTableCell(demangleSymbol(name))}\` | ${count2} |`);
145666
145666
  }
145667
145667
  lines.push("");
145668
145668
  }
@@ -145672,8 +145672,8 @@ function renderFunctionCallersIos(cpuSamples, functionName, topN2) {
145672
145672
  lines.push("");
145673
145673
  lines.push("| Function | Samples |");
145674
145674
  lines.push("|---|---|");
145675
- for (const [name, count] of sortedCallees) {
145676
- lines.push(`| \`${escapeMarkdownTableCell(demangleSymbol(name))}\` | ${count} |`);
145675
+ for (const [name, count2] of sortedCallees) {
145676
+ lines.push(`| \`${escapeMarkdownTableCell(demangleSymbol(name))}\` | ${count2} |`);
145677
145677
  }
145678
145678
  lines.push("");
145679
145679
  }
@@ -148170,6 +148170,7 @@ var path31 = __toESM(require("node:path"));
148170
148170
  // ../tool-server/src/tools/flows/flow-device.ts
148171
148171
  init_src();
148172
148172
  var DEVICE_BIND_KEYS = ["udid", "device_id"];
148173
+ var DEVICE_ARG_KEYS = [...DEVICE_BIND_KEYS, "device"];
148173
148174
  function deviceEntryId(d) {
148174
148175
  if (d.platform === "ios") return d.udid;
148175
148176
  if (d.platform === "chromium") return d.id;
@@ -148225,6 +148226,43 @@ function stripDeviceKeys(args) {
148225
148226
  for (const k of DEVICE_BIND_KEYS) delete out[k];
148226
148227
  return out;
148227
148228
  }
148229
+ function stepRequiresDevice(registry2, step) {
148230
+ switch (step.kind) {
148231
+ case "echo":
148232
+ case "wait":
148233
+ return false;
148234
+ case "tool":
148235
+ return toolRequiresDevice(registry2, step.name);
148236
+ case "when":
148237
+ case "run":
148238
+ case "launch":
148239
+ case "tap":
148240
+ case "long-press":
148241
+ case "type":
148242
+ case "await":
148243
+ case "assert":
148244
+ case "scroll-to":
148245
+ case "pinch":
148246
+ case "rotate":
148247
+ case "snapshot":
148248
+ return true;
148249
+ default: {
148250
+ const unclassified = step;
148251
+ void unclassified;
148252
+ return true;
148253
+ }
148254
+ }
148255
+ }
148256
+ function flowRequiresDevice(registry2, steps) {
148257
+ return steps.some((step) => stepRequiresDevice(registry2, step));
148258
+ }
148259
+ function toolRequiresDevice(registry2, toolName) {
148260
+ const toolDef = registry2.getTool(toolName);
148261
+ if (!toolDef) return true;
148262
+ const props = toolDef.inputSchema?.properties;
148263
+ if (!props) return false;
148264
+ return DEVICE_ARG_KEYS.some((k) => k in props);
148265
+ }
148228
148266
  function bindDeviceArgs(registry2, toolName, deviceId, args) {
148229
148267
  const toolDef = registry2.getTool(toolName);
148230
148268
  const props = toolDef?.inputSchema?.properties;
@@ -148886,8 +148924,8 @@ You can still edit the .yaml file directly afterwards to remove or reorder steps
148886
148924
  step.condition.expectedText,
148887
148925
  step.condition.textMatch
148888
148926
  ) : `${step.condition.condition} ${selectorLabel(step.condition.selector)}`;
148889
- const count = step.steps.length;
148890
- return `${n}. when: ${cond} (${count} step${count === 1 ? "" : "s"})`;
148927
+ const count2 = step.steps.length;
148928
+ return `${n}. when: ${cond} (${count2} step${count2 === 1 ? "" : "s"})`;
148891
148929
  }
148892
148930
  case "scroll-to":
148893
148931
  return `${n}. scroll-to: ${selectorLabel(step.target)} (${step.direction})`;
@@ -148921,6 +148959,74 @@ var fs48 = __toESM(require("node:fs/promises"));
148921
148959
  var path34 = __toESM(require("node:path"));
148922
148960
  init_src();
148923
148961
 
148962
+ // ../tool-server/src/tools/flows/flow-nested-outcome.ts
148963
+ var FLOW_EXECUTE_TOOL_ID = "flow-execute";
148964
+ var RUN_SEQUENCE_TOOL_ID = "run-sequence";
148965
+ function isRecord(value) {
148966
+ return typeof value === "object" && value !== null;
148967
+ }
148968
+ function firstFailingStep(steps) {
148969
+ if (!Array.isArray(steps)) return void 0;
148970
+ for (const entry of steps) {
148971
+ if (!isRecord(entry)) continue;
148972
+ if (entry.status !== "fail" && entry.status !== "error") continue;
148973
+ const what = typeof entry.tool === "string" ? entry.tool : typeof entry.kind === "string" ? entry.kind : "step";
148974
+ const why = typeof entry.reason === "string" ? entry.reason : "no reason given";
148975
+ return `${what}: ${why}`;
148976
+ }
148977
+ return void 0;
148978
+ }
148979
+ function count(value) {
148980
+ return typeof value === "number" ? value : 0;
148981
+ }
148982
+ function flowExecuteOutcome(result) {
148983
+ const flow = typeof result.flow === "string" ? result.flow : "the composed flow";
148984
+ if (!("steps" in result) && typeof result.notice === "string") {
148985
+ const prerequisite = typeof result.executionPrerequisite === "string" && result.executionPrerequisite ? `: ${result.executionPrerequisite}` : "";
148986
+ return {
148987
+ status: "error",
148988
+ reason: `flow "${flow}" did not run \u2014 its execution prerequisite was not acknowledged${prerequisite}. Add prerequisiteAcknowledged: true to the step's args, or compose with run: instead.`
148989
+ };
148990
+ }
148991
+ if (result.aborted === true) {
148992
+ return { status: "skip", reason: `flow "${flow}" was aborted` };
148993
+ }
148994
+ if (result.ok === false) {
148995
+ const detail = firstFailingStep(result.steps);
148996
+ return {
148997
+ status: "fail",
148998
+ reason: `flow "${flow}" failed: ${count(result.passed)} passed, ${count(result.failed)} failed, ${count(result.errored)} errored${detail ? ` (${detail})` : ""}`
148999
+ };
149000
+ }
149001
+ return void 0;
149002
+ }
149003
+ function runSequenceOutcome(result) {
149004
+ const steps = result.steps;
149005
+ if (!Array.isArray(steps)) return void 0;
149006
+ const failed = steps.find((s) => isRecord(s) && typeof s.error === "string");
149007
+ if (failed && isRecord(failed)) {
149008
+ const tool = typeof failed.tool === "string" ? failed.tool : "step";
149009
+ return {
149010
+ status: "fail",
149011
+ reason: `run-sequence stopped at ${tool} after ${count(result.completed)} of ${count(result.total)} steps: ${String(failed.error)}`
149012
+ };
149013
+ }
149014
+ const total = count(result.total);
149015
+ if (total > 0 && steps.length < total) {
149016
+ return {
149017
+ status: "skip",
149018
+ reason: `run-sequence was aborted after ${count(result.completed)} of ${total} steps`
149019
+ };
149020
+ }
149021
+ return void 0;
149022
+ }
149023
+ function nestedOrchestratorOutcome(tool, result) {
149024
+ if (!isRecord(result)) return void 0;
149025
+ if (tool === FLOW_EXECUTE_TOOL_ID) return flowExecuteOutcome(result);
149026
+ if (tool === RUN_SEQUENCE_TOOL_ID) return runSequenceOutcome(result);
149027
+ return void 0;
149028
+ }
149029
+
148924
149030
  // ../tool-server/src/tools/flows/flow-actions.ts
148925
149031
  var ABORTED_OUTCOME = {
148926
149032
  ok: false,
@@ -150089,7 +150195,7 @@ function bilinearSampleColor(colors, width, height, x, y, channel) {
150089
150195
  }
150090
150196
  function averageStrokeWidth(mask, width, height) {
150091
150197
  let total = 0;
150092
- let count = 0;
150198
+ let count2 = 0;
150093
150199
  for (let y = 0; y < height; y++) {
150094
150200
  for (let x = 0; x < width; x++) {
150095
150201
  const index = y * width + x;
@@ -150098,27 +150204,27 @@ function averageStrokeWidth(mask, width, height) {
150098
150204
  runLength(mask, width, height, x, y, 1, 0),
150099
150205
  runLength(mask, width, height, x, y, 0, 1)
150100
150206
  );
150101
- count++;
150207
+ count2++;
150102
150208
  }
150103
150209
  }
150104
- return count === 0 ? 0 : total / count;
150210
+ return count2 === 0 ? 0 : total / count2;
150105
150211
  }
150106
150212
  function averageInkColor(crop) {
150107
150213
  const sum = { r: 0, g: 0, b: 0 };
150108
- let count = 0;
150214
+ let count2 = 0;
150109
150215
  for (let index = 0; index < crop.mask.length; index++) {
150110
150216
  if (!crop.mask[index]) continue;
150111
150217
  const colorOffset = index * 3;
150112
150218
  sum.r += crop.colors[colorOffset];
150113
150219
  sum.g += crop.colors[colorOffset + 1];
150114
150220
  sum.b += crop.colors[colorOffset + 2];
150115
- count++;
150221
+ count2++;
150116
150222
  }
150117
- if (count === 0) return { r: 0, g: 0, b: 0 };
150223
+ if (count2 === 0) return { r: 0, g: 0, b: 0 };
150118
150224
  return {
150119
- r: Math.round(sum.r / count),
150120
- g: Math.round(sum.g / count),
150121
- b: Math.round(sum.b / count)
150225
+ r: Math.round(sum.r / count2),
150226
+ g: Math.round(sum.g / count2),
150227
+ b: Math.round(sum.b / count2)
150122
150228
  };
150123
150229
  }
150124
150230
  function textContrast(crop) {
@@ -150165,7 +150271,7 @@ function connectedComponentStats(mask, width, height) {
150165
150271
  const visited = new Uint8Array(mask.length);
150166
150272
  const queue = new Int32Array(mask.length);
150167
150273
  const minComponentArea = Math.max(2, Math.floor(mask.length * 5e-4));
150168
- let count = 0;
150274
+ let count2 = 0;
150169
150275
  let totalArea = 0;
150170
150276
  for (let start2 = 0; start2 < mask.length; start2++) {
150171
150277
  if (!mask[start2] || visited[start2]) continue;
@@ -150199,11 +150305,11 @@ function connectedComponentStats(mask, width, height) {
150199
150305
  }
150200
150306
  }
150201
150307
  if (area >= minComponentArea) {
150202
- count++;
150308
+ count2++;
150203
150309
  totalArea += area;
150204
150310
  }
150205
150311
  }
150206
- return { count, averageArea: count === 0 ? 0 : totalArea / count };
150312
+ return { count: count2, averageArea: count2 === 0 ? 0 : totalArea / count2 };
150207
150313
  }
150208
150314
  function maskBounds(mask, width, height) {
150209
150315
  let minX = Number.POSITIVE_INFINITY;
@@ -150242,9 +150348,9 @@ function normalizeWordForAspect(text) {
150242
150348
  return text.trim().normalize("NFKC").toLowerCase();
150243
150349
  }
150244
150350
  function countMask(mask) {
150245
- let count = 0;
150246
- for (const value of mask) count += value;
150247
- return count;
150351
+ let count2 = 0;
150352
+ for (const value of mask) count2 += value;
150353
+ return count2;
150248
150354
  }
150249
150355
  function relativeDelta(left, right) {
150250
150356
  const denominator = Math.max(Math.abs(left), Math.abs(right), 1);
@@ -151834,7 +151940,8 @@ async function treeSourceGate(registry2, device, bundleId, signal) {
151834
151940
  return null;
151835
151941
  }
151836
151942
  async function runLaunch(state3, app) {
151837
- const { registry: registry2, device, signal } = state3;
151943
+ const env = deviceEnv(state3);
151944
+ const { registry: registry2, device, signal } = env;
151838
151945
  if (device.platform === "chromium") {
151839
151946
  if (state3.chromiumLaunched) {
151840
151947
  return {
@@ -151871,7 +151978,7 @@ async function runLaunch(state3, app) {
151871
151978
  };
151872
151979
  }
151873
151980
  try {
151874
- await invokeOnDevice(state3, "restart-app", { bundleId });
151981
+ await invokeOnDevice(env, "restart-app", { bundleId });
151875
151982
  } catch (err) {
151876
151983
  if (signal?.aborted) return ABORTED_OUTCOME;
151877
151984
  return { ok: false, reason: `restart-app failed: ${errMsg2(err)}` };
@@ -151882,6 +151989,12 @@ async function runLaunch(state3, app) {
151882
151989
  if (gate) return { ok: false, reason: gate };
151883
151990
  return { ok: true };
151884
151991
  }
151992
+ function deviceEnv(state3) {
151993
+ if (!state3.device) {
151994
+ throw new Error("internal: a step that acts on a device ran in a flow resolved as device-free");
151995
+ }
151996
+ return { ...state3, device: state3.device };
151997
+ }
151885
151998
  function createRunFlowTool(registry2) {
151886
151999
  return {
151887
152000
  id: "flow-execute",
@@ -151940,11 +152053,13 @@ returns a notice with the prerequisite instead of running.`,
151940
152053
  }
151941
152054
  const resolved = await resolveRunDevice(registry2, ctx, flow, params, flowsDir);
151942
152055
  const device = resolved.device;
151943
- const env = { registry: registry2, ctx, device, signal };
151944
- const statusBarPinned = await pinStatusBar(device);
151945
- if (device.platform === "chromium") await frontChromiumPage(registry2, device);
152056
+ const statusBarPinned = device !== null && await pinStatusBar(device);
152057
+ if (device?.platform === "chromium") await frontChromiumPage(registry2, device);
151946
152058
  const state3 = {
151947
- ...env,
152059
+ registry: registry2,
152060
+ ctx,
152061
+ device,
152062
+ signal,
151948
152063
  flowsDir,
151949
152064
  topFlowName: params.name,
151950
152065
  updateBaselines: Boolean(params.updateBaselines),
@@ -151964,10 +152079,16 @@ returns a notice with the prerequisite instead of running.`,
151964
152079
  });
151965
152080
  } finally {
151966
152081
  aborted2 = state3.signal?.aborted === true;
151967
- if (state3.pinned) await restoreStatusBar(device);
152082
+ if (state3.pinned && device) await restoreStatusBar(device);
151968
152083
  if (resolved.booted) await teardownBootedChromium(registry2, resolved.booted);
151969
152084
  }
151970
- return summarize(params.name, device.id, flow.executionPrerequisite, state3.reports, aborted2);
152085
+ return summarize(
152086
+ params.name,
152087
+ device?.id ?? "",
152088
+ flow.executionPrerequisite,
152089
+ state3.reports,
152090
+ aborted2
152091
+ );
151971
152092
  }
151972
152093
  };
151973
152094
  }
@@ -151978,6 +152099,9 @@ async function resolveRunDevice(registry2, ctx, flow, params, flowDir) {
151978
152099
  const booted = await bootChromiumForFlow(spec, flowDir);
151979
152100
  return { device: resolveDevice(booted.deviceId), booted };
151980
152101
  }
152102
+ if (!flowRequiresDevice(registry2, flow.steps)) {
152103
+ return { device: null, booted: null };
152104
+ }
151981
152105
  }
151982
152106
  const device = await resolveFlowDevice(registry2, ctx, {
151983
152107
  device: params.device,
@@ -152133,6 +152257,20 @@ async function execSteps(state3, steps, scope) {
152133
152257
  if (step.kind === "when") reportBlockSkipped(state3, step.steps, childScope(scope));
152134
152258
  continue;
152135
152259
  }
152260
+ if (!state3.device && stepRequiresDevice(state3.registry, step)) {
152261
+ state3.stopped = true;
152262
+ pushReport(state3, {
152263
+ index,
152264
+ kind: step.kind,
152265
+ status: "error",
152266
+ flow: scope.flow,
152267
+ target: stepTarget(step),
152268
+ ...depthOf(scope),
152269
+ reason: `step needs a device but the flow was resolved as device-free \u2014 pass an explicit device`
152270
+ });
152271
+ if (step.kind === "when") reportBlockSkipped(state3, step.steps, childScope(scope));
152272
+ continue;
152273
+ }
152136
152274
  if (state3.signal?.aborted) {
152137
152275
  state3.stopped = true;
152138
152276
  pushReport(state3, {
@@ -152193,10 +152331,11 @@ async function execWhenStep(state3, step, scope) {
152193
152331
  const inner = childScope(scope);
152194
152332
  let met;
152195
152333
  if (step.condition.kind === "platform") {
152196
- const platform = state3.device.platform === "ios-remote" ? "ios" : state3.device.platform;
152334
+ const guardEnv = deviceEnv(state3);
152335
+ const platform = guardEnv.device.platform === "ios-remote" ? "ios" : guardEnv.device.platform;
152197
152336
  met = platform === step.condition.platform;
152198
152337
  } else {
152199
- const probe3 = await probeWhenCondition(state3, step.condition);
152338
+ const probe3 = await probeWhenCondition(deviceEnv(state3), step.condition);
152200
152339
  if (probe3.aborted) {
152201
152340
  pushReport(state3, { ...marker, status: "skip", reason: "run aborted" });
152202
152341
  reportBlockSkipped(state3, step.steps, inner, "run aborted");
@@ -152288,7 +152427,7 @@ async function execLeafStep(state3, step, index, scope) {
152288
152427
  case "pinch":
152289
152428
  case "rotate": {
152290
152429
  try {
152291
- const r = await runDirective(state3, step);
152430
+ const r = await runDirective(deviceEnv(state3), step);
152292
152431
  if (r.aborted) return { ...base, status: "skip", reason: r.reason };
152293
152432
  return { ...base, status: r.ok ? "pass" : "fail", reason: r.reason };
152294
152433
  } catch (err) {
@@ -152303,7 +152442,7 @@ async function execLeafStep(state3, step, index, scope) {
152303
152442
  }
152304
152443
  case "snapshot": {
152305
152444
  try {
152306
- const r = await runSnapshot(state3, {
152445
+ const r = await runSnapshot(deviceEnv(state3), {
152307
152446
  flowsDir: state3.flowsDir,
152308
152447
  flowName: state3.topFlowName,
152309
152448
  name: step.name,
@@ -152323,7 +152462,7 @@ async function execLeafStep(state3, step, index, scope) {
152323
152462
  }
152324
152463
  }
152325
152464
  case "tool": {
152326
- const args = bindDeviceArgs(registry2, step.name, device.id, step.args);
152465
+ const args = bindDeviceArgs(registry2, step.name, device?.id ?? "", step.args);
152327
152466
  const outputHint = registry2.getTool(step.name)?.outputHint;
152328
152467
  if (step.delayMs && !await sleepOrAbort(step.delayMs, signal)) {
152329
152468
  return { ...base, status: "skip", tool: step.name, reason: "run aborted during delay" };
@@ -152339,6 +152478,18 @@ async function execLeafStep(state3, step, index, scope) {
152339
152478
  reason: `await-ui-element condition not met${note ? `: ${note}` : ""}`
152340
152479
  };
152341
152480
  }
152481
+ const nested = nestedOrchestratorOutcome(step.name, result);
152482
+ if (nested) {
152483
+ return {
152484
+ ...base,
152485
+ status: nested.status,
152486
+ tool: step.name,
152487
+ reason: nested.reason,
152488
+ result,
152489
+ outputHint,
152490
+ args
152491
+ };
152492
+ }
152342
152493
  return { ...base, status: "pass", tool: step.name, result, outputHint, args };
152343
152494
  } catch (err) {
152344
152495
  return { ...base, status: "error", tool: step.name, reason: errMsg2(err) };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.18.1-next.15",
3
+ "version": "0.18.1-next.17",
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",