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

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.
Files changed (48) hide show
  1. package/bin/argent-android-devtools-0.4.0.apk +0 -0
  2. package/bin/darwin/argent-macos-helper +0 -0
  3. package/bin/darwin/ax-service +0 -0
  4. package/bin/darwin/tvos-ax-service +0 -0
  5. package/bin/darwin/tvos-hid-daemon +0 -0
  6. package/bin/network-inspector/network-inspector.jar +0 -0
  7. package/bin/tcp/ax-service +0 -0
  8. package/dist/cli-cmds.mjs +1 -1
  9. package/dist/installer.mjs +1 -1
  10. package/dist/mcp-server.mjs +1 -1
  11. package/dist/tool-args.generated.d.ts +2 -2
  12. package/dist/tool-server.cjs +167 -25
  13. package/dylibs/libArgentAudio.dylib +0 -0
  14. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  15. package/dylibs/libKeyboardPatch.dylib +0 -0
  16. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  17. package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
  18. package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
  19. package/dylibs/tcp/argent-audio-feeder +0 -0
  20. package/dylibs/tcp/libArgentAudio.dylib +0 -0
  21. package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
  22. package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
  23. package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
  24. package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
  25. package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
  26. package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
  27. package/package.json +2 -2
  28. package/skills/argent-android-emulator-setup/SKILL.md +2 -2
  29. package/skills/argent-create-e2e/SKILL.md +1 -1
  30. package/skills/argent-create-e2e/references/live-authoring.md +4 -2
  31. package/skills/argent-device-interact/SKILL.md +21 -94
  32. package/skills/argent-device-interact/references/advanced.md +64 -0
  33. package/skills/argent-ios-device-interact/SKILL.md +1 -1
  34. package/skills/argent-ios-device-setup/SKILL.md +1 -1
  35. package/skills/argent-ios-simulator-setup/SKILL.md +1 -1
  36. package/skills/argent-lens/SKILL.md +1 -1
  37. package/skills/argent-macos-app-interact/SKILL.md +1 -1
  38. package/skills/argent-metro-debugger/SKILL.md +1 -1
  39. package/skills/argent-native-profiler/SKILL.md +1 -1
  40. package/skills/argent-qa-e2e/SKILL.md +1 -1
  41. package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
  42. package/skills/argent-react-native-optimization/SKILL.md +1 -1
  43. package/skills/argent-react-native-profiler/SKILL.md +1 -1
  44. package/skills/argent-screen-recording/SKILL.md +1 -1
  45. package/skills/argent-screenshot-diff/SKILL.md +1 -1
  46. package/skills/argent-settings-permissions/SKILL.md +1 -1
  47. package/skills/argent-test-ui-flow/SKILL.md +1 -1
  48. package/skills/argent-tv-interact/SKILL.md +1 -1
Binary file
Binary file
Binary file
Binary file
Binary file
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.9";
38591
+ return "0.35.1-next.13";
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.9";
17106
+ return "0.35.1-next.13";
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.9" : installedVersion;
38061
+ const highlightsVersion = true ? "0.35.1-next.13" : installedVersion;
38062
38062
  const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
38063
38063
  const trees = createTreeMemory();
38064
38064
  const screenshots = createScreenshotMemory();
@@ -263,7 +263,7 @@ export interface ArgentToolArgs {
263
263
  env?: {
264
264
  [key: string]: string;
265
265
  };
266
- /** Save the script in the shutdown list. It still runs immediately. Its output reaches only later shutdown steps. stepCount counts shutdown entries. */
266
+ /** Save the script in the shutdown list. Pending fragment cleanup runs before the script. The script's output reaches only later shutdown steps. stepCount counts shutdown entries. */
267
267
  shutdown?: boolean;
268
268
  };
269
269
  "e2e-add-step": {
@@ -277,7 +277,7 @@ export interface ArgentToolArgs {
277
277
  args?: string;
278
278
  /** Milliseconds to sleep before executing this step during replay. */
279
279
  delayMs?: number;
280
- /** Save the call in the shutdown list. The call still runs immediately. stepCount counts shutdown entries. */
280
+ /** Save the call in the shutdown list. Pending fragment cleanup runs before the call. stepCount counts shutdown entries. */
281
281
  shutdown?: boolean;
282
282
  };
283
283
  "e2e-execute": {
@@ -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.9";
72960
+ return "0.35.1-next.13";
72961
72961
  }
72962
72962
  return "0.0.0";
72963
72963
  }
@@ -78710,6 +78710,67 @@ function keepRecordingOutput(session, block, doc, ranAgainst) {
78710
78710
  }
78711
78711
  }
78712
78712
  }
78713
+ async function runDeferredShutdown(session, ctx) {
78714
+ const queued = session.deferredShutdown;
78715
+ if (!queued?.length) return void 0;
78716
+ delete session.deferredShutdown;
78717
+ const ranAgainst = recordingOutput(session, "shutdown");
78718
+ const output2 = { doc: structuredClone(ranAgainst) };
78719
+ const steps = [];
78720
+ const kept = [];
78721
+ let thrown;
78722
+ for (const run2 of [...queued].reverse()) {
78723
+ if (!ctx?.signal?.aborted) {
78724
+ try {
78725
+ await run2(ctx, output2, steps);
78726
+ } catch (error63) {
78727
+ thrown ??= { error: error63 };
78728
+ }
78729
+ }
78730
+ if (ctx?.signal?.aborted) kept.unshift(run2);
78731
+ }
78732
+ if (kept.length > 0) session.deferredShutdown = [...kept, ...session.deferredShutdown ?? []];
78733
+ keepRecordingOutput(session, "shutdown", output2.doc, ranAgainst);
78734
+ if (thrown) throw thrown.error;
78735
+ if (steps.length === 0) return void 0;
78736
+ const failed3 = steps.some((s) => {
78737
+ const status = s.status;
78738
+ return status === "fail" || status === "error";
78739
+ });
78740
+ return { ok: !failed3, steps };
78741
+ }
78742
+ function fragmentShutdownNote(report) {
78743
+ const total = report.steps.length;
78744
+ const count2 = (...statuses) => report.steps.filter((s) => statuses.includes(s.status ?? "")).length;
78745
+ const failed3 = count2("fail", "error");
78746
+ const skipped = count2("skip");
78747
+ return `Separately, the recording ran the kept shutdown: of the fragments recorded as run: steps, as a replay does before the shutdown steps (${total} ${total === 1 ? "step" : "steps"}` + (failed3 === 0 ? "" : `, ${failed3} failed; see fragmentShutdown`) + (skipped === 0 ? "" : `, ${skipped} skipped as cancelled, which a later shutdown call or the finish runs again`) + `).`;
78748
+ }
78749
+ async function afterDeferredShutdown(session, ctx, call) {
78750
+ const report = await runDeferredShutdown(session, ctx);
78751
+ if (!report) return call();
78752
+ const note = fragmentShutdownNote(report);
78753
+ let result;
78754
+ try {
78755
+ result = await call();
78756
+ } catch (err) {
78757
+ if (err instanceof Error) err.message = `${err.message} ${note}`;
78758
+ throw err;
78759
+ }
78760
+ const lead = /[.!?]$/.test(result.message) ? result.message : `${result.message}.`;
78761
+ return { ...result, message: `${lead} ${note}`, fragmentShutdown: report };
78762
+ }
78763
+ function deferredShutdownFirst(tool) {
78764
+ const record2 = tool.execute.bind(tool);
78765
+ return {
78766
+ ...tool,
78767
+ async execute(services, params, ctx) {
78768
+ if (!params.shutdown) return record2(services, params, ctx);
78769
+ const session = await requireRecordingSession(params.project_root, params.name);
78770
+ return afterDeferredShutdown(session, ctx, () => record2(services, params, ctx));
78771
+ }
78772
+ };
78773
+ }
78713
78774
  function recordedCount(flow, block) {
78714
78775
  return block === "shutdown" ? flow.shutdown?.length ?? 0 : flow.steps.length;
78715
78776
  }
@@ -164485,7 +164546,7 @@ var zodSchema70 = external_exports.object({
164485
164546
  });
164486
164547
  var flowStartRecordingTool = {
164487
164548
  id: "e2e-start-recording",
164488
- description: `Start recording a new e2e test, resetting .argent/e2e/<name>.yaml to an empty e2e test and replacing any existing one.
164549
+ description: `Start recording a new e2e test, resetting .argent/e2e/<name>.yaml to an empty e2e test and replacing any existing one. A restart runs pending fragment cleanup from the discarded recording and reports it in \`fragmentShutdown\`.
164489
164550
  Use when you want to capture a reusable sequence of device interactions for later replay. Load the argent-create-e2e skill first: it holds the polish, audit and replay steps. Not for Apple TV or Android TV.
164490
164551
  Returns { message, e2eTestFile, savedTo } and optionally { restarted, discardedSteps } if a live recording of the same e2e test was discarded.
164491
164552
  Without a link, it creates that file and fails if the .argent/e2e/ directory cannot be created or the file cannot be written. Over a link (argent link or ARGENT_TOOLS_URL, also to 127.0.0.1), your client writes the file, and \`savedTo\` is its path on your computer, or null when that write failed.
@@ -164524,6 +164585,8 @@ and without a link, an edit that renumbers the steps drops their warnings.`,
164524
164585
  failedMsg: ({ params, failureSignal: failureSignal2 }) => `Failed to start recording of e2e test ${params.name}: ${failureSignal2.error_code}`
164525
164586
  },
164526
164587
  fileInputs: fileInputs3,
164588
+ // A restart may run the discarded take's fragment shutdown, on the device.
164589
+ longRunning: true,
164527
164590
  services: () => ({}),
164528
164591
  async execute(_services, params, ctx) {
164529
164592
  if (params.env) {
@@ -164566,11 +164629,13 @@ and without a link, an edit that renumbers the steps drops their warnings.`,
164566
164629
  }
164567
164630
  );
164568
164631
  if (replaced) {
164632
+ const fragmentShutdown = await runDeferredShutdown(replaced, ctx);
164569
164633
  const reset = persist2 === "host" ? `${filePath} reset to an empty e2e test.` : `${filePath} is reset to an empty e2e test once your client applies \`savedTo\` (a null \`savedTo\` means it did not).`;
164570
164634
  const lost = discardedSteps === void 0 ? "the previous take" : `the previous take (${discardedSteps} step${discardedSteps === 1 ? "" : "s"})`;
164571
164635
  return {
164572
- message: `Restarted recording "${params.name}" \u2014 ${lost} was discarded and ` + reset,
164636
+ message: `Restarted recording "${params.name}" \u2014 ${lost} was discarded and ` + reset + (fragmentShutdown ? ` ${fragmentShutdownNote(fragmentShutdown)}` : ""),
164573
164637
  restarted: true,
164638
+ ...fragmentShutdown ? { fragmentShutdown } : {},
164574
164639
  ...discardedSteps === void 0 ? {} : { discardedSteps },
164575
164640
  e2eTestFile: flowFile,
164576
164641
  flowFile,
@@ -167635,7 +167700,10 @@ async function activeFlowState(session, block) {
167635
167700
  }
167636
167701
  function reportsShutdown(result) {
167637
167702
  const steps = result?.steps;
167638
- return Array.isArray(steps) && steps.some((s) => s?.shutdown === true);
167703
+ return Array.isArray(steps) && steps.some((s) => {
167704
+ const step = s;
167705
+ return step?.shutdown === true && step.status !== "skip";
167706
+ });
167639
167707
  }
167640
167708
  async function recordNothing(session, guidance, block) {
167641
167709
  const { stepCount, note } = await activeFlowState(session, block);
@@ -167892,11 +167960,11 @@ var zodSchema71 = external_exports.object({
167892
167960
  ),
167893
167961
  delayMs: external_exports.number().int().min(0).optional().describe("Milliseconds to sleep before executing this step during replay."),
167894
167962
  shutdown: external_exports.boolean().optional().describe(
167895
- "Save the call in the shutdown list. The call still runs immediately. stepCount counts shutdown entries."
167963
+ "Save the call in the shutdown list. Pending fragment cleanup runs before the call. stepCount counts shutdown entries."
167896
167964
  )
167897
167965
  });
167898
167966
  function createFlowAddStepTool(registry2) {
167899
- return {
167967
+ return deferredShutdownFirst({
167900
167968
  id: "e2e-add-step",
167901
167969
  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.
167902
167970
  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.
@@ -167981,7 +168049,22 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
167981
168049
  }
167982
168050
  const runTarget = command === RUN_TARGET_COMMAND && params.delayMs === void 0 && !referencedArgs ? await captureRunTarget(session, args, project) : void 0;
167983
168051
  const ranAgainst = recordingOutput(session, block);
167984
- const sharedOutput = runTarget?.flow ? { doc: structuredClone(ranAgainst) } : void 0;
168052
+ const sharedOutput = runTarget?.flow ? { doc: structuredClone(ranAgainst), deferShutdown: block === "steps" } : void 0;
168053
+ let queued = false;
168054
+ const runUnrecordedShutdown = async () => {
168055
+ const run2 = sharedOutput?.deferredShutdown;
168056
+ if (!run2) return "";
168057
+ delete sharedOutput.deferredShutdown;
168058
+ const at = session.deferredShutdown?.indexOf(run2) ?? -1;
168059
+ if (at >= 0) session.deferredShutdown.splice(at, 1);
168060
+ else if (queued) return "";
168061
+ const steps = [];
168062
+ await run2(ctx, { doc: sharedOutput.doc }, steps).catch(() => void 0);
168063
+ const ok = !steps.some(
168064
+ (s) => ["fail", "error"].includes(s.status ?? "")
168065
+ );
168066
+ return ` No step was recorded, so the shutdown: of the fragment ran now (${ok ? "it passed" : "a step failed"}), and the device is as it would be after a replay of it.`;
168067
+ };
167985
168068
  let prepared;
167986
168069
  let toolResult;
167987
168070
  try {
@@ -168027,8 +168110,9 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
168027
168110
  if (linked && command === RUN_TARGET_COMMAND) {
168028
168111
  const outcome = nestedOrchestratorOutcome(RUN_TARGET_COMMAND, toolResult);
168029
168112
  if (outcome) {
168113
+ const ranShutdown = await runUnrecordedShutdown();
168030
168114
  throw new FailureError(
168031
- outcome.status === "fail" ? `Cannot record this call: the nested e2e test did not pass (${outcome.reason}). A replay over the same link fails at the same step. No step was recorded. Fix the nested e2e test, then call e2e-add-step again.` : `Cannot record this call: the nested e2e test did not run (${outcome.reason}). No step was recorded.`,
168115
+ (outcome.status === "fail" ? `Cannot record this call: the nested e2e test did not pass (${outcome.reason}). A replay over the same link fails at the same step. No step was recorded. Fix the nested e2e test, then call e2e-add-step again.` : `Cannot record this call: the nested e2e test did not run (${outcome.reason}). No step was recorded.`) + ranShutdown,
168032
168116
  {
168033
168117
  error_code: FAILURE_CODES.FLOW_FILE_INVALID,
168034
168118
  failure_stage: "flow_add_step_nested_failed",
@@ -168138,13 +168222,21 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
168138
168222
  delayMs: params.delayMs
168139
168223
  };
168140
168224
  }
168225
+ if (step.kind === "run" && sharedOutput?.deferredShutdown) {
168226
+ (session.deferredShutdown ??= []).push(sharedOutput.deferredShutdown);
168227
+ queued = true;
168228
+ }
168141
168229
  let savedTo;
168142
168230
  let stepCount;
168143
168231
  try {
168144
168232
  ({ savedTo, stepCount } = await appendStepToFlow(session, step, block));
168145
168233
  } catch (err) {
168146
- if (getFailureSignal(err)?.failure_stage !== "flow_output_reference") throw err;
168147
- const refused = err instanceof Error ? err.message : String(err);
168234
+ const ranShutdown = await runUnrecordedShutdown();
168235
+ if (getFailureSignal(err)?.failure_stage !== "flow_output_reference") {
168236
+ if (err instanceof Error) err.message += ranShutdown;
168237
+ throw err;
168238
+ }
168239
+ const refused = (err instanceof Error ? err.message : String(err)) + ranShutdown;
168148
168240
  throw wrapFailure(
168149
168241
  err,
168150
168242
  {
@@ -168169,8 +168261,8 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
168169
168261
  });
168170
168262
  }
168171
168263
  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("; ");
168264
+ const ranShutdownNow = block === "steps" && step.kind === "run" && reportsShutdown(toolResult) ? `${step.flow} ran its shutdown: steps at the end of this call (its files came with the call, or it started its own chromium app); a replay runs them at the end of the e2e test` : void 0;
168265
+ const notes = [warning, ranShutdownNow].filter((n) => n !== void 0).join("; ");
168174
168266
  return {
168175
168267
  message: `${params.shutdown ? "Shutdown step" : "Step"} added to "${params.name}" e2e test${notes ? ` \u2014 ${notes}` : ""}`,
168176
168268
  toolResult,
@@ -168180,7 +168272,7 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
168180
168272
  ...baselineWrites.length > 0 ? { baselineWrites } : {}
168181
168273
  };
168182
168274
  }
168183
- };
168275
+ });
168184
168276
  }
168185
168277
 
168186
168278
  // ../tool-server/src/tools/flows/flow-insert-echo.ts
@@ -168331,10 +168423,10 @@ var zodSchema74 = external_exports.object({
168331
168423
  "Environment overrides for this script. Argent uses them immediately and saves them on the step. Values can include {{secret:NAME}} or {{output:PATH}}."
168332
168424
  ),
168333
168425
  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."
168426
+ "Save the script in the shutdown list. Pending fragment cleanup runs before the script. The script's output reaches only later shutdown steps. stepCount counts shutdown entries."
168335
168427
  )
168336
168428
  });
168337
- var flowAddScriptTool = {
168429
+ var flowAddScriptTool = deferredShutdownFirst({
168338
168430
  id: "e2e-add-script",
168339
168431
  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).`,
168340
168432
  zodSchema: zodSchema74,
@@ -168449,7 +168541,7 @@ var flowAddScriptTool = {
168449
168541
  savedTo
168450
168542
  };
168451
168543
  }
168452
- };
168544
+ });
168453
168545
 
168454
168546
  // ../tool-server/src/tools/flows/flow-finish-recording.ts
168455
168547
  init_zod();
@@ -168499,12 +168591,14 @@ var zodSchema75 = external_exports.object({
168499
168591
  });
168500
168592
  var flowFinishRecordingTool = {
168501
168593
  id: "e2e-finish-recording",
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.
168594
+ 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. Runs any pending fragment cleanup first and reports it in \`fragmentShutdown\`. 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.
168503
168595
  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.
168504
168596
  You can still edit the .yaml file directly afterwards to remove or reorder steps.`,
168505
168597
  zodSchema: zodSchema75,
168506
168598
  fileInputs: PROJECT_ROOT_INPUT,
168507
168599
  aliases: ["flow-finish-recording"],
168600
+ // It may run the fragments' shutdown, on the device.
168601
+ longRunning: true,
168508
168602
  interaction: {
168509
168603
  // Name the flow: other recordings stay live, so an unqualified message would
168510
168604
  // not identify which one.
@@ -168516,12 +168610,19 @@ You can still edit the .yaml file directly afterwards to remove or reorder steps
168516
168610
  failedMsg: ({ params, failureSignal: failureSignal2 }) => `Failed to finish recording of e2e test ${params.name}: ${failureSignal2.error_code}`
168517
168611
  },
168518
168612
  services: () => ({}),
168519
- async execute(_services, params) {
168613
+ async execute(_services, params, ctx) {
168614
+ let fragmentShutdown;
168520
168615
  const { filePath, flowFile, savedTo, flow, summary, headline } = await withFlowFileLock(
168521
168616
  params.project_root,
168522
168617
  params.name,
168523
168618
  async () => {
168524
168619
  const session = await requireRecordingSession(params.project_root, params.name);
168620
+ fragmentShutdown = await runDeferredShutdown(session, ctx);
168621
+ if (ctx?.signal?.aborted && session.deferredShutdown?.length) {
168622
+ throw new Error(
168623
+ `The finish was cancelled before the kept shutdown: of the fragments recorded as run: steps ran, so the recording "${params.name}" is still open. Call e2e-finish-recording again.`
168624
+ );
168625
+ }
168525
168626
  const filePath2 = session.filePath;
168526
168627
  let flowFile2;
168527
168628
  let savedTo2;
@@ -168554,15 +168655,22 @@ You can still edit the .yaml file directly afterwards to remove or reorder steps
168554
168655
  clearRecordingSession(session);
168555
168656
  return { filePath: filePath2, flowFile: flowFile2, savedTo: savedTo2, flow: flow2, summary: summary2, headline: headline2 };
168556
168657
  }
168557
- );
168658
+ ).catch((err) => {
168659
+ if (fragmentShutdown && err instanceof Error) {
168660
+ err.message = `${err.message} ${fragmentShutdownNote(fragmentShutdown)}`;
168661
+ }
168662
+ throw err;
168663
+ });
168664
+ const ran = fragmentShutdown;
168558
168665
  return {
168559
168666
  // Name the counts in `message` as well. A caller that reads only
168560
168667
  // `message` would otherwise polish blind.
168561
- message: `Finished recording "${params.name}" e2e test (${flow.steps.length} steps` + (flow.shutdown ? `, ${flow.shutdown.length} shutdown steps` : "") + `)` + headline,
168668
+ message: `Finished recording "${params.name}" e2e test (${flow.steps.length} steps` + (flow.shutdown ? `, ${flow.shutdown.length} shutdown steps` : "") + `)` + headline + (ran ? `. ${fragmentShutdownNote(ran)}` : ""),
168562
168669
  path: filePath,
168563
168670
  executionPrerequisite: flow.executionPrerequisite,
168564
168671
  steps: flow.steps.length,
168565
168672
  ...flow.shutdown ? { shutdownSteps: flow.shutdown.length } : {},
168673
+ ...ran ? { fragmentShutdown: ran } : {},
168566
168674
  summary,
168567
168675
  e2eTestFile: flowFile,
168568
168676
  flowFile,
@@ -171864,12 +171972,16 @@ Without a link, every step kind runs.`,
171864
171972
  }
171865
171973
  const caller = ctx?.flowOutput;
171866
171974
  if (caller) state3.output = { doc: caller.doc };
171867
- try {
171868
- await execShutdown(state3);
171869
- } catch (error63) {
171870
- thrown ??= { error: error63 };
171975
+ if (caller?.deferShutdown && !thrown && canDeferShutdown(state3, viaUpload)) {
171976
+ caller.deferredShutdown = deferShutdown(state3);
171977
+ } else {
171978
+ try {
171979
+ await execShutdown(state3);
171980
+ } catch (error63) {
171981
+ thrown ??= { error: error63 };
171982
+ }
171983
+ if (caller) caller.shutdownDoc = state3.output.doc;
171871
171984
  }
171872
- if (caller) caller.shutdownDoc = state3.output.doc;
171873
171985
  if (thrown) throw thrown.error;
171874
171986
  } finally {
171875
171987
  aborted2 = state3.signal?.aborted === true;
@@ -172260,6 +172372,36 @@ async function execShutdown(state3) {
172260
172372
  await drainShutdown(state3, 0, thrown);
172261
172373
  if (thrown.length > 0) throw thrown[0];
172262
172374
  }
172375
+ function canDeferShutdown(state3, viaUpload) {
172376
+ return state3.shutdownQueue.length > 0 && !state3.signal?.aborted && !viaUpload && state3.owned.length === 0;
172377
+ }
172378
+ function deferShutdown(state3) {
172379
+ const queue = state3.shutdownQueue;
172380
+ return async (ctx, output2, reports) => {
172381
+ const { onStepReport: _, ...rest } = state3;
172382
+ const later = {
172383
+ ...rest,
172384
+ ctx,
172385
+ signal: ctx?.signal,
172386
+ reports,
172387
+ stopped: false,
172388
+ pinned: false,
172389
+ owned: [],
172390
+ output: output2,
172391
+ scriptLogBudget: createScriptLogBudget(),
172392
+ ...ctx?.emitProgress ? { onStepReport: ctx.emitProgress } : {},
172393
+ shutdownQueue: [...queue],
172394
+ inShutdown: false
172395
+ };
172396
+ try {
172397
+ await execShutdown(later);
172398
+ } finally {
172399
+ for (let i = later.owned.length - 1; i >= 0; i--) {
172400
+ await teardownBootedChromium(state3.registry, later.owned[i]);
172401
+ }
172402
+ }
172403
+ };
172404
+ }
172263
172405
  async function drainShutdown(state3, floor, thrown) {
172264
172406
  while (state3.shutdownQueue.length > floor) {
172265
172407
  const next = state3.shutdownQueue.pop();
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.35.1-next.11",
3
+ "version": "0.35.1-next.13",
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": "636886f1e85fd60a9b736a506b00cf0033bd6a83"
101
+ "gitHead": "eb7163afb29cd09a2d784f78f33cc51cdd9e8edb"
102
102
  }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-android-emulator-setup
3
- description: Set up and connect to an Android emulator using argent MCP tools. Use when starting a new session on Android, booting an emulator, getting a device serial, or before any UI interaction task.
3
+ description: Boot an Android emulator and find its serial with Argent. Use when no Android emulator is running yet or you need to pick and boot one.
4
4
  ---
5
5
 
6
6
  ## 1. Prerequisites
@@ -14,7 +14,7 @@ The Android SDK (platform tools and emulator) and an AVD, created in Android Stu
14
14
 
15
15
  ## 3. Using the device
16
16
 
17
- Pass the Android serial as `udid` to the same interaction tools as on iOS. See `argent-device-interact` for interaction tooling and the Android notes at the bottom of that skill. If a React Native app can't reach Metro, see `argent-metro-debugger` §1.
17
+ Pass the Android serial as `udid` to the same interaction tools as on iOS. See `argent-device-interact` (and its `references/advanced.md` for Android notes). If a React Native app can't reach Metro, see `argent-metro-debugger` §1.
18
18
 
19
19
  ## 4. Notes
20
20
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-create-e2e
3
- description: Create, record, edit, replay, or repair reusable Argent e2e test YAML files. Use when the user asks to record, replay, or run an e2e test or a repeatable device path, set up profiling or an A/B comparison, or invoke the authoring engine behind argent-qa-e2e. Also use before repeating three or more interactions. For one-off UI checks, acceptance-driven regression tests, or screen video, use argent-test-ui-flow, argent-qa-e2e, or argent-screen-recording respectively.
3
+ description: Create, record, edit, replay, or repair reusable Argent e2e test YAML files. Use when the user asks to record, replay, or run an e2e test or repeatable path, set up profiling/A-B comparison, or before repeating 3+ interactions. For one-off UI checks, writing QA regression tests, or screen video, use argent-test-ui-flow, argent-qa-e2e, or argent-screen-recording.
4
4
  ---
5
5
 
6
6
  # Create an Argent e2e test
@@ -39,9 +39,11 @@ Obey these lifecycle rules:
39
39
 
40
40
  ## Record cleanup after the main steps
41
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.
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 during the call. Check the `recorded` line for the `shutdown` prefix and read any wait warning before continuing.
43
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.
44
+ A fragment recorded as `run:` in the main list usually defers cleanup until the first shutdown action or script, or until `e2e-finish-recording`. Read `fragmentShutdown` and the call message before assuming cleanup passed. If the call was cancelled, finish the recording or retry the shutdown call to run queued cleanup.
45
+
46
+ For an uploaded fragment or one that starts its own Chromium app, read the message for cleanup that ran immediately. If later steps need the state it removed, record the fragment's main steps individually and its cleanup with `shutdown: true`. Replace those steps after `e2e-finish-recording`. See [Shutdown](e2e-yaml.md#shutdown) for replay order.
45
47
 
46
48
  ## Start in the correct order
47
49
 
@@ -1,103 +1,30 @@
1
1
  ---
2
2
  name: argent-device-interact
3
- description: Interact with an iOS simulator or iPhone, Android emulator or phone, or Chromium (CDP) app using argent MCP tools. Use when tapping UI elements, performing gestures, scrolling/swiping, typing text, pressing hardware buttons, launching apps, opening URLs, taking screenshots, waiting for an element to appear or disappear, or checking visible app state after interactions. Not for TV targets.
3
+ description: Drive iOS, Android, or Chromium apps with Argent MCP tools. Use when tapping, swiping, typing, launching apps, waiting for UI, or taking screenshots (not for TV targets).
4
4
  ---
5
5
 
6
- Each tool's own description carries its parameters, defaults, return shape and examples. This skill covers choosing between tools and the gotchas those descriptions don't state.
6
+ Each tool's description carries its parameters, defaults, and return shape. This skill covers routing and gotchas those descriptions don't state.
7
7
 
8
- ## 1. Before You Start
8
+ ## Target Routing
9
9
 
10
- - Get a target id from `list-devices`; if none is ready, `boot-device` one. Full setup flow: `argent-ios-simulator-setup` / `argent-ios-device-setup` / `argent-android-emulator-setup`. The same tool names drive iOS, Android and Chromium; each takes the `udid` from `list-devices`.
11
- - Physical iPhone (`kind: "device"`): read `argent-ios-device-interact` first. Only the tools it lists exist there, and `describe` sees only the app `launch-app` registered.
12
- - Mac app (`platform: "macos"`): read `argent-macos-app-interact` first.
13
- - Read the matching reference before driving these targets: `references/chromium.md` for a `chromium` target, `references/harmonyos.md` for a `harmony` target, `references/foldables.md` for a device `list-devices` marks `foldable: true` (or before calling `fold`).
14
- - Load a deferred tool's schema with ToolSearch before its first call (e.g. `gesture-pinch`, `gesture-rotate`, `gesture-custom`); without it, numbers go out as strings and fail validation.
15
- - If you delegate device tasks to sub-agents, make sure they have MCP permissions.
10
+ - Get a `udid` from `list-devices` (or `boot-device` if none is ready). Full setup: `argent-ios-simulator-setup` / `argent-ios-device-setup` / `argent-android-emulator-setup`.
11
+ - Before driving a specialized target, read the matching instructions below:
12
+ - Physical iPhone (`kind: "device"`): `argent-ios-device-setup` and `argent-ios-device-interact`
13
+ - Mac app (`platform: "macos"`): `argent-macos-app-interact`
14
+ - TV (`runtimeKind: "tv"` or `platform: "vega"`): `argent-tv-interact`
15
+ - Chromium / HarmonyOS / foldables (`foldable: true`): `references/chromium.md`, `references/harmonyos.md`, `references/foldables.md`
16
+ - Load any deferred tool's schema (e.g. `gesture-custom`, `gesture-pinch`, `gesture-rotate`) before its first call so numbers don't serialize as strings.
17
+ - If delegating device tasks to sub-agents, ensure they have MCP permissions.
16
18
 
17
- ## 2. Choosing the Right Tool
19
+ ## Core Rules
18
20
 
19
- | Action | Tool | Notes |
20
- | ------------------------------ | -------------------- | -------------------------------------------------------------- |
21
- | Several known steps | `run-sequence` | One call, one screenshot at the end (§5) |
22
- | Open an app | `launch-app` | **Never tap home-screen icons** |
23
- | Restart an app | `restart-app` | Clean in-memory state |
24
- | Open URL / deep link | `open-url` | Web pages, deep links, URL schemes |
25
- | Tap | `gesture-tap` | Buttons, links, checkboxes |
26
- | Scroll / swipe | `gesture-swipe` | Touch targets; not Chromium |
27
- | Scroll (Chromium) | `gesture-scroll` | Mouse wheel |
28
- | Drag (Chromium) | `gesture-drag` | Sliders, drag-and-drop, text selection |
29
- | Long press, drag & drop | `gesture-custom` | Also any other non-linear touch sequence |
30
- | Pinch / zoom | `gesture-pinch` | |
31
- | Two-finger rotation | `gesture-rotate` | |
32
- | Hardware key | `button` | Home, back, power, volume, appSwitch, actionButton |
33
- | Type text or press a named key | `keyboard` | Every platform; text or one key per call (§6) |
34
- | Paste text | `paste` | Only where a user would paste (§6). Sim/emu, Mac app |
35
- | Rotate device | `rotate` | Orientation changes |
36
- | Fold device | `fold` | Foldables only: `references/foldables.md` |
37
- | Shake device | `shake` | Shake handlers (sim/emu only), Undo-typing prompt, RN dev menu |
38
- | Slow or offline network | `network-conditions` | iOS simulator app, Android emulator, or Chromium tab |
39
- | Wait for UI | `await-ui-element` | Block until an element is visible/hidden/exists/contains text |
40
- | Wait for idle | `await-screen-idle` | Block until a non-empty tree holds for `minStableMs` (§4) |
21
+ - **Open apps directly:** use `launch-app` or `open-url`, never tap home-screen icons. Use `restart-app` for clean in-memory state.
22
+ - **Use the returned element tree:** interaction tools already attach a downscaled screenshot and `--- Elements after action (describe) ---` with normalized `[0,1]` tap frames. Call `describe` only when no fresh tree covers the current screen. Never derive routine tap coordinates from pixels.
23
+ - **Tree & screenshot IDs:** full trees/screenshots carry a `Tree id` / `Screenshot id`. When unchanged or slightly changed, a later result references that id (unchanged note or `-`/`+` diff); call `describe` or `screenshot` if that earlier result isn't in context. An identical tree does not mean the action did nothing.
24
+ - **Batch known steps:** use `run-sequence` when multiple consecutive steps are known ahead of time (scroll sweeps, type + enter, form fill + submit).
25
+ - **Text entry:** tap the field first (`keyboard` with no focus is a silent no-op). `keyboard` takes either `text` or `key`, not both. Keep `keyboard` as default; reserve `paste` for real paste flows (OTP, long tokens). Use `{{secret:<NAME>}}` placeholders for credentials and navigate/submit before capturing non-secure fields.
26
+ - **Wait server-side:** never poll `screenshot` or `describe` in a loop. Use `await-ui-element`, or use `await-screen-idle` before tapping moving UI.
27
+ - **Dialogs:** `describe` exposes simulator/emulator system & permission dialogs; prefer answering the app's dialog over `settings-permissions`.
28
+ - **Screenshots:** keep the default downscaled capture for UI checks; do not pass `scale: 1.0` as a tapping/readability aid.
41
29
 
42
- After a network test, call `network-conditions` with the same target and omit the conditions to reset. On Android, this brings an offline emulator back online. If an Argent crash leaves an emulator's proxy active, reset before retrying.
43
-
44
- ## 3. Finding Tap Targets
45
-
46
- After an action moves you to a different screen, or whenever you don't know an element's coordinates, discover before tapping. Interaction results already carry the element tree (`--- Elements after action (describe) ---`): use it, and call a discovery tool only when no fresh tree covers the current screen. Each full tree has a `Tree id`, and each full screenshot has a `Screenshot id`. When the tree or screenshot matches an earlier one (or only a few tree lines changed), the result names that id in place of repeating it (an unchanged note, or `-` gone / `+` new lines against it): refer back to the named result, and call `describe` or `screenshot` if it is not in your context. An identical tree does not mean the action did nothing.
47
-
48
- | Need | Tool |
49
- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
50
- | Any screen: app, system dialog, Home screen | `describe` |
51
- | UIKit properties of a view (iOS simulator) | `native-find-views` (needs `bundleId` and a class, id, label, tag or `nativeID` to match) |
52
- | What sits at a known raw point (iOS simulator) | `native-view-at-point` (the visually deepest view; `hitTest: true` for the view that receives touch) |
53
- | Final visual fallback | `screenshot`, only when the tools above cannot expose the control. Do not derive routine in-app navigation targets from pixels |
54
-
55
- If `describe` returns an empty tree, follow its `hint`; with no hint, the screen is blank, loading or unlabeled: check the attached screenshot and retry once content has loaded.
56
-
57
- For a React Native testID or component name that `describe` does not show, use `debugger-component-tree`; take tap points from `describe`.
58
-
59
- **React Native:** LogBox toasts sit over the bottom of the screen and catch taps meant for what is under them. Argent hides them when a `debugger-*` tool connects and after `debugger-reload-metro`; after `restart-app`, call a `debugger-*` tool again. After any other reload they come back: close each by tapping the right end of its `describe` frame (the X), not its middle.
60
-
61
- **System and permission dialogs:** on a simulator or emulator, `describe` returns a visible dialog's buttons with tap coordinates; keep using it for in-app modals too. Fall back to `screenshot` only if it does not expose the controls: then tap one obvious button (`Allow`, `OK`, `Don't Allow`, `Not Now`, `Continue`) at a time, check the returned screenshot, and go back to `describe` once the dialog is gone.
62
-
63
- > **Prefer the dialog over the Settings tool.** When the app triggers its own permission prompt, answering it is the real user path. Use `settings-permissions` only when you can't make the change through the app: set a permission _before_ the app asks, re-enable one the user denied (iOS won't re-prompt), or reset it so the prompt reappears. See `argent-settings-permissions`.
64
-
65
- ## 4. Waiting: `await-ui-element` and `await-screen-idle`
66
-
67
- **Never poll `screenshot`/`describe` in a loop to wait for something.** `await-ui-element` blocks server-side on the same tree `describe` reads. It has no bare-timer mode; for a plain pause, use your own harness sleep. Its description covers conditions, selector matching and defaults. What it does not tell you:
68
-
69
- - A `hidden` check that succeeds **immediately** may be a false pass: its `note` then says the selector never matched anything. Treat that as a failed check and fix the selector; it does not mean "the element went away".
70
- - The synthetic `ROOT` container `describe` prints is never matched, so a `role` like `AXGroup`/`html` won't trivially "match the screen".
71
- - To disambiguate a loose selector, pin `role` to a text role like `StaticText`; that skips a same-named button.
72
-
73
- `await-screen-idle` is for live diagnosis after a launch or navigation, before a raw tap on an element that may still be moving. Continue only when `settled: true`, and pair it with an `await-ui-element` for the destination: stillness does not identify a screen, and the tool can return during a presentation-layer animation. Do not record it in an e2e test; tests use `await: { idle: true }`, which also compares pixels.
74
-
75
- ## 5. Action Sequencing with `run-sequence`
76
-
77
- Use `run-sequence` when every step is known in advance; if a step depends on what the previous one shows, use separate calls. Its description lists the allowed tools and their arguments. Typical batches:
78
-
79
- - "scroll to bottom", "scroll until X": 3-5 swipes
80
- - "clear and retype a field": triple-tap to select all, then type the new value
81
- - typing then submitting: a `keyboard` text step, then a `keyboard` `enter` step (one call cannot carry both)
82
- - "submit form": fill every field, then tap submit
83
- - "go back to X": a known tap path
84
-
85
- Use `await-ui-element` to gate a step on a screen transition. To gate on a request, start capture before the sequence and put `await-network-request` after the triggering action. A failed step, including a wait with `success: false`, stops the sequence and returns partial results.
86
-
87
- ## 6. Text Entry and Secrets
88
-
89
- - Tap the field first. Typing or pasting with no focused field is a silent no-op.
90
- - `paste` is **not** a faster `keyboard`. `keyboard` types the way a user types and stays the default for every text entry. Use `paste` only where a real user would paste: a 2FA / OTP code from another app, a long link or token, or testing how the app handles pasted input. That it can carry text `keyboard` can't type on a platform (multi-line text, non-ASCII on Android) is not a reason on its own.
91
- - **Credentials:** type them as a `{{secret:<NAME>}}` placeholder in `text` (`keyboard`, `paste`, `run-sequence` keyboard steps, e2e `type` steps), never as plaintext, and never ask the user for the value. Do **not** `describe` or `screenshot` a non-secure field you just filled with a secret: submit or navigate away first, then verify the resulting screen.
92
-
93
- ## 7. Screenshots
94
-
95
- Interaction tools already attach a screenshot. Call `screenshot` for the initial state, for a baseline before you change visible UI, to check state after a delay, or when the attached capture shows a transitional or loading frame.
96
-
97
- Keep the default downscaled capture for UI context and state checks; do not use `scale: 1.0` as a readability or tapping aid. Full resolution is only for saving baseline/current PNGs for comparison (`scale: 1.0` with `includeImageInContext: false`); for visual regression checks use the `argent-screenshot-diff` skill.
98
-
99
- If `screenshot` times out, restart the device transport with `stop-simulator-server`.
100
-
101
- ## 8. Android notes
102
-
103
- - **First-launch permission prompts**: `reinstall-app` on Android installs with `-g`, so runtime permissions are pre-granted on first launch.
30
+ Read `references/advanced.md` when you need: the full tool table, `network-conditions` reset, React Native LogBox dismissal, an empty `describe` tree or a `screenshot` timeout, `await-ui-element`/`await-screen-idle` edge cases, `run-sequence` gating, `paste`/secrets rules, or Android `reinstall-app` notes.
@@ -0,0 +1,64 @@
1
+ # Advanced Interaction Notes
2
+
3
+ ## Tool Reference
4
+
5
+ | Action | Tool | Notes |
6
+ | --------------------------- | ---------------------------------------- | ----------------------------------------------------------------------- |
7
+ | Several known steps | `run-sequence` | One call, one screenshot at the end |
8
+ | Open / restart app | `launch-app` / `restart-app` | Never tap home-screen icons; `restart-app` clears in-memory state |
9
+ | Open URL / deep link | `open-url` | Web pages, deep links, URL schemes |
10
+ | Tap / swipe | `gesture-tap` / `gesture-swipe` | Touch targets; not Chromium for swipe |
11
+ | Scroll / drag (Chromium) | `gesture-scroll` / `gesture-drag` | Mouse wheel; sliders, drag-and-drop, text selection |
12
+ | Long press, drag & drop | `gesture-custom` | Also any non-linear touch sequence |
13
+ | Pinch / rotate gesture | `gesture-pinch` / `gesture-rotate` | Two-finger gestures |
14
+ | Hardware key / rotate | `button` / `rotate` | Home, back, power, volume, appSwitch, actionButton; orientation changes |
15
+ | Shake device | `shake` | Shake handlers (sim/emu only), Undo-typing prompt, RN dev menu |
16
+ | Fold device | `fold` | Foldables only (`references/foldables.md`) |
17
+ | Type text / press named key | `keyboard` | Every platform; text or one key per call |
18
+ | Paste text | `paste` | Only where a user would paste; sim/emu, Mac app |
19
+ | Slow or offline network | `network-conditions` | iOS sim app, Android emu, or Chromium tab |
20
+ | Wait for UI / idle | `await-ui-element` / `await-screen-idle` | Server-side waits |
21
+
22
+ ## Network Conditions Recovery
23
+
24
+ After a network test, call `network-conditions` with the same target and omit the conditions to reset. On Android, this brings an offline emulator back online. If an Argent crash leaves an emulator's proxy active, reset before retrying.
25
+
26
+ ## Discovery & React Native LogBox
27
+
28
+ - **UIKit view lookup (iOS simulator):** `native-find-views` (needs `bundleId` and a class, id, label, tag, or `nativeID`) and `native-view-at-point` (visually deepest view; `hitTest: true` for touch target).
29
+ - **React Native component names / testIDs:** `debugger-component-tree` when `describe` omits them; still take tap points from `describe`.
30
+ - **React Native LogBox toasts:** sit over the bottom of the screen and catch taps meant for what is under them. Argent hides them when a `debugger-*` tool connects and after `debugger-reload-metro`; after `restart-app`, call a `debugger-*` tool again. After any other reload they come back: close each by tapping the right end of its `describe` frame (the X), not its middle.
31
+ - **Empty `describe` tree:** follow its `hint` if present. If there's no hint, the screen is blank, loading, or unlabeled. Check the attached screenshot and retry once content loads.
32
+ - **System / permission dialogs:** on a simulator or emulator, `describe` returns visible dialog buttons with tap coordinates (and in-app modals too). Fall back to `screenshot` only if `describe` omits them. Tap one obvious button (`Allow`, `OK`, `Don't Allow`, `Not Now`, `Continue`) at a time, check the screenshot, and return to `describe` once dismissed. Prefer answering the app's own dialog over `settings-permissions`. Use `settings-permissions` only to pre-authorize, re-enable a denied permission (iOS won't re-prompt), or reset prompts. See `argent-settings-permissions`.
33
+
34
+ ## Waiting: `await-ui-element` and `await-screen-idle`
35
+
36
+ - `await-ui-element` blocks server-side on the same tree `describe` reads. It has no bare-timer mode; for a plain pause, use your own harness sleep.
37
+ - The synthetic `ROOT` container `describe` prints is never matched, so a `role` like `AXGroup`/`html` won't trivially match the screen.
38
+ - To disambiguate a loose selector, pin `role` to a text role like `StaticText` to skip a same-named button.
39
+ - `await-screen-idle` is for live diagnosis after a launch or navigation before a raw tap on a moving element. Continue only when `settled: true`, and pair it with `await-ui-element` for the destination: stillness does not identify a screen, and the tool can return during a presentation-layer animation. Do not record it in an e2e test; tests use `await: { idle: true }`, which also compares pixels.
40
+
41
+ ## Action Sequencing with `run-sequence`
42
+
43
+ Use `run-sequence` when every step is known in advance; if a step depends on what the previous one shows, use separate calls. Typical batches:
44
+
45
+ - Scroll to bottom / until X: 3–5 swipes
46
+ - Clear and retype a field: triple-tap to select all, then type
47
+ - Type then submit: a `keyboard` text step, then a `keyboard` `enter` step
48
+ - Submit form: fill every field, then tap submit
49
+ - Known tap path: e.g. navigating back through screens
50
+
51
+ Use `await-ui-element` to gate a step on a screen transition. To gate on an HTTP request, start capture before the sequence and put `await-network-request` after the triggering action. A failed step (including a wait with `success: false`) stops the sequence with partial results.
52
+
53
+ ## Text Entry, Paste & Secrets
54
+
55
+ - Tap the field first; typing or pasting with no focused field is a silent no-op.
56
+ - `paste` is **not** a faster `keyboard`. Keep `keyboard` as the default; use `paste` only where a real user would paste (OTP/2FA codes, long links/tokens, or testing paste handling). Platform text limitations alone are not a reason to switch to `paste`.
57
+ - **Credentials:** pass `{{secret:<NAME>}}` placeholders in `text` (`keyboard`, `paste`, `run-sequence` keyboard steps, e2e `type` steps), never plaintext, and never ask the user for the value. Do **not** `describe` or `screenshot` a non-secure field you just filled with a secret: submit or navigate away first, then verify the resulting screen.
58
+
59
+ ## Screenshots & Android Notes
60
+
61
+ - Call `screenshot` for initial state, baselines before visible UI changes, state after a delay, or when an attached capture shows a transitional/loading frame.
62
+ - Keep the default downscaled capture for routine checks; reserve `scale: 1.0` (with `includeImageInContext: false`) for saving baselines/currents for `argent-screenshot-diff`.
63
+ - If `screenshot` times out, restart the device transport with `stop-simulator-server`.
64
+ - **Android first-launch permissions:** `reinstall-app` on Android installs with `-g`, pre-granting runtime permissions on first launch.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-ios-device-interact
3
- description: Drive a physical iPhone through argent. Use when a physical iPhone is involved (a list-devices iOS entry with kind "device") and ONLY then; never for a simulator. For connection, trust, or signing problems read argent-ios-device-setup.
3
+ description: Drive a physical iPhone with Argent. Use when targeting a physical iPhone (list-devices kind "device") and ONLY then, never a simulator. For setup/signing, use `argent-ios-device-setup`.
4
4
  ---
5
5
 
6
6
  # Physical iPhone interaction
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-ios-device-setup
3
- description: Set up a physical iPhone over USB or a connected CoreDevice tunnel for argent. Use when a physical iPhone is involved (a list-devices iOS entry with kind "device") and ONLY then; never for a simulator.
3
+ description: Set up a physical iPhone over USB or CoreDevice tunnel for Argent. Use when a physical iPhone is involved (kind "device") and ONLY then; never for a simulator.
4
4
  ---
5
5
 
6
6
  # Physical iPhone setup
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-ios-simulator-setup
3
- description: Set up and connect to an iOS simulator using argent MCP tools. Use when starting a new session, booting an iOS simulator, getting an iOS UDID, or before any iOS simulator interaction task.
3
+ description: Boot an iOS simulator and find its UDID with Argent. Use when no simulator is booted yet or you need to pick and boot one.
4
4
  ---
5
5
 
6
6
  ## 1. Setup Steps
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-lens
3
- description: Propose multiple visual design variants for on-screen elements and let the human pick in the Argent Lens window. Use when the user asks for design alternatives / options / A-B choices for a screen or component, or any time you have produced more than one candidate look for an element and want a human decision before committing.
3
+ description: Propose visual design variants for on-screen elements so the user can pick in Argent Lens. Use when presenting UI design alternatives or A/B choices.
4
4
  ---
5
5
 
6
6
  > **Prerequisite: feature flag.** This workflow is gated behind the `argent-lens` flag (off by default). Run `argent enable argent-lens` once before using it. If `propose_variant` comes back not-found, the flag is off; enable it and retry.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-macos-app-interact
3
- description: Drive a native Mac app (AppKit, SwiftUI, react-native-macos, Mac Catalyst) through argent. Use when a list-devices entry has platform "macos", or the user names a Mac app, a macOS app or a native desktop app. Never for an iOS simulator, an iPhone, or an Electron or Chromium app (platform "chromium").
3
+ description: Drive a native Mac app (AppKit, SwiftUI, react-native-macos, Catalyst) with Argent. Use when targeting platform "macos" or a native macOS app, never iOS or Electron/Chromium.
4
4
  ---
5
5
 
6
6
  `argent-device-interact` still applies for everything not listed here (`run-sequence`, `await-ui-element`, secrets).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-metro-debugger
3
- description: Debug JavaScript with Argent in React Native apps on iOS, Android, Vega, and macOS, or in Chromium and Electron over CDP. Use when connecting to a runtime, inspecting React components, reading console logs, evaluating JavaScript, or inspecting and checking an app's HTTP requests.
3
+ description: Debug JS with Argent in React Native (iOS, Android, Vega, macOS) or Chromium/Electron (CDP). Use when reading console logs, inspecting React trees, evaluating JS, or checking HTTP requests.
4
4
  ---
5
5
 
6
6
  ## 1. Prerequisites
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-native-profiler
3
- description: Diagnose native CPU hotspots, UI hangs, memory issues, and iOS app launch time. Use Instruments (xctrace) on iOS simulators, iPhones (launch time only) and Mac apps, or Perfetto on Android. Use when diagnosing native-level performance issues.
3
+ description: Profile native CPU hotspots, UI hangs, memory, and iOS launch time via Instruments (iOS/Mac) or Perfetto (Android). Use when diagnosing native performance issues.
4
4
  ---
5
5
 
6
6
  ## 1. Tools and platforms
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-qa-e2e
3
- description: Write repeatable QA regression e2e tests from test cases, tickets, or acceptance criteria. Use when the user asks to write, automate, or generate an e2e test or preserve an automated regression scenario, with deterministic setup, stable targets, executable structural or visual evidence, and two consecutive full passes. For one-off UI checks or replayable paths without acceptance criteria, use argent-test-ui-flow or argent-create-e2e. Supports iOS, Android, Chromium, Mac apps, and Vega (Fire TV), where recorded tv-remote steps replace touch directives. Apple TV and Android TV are unsupported; use argent-tv-interact there and report the limitation.
3
+ description: Write repeatable QA regression e2e tests from test cases, tickets, or acceptance criteria (iOS, Android, Chromium, Mac apps, Vega; not Apple TV/Android TV). Use when the user asks to write, automate, or generate an e2e test or preserve a regression scenario. For one-off checks or replayable paths without criteria, use argent-test-ui-flow or argent-create-e2e.
4
4
  ---
5
5
 
6
6
  # Create a QA regression e2e test
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-react-native-app-workflow
3
- description: Step-by-step workflows for developing or debugging React Native apps on iOS simulator or Android emulator. Use when starting the app, debugging Metro, fixing builds, diagnosing runtime errors, or running tests.
3
+ description: Develop and debug React Native apps on iOS simulator or Android emulator. Use when starting the app, debugging Metro, fixing builds, diagnosing runtime errors, or running tests.
4
4
  ---
5
5
 
6
6
  Physical iPhone (`kind: "device"`): Metro debugging and profiling tools reject it. Use a simulator. Exception: measure and profile app launch on the iPhone with `native-profiler-launch-analysis` (`argent-native-profiler` §4).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-react-native-optimization
3
- description: Optimizes a React Native app by profiling first to find real bottlenecks, then sweeping for mechanical issues. Entry-point for all performance work. Use when the app feels slow, user asks to optimize, fix re-renders, reduce jank, or improve startup / TTI (including iOS launch time). Delegates to argent-react-native-profiler for measurement.
3
+ description: Entry-point for React Native performance optimization; profiles first via `argent-react-native-profiler`. Use when the app feels slow, fixing re-renders or jank, or improving startup/TTI.
4
4
  ---
5
5
 
6
6
  ## Rules
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-react-native-profiler
3
- description: Profile a React Native Hermes app to measure re-render and CPU performance using argent profiler tools. Use when optimizing for performance, measuring before/after a fix, spotting slow components, diagnosing re-renders, checking CPU hotspots, or producing a ranked issue report.
3
+ description: Profile a React Native Hermes app for JS re-renders and CPU hotspots via Argent profiler tools. Use when measuring before/after performance, diagnosing re-renders, or finding CPU hotspots.
4
4
  ---
5
5
 
6
6
  This skill is complementary to `argent-react-native-optimization`, not a replacement for it.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-screen-recording
3
- description: Record a screen video with Argent on an iOS simulator, cabled iPhone, Android emulator or device, or Mac app. Use when the user asks for a screen recording or a video of a flow, interaction, animation, or other app behavior.
3
+ description: Record a screen video with Argent on iOS, Android, or Mac apps. Use when asked to capture a video clip of a flow, interaction, or animation.
4
4
  ---
5
5
 
6
6
  `screen-recording-start` and `screen-recording-stop` carry the options (`timeLimitSeconds`, `trimStatic`, `showTouches`) and the result fields. One recording per device at a time; different devices can record concurrently.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-screenshot-diff
3
- description: Compare saved or live app screenshots with the argent screenshot-diff tool. Use when testing visual regressions, before/after UI comparisons, screenshot diff checks, visible layout, spacing, color, typography, clipping, overflow, text rendering, or image/icon rendering changes.
3
+ description: Compare saved or live app screenshots via `screenshot-diff`. Use when checking visual regressions, before/after UI diffs, layout, typography, or rendering changes.
4
4
  ---
5
5
 
6
6
  ## 1. Role
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-settings-permissions
3
- description: Grant, deny, or reset an app's runtime permissions (camera, microphone, photos, contacts, notifications, calendar, location, location-always, media-library, motion, reminders) on an iOS simulator or Android device using the argent `settings-permissions` tool - without navigating the system Settings UI. Use when the permission cannot be changed through the app itself - and only then, pre-authorize before the app asks, deny up front, re-enable a permission the user already denied, or reset so the prompt reappears. If the app can flip it - via an in-app toggle or the system permission dialog the app triggers - interact with the app instead.
3
+ description: Grant, deny, or reset app runtime permissions out-of-band on an iOS simulator or Android device via `settings-permissions`. Use when the app's own dialog or toggle cannot change the permission.
4
4
  ---
5
5
 
6
6
  `settings-permissions` edits the platform's permission store directly (the iOS simulator's TCC database, Android's runtime permissions over adb). It is a **test-setup / out-of-band** tool, not a general permissions toggle: the default way to change a permission is still through the app. The tool's description covers the supported permissions per platform, the parameters, the result (`applied` / `skipped`) and the per-platform requirements.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-test-ui-flow
3
- description: Autonomously test an app UI (iOS or Android) by running interact-screenshot-verify loops using argent MCP tools. Use when testing UI flows, verifying login works, testing navigation, running UI test scenarios, manual QA steps, visible UI changes, or visual behavior.
3
+ description: Autonomously verify one-off mobile UI flows (iOS/Android) with interact-screenshot-verify loops. Use when testing navigation, login, manual QA steps, or visible UI changes.
4
4
  ---
5
5
 
6
6
  ## Before testing
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-tv-interact
3
- description: Control and inspect TV apps via argent, Apple TV (tvOS), Android TV (leanback), and Amazon Fire TV (Vega). Boot the target, read focus, navigate with the D-pad remote, type, screenshot, and on Vega debug the JS runtime (evaluate, console logs, network inspector). Use when a task targets a TV (runtimeKind "tv", or platform "vega"), or mentions Apple TV / tvOS / Android TV / leanback / Vega / Fire TV / VVD.
3
+ description: Control Apple TV (tvOS), Android TV (leanback), and Fire TV (Vega) via Argent (D-pad remote, focus tree, Vega JS debugging). Use when targeting runtimeKind "tv", platform "vega", or a TV app.
4
4
  ---
5
5
 
6
6
  # Argent TV (Apple TV + Android TV + Fire TV)