@swmansion/argent 0.35.1-next.10 → 0.35.1-next.11

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
@@ -38588,7 +38588,7 @@ function isCi(env = process.env) {
38588
38588
  var SESSION_ID2 = randomUUID5();
38589
38589
  function readCliVersion() {
38590
38590
  if (true) {
38591
- return "0.35.1-next.8";
38591
+ return "0.35.1-next.9";
38592
38592
  }
38593
38593
  return "0.0.0";
38594
38594
  }
@@ -17103,7 +17103,7 @@ function isCi(env = process.env) {
17103
17103
  var SESSION_ID = randomUUID4();
17104
17104
  function readCliVersion() {
17105
17105
  if (true) {
17106
- return "0.35.1-next.8";
17106
+ return "0.35.1-next.9";
17107
17107
  }
17108
17108
  return "0.0.0";
17109
17109
  }
@@ -38058,7 +38058,7 @@ async function startMcpServer(options) {
38058
38058
  const autoDescribeOn = autoDescribeEnabled();
38059
38059
  const whatsNewOn = whatsNewEnabled();
38060
38060
  const installedVersion = getInstalledVersion();
38061
- const highlightsVersion = true ? "0.35.1-next.8" : installedVersion;
38061
+ const highlightsVersion = true ? "0.35.1-next.9" : installedVersion;
38062
38062
  const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
38063
38063
  const trees = createTreeMemory();
38064
38064
  const screenshots = createScreenshotMemory();
@@ -247,6 +247,8 @@ export interface ArgentToolArgs {
247
247
  project_root: string;
248
248
  /** Text the echo step prints */
249
249
  message: string;
250
+ /** Save the message in the shutdown list. stepCount counts shutdown entries. */
251
+ shutdown?: boolean;
250
252
  };
251
253
  "e2e-add-script": {
252
254
  /** E2E test name passed to e2e-start-recording. */
@@ -261,6 +263,8 @@ export interface ArgentToolArgs {
261
263
  env?: {
262
264
  [key: string]: string;
263
265
  };
266
+ /** Save the script in the shutdown list. It still runs immediately. Its output reaches only later shutdown steps. stepCount counts shutdown entries. */
267
+ shutdown?: boolean;
264
268
  };
265
269
  "e2e-add-step": {
266
270
  /** Name of the e2e test being recorded: the one passed to e2e-start-recording. */
@@ -273,6 +277,8 @@ export interface ArgentToolArgs {
273
277
  args?: string;
274
278
  /** Milliseconds to sleep before executing this step during replay. */
275
279
  delayMs?: number;
280
+ /** Save the call in the shutdown list. The call still runs immediately. stepCount counts shutdown entries. */
281
+ shutdown?: boolean;
276
282
  };
277
283
  "e2e-execute": {
278
284
  /** Name of a saved e2e test to run from `<project_root>/.argent/e2e`, or `.argent/flows` when it is not there (e.g. "settings-explore"). */
@@ -63391,12 +63391,12 @@ async function hasDefaultBootSnapshot(avdName) {
63391
63391
  return false;
63392
63392
  }
63393
63393
  }
63394
- var import_node_child_process18, import_node_util13, import_node_os5, import_node_path10, import_ini, execFileAsync13, emulatorFlagSupportCache, ADB_KILL_SIGNAL, ADB_DEVICE_STATES, ADB_DEVICES_TIMEOUT_MS, ENRICH_TIMEOUT_MS, androidRuntimeKindCache, TERMINAL_ADB_ERROR_PATTERNS, AVD_NAME_PATTERN;
63394
+ var import_node_child_process18, import_node_util14, import_node_os5, import_node_path10, import_ini, execFileAsync13, emulatorFlagSupportCache, ADB_KILL_SIGNAL, ADB_DEVICE_STATES, ADB_DEVICES_TIMEOUT_MS, ENRICH_TIMEOUT_MS, androidRuntimeKindCache, TERMINAL_ADB_ERROR_PATTERNS, AVD_NAME_PATTERN;
63395
63395
  var init_adb = __esm({
63396
63396
  "../tool-server/src/utils/adb.ts"() {
63397
63397
  "use strict";
63398
63398
  import_node_child_process18 = require("node:child_process");
63399
- import_node_util13 = require("node:util");
63399
+ import_node_util14 = require("node:util");
63400
63400
  import_node_os5 = require("node:os");
63401
63401
  import_node_path10 = require("node:path");
63402
63402
  import_ini = __toESM(require_ini());
@@ -63404,7 +63404,7 @@ var init_adb = __esm({
63404
63404
  init_android_binary();
63405
63405
  init_subprocess_error();
63406
63406
  init_external_devices();
63407
- execFileAsync13 = (0, import_node_util13.promisify)(import_node_child_process18.execFile);
63407
+ execFileAsync13 = (0, import_node_util14.promisify)(import_node_child_process18.execFile);
63408
63408
  emulatorFlagSupportCache = /* @__PURE__ */ new Map();
63409
63409
  ADB_KILL_SIGNAL = "SIGKILL";
63410
63410
  ADB_DEVICE_STATES = /* @__PURE__ */ new Set([
@@ -72957,7 +72957,7 @@ function isCi(env = process.env) {
72957
72957
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
72958
72958
  function readCliVersion() {
72959
72959
  if (true) {
72960
- return "0.35.1-next.8";
72960
+ return "0.35.1-next.9";
72961
72961
  }
72962
72962
  return "0.0.0";
72963
72963
  }
@@ -75203,6 +75203,7 @@ function buildScreenRecordingNote(recordings2, nowMs) {
75203
75203
  var path14 = __toESM(require("node:path"));
75204
75204
  var fs14 = __toESM(require("node:fs/promises"));
75205
75205
  var import_node_fs7 = require("node:fs");
75206
+ var import_node_util6 = require("node:util");
75206
75207
  init_src();
75207
75208
  init_src2();
75208
75209
  var import_yaml = __toESM(require_dist8());
@@ -78520,9 +78521,11 @@ async function writeNewFlowFile(filePath, content) {
78520
78521
  }
78521
78522
  await writeFlowFile(filePath, content);
78522
78523
  }
78523
- async function countStepsOnDisk(filePath) {
78524
+ async function countStepsOnDisk(filePath, block = "steps") {
78524
78525
  try {
78525
- return parseFlow(await fs14.readFile(filePath, "utf8")).steps.length;
78526
+ const flow = parseFlow(await fs14.readFile(filePath, "utf8"));
78527
+ const shutdown2 = flow.shutdown?.length ?? 0;
78528
+ return block === "steps" ? flow.steps.length : block === "shutdown" ? shutdown2 : flow.steps.length + shutdown2;
78526
78529
  } catch {
78527
78530
  return void 0;
78528
78531
  }
@@ -78552,13 +78555,11 @@ async function setRecordingEnv(session, changes) {
78552
78555
  }
78553
78556
  session.lastTouchedSeq = touch();
78554
78557
  if (session.persist === "host") {
78555
- const before = session.flow.steps;
78556
78558
  const flow2 = apply(parseFlow(await fs14.readFile(session.filePath, "utf8")));
78557
78559
  validateFlow(flow2);
78558
78560
  const updated = serializeFlow(flow2);
78559
78561
  await writeFlowFile(session.filePath, updated);
78560
- session.flow = parseFlow(updated);
78561
- session.discardedWarnings = (session.discardedWarnings ?? 0) + dropMovedWarnings(session.stepWarnings, session.flow.steps, before);
78562
+ adoptRecordedFile(session, parseFlow(updated));
78562
78563
  return { env: session.flow.env ?? {}, savedTo: session.filePath };
78563
78564
  }
78564
78565
  const flow = apply(session.flow);
@@ -78568,10 +78569,10 @@ async function setRecordingEnv(session, changes) {
78568
78569
  return { env: flow.env ?? {}, savedTo };
78569
78570
  });
78570
78571
  }
78571
- async function appendStep(filePath, step) {
78572
+ async function appendStep(filePath, step, block) {
78572
78573
  const content = await fs14.readFile(filePath, "utf8");
78573
78574
  const flow = parseFlow(content);
78574
- flow.steps.push(step);
78575
+ (block === "shutdown" ? flow.shutdown ??= [] : flow.steps).push(step);
78575
78576
  validateFlow(flow);
78576
78577
  const updated = serializeFlow(flow);
78577
78578
  await writeFlowFile(filePath, updated);
@@ -78645,31 +78646,73 @@ function dropMovedWarnings(warnings, now, before) {
78645
78646
  }
78646
78647
  return dropped;
78647
78648
  }
78648
- async function appendStepToFlow(session, step) {
78649
+ function adoptRecordedFile(session, flow, appended) {
78650
+ const before = session.flow;
78651
+ session.flow = flow;
78652
+ const { steps, shutdown: shutdown2 = [] } = flow;
78653
+ session.discardedWarnings = (session.discardedWarnings ?? 0) + dropMovedWarnings(
78654
+ session.stepWarnings,
78655
+ appended === "steps" ? steps.slice(0, -1) : steps,
78656
+ before.steps
78657
+ ) + dropMovedWarnings(
78658
+ session.shutdownStepWarnings,
78659
+ appended === "shutdown" ? shutdown2.slice(0, -1) : shutdown2,
78660
+ before.shutdown ?? []
78661
+ );
78662
+ }
78663
+ async function appendStepToFlow(session, step, block = "steps") {
78649
78664
  return withFlowLock(session.key, async () => {
78650
78665
  assertSessionStillLive(session, step);
78651
78666
  session.lastTouchedSeq = touch();
78652
78667
  if (session.persist === "host") {
78653
- const before = session.flow.steps;
78654
- const flowFile = await appendStep(session.filePath, step);
78655
- session.flow = parseFlow(flowFile);
78656
- session.discardedWarnings = (session.discardedWarnings ?? 0) + dropMovedWarnings(session.stepWarnings, session.flow.steps.slice(0, -1), before);
78657
- return { savedTo: session.filePath, stepCount: session.flow.steps.length };
78668
+ adoptRecordedFile(session, parseFlow(await appendStep(session.filePath, step, block)), block);
78669
+ return { savedTo: session.filePath, stepCount: recordedCount(session.flow, block) };
78658
78670
  }
78659
- session.flow.steps.push(step);
78671
+ const list = block === "shutdown" ? session.flow.shutdown ??= [] : session.flow.steps;
78672
+ list.push(step);
78660
78673
  try {
78661
78674
  validateFlow(session.flow);
78662
78675
  const flowFile = serializeFlow(session.flow);
78663
78676
  return {
78664
78677
  savedTo: clientFileDirective(session.filePath, flowFile),
78665
- stepCount: session.flow.steps.length
78678
+ stepCount: list.length
78666
78679
  };
78667
78680
  } catch (err) {
78668
- session.flow.steps.pop();
78681
+ list.pop();
78682
+ if (session.flow.shutdown?.length === 0) delete session.flow.shutdown;
78669
78683
  throw err;
78670
78684
  }
78671
78685
  });
78672
78686
  }
78687
+ var REMOVED_OUTPUT_KEY = /* @__PURE__ */ Symbol("removed");
78688
+ function recordingOutput(session, block) {
78689
+ const doc = session.output ?? {};
78690
+ if (block !== "shutdown" || !session.shutdownChanges) return doc;
78691
+ const merged = { ...doc };
78692
+ for (const [key2, value] of session.shutdownChanges) {
78693
+ if (value === REMOVED_OUTPUT_KEY) delete merged[key2];
78694
+ else merged[key2] = value;
78695
+ }
78696
+ return merged;
78697
+ }
78698
+ function keepRecordingOutput(session, block, doc, ranAgainst) {
78699
+ if (block === "steps") {
78700
+ session.output = doc;
78701
+ return;
78702
+ }
78703
+ const changes = session.shutdownChanges ??= /* @__PURE__ */ new Map();
78704
+ for (const key2 of Object.keys(ranAgainst)) {
78705
+ if (!Object.hasOwn(doc, key2)) changes.set(key2, REMOVED_OUTPUT_KEY);
78706
+ }
78707
+ for (const [key2, value] of Object.entries(doc)) {
78708
+ if (!Object.hasOwn(ranAgainst, key2) || !(0, import_node_util6.isDeepStrictEqual)(ranAgainst[key2], value)) {
78709
+ changes.set(key2, value);
78710
+ }
78711
+ }
78712
+ }
78713
+ function recordedCount(flow, block) {
78714
+ return block === "shutdown" ? flow.shutdown?.length ?? 0 : flow.steps.length;
78715
+ }
78673
78716
 
78674
78717
  // ../tool-server/src/tools/system/update-argent.ts
78675
78718
  function resolveCliEntry() {
@@ -78899,9 +78942,9 @@ This reminder comes from Argent itself. It will not repeat for the next 30 minut
78899
78942
 
78900
78943
  // ../tool-server/src/utils/ios-device/team-detect.ts
78901
78944
  var import_node_child_process10 = require("node:child_process");
78902
- var import_node_util6 = require("node:util");
78945
+ var import_node_util7 = require("node:util");
78903
78946
  var import_node_crypto5 = require("node:crypto");
78904
- var execFileAsync6 = (0, import_node_util6.promisify)(import_node_child_process10.execFile);
78947
+ var execFileAsync6 = (0, import_node_util7.promisify)(import_node_child_process10.execFile);
78905
78948
  var SIGNING_CERT_COMMON_NAMES = ["Apple Development", "iPhone Developer"];
78906
78949
  var SECURITY_TIMEOUT_MS = 15e3;
78907
78950
  async function listCertificatePem(commonName) {
@@ -79056,7 +79099,7 @@ var fsAsync = __toESM(require("node:fs/promises"));
79056
79099
  var os5 = __toESM(require("node:os"));
79057
79100
  var path18 = __toESM(require("node:path"));
79058
79101
  var import_node_child_process12 = require("node:child_process");
79059
- var import_node_util8 = require("node:util");
79102
+ var import_node_util9 = require("node:util");
79060
79103
 
79061
79104
  // ../tool-server/src/utils/simctl-config.ts
79062
79105
  var SIMCTL_SPAWN_TIMEOUT_MS = 1e4;
@@ -79065,11 +79108,11 @@ var SIMCTL_KILL_SIGNAL = "SIGKILL";
79065
79108
  // ../tool-server/src/utils/ios-device-sets.ts
79066
79109
  var fs18 = __toESM(require("node:fs"));
79067
79110
  var import_node_child_process11 = require("node:child_process");
79068
- var import_node_util7 = require("node:util");
79111
+ var import_node_util8 = require("node:util");
79069
79112
  init_src2();
79070
79113
  init_src();
79071
79114
  init_external_devices();
79072
- var execFileAsync7 = (0, import_node_util7.promisify)(import_node_child_process11.execFile);
79115
+ var execFileAsync7 = (0, import_node_util8.promisify)(import_node_child_process11.execFile);
79073
79116
  var deviceSetByUdid = /* @__PURE__ */ new Map();
79074
79117
  function configuredAdditionalDeviceSets() {
79075
79118
  try {
@@ -79424,7 +79467,7 @@ var PRE_BOOT_ACCESSIBILITY_KEYS = [
79424
79467
  "AccessibilityEnabled",
79425
79468
  "ApplicationAccessibilityEnabled"
79426
79469
  ];
79427
- var execFileAsync8 = (0, import_node_util8.promisify)(import_node_child_process12.execFile);
79470
+ var execFileAsync8 = (0, import_node_util9.promisify)(import_node_child_process12.execFile);
79428
79471
  async function accessibilityDefaults(udid, verb, ...args) {
79429
79472
  const { stdout } = await execFileAsync8(
79430
79473
  "xcrun",
@@ -79494,10 +79537,10 @@ async function setAccessibilityPrefsPreBoot(udid, { isTvOs }) {
79494
79537
  var fs19 = __toESM(require("node:fs"));
79495
79538
  var path19 = __toESM(require("node:path"));
79496
79539
  var import_node_child_process13 = require("node:child_process");
79497
- var import_node_util9 = require("node:util");
79540
+ var import_node_util10 = require("node:util");
79498
79541
  init_external_devices();
79499
79542
  init_device_info();
79500
- var execFileAsync9 = (0, import_node_util9.promisify)(import_node_child_process13.execFile);
79543
+ var execFileAsync9 = (0, import_node_util10.promisify)(import_node_child_process13.execFile);
79501
79544
  var SIMCTL_LIST_TIMEOUT_MS = 1e4;
79502
79545
  function simctlListTimeoutAdvice(retry) {
79503
79546
  return `\`xcrun simctl list\` did not answer within ${SIMCTL_LIST_TIMEOUT_MS / 1e3}s. CoreSimulatorService is probably still starting, which can take about a minute after a reboot, so call ${retry} again shortly. If it keeps timing out and Xcode was just updated, ask the user to ${xcodeInstallInstruction()}; otherwise restart CoreSimulatorService.`;
@@ -97688,9 +97731,9 @@ function installNodeWebTransport() {
97688
97731
 
97689
97732
  // ../tool-server/src/utils/sim-remote.ts
97690
97733
  var import_node_child_process14 = require("node:child_process");
97691
- var import_node_util10 = require("node:util");
97734
+ var import_node_util11 = require("node:util");
97692
97735
  init_device_info();
97693
- var execFileAsync10 = (0, import_node_util10.promisify)(import_node_child_process14.execFile);
97736
+ var execFileAsync10 = (0, import_node_util11.promisify)(import_node_child_process14.execFile);
97694
97737
  var SIM_REMOTE_TIMEOUT_MS = 3e4;
97695
97738
  function simRemoteExecError(err) {
97696
97739
  return err.cause ?? err;
@@ -98202,9 +98245,9 @@ function captureOnDemandDropped(deviceId, endpoint) {
98202
98245
  // ../tool-server/src/utils/foldable.ts
98203
98246
  var import_node_child_process15 = require("node:child_process");
98204
98247
  var fs20 = __toESM(require("node:fs"));
98205
- var import_node_util11 = require("node:util");
98248
+ var import_node_util12 = require("node:util");
98206
98249
  init_external_devices();
98207
- var execFileAsync11 = (0, import_node_util11.promisify)(import_node_child_process15.execFile);
98250
+ var execFileAsync11 = (0, import_node_util12.promisify)(import_node_child_process15.execFile);
98208
98251
  var MAIN_SCREEN_ID = 1;
98209
98252
  var AX_LIVE_PANEL_TIMEOUT_MS = 2e3;
98210
98253
  var DEVICECTL_TIMEOUT_MS = 5e3;
@@ -99503,7 +99546,7 @@ var import_node_child_process16 = require("node:child_process");
99503
99546
  var import_node_events = require("node:events");
99504
99547
  var fs24 = __toESM(require("node:fs"));
99505
99548
  var path22 = __toESM(require("node:path"));
99506
- var import_node_util12 = require("node:util");
99549
+ var import_node_util13 = require("node:util");
99507
99550
  init_src();
99508
99551
 
99509
99552
  // ../tool-server/src/utils/ios-audio-leftovers.ts
@@ -99790,7 +99833,7 @@ async function clearAudioLeftovers(dir) {
99790
99833
  }
99791
99834
 
99792
99835
  // ../tool-server/src/utils/ios-host.ts
99793
- var execFileAsync12 = (0, import_node_util12.promisify)(import_node_child_process16.execFile);
99836
+ var execFileAsync12 = (0, import_node_util13.promisify)(import_node_child_process16.execFile);
99794
99837
  var ARGENT_BOOTSTRAP_DYLIB_BASENAMES = /* @__PURE__ */ new Set(["libArgentInjectionBootstrap.dylib"]);
99795
99838
  var RECOGNISED_BOOTSTRAP_DYLIB_BASENAMES = /* @__PURE__ */ new Set([
99796
99839
  ...ARGENT_BOOTSTRAP_DYLIB_BASENAMES,
@@ -102444,10 +102487,10 @@ function classifyDeviceForTelemetry(deviceId) {
102444
102487
 
102445
102488
  // ../tool-server/src/utils/device-shutdown.ts
102446
102489
  var import_node_child_process20 = require("node:child_process");
102447
- var import_node_util14 = require("node:util");
102490
+ var import_node_util15 = require("node:util");
102448
102491
  init_device_info();
102449
102492
  init_android_binary();
102450
- var execFileAsync14 = (0, import_node_util14.promisify)(import_node_child_process20.execFile);
102493
+ var execFileAsync14 = (0, import_node_util15.promisify)(import_node_child_process20.execFile);
102451
102494
  var SHUTDOWN_EXEC_OPTIONS = { timeout: 3e4, killSignal: "SIGKILL" };
102452
102495
  async function shutdownOwnedDevice(id) {
102453
102496
  let platform;
@@ -102598,14 +102641,14 @@ function adbCommandPrefix(env) {
102598
102641
 
102599
102642
  // ../tool-server/src/utils/ios-device/devicectl.ts
102600
102643
  var import_node_child_process21 = require("node:child_process");
102601
- var import_node_util15 = require("node:util");
102644
+ var import_node_util16 = require("node:util");
102602
102645
  var fs27 = __toESM(require("node:fs/promises"));
102603
102646
  var os8 = __toESM(require("node:os"));
102604
102647
  var path24 = __toESM(require("node:path"));
102605
102648
  var import_node_crypto8 = require("node:crypto");
102606
102649
  var import_node_net = require("node:net");
102607
102650
  init_src2();
102608
- var execFileAsync15 = (0, import_node_util15.promisify)(import_node_child_process21.execFile);
102651
+ var execFileAsync15 = (0, import_node_util16.promisify)(import_node_child_process21.execFile);
102609
102652
  var DEVICECTL_TIMEOUT_MS2 = 2e4;
102610
102653
  var DEVICECTL_INSTALL_TIMEOUT_MS = 12e4;
102611
102654
  var DEVICECTL_LIST_TIMEOUT_MS = 8e3;
@@ -102938,13 +102981,13 @@ var import_node_crypto9 = require("node:crypto");
102938
102981
  var fs28 = __toESM(require("node:fs"));
102939
102982
  var os9 = __toESM(require("node:os"));
102940
102983
  var path25 = __toESM(require("node:path"));
102941
- var import_node_util16 = require("node:util");
102984
+ var import_node_util17 = require("node:util");
102942
102985
  init_src();
102943
102986
  init_src2();
102944
102987
  init_capability();
102945
102988
  init_device_info();
102946
102989
  init_macos_app_kind();
102947
- var execFileAsync16 = (0, import_node_util16.promisify)(import_node_child_process22.execFile);
102990
+ var execFileAsync16 = (0, import_node_util17.promisify)(import_node_child_process22.execFile);
102948
102991
  function isMacosAppsEnabled() {
102949
102992
  return isFeatureEnabled(MACOS_APPS_FLAG);
102950
102993
  }
@@ -105833,8 +105876,8 @@ async function resolveRunningVvdSerial() {
105833
105876
  // ../tool-server/src/tools/devices/list-devices.ts
105834
105877
  init_external_devices();
105835
105878
  var import_node_child_process23 = require("node:child_process");
105836
- var import_node_util17 = require("node:util");
105837
- var execFileAsync17 = (0, import_node_util17.promisify)(import_node_child_process23.execFile);
105879
+ var import_node_util18 = require("node:util");
105880
+ var execFileAsync17 = (0, import_node_util18.promisify)(import_node_child_process23.execFile);
105838
105881
  var ARGENT_CLOUD_URL = "https://argent.swmansion.com/cloud/";
105839
105882
  var ARGENT_CLOUD_OFFER = `Argent Cloud, a hosted service that is not set up here, runs iOS simulators on remote Macs; once the user sets it up with their API key and the sim-remote CLI, they are listed as platform 'ios-remote'. ` + ARGENT_CLOUD_URL;
105840
105883
  function iosReachNote(host, cloud) {
@@ -114680,7 +114723,7 @@ function reserveLaunchMeasurement(udid) {
114680
114723
 
114681
114724
  // ../tool-server/src/utils/ios-device/runner-artifact.ts
114682
114725
  var import_node_child_process28 = require("node:child_process");
114683
- var import_node_util19 = require("node:util");
114726
+ var import_node_util20 = require("node:util");
114684
114727
  var import_node_crypto10 = require("node:crypto");
114685
114728
  var fs37 = __toESM(require("node:fs"));
114686
114729
  var fsp = __toESM(require("node:fs/promises"));
@@ -114696,8 +114739,8 @@ var import_node_child_process27 = require("node:child_process");
114696
114739
  var import_node_fs12 = require("node:fs");
114697
114740
  var import_node_os9 = require("node:os");
114698
114741
  var path32 = __toESM(require("node:path"));
114699
- var import_node_util18 = require("node:util");
114700
- var execFileAsync18 = (0, import_node_util18.promisify)(import_node_child_process27.execFile);
114742
+ var import_node_util19 = require("node:util");
114743
+ var execFileAsync18 = (0, import_node_util19.promisify)(import_node_child_process27.execFile);
114701
114744
  var PROFILE_DIRECTORIES = [
114702
114745
  path32.join("Library", "Developer", "Xcode", "UserData", "Provisioning Profiles"),
114703
114746
  path32.join("Library", "MobileDevice", "Provisioning Profiles")
@@ -114806,7 +114849,7 @@ function resolveSigningHint(output2) {
114806
114849
  }
114807
114850
 
114808
114851
  // ../tool-server/src/utils/ios-device/runner-artifact.ts
114809
- var execFileAsync19 = (0, import_node_util19.promisify)(import_node_child_process28.execFile);
114852
+ var execFileAsync19 = (0, import_node_util20.promisify)(import_node_child_process28.execFile);
114810
114853
  var PROJECT_SUFFIX = "ios-device-runner/ArgentRunner/ArgentRunner.xcodeproj";
114811
114854
  function resolveRunnerProjectPath() {
114812
114855
  const override = process.env.ARGENT_IOS_RUNNER_PROJECT;
@@ -115080,9 +115123,9 @@ var fs38 = __toESM(require("node:fs"));
115080
115123
  var fsp2 = __toESM(require("node:fs/promises"));
115081
115124
  var os15 = __toESM(require("node:os"));
115082
115125
  var path34 = __toESM(require("node:path"));
115083
- var import_node_util20 = require("node:util");
115126
+ var import_node_util21 = require("node:util");
115084
115127
  init_src2();
115085
- var execFileAsync20 = (0, import_node_util20.promisify)(import_node_child_process29.execFile);
115128
+ var execFileAsync20 = (0, import_node_util21.promisify)(import_node_child_process29.execFile);
115086
115129
  function logsRoot() {
115087
115130
  return path34.join(os15.homedir(), ".argent", "ios-device-runner", "logs");
115088
115131
  }
@@ -115211,9 +115254,9 @@ function killRunnerProcess(child) {
115211
115254
 
115212
115255
  // ../tool-server/src/utils/ios-device/runner-sweep.ts
115213
115256
  var import_node_child_process30 = require("node:child_process");
115214
- var import_node_util21 = require("node:util");
115257
+ var import_node_util22 = require("node:util");
115215
115258
  var path35 = __toESM(require("node:path"));
115216
- var execFileAsync21 = (0, import_node_util21.promisify)(import_node_child_process30.execFile);
115259
+ var execFileAsync21 = (0, import_node_util22.promisify)(import_node_child_process30.execFile);
115217
115260
  var PROCESS_TABLE_MAX_BYTES = 16 * 1024 * 1024;
115218
115261
  var STALE_EXIT_TIMEOUT_MS = 5e3;
115219
115262
  var STALE_EXIT_POLL_INTERVAL_MS = 100;
@@ -115648,9 +115691,9 @@ function defaultSendViaUsbmux(udid, port, body, deadline) {
115648
115691
 
115649
115692
  // ../tool-server/src/utils/ios-device/runner-crash.ts
115650
115693
  var import_node_child_process31 = require("node:child_process");
115651
- var import_node_util22 = require("node:util");
115694
+ var import_node_util23 = require("node:util");
115652
115695
  var fs39 = __toESM(require("node:fs/promises"));
115653
- var execFileAsync22 = (0, import_node_util22.promisify)(import_node_child_process31.execFile);
115696
+ var execFileAsync22 = (0, import_node_util23.promisify)(import_node_child_process31.execFile);
115654
115697
  var XCRESULTTOOL_TIMEOUT_MS = 15e3;
115655
115698
  var XCRESULTTOOL_MAX_JSON_BYTES = 32 * 1024 * 1024;
115656
115699
  function extractCrashFailureText(summary) {
@@ -129664,9 +129707,9 @@ init_external_devices();
129664
129707
  // ../tool-server/src/utils/debugger/runtime-device.ts
129665
129708
  var import_node_crypto16 = require("node:crypto");
129666
129709
  var import_node_child_process33 = require("node:child_process");
129667
- var import_node_util23 = require("node:util");
129710
+ var import_node_util24 = require("node:util");
129668
129711
  init_adb();
129669
- var execFileAsync23 = (0, import_node_util23.promisify)(import_node_child_process33.execFile);
129712
+ var execFileAsync23 = (0, import_node_util24.promisify)(import_node_child_process33.execFile);
129670
129713
  var LOG_READ_TIMEOUT_MS = 5e3;
129671
129714
  var RETRY_DELAY_MS = 300;
129672
129715
  var OTHER_TRANSPORTS_GRACE_MS = 500;
@@ -132770,7 +132813,7 @@ var import_promises15 = require("node:fs/promises");
132770
132813
  var import_node_net4 = require("node:net");
132771
132814
  var import_node_os16 = require("node:os");
132772
132815
  var import_node_path20 = require("node:path");
132773
- var import_node_util26 = require("node:util");
132816
+ var import_node_util27 = require("node:util");
132774
132817
  init_zod();
132775
132818
  init_src();
132776
132819
  init_src2();
@@ -132836,8 +132879,8 @@ function readOnlyBootEntries() {
132836
132879
  var import_node_child_process34 = require("node:child_process");
132837
132880
  var import_node_fs17 = require("node:fs");
132838
132881
  var import_promises14 = require("node:fs/promises");
132839
- var import_node_util24 = require("node:util");
132840
- var execFileAsync24 = (0, import_node_util24.promisify)(import_node_child_process34.execFile);
132882
+ var import_node_util25 = require("node:util");
132883
+ var execFileAsync24 = (0, import_node_util25.promisify)(import_node_child_process34.execFile);
132841
132884
  var EMULATOR_PROCESS_RE = /(?:^|\/)(?:qemu-system-[\w-]+|emulator|emulator64-[\w-]+)\s/;
132842
132885
  function escapeRegExp(value) {
132843
132886
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -133072,8 +133115,8 @@ var import_node_child_process35 = require("node:child_process");
133072
133115
  var import_node_fs18 = __toESM(require("node:fs"));
133073
133116
  var import_node_os15 = __toESM(require("node:os"));
133074
133117
  var import_node_path19 = __toESM(require("node:path"));
133075
- var import_node_util25 = require("node:util");
133076
- var execFileAsync25 = (0, import_node_util25.promisify)(import_node_child_process35.execFile);
133118
+ var import_node_util26 = require("node:util");
133119
+ var execFileAsync25 = (0, import_node_util26.promisify)(import_node_child_process35.execFile);
133077
133120
  var CORE_SIMULATOR_INFO_PLIST = "/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/Resources/Info.plist";
133078
133121
  var LAUNCH_WATCH_MS = 1e4;
133079
133122
  var LAUNCH_POLL_MS = 250;
@@ -133542,7 +133585,7 @@ async function bootMacosApp(registry2, opts) {
133542
133585
  }
133543
133586
 
133544
133587
  // ../tool-server/src/tools/devices/boot-device.ts
133545
- var execFileAsync26 = (0, import_node_util26.promisify)(import_node_child_process37.execFile);
133588
+ var execFileAsync26 = (0, import_node_util27.promisify)(import_node_child_process37.execFile);
133546
133589
  function bootTarget(params) {
133547
133590
  return params.udid ?? params.avdName ?? params.vvdImage ?? params.harmonyInstance ?? params.electronAppPath ?? params.macosAppPath ?? "device";
133548
133591
  }
@@ -135380,7 +135423,7 @@ function dispatchByPlatform(opts) {
135380
135423
 
135381
135424
  // ../tool-server/src/tools/launch-app/platforms/ios.ts
135382
135425
  var import_node_child_process38 = require("node:child_process");
135383
- var import_node_util27 = require("node:util");
135426
+ var import_node_util28 = require("node:util");
135384
135427
  init_src2();
135385
135428
  init_external_devices();
135386
135429
 
@@ -135414,7 +135457,7 @@ async function awaitIosAppInFront(registry2, device, bundleId, signal) {
135414
135457
  }
135415
135458
 
135416
135459
  // ../tool-server/src/tools/launch-app/platforms/ios.ts
135417
- var execFileAsync27 = (0, import_node_util27.promisify)(import_node_child_process38.execFile);
135460
+ var execFileAsync27 = (0, import_node_util28.promisify)(import_node_child_process38.execFile);
135418
135461
  function makeIosImpl(registry2) {
135419
135462
  return {
135420
135463
  requires: ["xcrun"],
@@ -135965,10 +136008,10 @@ init_device_info();
135965
136008
 
135966
136009
  // ../tool-server/src/tools/restart-app/platforms/ios.ts
135967
136010
  var import_node_child_process39 = require("node:child_process");
135968
- var import_node_util28 = require("node:util");
136011
+ var import_node_util29 = require("node:util");
135969
136012
  init_src2();
135970
136013
  init_external_devices();
135971
- var execFileAsync28 = (0, import_node_util28.promisify)(import_node_child_process39.execFile);
136014
+ var execFileAsync28 = (0, import_node_util29.promisify)(import_node_child_process39.execFile);
135972
136015
  function makeIosImpl2(registry2) {
135973
136016
  return {
135974
136017
  requires: ["xcrun"],
@@ -136256,11 +136299,11 @@ For Mac apps, kind is 'catalyst' or 'app'. Check appPath and args to confirm the
136256
136299
 
136257
136300
  // ../tool-server/src/tools/terminate-app/index.ts
136258
136301
  var import_node_child_process40 = require("node:child_process");
136259
- var import_node_util29 = require("node:util");
136302
+ var import_node_util30 = require("node:util");
136260
136303
  init_zod();
136261
136304
  init_src2();
136262
136305
  init_adb();
136263
- var execFileAsync29 = (0, import_node_util29.promisify)(import_node_child_process40.execFile);
136306
+ var execFileAsync29 = (0, import_node_util30.promisify)(import_node_child_process40.execFile);
136264
136307
  var capability5 = {
136265
136308
  apple: { simulator: true },
136266
136309
  appleRemote: { simulator: true },
@@ -136350,7 +136393,7 @@ init_zod();
136350
136393
 
136351
136394
  // ../tool-server/src/tools/reinstall-app/platforms/ios.ts
136352
136395
  var import_node_child_process42 = require("node:child_process");
136353
- var import_node_util31 = require("node:util");
136396
+ var import_node_util32 = require("node:util");
136354
136397
  var import_node_path22 = require("node:path");
136355
136398
  init_src2();
136356
136399
 
@@ -136358,7 +136401,7 @@ init_src2();
136358
136401
  var import_node_child_process41 = require("node:child_process");
136359
136402
  var import_promises17 = require("node:fs/promises");
136360
136403
  var import_node_path21 = require("node:path");
136361
- var import_node_util30 = require("node:util");
136404
+ var import_node_util31 = require("node:util");
136362
136405
  init_capability();
136363
136406
 
136364
136407
  // ../tool-server/src/utils/apk-package.ts
@@ -136457,7 +136500,7 @@ function readStringPool(xml, chunk) {
136457
136500
  }
136458
136501
 
136459
136502
  // ../tool-server/src/tools/reinstall-app/validate-app.ts
136460
- var execFileAsync30 = (0, import_node_util30.promisify)(import_node_child_process41.execFile);
136503
+ var execFileAsync30 = (0, import_node_util31.promisify)(import_node_child_process41.execFile);
136461
136504
  async function requirePath(absolute, kind, what) {
136462
136505
  const info = await (0, import_promises17.stat)(absolute).catch(() => null);
136463
136506
  if (!info) {
@@ -136534,7 +136577,7 @@ async function assertHap(absolute, bundleName) {
136534
136577
  }
136535
136578
 
136536
136579
  // ../tool-server/src/tools/reinstall-app/platforms/ios.ts
136537
- var execFileAsync31 = (0, import_node_util31.promisify)(import_node_child_process42.execFile);
136580
+ var execFileAsync31 = (0, import_node_util32.promisify)(import_node_child_process42.execFile);
136538
136581
  var iosImpl = {
136539
136582
  requires: ["xcrun"],
136540
136583
  handler: async (_services, params) => {
@@ -136832,10 +136875,10 @@ var PERMISSION_NAMES = [
136832
136875
 
136833
136876
  // ../tool-server/src/tools/settings-permissions/platforms/ios.ts
136834
136877
  var import_node_child_process43 = require("node:child_process");
136835
- var import_node_util32 = require("node:util");
136878
+ var import_node_util33 = require("node:util");
136836
136879
  init_src2();
136837
136880
  init_capability();
136838
- var execFileAsync32 = (0, import_node_util32.promisify)(import_node_child_process43.execFile);
136881
+ var execFileAsync32 = (0, import_node_util33.promisify)(import_node_child_process43.execFile);
136839
136882
  var SIMCTL_ACTION = {
136840
136883
  grant: "grant",
136841
136884
  deny: "revoke",
@@ -137153,7 +137196,7 @@ init_device_info();
137153
137196
 
137154
137197
  // ../tool-server/src/tools/open-url/platforms/ios.ts
137155
137198
  var import_node_child_process44 = require("node:child_process");
137156
- var import_node_util33 = require("node:util");
137199
+ var import_node_util34 = require("node:util");
137157
137200
  init_src2();
137158
137201
 
137159
137202
  // ../tool-server/src/tools/open-url/deep-link-note.ts
@@ -137163,7 +137206,7 @@ function httpDeepLinkNote(url2) {
137163
137206
  }
137164
137207
 
137165
137208
  // ../tool-server/src/tools/open-url/platforms/ios.ts
137166
- var execFileAsync33 = (0, import_node_util33.promisify)(import_node_child_process44.execFile);
137209
+ var execFileAsync33 = (0, import_node_util34.promisify)(import_node_child_process44.execFile);
137167
137210
  var iosImpl3 = {
137168
137211
  requires: ["xcrun"],
137169
137212
  handler: async (_services, params) => {
@@ -137293,10 +137336,10 @@ var chromiumImpl2 = {
137293
137336
  // ../tool-server/src/tools/open-url/platforms/macos.ts
137294
137337
  var import_node_child_process45 = require("node:child_process");
137295
137338
  var path43 = __toESM(require("node:path"));
137296
- var import_node_util34 = require("node:util");
137339
+ var import_node_util35 = require("node:util");
137297
137340
  init_src2();
137298
137341
  init_capability();
137299
- var execFileAsync34 = (0, import_node_util34.promisify)(import_node_child_process45.execFile);
137342
+ var execFileAsync34 = (0, import_node_util35.promisify)(import_node_child_process45.execFile);
137300
137343
  var WEB_URL_NOTE = "The URL went to the app of the device, not to the default browser. The app shows it only if it handles that URL.";
137301
137344
  async function declaredSchemes(appPath) {
137302
137345
  try {
@@ -137434,7 +137477,7 @@ Returns { opened, url, note? }. \`note\` explains the routing caveat when a web
137434
137477
 
137435
137478
  // ../tool-server/src/tools/screenshot/index.ts
137436
137479
  var import_node_child_process46 = require("node:child_process");
137437
- var import_node_util35 = require("node:util");
137480
+ var import_node_util36 = require("node:util");
137438
137481
  var os20 = __toESM(require("node:os"));
137439
137482
  var path44 = __toESM(require("node:path"));
137440
137483
  init_zod();
@@ -137694,7 +137737,7 @@ async function captureHarmonyScreenshotPng(opts) {
137694
137737
  // ../tool-server/src/tools/screenshot/index.ts
137695
137738
  init_capability();
137696
137739
  var fs50 = __toESM(require("node:fs/promises"));
137697
- var execFileAsync35 = (0, import_node_util35.promisify)(import_node_child_process46.execFile);
137740
+ var execFileAsync35 = (0, import_node_util36.promisify)(import_node_child_process46.execFile);
137698
137741
  var capability9 = {
137699
137742
  apple: { simulator: true, device: true },
137700
137743
  appleRemote: { simulator: true },
@@ -140434,7 +140477,7 @@ var shakeZodSchema = external_exports.object({
140434
140477
 
140435
140478
  // ../tool-server/src/tools/shake/platforms/ios.ts
140436
140479
  var import_node_child_process48 = require("node:child_process");
140437
- var import_node_util36 = require("node:util");
140480
+ var import_node_util37 = require("node:util");
140438
140481
  init_src2();
140439
140482
  init_capability();
140440
140483
 
@@ -140639,7 +140682,7 @@ async function prepareHostWindowShake(target) {
140639
140682
  }
140640
140683
 
140641
140684
  // ../tool-server/src/tools/shake/platforms/ios.ts
140642
- var execFileAsync36 = (0, import_node_util36.promisify)(import_node_child_process48.execFile);
140685
+ var execFileAsync36 = (0, import_node_util37.promisify)(import_node_child_process48.execFile);
140643
140686
  var SHAKE_NOTIFICATION = "com.apple.UIKit.SimulatorShake";
140644
140687
  var SHAKE_INTERVAL_MS = 400;
140645
140688
  var sleep13 = (ms3) => new Promise((r) => setTimeout(r, ms3));
@@ -153581,7 +153624,7 @@ function inFlightGuardMessage(state3, retryAction) {
153581
153624
  // ../tool-server/src/tools/profiler/native-profiler/platforms/xctrace.ts
153582
153625
  var import_child_process5 = require("child_process");
153583
153626
  var import_node_fs21 = require("node:fs");
153584
- var import_node_util37 = require("node:util");
153627
+ var import_node_util38 = require("node:util");
153585
153628
  init_src2();
153586
153629
  var import_node_fs22 = require("node:fs");
153587
153630
  var path47 = __toESM(require("path"));
@@ -153942,7 +153985,7 @@ function commitXctraceRecording(api, started, capture) {
153942
153985
  traceFile: capture.traceFile
153943
153986
  };
153944
153987
  }
153945
- var execFileAsync37 = (0, import_node_util37.promisify)(import_child_process5.execFile);
153988
+ var execFileAsync37 = (0, import_node_util38.promisify)(import_child_process5.execFile);
153946
153989
  function xctraceProgressProbe(child, traceFile) {
153947
153990
  return async () => {
153948
153991
  if (!child.pid) return null;
@@ -156238,7 +156281,7 @@ init_zod();
156238
156281
 
156239
156282
  // ../tool-server/src/tools/profiler/native-profiler/launch-analysis/measure.ts
156240
156283
  var import_node_child_process50 = require("node:child_process");
156241
- var import_node_util39 = require("node:util");
156284
+ var import_node_util40 = require("node:util");
156242
156285
  var fsp5 = __toESM(require("node:fs/promises"));
156243
156286
  var path53 = __toESM(require("node:path"));
156244
156287
  var import_node_crypto19 = require("node:crypto");
@@ -156246,14 +156289,14 @@ init_src2();
156246
156289
 
156247
156290
  // ../tool-server/src/utils/ios-launch-time/workflow.ts
156248
156291
  var import_node_child_process49 = require("node:child_process");
156249
- var import_node_util38 = require("node:util");
156292
+ var import_node_util39 = require("node:util");
156250
156293
  var import_promises20 = require("node:timers/promises");
156251
156294
  var fs64 = __toESM(require("node:fs"));
156252
156295
  var fsp4 = __toESM(require("node:fs/promises"));
156253
156296
  var path52 = __toESM(require("node:path"));
156254
156297
  init_src();
156255
156298
  init_src2();
156256
- var execFileAsync38 = (0, import_node_util38.promisify)(import_node_child_process49.execFile);
156299
+ var execFileAsync38 = (0, import_node_util39.promisify)(import_node_child_process49.execFile);
156257
156300
  var BUILD_TIMEOUT_MS2 = 60 * 6e4;
156258
156301
  var BOOTSTATUS_TIMEOUT_MS = 18e4;
156259
156302
  function runnerBuildCacheDir(key2) {
@@ -156792,7 +156835,7 @@ function optionalExportCrashNote(tables, xcodeVersion2, options = {}) {
156792
156835
  }
156793
156836
 
156794
156837
  // ../tool-server/src/tools/profiler/native-profiler/launch-analysis/measure.ts
156795
- var execFileAsync39 = (0, import_node_util39.promisify)(import_node_child_process50.execFile);
156838
+ var execFileAsync39 = (0, import_node_util40.promisify)(import_node_child_process50.execFile);
156796
156839
  var LAUNCH_ITERATIONS = 5;
156797
156840
  async function measureLaunch(params, ctx) {
156798
156841
  let release2;
@@ -156964,7 +157007,7 @@ async function measurePreparedLaunch(context2, ctx) {
156964
157007
  // ../tool-server/src/tools/profiler/native-profiler/launch-analysis/profile.ts
156965
157008
  var import_node_child_process51 = require("node:child_process");
156966
157009
  var import_node_crypto20 = require("node:crypto");
156967
- var import_node_util40 = require("node:util");
157010
+ var import_node_util41 = require("node:util");
156968
157011
  var fsp6 = __toESM(require("node:fs/promises"));
156969
157012
  var path54 = __toESM(require("node:path"));
156970
157013
  init_src2();
@@ -157206,7 +157249,7 @@ function cpuTableXpath(tocXml) {
157206
157249
  }
157207
157250
 
157208
157251
  // ../tool-server/src/tools/profiler/native-profiler/launch-analysis/profile.ts
157209
- var execFileAsync40 = (0, import_node_util40.promisify)(import_node_child_process51.execFile);
157252
+ var execFileAsync40 = (0, import_node_util41.promisify)(import_node_child_process51.execFile);
157210
157253
  var TABLE_XPATH = (schema) => `/trace-toc/run[@number="1"]/data/table[@schema="${schema}"]`;
157211
157254
  async function writeProfilerSession(xml) {
157212
157255
  const debugDir = await getDebugDir();
@@ -157552,11 +157595,11 @@ var import_node_child_process52 = require("node:child_process");
157552
157595
  var fs65 = __toESM(require("node:fs"));
157553
157596
  var path55 = __toESM(require("node:path"));
157554
157597
  var import_node_crypto21 = require("node:crypto");
157555
- var import_node_util41 = require("node:util");
157598
+ var import_node_util42 = require("node:util");
157556
157599
  init_src2();
157557
157600
  init_capability();
157558
157601
  init_external_devices();
157559
- var execFileAsync41 = (0, import_node_util41.promisify)(import_node_child_process52.execFile);
157602
+ var execFileAsync41 = (0, import_node_util42.promisify)(import_node_child_process52.execFile);
157560
157603
  var AUDIO_DIR_ENV = "ARGENT_AUDIO_DIR";
157561
157604
  var AUDIO_HOOK_PROTO = 1;
157562
157605
  var MAX_CLIP_SECONDS = 600;
@@ -164504,7 +164547,7 @@ and without a link, an edit that renumbers the steps drops their warnings.`,
164504
164547
  params.name,
164505
164548
  async () => {
164506
164549
  const replaced2 = await getRecordingSession(params.project_root, params.name) ?? null;
164507
- const discardedSteps2 = replaced2 === null ? void 0 : replaced2.persist === "host" ? await countStepsOnDisk(replaced2.filePath) : replaced2.flow.steps.length;
164550
+ const discardedSteps2 = replaced2 === null ? void 0 : replaced2.persist === "host" ? await countStepsOnDisk(replaced2.filePath, "both") : replaced2.flow.steps.length + (replaced2.flow.shutdown?.length ?? 0);
164508
164551
  let savedTo2;
164509
164552
  if (persist2 === "host") {
164510
164553
  await writeNewFlowFile(filePath, flowFile);
@@ -167292,6 +167335,9 @@ function summarizeStep(step, n) {
167292
167335
  function summarizeSteps(flow) {
167293
167336
  return flow.steps.map((step, i) => summarizeStep(step, i + 1));
167294
167337
  }
167338
+ function summarizeShutdownStep(step, n) {
167339
+ return `shutdown ${summarizeStep(step, n)}`;
167340
+ }
167295
167341
  function stepAnchor(step) {
167296
167342
  return summarizeStep(step, 0);
167297
167343
  }
@@ -167305,9 +167351,10 @@ var REPLAY_TREE_SOURCES = {
167305
167351
  android: "android-devtools",
167306
167352
  macos: "macos-devtools"
167307
167353
  };
167308
- function recordedLaunchedApp(session, platform) {
167309
- for (let i = session.flow.steps.length - 1; i >= 0; i--) {
167310
- const step = session.flow.steps[i];
167354
+ function recordedLaunchedApp(session, platform, block) {
167355
+ const steps = block === "shutdown" ? [...session.flow.steps, ...session.flow.shutdown ?? []] : session.flow.steps;
167356
+ for (let i = steps.length - 1; i >= 0; i--) {
167357
+ const step = steps[i];
167311
167358
  if (step.kind === "launch") return appIdForPlatform(step.app, platform) ?? void 0;
167312
167359
  }
167313
167360
  return void 0;
@@ -167405,13 +167452,13 @@ function textTieClause(udid) {
167405
167452
  return ` Check FIRST whether the selector matches more than one element, because a \`text\` check reads only one of them \u2014 the first visible match in reading order \u2014 and the two sides can elect DIFFERENT ones from the very same nodes: an exact frame tie is settled by which node its tree listed first, ${order}. The reason above quotes whichever element the RUNNER elected, so compare it against the one you meant. If that is what happened, both trees hold both elements and neither the tree differences nor a changed screen below explains anything \u2014 narrow the selector until it resolves a single node, and note that a longer \`await:\` timeout cannot help, since the text it read is already final.`;
167406
167453
  }
167407
167454
  var SPELLING_CLAUSE = "Both of those are about the selector exactly as recorded, so convert it in the strict map spelling (`{ text: \u2026 }` / `{ id: \u2026 }`, a straight copy of the step's `selector:`): a bare-string conversion (`{ visible: Continue }`) re-parses as a LOOSE selector \u2014 identifier first, text only as a fallback \u2014 which is a different check this probe never made.";
167408
- var UNMET_WAIT_WARNING = "recorded, but the wait itself never held \u2014 `await-ui-element` reports an unmet condition by returning success:false instead of failing, so the step was written to the e2e test anyway. At replay an unmet wait FAILS the step and stops the run there, so re-record it once the condition can actually hold, and delete the failed step after `e2e-finish-recording` rather than mid-recording: over a link the in-memory copy is authoritative and the next append writes the step straight back, and without a link the recorder re-reads the file before each append, so an edit that renumbers the steps costs the finish the verdicts it would otherwise carry. The cross-tree re-probe was skipped: it asks whether a check that PASSED would survive conversion to `await:`/`assert:`, and this one did not pass";
167455
+ var unmetWaitWarning = (block) => `recorded, but the wait itself never held \u2014 \`await-ui-element\` reports an unmet condition by returning success:false instead of failing, so the step was written to the e2e test anyway. At replay an unmet wait FAILS the step and ${block === "shutdown" ? "the run" : "stops the run there"}, so re-record it once the condition can actually hold, and delete the failed step after \`e2e-finish-recording\` rather than mid-recording: over a link the in-memory copy is authoritative and the next append writes the step straight back, and without a link the recorder re-reads the file before each append, so an edit that renumbers the steps costs the finish the verdicts it would otherwise carry. The cross-tree re-probe was skipped: it asks whether a check that PASSED would survive conversion to \`await:\`/\`assert:\`, and this one did not pass`;
167409
167456
  var UNREADABLE_WAIT_WARNING = "recorded, but this wait reached its deadline without a trustworthy read of the UI tree, so the condition was never judged \u2014 `await-ui-element` returns success:false for that too, and the step was written to the e2e test anyway. Either no read in the window could be trusted, or the reads went dark before the end and what they saw no longer describes it. Whether the condition holds is UNKNOWN, not known-bad: `toolResult.note` names the tree-source error where a fetch threw, and describes what was seen where the tree was merely empty or degraded. Get that source back and re-record the step to find out. Do not delete the step on this warning alone. The cross-tree re-probe was skipped: it asks whether a check that PASSED would survive conversion to `await:`/`assert:`, and this one never got an answer";
167410
167457
  var CANCELLED_WAIT_WARNING = "recorded, but this wait was cancelled before its deadline, so the condition was never settled \u2014 `await-ui-element` reports a cancelled wait as success:false, and the step was written to the e2e test anyway. Whether it holds is UNKNOWN, not known-bad: re-record the step to find out. The cross-tree re-probe was skipped for the same reason";
167411
- function unmetWaitWarningFor(cause) {
167458
+ function unmetWaitWarningFor(cause, block) {
167412
167459
  if (cause === "unreadable") return UNREADABLE_WAIT_WARNING;
167413
167460
  if (cause === "cancelled") return CANCELLED_WAIT_WARNING;
167414
- return UNMET_WAIT_WARNING;
167461
+ return unmetWaitWarning(block);
167415
167462
  }
167416
167463
  var UNMET_NETWORK_WAIT_WARNING = "recorded, but the wait never held: `await-network-request` returned success:false, and at replay an unmet wait FAILS the step. `toolResult.nearMisses` lists the closest requests and the criteria each missed: fix the matcher, or record the action that sends the request, then record the wait again. Delete the failed step after `e2e-finish-recording`, not mid-recording";
167417
167464
  var UNREADABLE_NETWORK_WAIT_WARNING = "recorded, but no armed capture layer was read near the deadline, so the request was never judged and whether it is sent is UNKNOWN: `toolResult.layers` says why. Get the layer back (for example call network-capture-start again once the app's JavaScript has loaded) and record the wait again. Do not delete the step on this warning alone";
@@ -167526,10 +167573,10 @@ function innermostTreeReason(message) {
167526
167573
  function withoutTypedText(node2, { source }) {
167527
167574
  return source === "native-devtools" && node2.role === IOS_TEXT_INPUT_ROLE ? { ...node2, value: void 0 } : node2;
167528
167575
  }
167529
- async function captureTapSelector(registry2, session, udid, point) {
167576
+ async function captureTapSelector(registry2, session, udid, point, block) {
167530
167577
  try {
167531
167578
  const device = resolveDevice(udid);
167532
- const launched = recordedLaunchedApp(session, device.platform);
167579
+ const launched = recordedLaunchedApp(session, device.platform, block);
167533
167580
  const data = await fetchFlowTree(
167534
167581
  registry2,
167535
167582
  device,
@@ -167573,21 +167620,25 @@ async function captureTapSelector(registry2, session, udid, point) {
167573
167620
  };
167574
167621
  }
167575
167622
  }
167576
- async function activeFlowState(session) {
167623
+ async function activeFlowState(session, block) {
167577
167624
  if (session.persist === "host") {
167578
167625
  try {
167579
- session.flow = parseFlow(await fs80.readFile(session.filePath, "utf8"));
167626
+ adoptRecordedFile(session, parseFlow(await fs80.readFile(session.filePath, "utf8")));
167580
167627
  } catch (err) {
167581
167628
  return {
167582
- stepCount: session.flow.steps.length,
167629
+ stepCount: recordedCount(session.flow, block),
167583
167630
  note: `The persisted e2e test could not be read and parsed (${err instanceof Error ? err.message : String(err)}); the step count is from the last valid in-memory snapshot.`
167584
167631
  };
167585
167632
  }
167586
167633
  }
167587
- return { stepCount: session.flow.steps.length };
167634
+ return { stepCount: recordedCount(session.flow, block) };
167588
167635
  }
167589
- async function recordNothing(session, guidance) {
167590
- const { stepCount, note } = await activeFlowState(session);
167636
+ function reportsShutdown(result) {
167637
+ const steps = result?.steps;
167638
+ return Array.isArray(steps) && steps.some((s) => s?.shutdown === true);
167639
+ }
167640
+ async function recordNothing(session, guidance, block) {
167641
+ const { stepCount, note } = await activeFlowState(session, block);
167591
167642
  return {
167592
167643
  message: `${guidance} Nothing was executed and no step was recorded.${note ? ` ${note}` : ""}`,
167593
167644
  toolResult: void 0,
@@ -167839,13 +167890,17 @@ var zodSchema71 = external_exports.object({
167839
167890
  args: external_exports.string().optional().describe(
167840
167891
  `Tool arguments as a JSON string, e.g. '{"udid": "ABC", "x": 0.5, "y": 0.3}'. Omit for tools with no arguments.`
167841
167892
  ),
167842
- delayMs: external_exports.number().int().min(0).optional().describe("Milliseconds to sleep before executing this step during replay.")
167893
+ delayMs: external_exports.number().int().min(0).optional().describe("Milliseconds to sleep before executing this step during replay."),
167894
+ shutdown: external_exports.boolean().optional().describe(
167895
+ "Save the call in the shutdown list. The call still runs immediately. stepCount counts shutdown entries."
167896
+ )
167843
167897
  });
167844
167898
  function createFlowAddStepTool(registry2) {
167845
167899
  return {
167846
167900
  id: "e2e-add-step",
167847
167901
  description: `Execute one MCP tool and record its step in the e2e test named by \`name\` + \`project_root\`. Use when recording and you want each action run and captured; the recording must already be open.
167848
167902
  A coordinate \`gesture-tap\` records as a portable \`tap\` selector step; \`restart-app\` as a \`launch\`. Use \`{{output:PATH}}\` in arguments to read prior script output. The tool resolves the values for the live call and saves the references in a \`tool:\` step.
167903
+ Use \`shutdown: true\` for cleanup actions such as logging out.
167849
167904
  Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status, says whether a step was appended. Fails with an error, recording nothing. Call recording tools, including \`e2e-add-script\`, directly.`,
167850
167905
  zodSchema: zodSchema71,
167851
167906
  aliases: ["flow-add-step"],
@@ -167866,16 +167921,17 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
167866
167921
  services: () => ({}),
167867
167922
  async execute(_services, params, ctx) {
167868
167923
  const session = await requireRecordingSession(params.project_root, params.name);
167924
+ const block = params.shutdown ? "shutdown" : "steps";
167869
167925
  const command = canonicalToolId(params.command);
167870
167926
  const nested = Object.hasOwn(NESTED_RECORDER_TOOLS, command) ? NESTED_RECORDER_TOOLS[command] : void 0;
167871
- if (nested) return recordNothing(session, nested);
167927
+ if (nested) return recordNothing(session, nested, block);
167872
167928
  let args;
167873
167929
  try {
167874
167930
  args = params.args ? JSON.parse(params.args) : {};
167875
167931
  } catch (err) {
167876
167932
  if (registry2.getTool(params.command) === void 0) {
167877
167933
  const hint = directiveCommandHint(params.command);
167878
- if (hint) return recordNothing(session, hint);
167934
+ if (hint) return recordNothing(session, hint, block);
167879
167935
  }
167880
167936
  throw err;
167881
167937
  }
@@ -167897,7 +167953,7 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
167897
167953
  if (problem)
167898
167954
  throw new InvalidToolInputError(`Nothing ran and no step was recorded: ${problem}`);
167899
167955
  try {
167900
- args = resolveStepOutputs(authored, session.output ?? {}).args;
167956
+ args = resolveStepOutputs(authored, recordingOutput(session, block)).args;
167901
167957
  } catch (err) {
167902
167958
  if (!(err instanceof OutputReferenceError)) throw err;
167903
167959
  throw new InvalidToolInputError(`Nothing ran and no step was recorded: ${err.message}`);
@@ -167915,13 +167971,17 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
167915
167971
  const isTap = !referencedArgs && command === "gesture-tap" && params.delayMs === void 0 && typeof args.udid === "string" && typeof args.x === "number" && typeof args.y === "number";
167916
167972
  let captured;
167917
167973
  if (isTap) {
167918
- captured = await captureTapSelector(registry2, session, args.udid, {
167919
- x: args.x,
167920
- y: args.y
167921
- });
167974
+ captured = await captureTapSelector(
167975
+ registry2,
167976
+ session,
167977
+ args.udid,
167978
+ { x: args.x, y: args.y },
167979
+ block
167980
+ );
167922
167981
  }
167923
167982
  const runTarget = command === RUN_TARGET_COMMAND && params.delayMs === void 0 && !referencedArgs ? await captureRunTarget(session, args, project) : void 0;
167924
- const sharedOutput = runTarget?.flow ? { doc: structuredClone(session.output ?? {}) } : void 0;
167983
+ const ranAgainst = recordingOutput(session, block);
167984
+ const sharedOutput = runTarget?.flow ? { doc: structuredClone(ranAgainst) } : void 0;
167925
167985
  let prepared;
167926
167986
  let toolResult;
167927
167987
  try {
@@ -167942,7 +168002,7 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
167942
168002
  });
167943
168003
  } catch (err) {
167944
168004
  const hint = isToolNotFound(err, params.command) ? directiveCommandHint(params.command) : void 0;
167945
- if (hint) return recordNothing(session, hint);
168005
+ if (hint) return recordNothing(session, hint, block);
167946
168006
  const reframed = describeNestedParamError(
167947
168007
  registry2,
167948
168008
  err,
@@ -168005,7 +168065,7 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
168005
168065
  if (isUnmetWaitResult(command, toolResult)) {
168006
168066
  const cause = unmetWaitCause(command, toolResult);
168007
168067
  waitWarning = {
168008
- warning: command === AWAIT_NETWORK_REQUEST_TOOL_ID ? unmetNetworkWaitWarningFor(cause) : unmetWaitWarningFor(cause),
168068
+ warning: command === AWAIT_NETWORK_REQUEST_TOOL_ID ? unmetNetworkWaitWarningFor(cause) : unmetWaitWarningFor(cause, block),
168009
168069
  kind: "wait"
168010
168070
  };
168011
168071
  } else if (command === AWAIT_UI_ELEMENT_TOOL_ID) {
@@ -168081,7 +168141,7 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
168081
168141
  let savedTo;
168082
168142
  let stepCount;
168083
168143
  try {
168084
- ({ savedTo, stepCount } = await appendStepToFlow(session, step));
168144
+ ({ savedTo, stepCount } = await appendStepToFlow(session, step, block));
168085
168145
  } catch (err) {
168086
168146
  if (getFailureSignal(err)?.failure_stage !== "flow_output_reference") throw err;
168087
168147
  const refused = err instanceof Error ? err.message : String(err);
@@ -168096,19 +168156,26 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
168096
168156
  `The \`${params.command}\` call ran, but an existing e2e test step failed validation. Fix the step named below. Check the call's changes before you retry. ${refused}`
168097
168157
  );
168098
168158
  }
168099
- if (step.kind === "run" && sharedOutput) session.output = sharedOutput.doc;
168159
+ if (step.kind === "run" && sharedOutput) {
168160
+ const { doc, shutdownDoc = doc } = sharedOutput;
168161
+ if (block === "shutdown") keepRecordingOutput(session, "shutdown", shutdownDoc, ranAgainst);
168162
+ else keepRecordingOutput(session, "steps", doc, ranAgainst);
168163
+ }
168100
168164
  if (waitWarning) {
168101
- (session.stepWarnings ??= /* @__PURE__ */ new Map()).set(stepCount, {
168165
+ const verdicts = block === "shutdown" ? "shutdownStepWarnings" : "stepWarnings";
168166
+ (session[verdicts] ??= /* @__PURE__ */ new Map()).set(stepCount, {
168102
168167
  ...waitWarning,
168103
168168
  step: stepAnchor(step)
168104
168169
  });
168105
168170
  }
168106
168171
  const baselineWrites = project instanceof ClientProjectAccess && ctx?.flowStack === void 0 ? project.baselineDirectives() : [];
168172
+ const fragmentShutdown = block === "steps" && step.kind === "run" && reportsShutdown(toolResult) ? `${step.flow} ran its shutdown: steps at the end of this call; a replay runs them at the end of the e2e test, after its later steps. If a later step needs what that shutdown undid (a login, a test user), record the fragment's steps one by one instead, its cleanup with shutdown: true, and swap them for the run: line after e2e-finish-recording` : void 0;
168173
+ const notes = [warning, fragmentShutdown].filter((n) => n !== void 0).join("; ");
168107
168174
  return {
168108
- message: `Step added to "${params.name}" e2e test${warning ? ` \u2014 ${warning}` : ""}`,
168175
+ message: `${params.shutdown ? "Shutdown step" : "Step"} added to "${params.name}" e2e test${notes ? ` \u2014 ${notes}` : ""}`,
168109
168176
  toolResult,
168110
168177
  stepCount,
168111
- recorded: summarizeStep(step, stepCount),
168178
+ recorded: (params.shutdown ? summarizeShutdownStep : summarizeStep)(step, stepCount),
168112
168179
  savedTo,
168113
168180
  ...baselineWrites.length > 0 ? { baselineWrites } : {}
168114
168181
  };
@@ -168123,12 +168190,13 @@ var zodSchema72 = external_exports.object({
168123
168190
  project_root: external_exports.string().describe(
168124
168191
  "Absolute path to the project root of the e2e test being recorded: the same value passed to e2e-start-recording."
168125
168192
  ),
168126
- message: external_exports.string().describe("Text the echo step prints")
168193
+ message: external_exports.string().describe("Text the echo step prints"),
168194
+ shutdown: external_exports.boolean().optional().describe("Save the message in the shutdown list. stepCount counts shutdown entries.")
168127
168195
  });
168128
168196
  var flowInsertEchoTool = {
168129
168197
  id: "e2e-add-echo",
168130
168198
  description: `Record an echo step in the e2e test named by \`name\` + \`project_root\`. Echo steps print a message when the e2e test is replayed, useful as labels between tool calls.
168131
- Use when you want to annotate a recorded e2e test with a human-readable label or checkpoint message.
168199
+ Use when you want to annotate a recorded e2e test with a human-readable label or checkpoint message; pass \`shutdown: true\` to label its shutdown steps.
168132
168200
  Returns { message, stepCount, savedTo }. Fails if that e2e test has no recording in progress.`,
168133
168201
  zodSchema: zodSchema72,
168134
168202
  fileInputs: PROJECT_ROOT_INPUT,
@@ -168142,12 +168210,13 @@ Returns { message, stepCount, savedTo }. Fails if that e2e test has no recording
168142
168210
  services: () => ({}),
168143
168211
  async execute(_services, params) {
168144
168212
  const session = await requireRecordingSession(params.project_root, params.name);
168145
- const { savedTo, stepCount } = await appendStepToFlow(session, {
168146
- kind: "echo",
168147
- message: params.message
168148
- });
168213
+ const { savedTo, stepCount } = await appendStepToFlow(
168214
+ session,
168215
+ { kind: "echo", message: params.message },
168216
+ params.shutdown ? "shutdown" : "steps"
168217
+ );
168149
168218
  return {
168150
- message: `Echo added to "${params.name}" e2e test`,
168219
+ message: `${params.shutdown ? "Shutdown echo" : "Echo"} added to "${params.name}" e2e test`,
168151
168220
  stepCount,
168152
168221
  savedTo
168153
168222
  };
@@ -168203,11 +168272,11 @@ init_src2();
168203
168272
  var fs81 = __toESM(require("node:fs/promises"));
168204
168273
  init_capability();
168205
168274
  var OUTPUT_RENDER_LIMIT_BYTES = 64 * 1024;
168206
- async function recordedStepCount(session) {
168207
- const onDisk = await countStepsOnDisk(session.filePath);
168275
+ async function recordedStepCount(session, block) {
168276
+ const onDisk = await countStepsOnDisk(session.filePath, block);
168208
168277
  if (onDisk !== void 0) return { stepCount: onDisk };
168209
168278
  return {
168210
- stepCount: session.flow.steps.length,
168279
+ stepCount: recordedCount(session.flow, block),
168211
168280
  note: `Could not verify stepCount from ${session.filePath}.`
168212
168281
  };
168213
168282
  }
@@ -168260,11 +168329,14 @@ var zodSchema74 = external_exports.object({
168260
168329
  timeout: external_exports.number().optional().describe("Time limit in milliseconds. The default is 30000 and the minimum is 100."),
168261
168330
  env: envRecordSchema(external_exports.string()).optional().describe(
168262
168331
  "Environment overrides for this script. Argent uses them immediately and saves them on the step. Values can include {{secret:NAME}} or {{output:PATH}}."
168332
+ ),
168333
+ shutdown: external_exports.boolean().optional().describe(
168334
+ "Save the script in the shutdown list. It still runs immediately. Its output reaches only later shutdown steps. stepCount counts shutdown entries."
168263
168335
  )
168264
168336
  });
168265
168337
  var flowAddScriptTool = {
168266
168338
  id: "e2e-add-script",
168267
- description: `Run a local JavaScript (.mjs, .js) or TypeScript (.mts, .ts) file and record it as a script step. Use when the user requests a local script in an active recording. Call it where the script must run. A successful script updates the shared output and returns it as \`outputJson\`. Later steps can read it with \`{{output:PATH}}\`. Returns \`status\`, \`reason\` and \`stepCount\`. A failed script is not recorded. Check \`reason\` and the affected state before retrying. Record without a link (argent link or ARGENT_TOOLS_URL).`,
168339
+ description: `Run a local JavaScript (.mjs, .js) or TypeScript (.mts, .ts) file and record it as a script step. Use when the user requests a local script in an active recording. Call it where the script must run. A successful script updates the shared output and returns it as \`outputJson\`. Later steps can read it with \`{{output:PATH}}\`. Use \`shutdown: true\` for cleanup scripts. Returns \`status\`, \`reason\` and \`stepCount\`. A failed script is not recorded. Check \`reason\` and the affected state before retrying. Record without a link (argent link or ARGENT_TOOLS_URL).`,
168268
168340
  zodSchema: zodSchema74,
168269
168341
  fileInputs: PROJECT_ROOT_INPUT,
168270
168342
  aliases: ["flow-add-script"],
@@ -168285,6 +168357,7 @@ var flowAddScriptTool = {
168285
168357
  services: () => ({}),
168286
168358
  async execute(_services, params, ctx) {
168287
168359
  const session = await requireRecordingSession(params.project_root, params.name);
168360
+ const block = params.shutdown ? "shutdown" : "steps";
168288
168361
  if (isLinkedRecorderCall(session, ctx)) {
168289
168362
  throw new FailureError(
168290
168363
  `Cannot add a script step to e2e test "${params.name}": the recording is over a link (argent link or ARGENT_TOOLS_URL), and an e2e test cannot run script steps over a link. Nothing ran and no step was recorded. To record a script step, record the e2e test on the computer that runs the tool-server, with no link and no ARGENT_TOOLS_URL.`,
@@ -168313,12 +168386,13 @@ var flowAddScriptTool = {
168313
168386
  };
168314
168387
  const flowDir = nodePath.dirname(await canonicalFlowPath(session.filePath));
168315
168388
  const env = mergeScriptEnv(await recordedFileEnv(session), step.env);
168389
+ const ranAgainst = recordingOutput(session, block);
168316
168390
  const { outcome, result, ran } = await runFlowScriptStep({
168317
168391
  flowDir,
168318
168392
  step,
168319
168393
  projectRoot: params.project_root,
168320
168394
  env,
168321
- output: session.output ?? {},
168395
+ output: ranAgainst,
168322
168396
  ...ctx?.clientSecrets ? { clientSecrets: ctx.clientSecrets } : {},
168323
168397
  ...ctx?.signal ? { signal: ctx.signal } : {}
168324
168398
  });
@@ -168337,10 +168411,10 @@ var flowAddScriptTool = {
168337
168411
  return {
168338
168412
  ...common,
168339
168413
  message: `Script "${step.path}" ${lead}; no step was recorded. ${lost} ${leftBehind} Use a new e2e test name because e2e-start-recording overwrites the existing file. stepCount is from the ended recording.`,
168340
- stepCount: session.flow.steps.length
168414
+ stepCount: recordedCount(session.flow, block)
168341
168415
  };
168342
168416
  }
168343
- const { stepCount: stepCount2, note } = await recordedStepCount(session);
168417
+ const { stepCount: stepCount2, note } = await recordedStepCount(session, block);
168344
168418
  return {
168345
168419
  ...common,
168346
168420
  message: `Script "${step.path}" ${lead}; no step was recorded. ${nextMove}` + (note ? ` ${note}` : ""),
@@ -168350,7 +168424,7 @@ var flowAddScriptTool = {
168350
168424
  let savedTo;
168351
168425
  let stepCount;
168352
168426
  try {
168353
- ({ savedTo, stepCount } = await appendStepToFlow(session, step));
168427
+ ({ savedTo, stepCount } = await appendStepToFlow(session, step, block));
168354
168428
  } catch (err) {
168355
168429
  const refusedAnEarlierStep = getFailureSignal(err)?.failure_stage === "flow_output_reference";
168356
168430
  throw wrapFailure(
@@ -168364,14 +168438,14 @@ var flowAddScriptTool = {
168364
168438
  `Script "${step.path}" passed, but the step was not recorded. ` + (refusedAnEarlierStep ? `Fix the existing step named below in ${session.filePath}. ` : "Check the script's changes before you retry. ") + `${err instanceof Error ? err.message : String(err)}`
168365
168439
  );
168366
168440
  }
168367
- if (result?.output) session.output = result.output;
168441
+ if (result?.output) keepRecordingOutput(session, block, result.output, ranAgainst);
168368
168442
  const rendered = result?.output ? renderOutput(result.output) : void 0;
168369
168443
  return {
168370
168444
  ...common,
168371
- message: `Added script step to "${params.name}" e2e test.`,
168445
+ message: `Added ${params.shutdown ? "shutdown " : ""}script step to "${params.name}" e2e test.`,
168372
168446
  ...rendered ?? {},
168373
168447
  stepCount,
168374
- recorded: summarizeStep(step, stepCount),
168448
+ recorded: (params.shutdown ? summarizeShutdownStep : summarizeStep)(step, stepCount),
168375
168449
  savedTo
168376
168450
  };
168377
168451
  }
@@ -168389,7 +168463,7 @@ function attachStepWarnings(summary, warnings) {
168389
168463
  }
168390
168464
  function warningHeadline(warnings, discarded) {
168391
168465
  const counts = { conversion: 0, wait: 0 };
168392
- for (const { kind } of warnings.values()) counts[kind] += 1;
168466
+ for (const { kind } of warnings) counts[kind] += 1;
168393
168467
  const clauses = [];
168394
168468
  if (counts.conversion > 0) {
168395
168469
  clauses.push(
@@ -168407,12 +168481,11 @@ function warningHeadline(warnings, discarded) {
168407
168481
  const drop = `${discarded} ${one ? "warning" : "warnings"} raised during this recording ${one ? "is" : "are"} NOT in \`summary\`: a hand edit to the .yaml moved the ${one ? "step it judged" : "steps they judged"}, so which step ${one ? "it belongs" : "they belong"} to is no longer knowable \u2014 re-record ${one ? "that wait" : "those waits"} to see ${one ? "it" : "them"} again`;
168408
168482
  return carried === "" ? ` \u2014 ${drop}` : `${carried}. ${drop}`;
168409
168483
  }
168410
- function anchoredWarnings(session, steps) {
168484
+ function anchoredWarnings(recorded, warnings, steps) {
168411
168485
  const kept = /* @__PURE__ */ new Map();
168412
- const recorded = session.flow.steps;
168413
168486
  if (recorded.length !== steps.length) return kept;
168414
168487
  if (!steps.every((step, i) => stepAnchor(step) === stepAnchor(recorded[i]))) return kept;
168415
- for (const [n, verdict] of session.stepWarnings ?? []) {
168488
+ for (const [n, verdict] of warnings ?? []) {
168416
168489
  const step = steps[n - 1];
168417
168490
  if (step !== void 0 && stepAnchor(step) === verdict.step) kept.set(n, verdict);
168418
168491
  }
@@ -168426,7 +168499,7 @@ var zodSchema75 = external_exports.object({
168426
168499
  });
168427
168500
  var flowFinishRecordingTool = {
168428
168501
  id: "e2e-finish-recording",
168429
- description: `Finish recording the e2e test named by \`name\` + \`project_root\`, leaving recordings under any other key untouched. Returns { message, path, executionPrerequisite, steps, summary, e2eTestFile, savedTo } - a summary of all recorded steps plus the final YAML. Use when you have added all desired steps and want to finalize the e2e test file. Fails if that e2e test has no recording in progress.
168502
+ description: `Finish recording the e2e test named by \`name\` + \`project_root\`, leaving recordings under any other key untouched. Returns the final YAML and a step summary, including \`shutdownSteps\` when shutdown has entries. Use when you have added all desired steps and want to finalize the e2e test file. Fails if that e2e test has no recording in progress.
168430
168503
  A warning e2e-add-step raised on a recorded \`await-ui-element\` is repeated in \`summary\` as a \`warning:\` line right below its step, and \`message\` counts them by kind. Read them before you convert a wait to \`await:\`/\`assert:\` or replay the e2e test.
168431
168504
  You can still edit the .yaml file directly afterwards to remove or reorder steps.`,
168432
168505
  zodSchema: zodSchema75,
@@ -168460,10 +168533,24 @@ You can still edit the .yaml file directly afterwards to remove or reorder steps
168460
168533
  savedTo2 = filePath2;
168461
168534
  }
168462
168535
  const flow2 = parseFlow(flowFile2);
168463
- const anchored = anchoredWarnings(session, flow2.steps);
168464
- const summary2 = attachStepWarnings(summarizeSteps(flow2), anchored);
168465
- const discarded = (session.discardedWarnings ?? 0) + (session.stepWarnings?.size ?? 0) - anchored.size;
168466
- const headline2 = warningHeadline(anchored, discarded);
168536
+ const anchored = anchoredWarnings(session.flow.steps, session.stepWarnings, flow2.steps);
168537
+ const shutdownAnchored = anchoredWarnings(
168538
+ session.flow.shutdown ?? [],
168539
+ session.shutdownStepWarnings,
168540
+ flow2.shutdown ?? []
168541
+ );
168542
+ const summary2 = [
168543
+ ...attachStepWarnings(summarizeSteps(flow2), anchored),
168544
+ ...attachStepWarnings(
168545
+ (flow2.shutdown ?? []).map((step, i) => summarizeShutdownStep(step, i + 1)),
168546
+ shutdownAnchored
168547
+ )
168548
+ ];
168549
+ const discarded = (session.discardedWarnings ?? 0) + (session.stepWarnings?.size ?? 0) + (session.shutdownStepWarnings?.size ?? 0) - anchored.size - shutdownAnchored.size;
168550
+ const headline2 = warningHeadline(
168551
+ [...anchored.values(), ...shutdownAnchored.values()],
168552
+ discarded
168553
+ );
168467
168554
  clearRecordingSession(session);
168468
168555
  return { filePath: filePath2, flowFile: flowFile2, savedTo: savedTo2, flow: flow2, summary: summary2, headline: headline2 };
168469
168556
  }
@@ -168471,10 +168558,11 @@ You can still edit the .yaml file directly afterwards to remove or reorder steps
168471
168558
  return {
168472
168559
  // Name the counts in `message` as well. A caller that reads only
168473
168560
  // `message` would otherwise polish blind.
168474
- message: `Finished recording "${params.name}" e2e test (${flow.steps.length} steps)` + headline,
168561
+ message: `Finished recording "${params.name}" e2e test (${flow.steps.length} steps` + (flow.shutdown ? `, ${flow.shutdown.length} shutdown steps` : "") + `)` + headline,
168475
168562
  path: filePath,
168476
168563
  executionPrerequisite: flow.executionPrerequisite,
168477
168564
  steps: flow.steps.length,
168565
+ ...flow.shutdown ? { shutdownSteps: flow.shutdown.length } : {},
168478
168566
  summary,
168479
168567
  e2eTestFile: flowFile,
168480
168568
  flowFile,
@@ -170919,10 +171007,10 @@ async function turnPngToNative(src, dest, orientation) {
170919
171007
 
170920
171008
  // ../tool-server/src/utils/status-bar.ts
170921
171009
  var import_node_child_process55 = require("node:child_process");
170922
- var import_node_util42 = require("node:util");
171010
+ var import_node_util43 = require("node:util");
170923
171011
  init_adb();
170924
171012
  init_device_info();
170925
- var execFileAsync46 = (0, import_node_util42.promisify)(import_node_child_process55.execFile);
171013
+ var execFileAsync46 = (0, import_node_util43.promisify)(import_node_child_process55.execFile);
170926
171014
  var DEMO_BROADCAST = "am broadcast -a com.android.systemui.demo";
170927
171015
  var IOS_STATUS_BAR_OVERRIDE = [
170928
171016
  "override",
@@ -171774,11 +171862,14 @@ Without a link, every step kind runs.`,
171774
171862
  } catch (error63) {
171775
171863
  thrown = { error: error63 };
171776
171864
  }
171865
+ const caller = ctx?.flowOutput;
171866
+ if (caller) state3.output = { doc: caller.doc };
171777
171867
  try {
171778
171868
  await execShutdown(state3);
171779
171869
  } catch (error63) {
171780
171870
  thrown ??= { error: error63 };
171781
171871
  }
171872
+ if (caller) caller.shutdownDoc = state3.output.doc;
171782
171873
  if (thrown) throw thrown.error;
171783
171874
  } finally {
171784
171875
  aborted2 = state3.signal?.aborted === true;
@@ -174602,9 +174693,9 @@ function createLensTools(registry2) {
174602
174693
  var import_node_child_process57 = require("node:child_process");
174603
174694
  var import_node_fs24 = require("node:fs");
174604
174695
  var import_node_path33 = require("node:path");
174605
- var import_node_util43 = require("node:util");
174696
+ var import_node_util44 = require("node:util");
174606
174697
  init_android_binary();
174607
- var execFileAsync47 = (0, import_node_util43.promisify)(import_node_child_process57.execFile);
174698
+ var execFileAsync47 = (0, import_node_util44.promisify)(import_node_child_process57.execFile);
174608
174699
  async function activeDeveloperDir2() {
174609
174700
  try {
174610
174701
  const { stdout } = await execFileAsync47("xcode-select", ["-p"], { timeout: 5e3 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.35.1-next.10",
3
+ "version": "0.35.1-next.11",
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": "9a1084bcf7b3296e3d4865a4f9de977ce4598510"
101
+ "gitHead": "636886f1e85fd60a9b736a506b00cf0033bd6a83"
102
102
  }
@@ -37,6 +37,12 @@ Obey these lifecycle rules:
37
37
  5. Edit or reorder the YAML only after `e2e-finish-recording`.
38
38
  6. Set script defaults with `e2e-start-recording.env` or call `e2e-set-env` directly before recording the script. Use `e2e-add-script.env` for values specific to one step. The tool runs the script immediately. If a secret is missing, check the project’s secret sources before retrying.
39
39
 
40
+ ## Record cleanup after the main steps
41
+
42
+ Pass `shutdown: true` to `e2e-add-step` or `e2e-add-script` for cleanup. Use the same flag on `e2e-add-echo` to label it. Actions and scripts run immediately. Check the `recorded` line for the `shutdown` prefix and read any wait warning before continuing.
43
+
44
+ Read the result of any call recorded as `run:`. If the fragment already ran cleanup and later steps need that state, record its main steps individually and its cleanup with `shutdown: true`. Replace those steps with the fragment call after `e2e-finish-recording`. See [Shutdown](e2e-yaml.md#shutdown) for replay order.
45
+
40
46
  ## Start in the correct order
41
47
 
42
48
  ### iOS, Android, and Vega standalone tests