@swmansion/argent 0.33.1-next.2 → 0.33.1-next.20

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 (35) 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 +267 -70
  9. package/dist/client.js +253 -56
  10. package/dist/flow-script-runner.mjs +148 -5
  11. package/dist/installer.mjs +52 -26
  12. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Snapshot.swift +110 -4
  13. package/dist/mcp-server.mjs +257 -60
  14. package/dist/tool-args.generated.d.ts +3 -1
  15. package/dist/tool-server.cjs +1366 -697
  16. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  17. package/dylibs/libKeyboardPatch.dylib +0 -0
  18. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  19. package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
  20. package/dylibs/macos/libNativeDevtoolsMacos.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 -3
  28. package/skills/argent-create-e2e/references/e2e-yaml.md +11 -1
  29. package/skills/argent-create-e2e/references/reliability-and-recovery.md +1 -1
  30. package/skills/argent-device-interact/SKILL.md +1 -1
  31. package/skills/argent-device-interact/references/harmonyos.md +1 -1
  32. package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
  33. package/skills/argent-test-ui-flow/SKILL.md +6 -8
  34. package/assets/trace-processor/SHA256SUMS +0 -4
  35. package/assets/trace-processor/engine.mjs +0 -42423
@@ -106,9 +106,9 @@ var require_picocolors = __commonJS({
106
106
  var argv = p.argv || [];
107
107
  var env = p.env || {};
108
108
  var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
109
- var formatter = (open, close, replace = open) => (input) => {
110
- let string = "" + input, index = string.indexOf(close, open.length);
111
- return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
109
+ var formatter = (open2, close, replace = open2) => (input) => {
110
+ let string = "" + input, index = string.indexOf(close, open2.length);
111
+ return ~index ? open2 + replaceClose(string, close, replace, index) + close : open2 + string + close;
112
112
  };
113
113
  var replaceClose = (string, close, replace, index) => {
114
114
  let result = "", cursor3 = 0;
@@ -15735,7 +15735,10 @@ import { basename, extname } from "node:path";
15735
15735
  var FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
15736
15736
  var FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
15737
15737
  var FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
15738
- var SCRIPT_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.mjs$`);
15738
+ var SCRIPT_FILE_EXTENSIONS = [".mjs", ".mts", ".js", ".ts"];
15739
+ var SCRIPT_FILE_NAME_PATTERN = new RegExp(
15740
+ `^${FLOW_NAME_CHARSET}(?:${SCRIPT_FILE_EXTENSIONS.map((ext) => `\\${ext}`).join("|")})$`
15741
+ );
15739
15742
 
15740
15743
  // ../registry/src/flow-file-refs.ts
15741
15744
  import * as fs7 from "node:fs/promises";
@@ -16059,6 +16062,8 @@ var FAILURE_CODES = {
16059
16062
  FLOW_DEVICE_RESOLUTION: "FLOW_DEVICE_RESOLUTION",
16060
16063
  // The target does not satisfy the test's `requires:` block; a directory run skips it.
16061
16064
  FLOW_REQUIREMENTS_UNMET: "FLOW_REQUIREMENTS_UNMET",
16065
+ // The tool-server's Node.js cannot run a TypeScript `script:` step the test holds.
16066
+ FLOW_SCRIPT_TYPESCRIPT_UNSUPPORTED: "FLOW_SCRIPT_TYPESCRIPT_UNSUPPORTED",
16062
16067
  PROFILER_QUERY_MODE_INVALID: "PROFILER_QUERY_MODE_INVALID",
16063
16068
  PROFILER_QUERY_REQUIRED_PARAM_MISSING: "PROFILER_QUERY_REQUIRED_PARAM_MISSING",
16064
16069
  PROFILER_DATA_NOT_LOADED: "PROFILER_DATA_NOT_LOADED",
@@ -16981,7 +16986,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16981
16986
  var SESSION_ID = randomUUID4();
16982
16987
  function readCliVersion() {
16983
16988
  if (true) {
16984
- return "0.33.1-next.2";
16989
+ return "0.33.1-next.20";
16985
16990
  }
16986
16991
  return "0.0.0";
16987
16992
  }
@@ -20064,7 +20069,7 @@ function localInstallCommand(pm, pkg) {
20064
20069
  case "yarn":
20065
20070
  return { bin: "yarn", args: ["add", "--dev", pkg] };
20066
20071
  case "pnpm":
20067
- return { bin: "pnpm", args: ["add", "-D", pkg] };
20072
+ return { bin: "pnpm", args: ["add", "-D", "--ignore-workspace-root-check", pkg] };
20068
20073
  case "bun":
20069
20074
  return { bin: "bun", args: ["add", "-d", pkg] };
20070
20075
  default:
@@ -20495,6 +20500,13 @@ function getAtJsoncPath(value, jsonPath) {
20495
20500
  function isEmptyPlainObject(value) {
20496
20501
  return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0;
20497
20502
  }
20503
+ function removePath(targetPath) {
20504
+ const entry = fs16.lstatSync(targetPath, { throwIfNoEntry: false });
20505
+ if (!entry) return false;
20506
+ if (entry.isSymbolicLink()) fs16.unlinkSync(targetPath);
20507
+ else fs16.rmSync(targetPath, { recursive: entry.isDirectory(), force: true });
20508
+ return true;
20509
+ }
20498
20510
  function rmEmptyDir(dirPath) {
20499
20511
  try {
20500
20512
  if (!fs16.existsSync(dirPath)) return false;
@@ -20612,7 +20624,7 @@ function removeRetiredFiles(targetDir, files) {
20612
20624
  const file = resolveLinkedDestination(entryPath);
20613
20625
  try {
20614
20626
  fs16.rmSync(file);
20615
- if (file !== entryPath) fs16.rmSync(entryPath, { force: true });
20627
+ if (file !== entryPath) removePath(entryPath);
20616
20628
  removedPaths.push(relativePath);
20617
20629
  } catch {
20618
20630
  continue;
@@ -20654,6 +20666,7 @@ function isNewerVersion(candidate, current) {
20654
20666
  function withNpmForce(npxArgs) {
20655
20667
  return ["--force", ...npxArgs];
20656
20668
  }
20669
+ var SKIPPED_SKILLS_SOURCE_SUBMODULES = ["packages/argent-private"];
20657
20670
  function npxChildEnv(env = process.env) {
20658
20671
  const childEnv = { ...env };
20659
20672
  for (const key of Object.keys(childEnv)) {
@@ -20661,6 +20674,14 @@ function npxChildEnv(env = process.env) {
20661
20674
  delete childEnv[key];
20662
20675
  }
20663
20676
  }
20677
+ const existing = Number(childEnv.GIT_CONFIG_COUNT ?? 0);
20678
+ let count = Number.isInteger(existing) && existing >= 0 ? existing : 0;
20679
+ for (const name of SKIPPED_SKILLS_SOURCE_SUBMODULES) {
20680
+ childEnv[`GIT_CONFIG_KEY_${count}`] = `submodule.${name}.update`;
20681
+ childEnv[`GIT_CONFIG_VALUE_${count}`] = "none";
20682
+ count += 1;
20683
+ }
20684
+ childEnv.GIT_CONFIG_COUNT = String(count);
20664
20685
  return childEnv;
20665
20686
  }
20666
20687
  function isSkillsCliAvailable(cwd) {
@@ -22471,7 +22492,11 @@ function runShellCommand(cmd, opts = {}) {
22471
22492
  shell: process.platform === "win32",
22472
22493
  ...opts.cwd ? { cwd: opts.cwd } : {}
22473
22494
  });
22495
+ let stdout2 = "";
22474
22496
  let stderr = "";
22497
+ child.stdout?.on("data", (chunk) => {
22498
+ stdout2 += chunk.toString();
22499
+ });
22475
22500
  child.stderr?.on("data", (chunk) => {
22476
22501
  stderr += chunk.toString();
22477
22502
  });
@@ -22480,7 +22505,7 @@ function runShellCommand(cmd, opts = {}) {
22480
22505
  else
22481
22506
  reject(
22482
22507
  new ShellCommandError(
22483
- stderr.trim() || (signal !== null ? `Command terminated by signal ${signal}` : `Command exited with code ${code}`),
22508
+ stderr.trim() || stdout2.trim() || (signal !== null ? `Command terminated by signal ${signal}` : `Command exited with code ${code}`),
22484
22509
  code,
22485
22510
  signal
22486
22511
  )
@@ -22599,9 +22624,7 @@ function pruneLegacySkillDirs(projectRoot, scope, bundled = new Set(listBundledS
22599
22624
  for (const name of legacy) {
22600
22625
  const dir = path21.join(targetPath, name);
22601
22626
  try {
22602
- if (!fs19.lstatSync(dir, { throwIfNoEntry: false })) continue;
22603
- fs19.rmSync(dir, { recursive: true, force: true });
22604
- removed.add(name);
22627
+ if (removePath(dir)) removed.add(name);
22605
22628
  } catch {
22606
22629
  }
22607
22630
  }
@@ -24147,7 +24170,7 @@ var LINK_FILE = path24.join(LINK_DIR, "link.json");
24147
24170
 
24148
24171
  // ../argent-tools-client/src/file-inputs.ts
24149
24172
  import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
24150
- import { createReadStream, rmSync as rmSync7 } from "node:fs";
24173
+ import { createReadStream as createReadStream2, rmSync as rmSync6 } from "node:fs";
24151
24174
  import {
24152
24175
  chmod as chmod3,
24153
24176
  lstat,
@@ -24163,11 +24186,21 @@ import { constants, tmpdir } from "node:os";
24163
24186
  import * as path25 from "node:path";
24164
24187
 
24165
24188
  // ../archive/src/index.ts
24166
- import { execFile } from "node:child_process";
24167
- import { rm, readdir as readdir3 } from "node:fs/promises";
24168
- import { basename as basename4, dirname as dirname13, join as join24, posix as posix2, resolve as resolve13, sep as sep4 } from "node:path";
24169
- import { promisify } from "node:util";
24170
- var execFileAsync = promisify(execFile);
24189
+ import { spawn as spawn5 } from "node:child_process";
24190
+ import { once } from "node:events";
24191
+ import { createReadStream, createWriteStream } from "node:fs";
24192
+ import { open, rm, readdir as readdir3 } from "node:fs/promises";
24193
+ import { basename as basename4, dirname as dirname13, join as join24, resolve as resolve13, sep as sep4 } from "node:path";
24194
+ import { Writable } from "node:stream";
24195
+ import { pipeline } from "node:stream/promises";
24196
+ import zlib2 from "node:zlib";
24197
+ var ARCHIVE_FORMATS = typeof zlib2.createZstdCompress === "function" ? ["zstd", "gzip"] : ["gzip"];
24198
+ var CHUNK_BYTES = 1 << 20;
24199
+ var MAX_LISTING_BYTES = 32 << 20;
24200
+ var MAX_LISTING_LINES = 1 << 18;
24201
+ var MAX_STDERR_BYTES = 16 << 10;
24202
+ var MAX_UNREAD_BYTES = 16 << 20;
24203
+ var TAR_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
24171
24204
 
24172
24205
  // ../argent-tools-client/src/file-inputs.ts
24173
24206
  var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
@@ -24796,7 +24829,7 @@ function removeBundledContent(sourceDir, targetDir) {
24796
24829
  try {
24797
24830
  if (!fs21.existsSync(targetPath)) continue;
24798
24831
  if (fs21.lstatSync(targetPath).isDirectory()) continue;
24799
- fs21.rmSync(targetPath, { force: true });
24832
+ removePath(targetPath);
24800
24833
  removedPaths.push(relativePath);
24801
24834
  } catch {
24802
24835
  }
@@ -24860,14 +24893,7 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
24860
24893
  for (const skillName of skillNames) {
24861
24894
  const targetPath = path29.join(targetDir, skillName);
24862
24895
  try {
24863
- const stats = fs21.lstatSync(targetPath, { throwIfNoEntry: false });
24864
- if (!stats) continue;
24865
- if (stats.isDirectory() && !stats.isSymbolicLink()) {
24866
- fs21.rmSync(targetPath, { recursive: true, force: true });
24867
- } else {
24868
- fs21.rmSync(targetPath, { force: true });
24869
- }
24870
- removedPaths.push(skillName);
24896
+ if (removePath(targetPath)) removedPaths.push(skillName);
24871
24897
  } catch {
24872
24898
  }
24873
24899
  }
@@ -26,6 +26,16 @@ extension ArgentRunnerSession {
26
26
  /// Ceiling on emitted node depth.
27
27
  private static let emittedDepthLimit = 60
28
28
 
29
+ /// View services that present UI over the registered app from their own
30
+ /// process. On iOS 26 the host app's tree no longer bridges into them, so
31
+ /// an ASWebAuthenticationSession or SFSafariViewController sheet is missing
32
+ /// from the app's snapshot even though it covers the screen.
33
+ private static let hostedViewServiceBundleIds = ["com.apple.SafariViewService"]
34
+
35
+ /// Share of the node budget a hosted service may use. A heavy web page
36
+ /// must not crowd out the app's own nodes and the keyboard.
37
+ private static let hostedNodeBudget = 1000
38
+
29
39
  /// Captures the app's accessibility tree and flattens it into a snapshot
30
40
  /// payload. The capture is retried once after a short pause: this is the
31
41
  /// one runner-side retry, kept here because the capture can read its own
@@ -70,7 +80,7 @@ extension ArgentRunnerSession {
70
80
  )
71
81
  }
72
82
 
73
- let nodes = Self.flatten(root)
83
+ let nodes = Self.flatten(root, hosted: hostedServiceRoots(over: root))
74
84
  let capped = nodes.count >= Self.snapshotNodeBudget
75
85
 
76
86
  return .success(
@@ -88,28 +98,122 @@ extension ArgentRunnerSession {
88
98
  )
89
99
  }
90
100
 
101
+ /// Trees of the hosted view services presenting over `root` right now.
102
+ /// The service is read through a proxy and never activated: activating it
103
+ /// would front it as a standalone app and black out the screen.
104
+ ///
105
+ /// Only a foreground service is read. A suspended one, where the service
106
+ /// stays after its sheet closes, blocks `snapshot()` past the command
107
+ /// watchdog and leaves the runner busy. A background one returns stale
108
+ /// pieces of the closed sheet. A tree whose size differs from the app's
109
+ /// belongs to a sheet still animating in or out, and its frames would
110
+ /// mislead taps, so it is dropped too. A failure here never fails the
111
+ /// app's own snapshot.
112
+ private func hostedServiceRoots(over root: XCUIElementSnapshot)
113
+ -> [XCUIElementSnapshot]
114
+ {
115
+ // Before iOS 26 the app's tree already carries the hosted browser.
116
+ if Self.containsHostedBrowser(root) { return [] }
117
+
118
+ var roots: [XCUIElementSnapshot] = []
119
+
120
+ for bundleId in Self.hostedViewServiceBundleIds {
121
+ let service = XCUIApplication(bundleIdentifier: bundleId)
122
+ guard service.state == .runningForeground else { continue }
123
+
124
+ var hosted: XCUIElementSnapshot?
125
+ var failure: String?
126
+ let started = Date()
127
+ let exceptionDescription = ArgentExceptionGuard.runCatching {
128
+ do {
129
+ hosted = try service.snapshot()
130
+ } catch {
131
+ failure = String(describing: error)
132
+ }
133
+ }
134
+ let elapsedMs = Int(Date().timeIntervalSince(started) * 1000)
135
+
136
+ guard let hosted, service.state == .runningForeground,
137
+ Self.sameSize(hosted.frame, root.frame)
138
+ else {
139
+ NSLog(
140
+ "ARGENT_HOSTED_SKIPPED bundle=%@ ms=%d reason=%@",
141
+ bundleId, elapsedMs,
142
+ exceptionDescription ?? failure ?? "not settled on screen"
143
+ )
144
+ continue
145
+ }
146
+
147
+ NSLog("ARGENT_HOSTED bundle=%@ ms=%d", bundleId, elapsedMs)
148
+ roots.append(hosted)
149
+ }
150
+
151
+ return roots
152
+ }
153
+
154
+ /// Whether the tree holds SafariViewService's browser container, whose
155
+ /// identifier starts with "BrowserView". An app's own web view does not
156
+ /// count. Bounded by the raw depth limit.
157
+ private static func containsHostedBrowser(_ root: XCUIElementSnapshot)
158
+ -> Bool
159
+ {
160
+ var stack: [(XCUIElementSnapshot, Int)] = [(root, 0)]
161
+
162
+ while let (snapshot, depth) = stack.popLast() {
163
+ if snapshot.identifier.hasPrefix("BrowserView") { return true }
164
+ if depth >= rawDepthLimit { continue }
165
+ stack.append(contentsOf: snapshot.children.map { ($0, depth + 1) })
166
+ }
167
+
168
+ return false
169
+ }
170
+
171
+ /// Whether two frames have the same size within a point.
172
+ private static func sameSize(_ a: CGRect, _ b: CGRect) -> Bool {
173
+ abs(a.width - b.width) < 1 && abs(a.height - b.height) < 1
174
+ }
175
+
91
176
  /// Flattens the snapshot tree into an ordered node list. Keeps elements an
92
177
  /// agent can name or act on, assigns indices and parent links in emission
93
- /// order, and dedupes mirror elements.
94
- static func flatten(_ root: XCUIElementSnapshot) -> [SnapshotNodePayload] {
178
+ /// order, and dedupes mirror elements. `hosted` trees of view services
179
+ /// presenting over the app are emitted first under the root, within
180
+ /// their own share of the node budget.
181
+ static func flatten(
182
+ _ root: XCUIElementSnapshot,
183
+ hosted: [XCUIElementSnapshot] = []
184
+ ) -> [SnapshotNodePayload] {
95
185
  struct WorkItem {
96
186
  let snapshot: XCUIElementSnapshot
97
187
  let rawDepth: Int
98
188
  let emittedDepth: Int
99
189
  let parentIndex: Int
190
+ var hosted = false
100
191
  }
101
192
 
102
193
  let viewport = root.frame
103
194
  var nodes = [makeNode(root, index: 0, depth: 0, parentIndex: nil)]
104
195
  var seen: Set<String> = [identity(root)]
196
+ var hostedEmitted = 0
105
197
 
106
198
  var stack = root.children.reversed().map {
107
199
  WorkItem(snapshot: $0, rawDepth: 1, emittedDepth: 1, parentIndex: 0)
108
200
  }
109
201
 
202
+ // Pushed last so they are walked first: they cover the screen, and the
203
+ // app's keyboard keys must not use up the budget before them.
204
+ stack.append(
205
+ contentsOf: hosted.reversed().map {
206
+ WorkItem(
207
+ snapshot: $0, rawDepth: 1, emittedDepth: 1, parentIndex: 0,
208
+ hosted: true
209
+ )
210
+ }
211
+ )
212
+
110
213
  while let item = stack.popLast() {
111
214
  if nodes.count >= snapshotNodeBudget { break }
112
215
  if item.rawDepth > rawDepthLimit { continue }
216
+ if item.hosted && hostedEmitted >= hostedNodeBudget { continue }
113
217
 
114
218
  let snapshot = item.snapshot
115
219
  let frame = snapshot.frame
@@ -141,6 +245,7 @@ extension ArgentRunnerSession {
141
245
 
142
246
  childParentIndex = index
143
247
  childEmittedDepth += 1
248
+ if item.hosted { hostedEmitted += 1 }
144
249
  }
145
250
 
146
251
  for child in snapshot.children.reversed() {
@@ -149,7 +254,8 @@ extension ArgentRunnerSession {
149
254
  snapshot: child,
150
255
  rawDepth: item.rawDepth + 1,
151
256
  emittedDepth: childEmittedDepth,
152
- parentIndex: childParentIndex
257
+ parentIndex: childParentIndex,
258
+ hosted: item.hosted
153
259
  )
154
260
  )
155
261
  }