@swmansion/argent 0.20.1-next.4 → 0.20.1-next.6

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.
@@ -122457,7 +122457,6 @@ Use when you need to zoom in or out on a map, image, or zoomable view. Returns {
122457
122457
 
122458
122458
  // ../tool-server/src/tools/gesture-rotate/index.ts
122459
122459
  init_zod();
122460
- init_src();
122461
122460
  var zodSchema22 = external_exports.object({
122462
122461
  udid: external_exports.string().describe("Target device id from `list-devices` (iOS UDID or Android serial)."),
122463
122462
  centerX: external_exports.number().describe(
@@ -122483,16 +122482,6 @@ var zodSchema22 = external_exports.object({
122483
122482
  }).refine((p) => p.radius !== void 0 || p.radiusX !== void 0, {
122484
122483
  message: "Pass radius, or both radiusX and radiusY."
122485
122484
  });
122486
- var inputSchema = {
122487
- ...zodObjectToJsonSchema(zodSchema22),
122488
- anyOf: [
122489
- { required: ["radiusX", "radiusY"] },
122490
- {
122491
- required: ["radius"],
122492
- not: { anyOf: [{ required: ["radiusX"] }, { required: ["radiusY"] }] }
122493
- }
122494
- ]
122495
- };
122496
122485
  var capability14 = {
122497
122486
  apple: { simulator: true, device: true },
122498
122487
  appleRemote: { simulator: true },
@@ -122517,9 +122506,9 @@ var gestureRotateTool = {
122517
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.
122518
122507
  Auto-generates interpolated frames at ~60fps.
122519
122508
  Unlike gesture-pinch which moves fingers linearly to zoom, this orbits fingers in an arc to change orientation.
122520
- 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.`,
122521
122511
  zodSchema: zodSchema22,
122522
- inputSchema,
122523
122512
  capability: capability14,
122524
122513
  services: (params) => ({
122525
122514
  simulatorServer: simulatorServerRef(resolveDevice(params.udid))
@@ -142728,6 +142717,12 @@ function selectorTree(sel) {
142728
142717
  walk(sel);
142729
142718
  return out;
142730
142719
  }
142720
+ function blockSteps(step) {
142721
+ return isBlockStep(step) ? step.steps : void 0;
142722
+ }
142723
+ function isBlockStep(step) {
142724
+ return isBlockDirectiveKey(step.kind);
142725
+ }
142731
142726
  function isE2eFlow(flow) {
142732
142727
  const first = flow.steps.find((s) => s.kind !== "echo");
142733
142728
  return first?.kind === "launch";
@@ -143392,6 +143387,10 @@ var STEP_DIRECTIVE_KEYS = [
143392
143387
  "rotate",
143393
143388
  "snapshot"
143394
143389
  ];
143390
+ var BLOCK_DIRECTIVE_KEYS = ["when"];
143391
+ function isBlockDirectiveKey(key2) {
143392
+ return BLOCK_DIRECTIVE_KEYS.includes(key2);
143393
+ }
143395
143394
  function parseTapTimes(raw, entry) {
143396
143395
  if (raw === void 0) return void 0;
143397
143396
  if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 1 || raw > 10) {
@@ -143584,14 +143583,26 @@ function parseWhenCondition(raw) {
143584
143583
  }
143585
143584
  return { kind: "ui", ...cond };
143586
143585
  }
143587
- var MAX_WHEN_DEPTH = 20;
143588
- function parseWhenStep(raw, depth) {
143589
- if (depth >= MAX_WHEN_DEPTH) {
143586
+ var MAX_BLOCK_DEPTH = 20;
143587
+ function assertBlockDepth(raw, depth) {
143588
+ if (depth >= MAX_BLOCK_DEPTH) {
143589
+ const directives = BLOCK_DIRECTIVE_KEYS.map((key2) => `\`${key2}:\``).join("/");
143590
143590
  badEntry(
143591
143591
  raw,
143592
- `when blocks nest deeper than ${MAX_WHEN_DEPTH} levels \u2014 check for a cyclic YAML alias (\`steps: &s \u2026 steps: *s\`)`
143592
+ `${directives} blocks nest deeper than ${MAX_BLOCK_DEPTH} levels \u2014 check for a cyclic YAML alias (\`steps: &s \u2026 steps: *s\`)`
143593
143593
  );
143594
143594
  }
143595
+ }
143596
+ function parseBlockSteps(raw, depth, emptyDetail) {
143597
+ assertBlockDepth(raw, depth);
143598
+ if (!Array.isArray(raw.steps) || raw.steps.length === 0) badEntry(raw, emptyDetail);
143599
+ return raw.steps.map((s) => {
143600
+ if (s !== null && typeof s === "object") return fromYamlStep(s, depth + 1);
143601
+ return badEntry(s, "step must be an object");
143602
+ });
143603
+ }
143604
+ function parseWhenStep(raw, depth) {
143605
+ assertBlockDepth(raw, depth);
143595
143606
  if ("else" in raw) {
143596
143607
  badEntry(
143597
143608
  raw,
@@ -143602,13 +143613,7 @@ function parseWhenStep(raw, depth) {
143602
143613
  badEntry(raw, "a when step takes exactly { when: <condition>, steps: [...] }");
143603
143614
  }
143604
143615
  const condition = parseWhenCondition(raw.when);
143605
- if (!Array.isArray(raw.steps) || raw.steps.length === 0) {
143606
- badEntry(raw, "when needs a non-empty steps list to guard");
143607
- }
143608
- const steps = raw.steps.map((s) => {
143609
- if (s !== null && typeof s === "object") return fromYamlStep(s, depth + 1);
143610
- return badEntry(s, "step must be an object");
143611
- });
143616
+ const steps = parseBlockSteps(raw, depth, "when needs a non-empty steps list to guard");
143612
143617
  return { kind: "when", condition, steps };
143613
143618
  }
143614
143619
  function runTargetName(target) {
@@ -143647,7 +143652,7 @@ function completeRunExtension(value) {
143647
143652
  const candidate = `${value}.yaml`;
143648
143653
  return FLOW_FILE_NAME_PATTERN.test(path31.posix.basename(candidate)) ? candidate : value;
143649
143654
  }
143650
- function fromYamlStep(raw, whenDepth = 0) {
143655
+ function fromYamlStep(raw, blockDepth = 0) {
143651
143656
  const entry = raw;
143652
143657
  if ("optional" in raw) {
143653
143658
  badEntry(
@@ -143670,7 +143675,7 @@ function fromYamlStep(raw, whenDepth = 0) {
143670
143675
  );
143671
143676
  }
143672
143677
  const kind = kinds[0];
143673
- if (kind !== "when") {
143678
+ if (!isBlockDirectiveKey(kind)) {
143674
143679
  const siblings = kind === "tool" ? ["tool", "args", "delayMs"] : [kind];
143675
143680
  const extras = Object.keys(entry).filter((k) => !siblings.includes(k));
143676
143681
  if (extras.length > 0) {
@@ -143683,7 +143688,7 @@ function fromYamlStep(raw, whenDepth = 0) {
143683
143688
  if ("echo" in raw) return { kind: "echo", message: String(raw.echo) };
143684
143689
  if ("launch" in raw) return { kind: "launch", app: parseLaunch(raw.launch) };
143685
143690
  if ("run" in raw) return { kind: "run", flow: parseRunTarget(raw, raw.run) };
143686
- if ("when" in raw) return parseWhenStep(entry, whenDepth);
143691
+ if ("when" in raw) return parseWhenStep(entry, blockDepth);
143687
143692
  if ("tap" in raw) return parseTap(raw.tap, raw);
143688
143693
  if ("long-press" in raw) {
143689
143694
  return parseLongPress(raw["long-press"], raw);
@@ -144399,11 +144404,13 @@ function stepRequiresDevice(registry2, step) {
144399
144404
  }
144400
144405
  }
144401
144406
  function flowRequiresDevice(registry2, steps) {
144402
- return steps.some((step) => stepRequiresDevice(registry2, step));
144407
+ return steps.some(
144408
+ (step) => stepRequiresDevice(registry2, step) || flowRequiresDevice(registry2, blockSteps(step) ?? [])
144409
+ );
144403
144410
  }
144404
144411
  function flowScopesDevice(registry2, steps) {
144405
144412
  return steps.some(
144406
- (step) => step.kind === "tool" && declaresAny(registry2, step.name, DEVICE_BIND_LIST_KEYS)
144413
+ (step) => step.kind === "tool" && declaresAny(registry2, step.name, DEVICE_BIND_LIST_KEYS) || flowScopesDevice(registry2, blockSteps(step) ?? [])
144407
144414
  );
144408
144415
  }
144409
144416
  function toolRequiresDevice(registry2, toolName) {
@@ -148397,7 +148404,7 @@ var zodSchema65 = external_exports.object({
148397
148404
  "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."
148398
148405
  ),
148399
148406
  flow_path: external_exports.string().optional().describe(
148400
- "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."
148407
+ "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."
148401
148408
  ),
148402
148409
  device: external_exports.string().optional().describe(
148403
148410
  "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."
@@ -148420,14 +148427,6 @@ var zodSchema65 = external_exports.object({
148420
148427
  });
148421
148428
  }
148422
148429
  });
148423
- var inputSchema2 = {
148424
- ...zodObjectToJsonSchema(zodSchema65),
148425
- // Zod's JSON Schema conversion cannot represent superRefine. `oneOf` makes
148426
- // the same exactly-one source rule visible to MCP and HTTP clients: neither
148427
- // branch matches when both fields are absent, and both branches match (which
148428
- // is invalid for oneOf) when both fields are present.
148429
- oneOf: [{ required: ["name"] }, { required: ["flow_path"] }]
148430
- };
148431
148430
  var fileInputs3 = [
148432
148431
  {
148433
148432
  target: "flow_path",
@@ -148681,7 +148680,8 @@ function displayFlowName(params) {
148681
148680
  function* walkSteps(steps) {
148682
148681
  for (const step of steps) {
148683
148682
  yield step;
148684
- if (step.kind === "when") yield* walkSteps(step.steps);
148683
+ const inner = blockSteps(step);
148684
+ if (inner) yield* walkSteps(inner);
148685
148685
  }
148686
148686
  }
148687
148687
  function assertUploadSelfContained(flow) {
@@ -148768,10 +148768,10 @@ off <id>\`, or \`retired <id> (same app relaunched)\` when the instance it left
148768
148768
  a relaunch that retired an older owned instance names both.
148769
148769
 
148770
148770
  If a fragment has an execution prerequisite and prerequisiteAcknowledged is not set to true, the tool
148771
- returns a notice with the prerequisite instead of running.`,
148771
+ returns a notice with the prerequisite instead of running.
148772
+ 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.`,
148772
148773
  longRunning: true,
148773
148774
  zodSchema: zodSchema65,
148774
- inputSchema: inputSchema2,
148775
148775
  fileInputs: fileInputs3,
148776
148776
  services: () => ({}),
148777
148777
  async execute(_services, params, ctx) {
@@ -149082,8 +149082,18 @@ function stepTarget(step) {
149082
149082
  return step.cropOn ? `"${step.name}" cropOn ${selectorLabel2(step.cropOn)}` : `"${step.name}"`;
149083
149083
  case "run":
149084
149084
  return step.flow;
149085
- default:
149085
+ case "echo":
149086
+ case "tool":
149087
+ return void 0;
149088
+ case "launch":
149089
+ return void 0;
149090
+ case "wait":
149091
+ return void 0;
149092
+ default: {
149093
+ const unclassified = step;
149094
+ void unclassified;
149086
149095
  return void 0;
149096
+ }
149087
149097
  }
149088
149098
  }
149089
149099
  function scopeFlow(scope) {
@@ -149125,7 +149135,8 @@ async function execSteps(state3, steps, scope) {
149125
149135
  // line rather than vanishing — matching reportBlockSkipped.
149126
149136
  ...step.kind === "echo" ? { message: step.message } : {}
149127
149137
  });
149128
- if (step.kind === "when") reportBlockSkipped(state3, step.steps, childScope(scope));
149138
+ const inner = blockSteps(step);
149139
+ if (inner) reportBlockSkipped(state3, inner, childScope(scope));
149129
149140
  continue;
149130
149141
  }
149131
149142
  if (!state3.device && stepRequiresDevice(state3.registry, step)) {
@@ -149139,7 +149150,8 @@ async function execSteps(state3, steps, scope) {
149139
149150
  ...depthOf(scope),
149140
149151
  reason: `step needs a device but the flow was resolved as device-free \u2014 pass an explicit device`
149141
149152
  });
149142
- if (step.kind === "when") reportBlockSkipped(state3, step.steps, childScope(scope));
149153
+ const inner = blockSteps(step);
149154
+ if (inner) reportBlockSkipped(state3, inner, childScope(scope));
149143
149155
  continue;
149144
149156
  }
149145
149157
  if (state3.signal?.aborted) {
@@ -149154,17 +149166,16 @@ async function execSteps(state3, steps, scope) {
149154
149166
  ...depthOf(scope),
149155
149167
  ...step.kind === "echo" ? { message: step.message } : {}
149156
149168
  });
149157
- if (step.kind === "when") {
149158
- reportBlockSkipped(state3, step.steps, childScope(scope), "run aborted");
149159
- }
149169
+ const inner = blockSteps(step);
149170
+ if (inner) reportBlockSkipped(state3, inner, childScope(scope), "run aborted");
149160
149171
  continue;
149161
149172
  }
149162
149173
  if (step.kind === "run") {
149163
149174
  await execRunStep(state3, step, scope);
149164
149175
  continue;
149165
149176
  }
149166
- if (step.kind === "when") {
149167
- await execWhenStep(state3, step, scope);
149177
+ if (isBlockStep(step)) {
149178
+ await execBlockStep(state3, step, scope);
149168
149179
  continue;
149169
149180
  }
149170
149181
  const report = await execLeafStep(state3, step, index, scope);
@@ -149188,7 +149199,18 @@ function reportBlockSkipped(state3, steps, scope, reason) {
149188
149199
  ...depthOf(scope),
149189
149200
  ...step.kind === "echo" ? { message: step.message } : {}
149190
149201
  });
149191
- if (step.kind === "when") reportBlockSkipped(state3, step.steps, childScope(scope), reason);
149202
+ const inner = blockSteps(step);
149203
+ if (inner) reportBlockSkipped(state3, inner, childScope(scope), reason);
149204
+ }
149205
+ }
149206
+ async function execBlockStep(state3, step, scope) {
149207
+ switch (step.kind) {
149208
+ case "when":
149209
+ return execWhenStep(state3, step, scope);
149210
+ default: {
149211
+ const unhandled = step.kind;
149212
+ void unhandled;
149213
+ }
149192
149214
  }
149193
149215
  }
149194
149216
  async function execWhenStep(state3, step, scope) {
@@ -149564,7 +149586,6 @@ async function resolveFlowSource(params, fileInput, flowPathInput) {
149564
149586
  // ../tool-server/src/tools/flows/flow-read-prerequisite.ts
149565
149587
  init_zod();
149566
149588
  var fs50 = __toESM(require("node:fs/promises"));
149567
- init_src();
149568
149589
  var zodSchema66 = external_exports.object({
149569
149590
  name: external_exports.string().optional().describe(
149570
149591
  'Name of a saved flow to inspect from `.argent/flows` (e.g. "settings-explore"). Omit when flow_path is set.'
@@ -149576,7 +149597,7 @@ var zodSchema66 = external_exports.object({
149576
149597
  "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."
149577
149598
  ),
149578
149599
  flow_path: external_exports.string().optional().describe(
149579
- "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."
149600
+ "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."
149580
149601
  )
149581
149602
  }).superRefine((params, ctx) => {
149582
149603
  if (params.name === void 0 === (params.flow_path === void 0)) {
@@ -149587,14 +149608,6 @@ var zodSchema66 = external_exports.object({
149587
149608
  });
149588
149609
  }
149589
149610
  });
149590
- var inputSchema3 = {
149591
- ...zodObjectToJsonSchema(zodSchema66),
149592
- // Zod's JSON Schema conversion cannot represent superRefine. `oneOf` makes
149593
- // the same exactly-one source rule visible to MCP and HTTP clients — the
149594
- // identical addition flow-execute makes, so the pre-flight read advertises
149595
- // the same contract as the run it precedes.
149596
- oneOf: [{ required: ["name"] }, { required: ["flow_path"] }]
149597
- };
149598
149611
  var fileInputs4 = [
149599
149612
  {
149600
149613
  target: "flow_path",
@@ -149622,9 +149635,9 @@ Returns the prerequisite description so you can verify the required state is met
149622
149635
  Use when you need to check what app/simulator state is required before executing a flow; pass the same flow
149623
149636
  source (name or flow_path) you will pass to flow-execute, so the prerequisite you read is the contract of
149624
149637
  the flow that will actually run.
149625
- Fails if the flow file does not exist.`,
149638
+ Fails if the flow file does not exist.
149639
+ 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.`,
149626
149640
  zodSchema: zodSchema66,
149627
- inputSchema: inputSchema3,
149628
149641
  fileInputs: fileInputs4,
149629
149642
  services: () => ({}),
149630
149643
  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.4",
3
+ "version": "0.20.1-next.6",
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",