@swmansion/argent 0.32.1-next.20 → 0.32.1-next.22

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.
Binary file
Binary file
Binary file
Binary file
Binary file
package/dist/cli-cmds.mjs CHANGED
@@ -9484,7 +9484,8 @@ var FLAG_REGISTRY = [
9484
9484
  },
9485
9485
  {
9486
9486
  name: "macos-apps",
9487
- description: "Drive native Mac apps (AppKit, SwiftUI, react-native-macos) from inside the app. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. Off by default."
9487
+ description: "Drive native Mac apps (AppKit, SwiftUI, react-native-macos) from inside the app. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. On by default; turn it off with `argent disable macos-apps`.",
9488
+ defaultEnabled: true
9488
9489
  }
9489
9490
  ];
9490
9491
  function getFlagDefinition(name, registry2 = FLAG_REGISTRY) {
@@ -35871,7 +35872,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
35871
35872
  var SESSION_ID2 = randomUUID5();
35872
35873
  function readCliVersion() {
35873
35874
  if (true) {
35874
- return "0.32.1-next.20";
35875
+ return "0.32.1-next.22";
35875
35876
  }
35876
35877
  return "0.0.0";
35877
35878
  }
@@ -36905,8 +36906,18 @@ function durationSuffix(ms) {
36905
36906
  const seconds = Math.round(ms / 1e3);
36906
36907
  return ` (${Math.floor(seconds / 60)}m ${seconds % 60}s)`;
36907
36908
  }
36908
- function printHelp(toStderr = false) {
36909
+ async function offersMacosPlatform() {
36910
+ if (!isFeatureEnabled("macos-apps")) return false;
36911
+ if (process.platform === "darwin") return true;
36912
+ try {
36913
+ return (await getResolvedToolsUrl()).url !== null;
36914
+ } catch {
36915
+ return false;
36916
+ }
36917
+ }
36918
+ async function printHelp(toStderr = false) {
36909
36919
  const print = toStderr ? console.error : console.log;
36920
+ const macos = await offersMacosPlatform() ? " macos |" : "";
36910
36921
  print(`Usage: argent e2e <subcommand> [options]
36911
36922
 
36912
36923
  Run a YAML e2e test without an LLM in the loop. \`run\` takes any of these forms:
@@ -36977,7 +36988,7 @@ Subcommands:
36977
36988
 
36978
36989
  Options (run):
36979
36990
  --device <id> Device id to run against (auto-detected when omitted)
36980
- --platform <p> ios | android | chromium | vega |${isFlagEnabled("macos-apps") ? " macos |" : ""} ios-remote \u2014 narrow
36991
+ --platform <p> ios | android | chromium | vega |${macos} ios-remote \u2014 narrow
36981
36992
  auto-detection (ios never picks a remote simulator)
36982
36993
  --update-baselines Write/refresh screenshot baselines instead of diffing,
36983
36994
  also those of tests that tool: e2e-execute steps run,
@@ -37684,7 +37695,7 @@ ${renderBatchSummary(counts, durationMs)}`);
37684
37695
  async function e2e(argv, options) {
37685
37696
  const [sub, ...rest] = argv;
37686
37697
  if (!sub || sub === "--help" || sub === "-h") {
37687
- printHelp();
37698
+ await printHelp();
37688
37699
  return;
37689
37700
  }
37690
37701
  if (sub === "list") {
@@ -37735,17 +37746,17 @@ async function e2e(argv, options) {
37735
37746
  const jsonStream = flagGiven("--json-stream");
37736
37747
  const json2 = !jsonStream && flagGiven("--json");
37737
37748
  if (rest.includes("--help") || rest.includes("-h")) {
37738
- printHelp(jsonStream);
37749
+ await printHelp(jsonStream);
37739
37750
  return;
37740
37751
  }
37741
- const usageError = (message, prose) => {
37752
+ const usageError = async (message, prose) => {
37742
37753
  if (json2) {
37743
37754
  console.error(JSON.stringify(errorRecord(message)));
37744
37755
  return exitAfterFlush(2);
37745
37756
  }
37746
37757
  if (jsonStream) writeJsonStreamError(message);
37747
37758
  console.error(prose);
37748
- printHelp(jsonStream);
37759
+ await printHelp(jsonStream);
37749
37760
  return exitAfterFlush(2);
37750
37761
  };
37751
37762
  let args;
@@ -39890,8 +39901,17 @@ function runToggle(argv, command, registry2) {
39890
39901
  } else {
39891
39902
  console.log(`Disabled flag "${parsed.name}" (${parsed.scope}).`);
39892
39903
  }
39904
+ const shadow = projectShadowNote(parsed.name, parsed.scope, command);
39905
+ if (shadow) console.log(import_picocolors2.default.yellow(shadow));
39893
39906
  return parsed.name;
39894
39907
  }
39908
+ function projectShadowNote(name, scope, command) {
39909
+ if (scope !== "global") return void 0;
39910
+ const wanted = command === "enable";
39911
+ const project = readFlags("project");
39912
+ if (!Object.hasOwn(project, name) || project[name] === wanted) return void 0;
39913
+ return `The project flags file ${getFlagsPath("project")} sets "${name}" to ${project[name]}, which overrides the global value, so the flag stays ${wanted ? "off" : "on"} in this project. Run: argent ${command} ${name} --scope project`;
39914
+ }
39895
39915
  function enable(argv, registry2 = FLAG_REGISTRY) {
39896
39916
  if (runToggle(argv, "enable", registry2) !== "forward-secrets") return;
39897
39917
  return linkedSecretsNote().then((note) => {
package/dist/client.js CHANGED
@@ -7805,7 +7805,8 @@ var FLAG_REGISTRY = [
7805
7805
  },
7806
7806
  {
7807
7807
  name: "macos-apps",
7808
- description: "Drive native Mac apps (AppKit, SwiftUI, react-native-macos) from inside the app. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. Off by default."
7808
+ description: "Drive native Mac apps (AppKit, SwiftUI, react-native-macos) from inside the app. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. On by default; turn it off with `argent disable macos-apps`.",
7809
+ defaultEnabled: true
7809
7810
  }
7810
7811
  ];
7811
7812
  function getFlagDefinition(name, registry = FLAG_REGISTRY) {
@@ -16981,7 +16981,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16981
16981
  var SESSION_ID = randomUUID4();
16982
16982
  function readCliVersion() {
16983
16983
  if (true) {
16984
- return "0.32.1-next.20";
16984
+ return "0.32.1-next.22";
16985
16985
  }
16986
16986
  return "0.0.0";
16987
16987
  }
@@ -24946,7 +24946,8 @@ var FLAG_REGISTRY = [
24946
24946
  },
24947
24947
  {
24948
24948
  name: "macos-apps",
24949
- description: "Drive native Mac apps (AppKit, SwiftUI, react-native-macos) from inside the app. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. Off by default."
24949
+ description: "Drive native Mac apps (AppKit, SwiftUI, react-native-macos) from inside the app. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. On by default; turn it off with `argent disable macos-apps`.",
24950
+ defaultEnabled: true
24950
24951
  }
24951
24952
  ];
24952
24953
  function getFlagDefinition(name, registry2 = FLAG_REGISTRY) {
@@ -157,7 +157,8 @@ var init_flags = __esm({
157
157
  },
158
158
  {
159
159
  name: "macos-apps",
160
- description: "Drive native Mac apps (AppKit, SwiftUI, react-native-macos) from inside the app. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. Off by default."
160
+ description: "Drive native Mac apps (AppKit, SwiftUI, react-native-macos) from inside the app. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. On by default; turn it off with `argent disable macos-apps`.",
161
+ defaultEnabled: true
161
162
  }
162
163
  ];
163
164
  PROJECT_MARKERS = [".argent", ".git", "package.json"];
@@ -79539,10 +79540,14 @@ function platformMatrix(platform, capability41) {
79539
79540
  }
79540
79541
  }
79541
79542
  function macosAppsUnavailableReason() {
79542
- if (!isFlagEnabled(MACOS_APPS_FLAG)) return MACOS_APPS_FLAG_OFF_REASON;
79543
+ if (!isFeatureEnabled(MACOS_APPS_FLAG)) return MACOS_APPS_FLAG_OFF_REASON;
79543
79544
  if (process.platform !== "darwin") return "native Mac apps can only be driven on macOS";
79544
79545
  return null;
79545
79546
  }
79547
+ function isFlagOffered(flag) {
79548
+ if (flag === MACOS_APPS_FLAG) return macosAppsUnavailableReason() === null;
79549
+ return isFeatureEnabled(flag);
79550
+ }
79546
79551
  function assertSupported(toolId, capability41, device) {
79547
79552
  if (!capability41) return;
79548
79553
  if (device.platform === "harmony" && !isHarmonyEnabled()) {
@@ -101256,7 +101261,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
101256
101261
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
101257
101262
  function readCliVersion() {
101258
101263
  if (true) {
101259
- return "0.32.1-next.20";
101264
+ return "0.32.1-next.22";
101260
101265
  }
101261
101266
  return "0.0.0";
101262
101267
  }
@@ -125697,7 +125702,7 @@ init_capability();
125697
125702
  init_device_info();
125698
125703
  var execFileAsync16 = (0, import_node_util16.promisify)(import_node_child_process20.execFile);
125699
125704
  function isMacosAppsEnabled() {
125700
- return isFlagEnabled(MACOS_APPS_FLAG);
125705
+ return isFeatureEnabled(MACOS_APPS_FLAG);
125701
125706
  }
125702
125707
  function assertMacosAppsEnabled(toolId, device) {
125703
125708
  const reason2 = macosAppsUnavailableReason();
@@ -141369,7 +141374,7 @@ function scaleDecodedPng(src, scale) {
141369
141374
  // ../tool-server/src/utils/macos-input.ts
141370
141375
  var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
141371
141376
  function macosAppServices(device) {
141372
- return isMacosAppsEnabled() ? { macosApp: macosAppRef(device) } : {};
141377
+ return macosAppsUnavailableReason() === null ? { macosApp: macosAppRef(device) } : {};
141373
141378
  }
141374
141379
  function requireMacosApp(services, toolId, device) {
141375
141380
  assertMacosAppsEnabled(toolId, device);
@@ -143569,10 +143574,6 @@ function isToolExposed(def) {
143569
143574
  if (def.hideWhen?.()) return false;
143570
143575
  return true;
143571
143576
  }
143572
- function isFlagOffered(flag) {
143573
- if (flag === MACOS_APPS_FLAG) return macosAppsUnavailableReason() === null;
143574
- return isFlagEnabled(flag);
143575
- }
143576
143577
  function findDependencyMissing(err) {
143577
143578
  return findErrorInCauseChain(err, DependencyMissingError);
143578
143579
  }
@@ -151401,7 +151402,7 @@ HarmonyOS hands the instance to DevEco Studio's Emulator manager, then waits for
151401
151402
  throw new InvalidToolInputError(
151402
151403
  renderFlagGated(
151403
151404
  "Provide exactly one of `udid` (iOS), `avdName` (Android), `vvdImage` (Vega VVD), <flag:harmonyos>`harmonyInstance` (HarmonyOS), </flag:harmonyos><flag:macos-apps>`macosAppPath` (Mac app), </flag:macos-apps>or `electronAppPath` (Electron).",
151404
- isFlagEnabled
151405
+ isFlagOffered
151405
151406
  ),
151406
151407
  {
151407
151408
  error_code: FAILURE_CODES.BOOT_DEVICE_TARGET_SELECTION_INVALID,
@@ -154039,7 +154040,6 @@ async function assertChromiumWindowVisible(chromium, action) {
154039
154040
 
154040
154041
  // ../tool-server/src/tools/gesture-tap/index.ts
154041
154042
  init_device_info();
154042
- init_src();
154043
154043
  init_capability();
154044
154044
  var sleep4 = (ms) => new Promise((r) => setTimeout(r, ms));
154045
154045
  function tapDescription(params, tense) {
@@ -154159,7 +154159,7 @@ Before tapping, take the coordinates from \`describe\` on every platform (on Chr
154159
154159
  throw new InvalidToolInputError(
154160
154160
  renderFlagGated(
154161
154161
  `gesture-tap button "right" is a mouse right-click${refusal}`,
154162
- isFlagEnabled
154162
+ isFlagOffered
154163
154163
  )
154164
154164
  );
154165
154165
  }
@@ -166058,6 +166058,7 @@ function parseCpuXml(xml, targetPid = null) {
166058
166058
  if (sampleTimeMatch) {
166059
166059
  timestampNs = parseInt(sampleTimeMatch[1], 10);
166060
166060
  } else if (sampleTimeRef) {
166061
+ resolveBacktrace(row, frameRegistry, backtraceRegistry, binaryRegistry);
166061
166062
  continue;
166062
166063
  }
166063
166064
  const threadMatch = row.match(/<thread[^>]*\sfmt="([^"]*)"[^>]*>/);
@@ -166121,6 +166122,21 @@ function rowProcessPid(rowXml, processPid) {
166121
166122
  return id != null ? processPid.get(id) : void 0;
166122
166123
  }
166123
166124
  function resolveBacktrace(rowXml, frameRegistry, backtraceRegistry, binaryRegistry) {
166125
+ const tagged = rowXml.match(/<tagged-backtrace\b([^>]*?)(\/?)>/);
166126
+ if (tagged) {
166127
+ const taggedRef = tagged[1].match(/\bref="(\d+)"/);
166128
+ if (taggedRef) return backtraceRegistry.get(taggedRef[1]) ?? [];
166129
+ let content = "";
166130
+ if (!tagged[2]) {
166131
+ const start2 = tagged.index + tagged[0].length;
166132
+ const end = rowXml.indexOf("</tagged-backtrace>", start2);
166133
+ content = rowXml.substring(start2, end === -1 ? rowXml.length : end);
166134
+ }
166135
+ const frames2 = /<backtrace[\s>]/.test(content) ? resolveBacktrace(content, frameRegistry, backtraceRegistry, binaryRegistry) : resolveFrames(content, frameRegistry, binaryRegistry);
166136
+ const taggedId = tagged[1].match(/\bid="(\d+)"/);
166137
+ if (taggedId) backtraceRegistry.set(taggedId[1], frames2);
166138
+ return frames2;
166139
+ }
166124
166140
  const btRefMatch = rowXml.match(/<backtrace\s+ref="(\d+)"\s*\/>/);
166125
166141
  if (btRefMatch) {
166126
166142
  return backtraceRegistry.get(btRefMatch[1]) ?? [];
@@ -174586,7 +174602,7 @@ function isIdleCondition(raw, kind) {
174586
174602
  }
174587
174603
  var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
174588
174604
  function namedLaunchPlatforms() {
174589
- return LAUNCH_PLATFORMS.filter((p) => p !== "macos" || isFlagEnabled(MACOS_APPS_FLAG));
174605
+ return LAUNCH_PLATFORMS.filter((p) => p !== "macos" || isFlagOffered(MACOS_APPS_FLAG));
174590
174606
  }
174591
174607
  var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
174592
174608
  function authoringPlatform(platform) {
@@ -174705,7 +174721,7 @@ function parseLaunch(raw) {
174705
174721
  }
174706
174722
  return badEntry(
174707
174723
  { launch: raw },
174708
- `launch needs an app id (bare string) or a per-platform map ({ native | ${namedLaunchPlatforms().filter((p) => p !== "chromium").join(" | ")}: <app id>, ios${isFlagEnabled(MACOS_APPS_FLAG) ? " | macos" : ""}: { app, args }, chromium: <app path> | { path, args } })`
174724
+ `launch needs an app id (bare string) or a per-platform map ({ native | ${namedLaunchPlatforms().filter((p) => p !== "chromium").join(" | ")}: <app id>, ios${isFlagOffered(MACOS_APPS_FLAG) ? " | macos" : ""}: { app, args }, chromium: <app path> | { path, args } })`
174709
174725
  );
174710
174726
  }
174711
174727
  var STEP_DIRECTIVE_KEYS = [
@@ -176008,8 +176024,8 @@ var path52 = __toESM(require("node:path"));
176008
176024
  init_src2();
176009
176025
 
176010
176026
  // ../tool-server/src/tools/flows/flow-actions.ts
176011
- init_src();
176012
176027
  init_device_info();
176028
+ init_capability();
176013
176029
 
176014
176030
  // ../tool-server/src/tools/flows/flow-device.ts
176015
176031
  init_src2();
@@ -176057,8 +176073,9 @@ function macosAppHint(devices, platform) {
176057
176073
  return " A Mac app is picked only with --platform macos or --device.";
176058
176074
  }
176059
176075
  function macosFlagHint(platform) {
176060
- if (platform !== "macos" || isMacosAppsEnabled()) return "";
176061
- return " The macos-apps flag is off, so no Mac app is listed. Run: argent enable macos-apps.";
176076
+ const reason2 = platform === "macos" ? macosAppsUnavailableReason() : null;
176077
+ if (!reason2) return "";
176078
+ return reason2 === MACOS_APPS_FLAG_OFF_REASON ? " The macos-apps flag is off, so no Mac app is listed. Run: argent enable macos-apps." : ` No Mac app is listed: ${reason2}.`;
176062
176079
  }
176063
176080
  function describeDevice(d) {
176064
176081
  return `${deviceEntryId(d) ?? "?"} (${d.platform}${d.state ? `, ${d.state}` : ""})`;
@@ -176155,9 +176172,8 @@ async function candidateRuntimeKind(d) {
176155
176172
  async function resolveFlowDevice(registry2, ctx, opts) {
176156
176173
  if (opts.device) {
176157
176174
  const device = resolveDevice(opts.device);
176158
- if (device.platform === "macos" && !isMacosAppsEnabled()) {
176159
- throw deviceResolutionError(`Cannot run on ${device.id}: ${MACOS_APPS_FLAG_OFF_REASON}`);
176160
- }
176175
+ const macosRefusal = device.platform === "macos" ? macosAppsUnavailableReason() : null;
176176
+ if (macosRefusal) throw deviceResolutionError(`Cannot run on ${device.id}: ${macosRefusal}`);
176161
176177
  return device;
176162
176178
  }
176163
176179
  const { devices } = await invokeSubTool(registry2, ctx, "list-devices", {});
@@ -177307,7 +177323,7 @@ async function runDirective(env, step) {
177307
177323
  reason: renderFlagGated(
177308
177324
  platform === "chromium" ? `tap with button: right is a mouse right-click<flag:macos-apps>, which argent sends only to a Mac app</flag:macos-apps>; argent does not support it on chromium yet` : `tap with button: right is a mouse right-click<flag:macos-apps>, which only a Mac app takes</flag:macos-apps>; ${platform} takes none` + // HarmonyOS refuses long-press too.
177309
177325
  (platform === "harmony" ? "" : ". On a touch screen, open a context menu with long-press"),
177310
- isFlagEnabled
177326
+ isFlagOffered
177311
177327
  )
177312
177328
  };
177313
177329
  }
@@ -178637,7 +178653,6 @@ function stepAnchor(step) {
178637
178653
  // ../tool-server/src/tools/flows/flow-add-step.ts
178638
178654
  init_device_info();
178639
178655
  init_capability();
178640
- init_src();
178641
178656
  var REPLAY_TREE_SOURCES = {
178642
178657
  ios: "native-devtools",
178643
178658
  android: "android-devtools",
@@ -178951,7 +178966,7 @@ function directiveCommandHint(command) {
178951
178966
  if (command === "swipe") {
178952
178967
  return renderFlagGated(
178953
178968
  `"swipe" is an e2e test directive, not a tool. Record the movement by calling \`gesture-swipe\` (\`gesture-drag\` on chromium<flag:macos-apps> and macOS</flag:macos-apps>, where gesture-swipe is not supported) through e2e-add-step. It is stored as the raw \`tool:\` step for whichever one you called; converting it to \`swipe:\` is part of the polish pass.`,
178954
- isFlagEnabled
178969
+ isFlagOffered
178955
178970
  );
178956
178971
  }
178957
178972
  if (command === "echo") {
@@ -178969,7 +178984,7 @@ function directiveCommandHint(command) {
178969
178984
  if (command === "scroll-to") {
178970
178985
  return renderFlagGated(
178971
178986
  `"scroll-to" is an e2e test directive, not a tool, and no tool records one \u2014 it SEARCHES, scrolling until the target is visible, which no single recorded gesture reproduces. Record the movement with \`gesture-swipe\` (\`gesture-scroll\` on chromium<flag:macos-apps> and macOS</flag:macos-apps>) if the path needs it, then add the \`scroll-to:\` step by hand during polish and prove it with the replay.`,
178972
- isFlagEnabled
178987
+ isFlagOffered
178973
178988
  );
178974
178989
  }
178975
178990
  if (command === "snapshot") {
@@ -186875,7 +186890,7 @@ Fails if no item matches (the error lists the titles at that level), if the item
186875
186890
  // ../tool-server/src/utils/setup-registry.ts
186876
186891
  init_device_info();
186877
186892
  function createRegistry() {
186878
- const registry2 = new Registry({ isFlagEnabled: (flag) => isFlagEnabled(flag) });
186893
+ const registry2 = new Registry({ isFlagEnabled: (flag) => isFeatureEnabled(flag) });
186879
186894
  setLivePanelSourceProvider((udid) => {
186880
186895
  const ref = axServiceRef(resolveDevice(udid));
186881
186896
  return registry2.resolveService(ref.urn, ref.options);
@@ -187530,7 +187545,7 @@ function getAvailableTools() {
187530
187545
  const def = registry2.getTool(id);
187531
187546
  return renderFlagGated(
187532
187547
  { id: def.id, description: def.description, inputSchema: def.inputSchema },
187533
- isFlagEnabled
187548
+ isFeatureEnabled
187534
187549
  );
187535
187550
  });
187536
187551
  }
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.32.1-next.20",
3
+ "version": "0.32.1-next.22",
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",
@@ -7,7 +7,7 @@ description: Drive a native Mac app (AppKit, SwiftUI, react-native-macos) throug
7
7
 
8
8
  ## Contract
9
9
 
10
- - Needs the `macos-apps` flag. When a tool says it is off, tell the user to run the command it names. Do not change the flag yourself.
10
+ - Needs the `macos-apps` flag, which is on by default. When a tool says it is off, tell the user to run the command it names. Do not change the flag yourself.
11
11
  - One app is one device. `list-devices` shows only apps argent started that still run, also those of other sessions: never pick one unless the user named that app or this session started it.
12
12
  - Start an app with `boot-device {macosAppPath: "<abs path>.app"}`, never with `open` or Xcode. Use `launch-app` only for an app argent already started: with no recorded path it takes whichever copy Spotlight finds.
13
13
  - Build the `.app` without starting it: `xcodebuild ... build`, then take the bundle from `BUILT_PRODUCTS_DIR` (`xcodebuild -showBuildSettings`). Xcode Run and `react-native run-macos` start a copy without the argent library: `boot-device` then fails with `already running ... without the argent library`. Retry with `force: true`, but ask the user first when they may have work open in that copy.