@swmansion/argent 0.20.1-next.3 → 0.20.1-next.5

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.
@@ -112329,6 +112329,7 @@ var nativeDevtoolsBlueprint = {
112329
112329
  );
112330
112330
  }
112331
112331
  const id = nextRpcId++;
112332
+ const timeoutMs = method === "ViewHierarchy.getFullHierarchy" ? 15e3 : 5e3;
112332
112333
  return new Promise((resolve11, reject) => {
112333
112334
  pendingRpc.set(id, { resolve: resolve11, reject });
112334
112335
  conn.socket.write(
@@ -112349,7 +112350,7 @@ var nativeDevtoolsBlueprint = {
112349
112350
  })
112350
112351
  );
112351
112352
  }
112352
- }, 5e3);
112353
+ }, timeoutMs);
112353
112354
  });
112354
112355
  }
112355
112356
  if (transport === "unix") {
@@ -122456,7 +122457,6 @@ Use when you need to zoom in or out on a map, image, or zoomable view. Returns {
122456
122457
 
122457
122458
  // ../tool-server/src/tools/gesture-rotate/index.ts
122458
122459
  init_zod();
122459
- init_src();
122460
122460
  var zodSchema22 = external_exports.object({
122461
122461
  udid: external_exports.string().describe("Target device id from `list-devices` (iOS UDID or Android serial)."),
122462
122462
  centerX: external_exports.number().describe(
@@ -122482,16 +122482,6 @@ var zodSchema22 = external_exports.object({
122482
122482
  }).refine((p) => p.radius !== void 0 || p.radiusX !== void 0, {
122483
122483
  message: "Pass radius, or both radiusX and radiusY."
122484
122484
  });
122485
- var inputSchema = {
122486
- ...zodObjectToJsonSchema(zodSchema22),
122487
- anyOf: [
122488
- { required: ["radiusX", "radiusY"] },
122489
- {
122490
- required: ["radius"],
122491
- not: { anyOf: [{ required: ["radiusX"] }, { required: ["radiusY"] }] }
122492
- }
122493
- ]
122494
- };
122495
122485
  var capability14 = {
122496
122486
  apple: { simulator: true, device: true },
122497
122487
  appleRemote: { simulator: true },
@@ -122516,9 +122506,9 @@ var gestureRotateTool = {
122516
122506
  endAngle > startAngle = clockwise rotation. Typical values: radius 0.15, startAngle 0, endAngle 90 for a 90\xB0 clockwise turn. A single radius applies to both axes, so on a non-square screen it traces a physical ellipse (finger separation varies through the turn); pass radiusX+radiusY (fractions of width/height with radiusX\xB7width = radiusY\xB7height) for a physically circular orbit instead.
122517
122507
  Auto-generates interpolated frames at ~60fps.
122518
122508
  Unlike gesture-pinch which moves fingers linearly to zoom, this orbits fingers in an arc to change orientation.
122519
- Use when you need to rotate a map, image picker, or any rotateable UI element. Returns { rotated: true, timestampMs }. Fails if the simulator-server / emulator backend is not reachable for the given device.`,
122509
+ Use when you need to rotate a map, image picker, or any rotateable UI element. Returns { rotated: true, timestampMs }. Fails if the simulator-server / emulator backend is not reachable for the given device.
122510
+ Size the orbit with radius, or with radiusX and radiusY together (the pair overrides radius); one half of the pair alone, or none of the three, is rejected.`,
122520
122511
  zodSchema: zodSchema22,
122521
- inputSchema,
122522
122512
  capability: capability14,
122523
122513
  services: (params) => ({
122524
122514
  simulatorServer: simulatorServerRef(resolveDevice(params.udid))
@@ -144437,6 +144427,9 @@ function bindDeviceArgs(registry2, toolName, deviceId, args, deviceIsExplicit =
144437
144427
  return out;
144438
144428
  }
144439
144429
 
144430
+ // ../tool-server/src/tools/flows/flow-ios-tree.ts
144431
+ init_src();
144432
+
144440
144433
  // ../tool-server/src/tools/flows/flow-tree-flatten.ts
144441
144434
  function intersectClip(rect, clip3) {
144442
144435
  if (!clip3) return rect;
@@ -144613,7 +144606,7 @@ var FULL_HIERARCHY_FIELDS = [
144613
144606
  // request, which just leaves the wait's poll unconfirmed.
144614
144607
  "firstResponder"
144615
144608
  ];
144616
- async function queryFullHierarchyTree(registry2, device) {
144609
+ async function queryFullHierarchyTree(registry2, device, launchedNativeApp) {
144617
144610
  let nativeApi;
144618
144611
  try {
144619
144612
  const ndRef = nativeDevtoolsRef(device);
@@ -144624,7 +144617,17 @@ async function queryFullHierarchyTree(registry2, device) {
144624
144617
  { cause: err }
144625
144618
  );
144626
144619
  }
144627
- const target = await resolveNativeTargetApp(nativeApi, void 0);
144620
+ let target;
144621
+ try {
144622
+ target = await resolveNativeTargetApp(nativeApi, void 0);
144623
+ } catch (err) {
144624
+ const timedOut = getFailureSignal(err)?.error_code === FAILURE_CODES.NATIVE_DEVTOOLS_RPC_TIMEOUT;
144625
+ if (timedOut && launchedNativeApp !== void 0 && nativeApi.listConnectedBundleIds().includes(launchedNativeApp)) {
144626
+ target = { bundleId: launchedNativeApp };
144627
+ } else {
144628
+ throw err;
144629
+ }
144630
+ }
144628
144631
  if (await nativeApi.requiresAppRestart(target.bundleId)) {
144629
144632
  throw new Error(
144630
144633
  `${target.bundleId} was launched before argent's instrumentation loaded \u2014 relaunch it (launch-app, or a flow \`launch\` step) so the full view hierarchy is readable`
@@ -144851,9 +144854,9 @@ async function queryVegaTree(device) {
144851
144854
  }
144852
144855
 
144853
144856
  // ../tool-server/src/tools/flows/flow-tree.ts
144854
- async function fetchFlowTree(registry2, device) {
144857
+ async function fetchFlowTree(registry2, device, launchedNativeApp) {
144855
144858
  if (device.platform === "ios") {
144856
- return queryFullHierarchyTree(registry2, device);
144859
+ return queryFullHierarchyTree(registry2, device, launchedNativeApp);
144857
144860
  }
144858
144861
  if (device.platform === "android") {
144859
144862
  return queryAndroidFullHierarchy(registry2, device);
@@ -145405,7 +145408,7 @@ async function settleTree(env) {
145405
145408
  if (env.signal?.aborted) return void 0;
145406
145409
  let tree;
145407
145410
  try {
145408
- ({ tree } = await fetchFlowTree(env.registry, env.device));
145411
+ ({ tree } = await fetchFlowTree(env.registry, env.device, env.launchedNativeApp));
145409
145412
  } catch (err) {
145410
145413
  lastError = err instanceof Error ? err : new Error(String(err));
145411
145414
  }
@@ -145466,7 +145469,7 @@ async function waitForFocus(env, into, tappedFrame) {
145466
145469
  for (; ; ) {
145467
145470
  if (env.signal?.aborted) return;
145468
145471
  try {
145469
- const { tree, source } = await fetchFlowTree(env.registry, env.device);
145472
+ const { tree, source } = await fetchFlowTree(env.registry, env.device, env.launchedNativeApp);
145470
145473
  if (!FOCUS_REPORTING_SOURCES.has(source)) return;
145471
145474
  const target = flowSelectorToFrame(tree, into) ?? tappedFrame;
145472
145475
  if (collectFocused(tree, []).some((n) => framesOverlap(n.frame, target))) return;
@@ -145668,7 +145671,7 @@ async function runPinch(env, step) {
145668
145671
  }
145669
145672
  async function fetchScreenAspect(env) {
145670
145673
  try {
145671
- const { screen } = await fetchFlowTree(env.registry, env.device);
145674
+ const { screen } = await fetchFlowTree(env.registry, env.device, env.launchedNativeApp);
145672
145675
  return screen && screen.width > 0 && screen.height > 0 ? screen.width / screen.height : void 0;
145673
145676
  } catch {
145674
145677
  return void 0;
@@ -145756,7 +145759,7 @@ async function waitForCondition(env, step, timeoutMs) {
145756
145759
  for (; ; ) {
145757
145760
  if (env.signal?.aborted) return ABORTED_OUTCOME;
145758
145761
  try {
145759
- const data = await fetchFlowTree(env.registry, env.device);
145762
+ const data = await fetchFlowTree(env.registry, env.device, env.launchedNativeApp);
145760
145763
  lastMatches = flowFindAll(data.tree, step.selector);
145761
145764
  fetchError = void 0;
145762
145765
  everMatched ||= lastMatches.length > 0;
@@ -145851,7 +145854,11 @@ async function waitForIdle(env, step) {
145851
145854
  const roundStartedAt = Date.now();
145852
145855
  let answeredReadMs;
145853
145856
  const [read, frame] = await Promise.all([
145854
- settleWithin(fetchFlowTree(env.registry, env.device), roundBudget, env.signal).then((r) => {
145857
+ settleWithin(
145858
+ fetchFlowTree(env.registry, env.device, env.launchedNativeApp),
145859
+ roundBudget,
145860
+ env.signal
145861
+ ).then((r) => {
145855
145862
  answeredReadMs = Date.now() - roundStartedAt;
145856
145863
  return r;
145857
145864
  }),
@@ -148379,7 +148386,7 @@ var zodSchema65 = external_exports.object({
148379
148386
  "Path to the flow .yaml as readable by the tool-server. Internal \u2014 the argent client derives it from project_root and name automatically; leave unset."
148380
148387
  ),
148381
148388
  flow_path: external_exports.string().optional().describe(
148382
- "Absolute path to a co-located flow .yaml on the client and tool server's shared filesystem. This must be supplied through the file-input boundary. For remote execution, pass name + project_root instead."
148389
+ "Omit when name is set. Absolute path to a co-located flow .yaml on the client and tool server's shared filesystem. This must be supplied through the file-input boundary. For remote execution, pass name + project_root instead."
148383
148390
  ),
148384
148391
  device: external_exports.string().optional().describe(
148385
148392
  "Device id to run against (iOS UDID, Android/Vega serial, Chromium id) \u2014 the id list-devices reports. Auto-detected when omitted, but only when exactly one booted device matches (optionally narrowed by `platform`); with several booted the run fails and lists them, so pass this explicitly whenever more than one device is up."
@@ -148402,14 +148409,6 @@ var zodSchema65 = external_exports.object({
148402
148409
  });
148403
148410
  }
148404
148411
  });
148405
- var inputSchema2 = {
148406
- ...zodObjectToJsonSchema(zodSchema65),
148407
- // Zod's JSON Schema conversion cannot represent superRefine. `oneOf` makes
148408
- // the same exactly-one source rule visible to MCP and HTTP clients: neither
148409
- // branch matches when both fields are absent, and both branches match (which
148410
- // is invalid for oneOf) when both fields are present.
148411
- oneOf: [{ required: ["name"] }, { required: ["flow_path"] }]
148412
- };
148413
148412
  var fileInputs3 = [
148414
148413
  {
148415
148414
  target: "flow_path",
@@ -148427,8 +148426,15 @@ var fileInputs3 = [
148427
148426
  ];
148428
148427
  var MAX_RUN_DEPTH = 20;
148429
148428
  var POST_LAUNCH_SETTLE_MS = 1500;
148430
- var NATIVE_READY_TIMEOUT_MS = 8e3;
148429
+ var NATIVE_READY_TIMEOUT_MS = 15e3;
148431
148430
  var NATIVE_READY_POLL_MS = 250;
148431
+ var FOREGROUND_CHANGING_TOOLS = /* @__PURE__ */ new Set([
148432
+ "launch-app",
148433
+ "restart-app",
148434
+ "reinstall-app",
148435
+ "open-url",
148436
+ "button"
148437
+ ]);
148432
148438
  async function waitForNativeDevtools(registry2, device, bundleId, signal) {
148433
148439
  let api;
148434
148440
  try {
@@ -148509,6 +148515,7 @@ async function runLaunch(state3, app) {
148509
148515
  const gate = await treeSourceGate(registry2, device, bundleId, signal);
148510
148516
  if (signal?.aborted) return ABORTED_OUTCOME;
148511
148517
  if (gate) return { ok: false, reason: gate };
148518
+ state3.launchedNativeApp = bundleId;
148512
148519
  return { ok: true };
148513
148520
  }
148514
148521
  async function runChromiumLaunch(state3, app) {
@@ -148742,10 +148749,10 @@ off <id>\`, or \`retired <id> (same app relaunched)\` when the instance it left
148742
148749
  a relaunch that retired an older owned instance names both.
148743
148750
 
148744
148751
  If a fragment has an execution prerequisite and prerequisiteAcknowledged is not set to true, the tool
148745
- returns a notice with the prerequisite instead of running.`,
148752
+ returns a notice with the prerequisite instead of running.
148753
+ Pass exactly one flow source: name for a saved flow under project_root, or flow_path for an explicit YAML \u2014 both together, or neither, fails the call.`,
148746
148754
  longRunning: true,
148747
148755
  zodSchema: zodSchema65,
148748
- inputSchema: inputSchema2,
148749
148756
  fileInputs: fileInputs3,
148750
148757
  services: () => ({}),
148751
148758
  async execute(_services, params, ctx) {
@@ -149369,6 +149376,9 @@ async function execLeafStep(state3, step, index, scope) {
149369
149376
  return { ...base, status: "skip", tool: step.name, reason: "run aborted during delay" };
149370
149377
  }
149371
149378
  try {
149379
+ if (FOREGROUND_CHANGING_TOOLS.has(step.name)) {
149380
+ state3.launchedNativeApp = void 0;
149381
+ }
149372
149382
  const result = await invokeSubTool(registry2, ctx, step.name, args);
149373
149383
  if (isUnmetUiWaitResult(step.name, result)) {
149374
149384
  const note = result.note;
@@ -149535,7 +149545,6 @@ async function resolveFlowSource(params, fileInput, flowPathInput) {
149535
149545
  // ../tool-server/src/tools/flows/flow-read-prerequisite.ts
149536
149546
  init_zod();
149537
149547
  var fs50 = __toESM(require("node:fs/promises"));
149538
- init_src();
149539
149548
  var zodSchema66 = external_exports.object({
149540
149549
  name: external_exports.string().optional().describe(
149541
149550
  'Name of a saved flow to inspect from `.argent/flows` (e.g. "settings-explore"). Omit when flow_path is set.'
@@ -149547,7 +149556,7 @@ var zodSchema66 = external_exports.object({
149547
149556
  "Path to the flow .yaml as readable by the tool-server. Internal \u2014 the argent client derives it from project_root and name automatically; leave unset."
149548
149557
  ),
149549
149558
  flow_path: external_exports.string().optional().describe(
149550
- "Absolute path to a co-located flow .yaml on the client and tool server's shared filesystem. This must be supplied through the file-input boundary. Pass the same flow source here as to flow-execute, so the prerequisite you read belongs to the flow that will run; for remote reads, pass name + project_root instead."
149559
+ "Omit when name is set. Absolute path to a co-located flow .yaml on the client and tool server's shared filesystem. This must be supplied through the file-input boundary. Pass the same flow source here as to flow-execute, so the prerequisite you read belongs to the flow that will run; for remote reads, pass name + project_root instead."
149551
149560
  )
149552
149561
  }).superRefine((params, ctx) => {
149553
149562
  if (params.name === void 0 === (params.flow_path === void 0)) {
@@ -149558,14 +149567,6 @@ var zodSchema66 = external_exports.object({
149558
149567
  });
149559
149568
  }
149560
149569
  });
149561
- var inputSchema3 = {
149562
- ...zodObjectToJsonSchema(zodSchema66),
149563
- // Zod's JSON Schema conversion cannot represent superRefine. `oneOf` makes
149564
- // the same exactly-one source rule visible to MCP and HTTP clients — the
149565
- // identical addition flow-execute makes, so the pre-flight read advertises
149566
- // the same contract as the run it precedes.
149567
- oneOf: [{ required: ["name"] }, { required: ["flow_path"] }]
149568
- };
149569
149570
  var fileInputs4 = [
149570
149571
  {
149571
149572
  target: "flow_path",
@@ -149593,9 +149594,9 @@ Returns the prerequisite description so you can verify the required state is met
149593
149594
  Use when you need to check what app/simulator state is required before executing a flow; pass the same flow
149594
149595
  source (name or flow_path) you will pass to flow-execute, so the prerequisite you read is the contract of
149595
149596
  the flow that will actually run.
149596
- Fails if the flow file does not exist.`,
149597
+ Fails if the flow file does not exist.
149598
+ Address the flow exactly as you will address it in flow-execute: name or flow_path, one and only one; supplying both or neither is rejected.`,
149597
149599
  zodSchema: zodSchema66,
149598
- inputSchema: inputSchema3,
149599
149600
  fileInputs: fileInputs4,
149600
149601
  services: () => ({}),
149601
149602
  async execute(_services, params, ctx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.20.1-next.3",
3
+ "version": "0.20.1-next.5",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator and Android Emulator control",
6
6
  "license": "Apache-2.0",