@swmansion/argent 0.23.0 → 0.23.1-next.1

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 (44) hide show
  1. package/README.md +1 -1
  2. package/bin/argent-android-devtools-0.1.0.apk +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/tcp/ax-service +0 -0
  7. package/dist/cli-cmds.mjs +48 -20
  8. package/dist/installer.mjs +46 -18
  9. package/dist/ios-device-runner/ArgentRunner/ArgentRunner/RunnerHostApp.swift +37 -0
  10. package/dist/ios-device-runner/ArgentRunner/ArgentRunner.xcodeproj/project.pbxproj +389 -0
  11. package/dist/ios-device-runner/ArgentRunner/ArgentRunner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  12. package/dist/ios-device-runner/ArgentRunner/ArgentRunner.xcodeproj/xcshareddata/xcschemes/ArgentRunner.xcscheme +88 -0
  13. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentExceptionGuard.h +16 -0
  14. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentExceptionGuard.m +16 -0
  15. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Commands.swift +280 -0
  16. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Gestures.swift +149 -0
  17. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Screenshot.swift +21 -0
  18. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Snapshot.swift +327 -0
  19. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+TextEntry.swift +157 -0
  20. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession.swift +410 -0
  21. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerUITests-Bridging-Header.h +1 -0
  22. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/CommandJournal.swift +134 -0
  23. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/MainThreadGate.swift +111 -0
  24. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/RunnerHTTPServer.swift +267 -0
  25. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/RunnerProtocol.swift +331 -0
  26. package/dist/mcp-server.mjs +47 -19
  27. package/dist/tool-server.cjs +4224 -1388
  28. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  29. package/dylibs/libKeyboardPatch.dylib +0 -0
  30. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  31. package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
  32. package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
  33. package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
  34. package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
  35. package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
  36. package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
  37. package/package.json +1 -1
  38. package/rules/argent.md +8 -3
  39. package/skills/argent-create-flow/SKILL.md +1 -0
  40. package/skills/argent-device-interact/SKILL.md +2 -0
  41. package/skills/argent-ios-device-interact/SKILL.md +18 -0
  42. package/skills/argent-ios-device-setup/SKILL.md +20 -0
  43. package/skills/argent-qa-flows/SKILL.md +2 -0
  44. package/skills/argent-screenshot-diff/SKILL.md +2 -0
@@ -16057,14 +16057,10 @@ async function sweepDeadStateFiles() {
16057
16057
  continue;
16058
16058
  }
16059
16059
  if (fs.existsSync(fresh.bundlePath)) continue;
16060
- const guarded = process.platform !== "win32";
16061
- if (guarded && !processCommandMatches(fresh.pid, fresh.bundlePath)) continue;
16060
+ if (!couldBeOurToolServer(fresh.pid, fresh.bundlePath)) continue;
16062
16061
  await unlink(file).catch(() => {
16063
16062
  });
16064
- void terminatePid(
16065
- fresh.pid,
16066
- guarded ? () => processCommandMatches(fresh.pid, fresh.bundlePath) : void 0
16067
- );
16063
+ void terminatePid(fresh.pid, () => couldBeOurToolServer(fresh.pid, fresh.bundlePath));
16068
16064
  }
16069
16065
  }
16070
16066
  var readState = readToolsServerState;
@@ -16097,20 +16093,37 @@ async function terminatePid(pid, stillOurs) {
16097
16093
  }
16098
16094
  await waitForExit(pid, SIGKILL_GRACE_MS);
16099
16095
  }
16100
- function processCommandMatches(pid, marker) {
16096
+ var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs.existsSync(p)) ?? "ps";
16097
+ var PS_WIDTH_FLAGS = ["-ww"];
16098
+ function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS) {
16099
+ return execFileSync(PS_BIN, [...flags, "-p", String(pid), "-o", "command="], {
16100
+ encoding: "utf8",
16101
+ timeout: 2e3,
16102
+ // A recycled pid can sit on a process with an argv past Node's 1 MiB exec
16103
+ // default, where the overrun surfaces as ENOBUFS instead of a command line.
16104
+ // Same ceiling as tool-server's vega-process ps probes.
16105
+ maxBuffer: 16 * 1024 * 1024,
16106
+ // Piping ps's stderr is what puts a rejected flag ("ps: invalid option --
16107
+ // 'w'") into the thrown error's message.
16108
+ stdio: ["ignore", "pipe", "pipe"]
16109
+ }).trim();
16110
+ }
16111
+ function couldBeOurToolServer(pid, marker) {
16101
16112
  if (!marker) return false;
16113
+ if (process.platform === "win32") return true;
16114
+ let cmd;
16102
16115
  try {
16103
- const cmd = execFileSync("ps", ["-p", String(pid), "-o", "command="], {
16104
- encoding: "utf8",
16105
- timeout: 2e3,
16106
- stdio: ["ignore", "pipe", "ignore"]
16107
- }).trim();
16108
- if (!cmd) return false;
16109
- const escaped = marker.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
16110
- return new RegExp(`(?:^|\\s)${escaped} start(?:\\s|$)`).test(cmd);
16111
- } catch {
16116
+ cmd = readProcessCommandLine(pid);
16117
+ } catch (err) {
16118
+ process.stderr.write(
16119
+ `[launcher] ps could not read pid ${pid}'s command line; leaving it alone: ${String(err)}
16120
+ `
16121
+ );
16112
16122
  return false;
16113
16123
  }
16124
+ if (!cmd) return false;
16125
+ const escaped = marker.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
16126
+ return new RegExp(`(?:^|\\s)${escaped} start(?:\\s|$)`).test(cmd);
16114
16127
  }
16115
16128
  var LOCK_WAIT_TIMEOUT_MS = 3e4;
16116
16129
  var LOCK_STALE_MS = 45e3;
@@ -16199,8 +16212,8 @@ async function ensureToolsServer(paths) {
16199
16212
  const state = await readState(paths.bundlePath);
16200
16213
  const reuse = await reusableHandle(state, paths.bundlePath, paths.version);
16201
16214
  if (reuse) return reuse;
16202
- if (state && state.managed === "autospawn" && state.bundlePath === paths.bundlePath && isProcessAlive(state.pid) && processCommandMatches(state.pid, state.bundlePath)) {
16203
- await terminatePid(state.pid, () => processCommandMatches(state.pid, state.bundlePath));
16215
+ if (state && state.managed === "autospawn" && state.bundlePath === paths.bundlePath && isProcessAlive(state.pid) && couldBeOurToolServer(state.pid, state.bundlePath)) {
16216
+ await terminatePid(state.pid, () => couldBeOurToolServer(state.pid, state.bundlePath));
16204
16217
  }
16205
16218
  await clearToolsServerState(paths.bundlePath);
16206
16219
  await sweepDeadStateFiles();
@@ -16474,6 +16487,18 @@ var FAILURE_CODES = {
16474
16487
  SIMULATOR_COMMAND_REJECTED: "SIMULATOR_COMMAND_REJECTED",
16475
16488
  SIMULATOR_COMMAND_ACK_TIMEOUT: "SIMULATOR_COMMAND_ACK_TIMEOUT",
16476
16489
  SIMULATOR_COMMAND_TRANSPORT_FAILED: "SIMULATOR_COMMAND_TRANSPORT_FAILED",
16490
+ // Physical iOS devices: the XCUITest-runner blueprint lifecycle, the runner
16491
+ // command client, and the `xcrun devicectl` subprocess wrapper (simulators
16492
+ // use the SIMULATOR_* set).
16493
+ IOS_DEVICE_RUNNER_FACTORY_OPTIONS_MISSING: "IOS_DEVICE_RUNNER_FACTORY_OPTIONS_MISSING",
16494
+ IOS_DEVICE_RUNNER_NOT_READY: "IOS_DEVICE_RUNNER_NOT_READY",
16495
+ IOS_DEVICE_RUNNER_TERMINATED: "IOS_DEVICE_RUNNER_TERMINATED",
16496
+ IOS_DEVICE_RUNNER_EXITED: "IOS_DEVICE_RUNNER_EXITED",
16497
+ // The runner answered a command with an ok:false envelope.
16498
+ IOS_DEVICE_RUNNER_COMMAND_FAILED: "IOS_DEVICE_RUNNER_COMMAND_FAILED",
16499
+ // The usbmux or HTTP exchange with a reachable runner failed.
16500
+ IOS_DEVICE_RUNNER_TRANSPORT_FAILED: "IOS_DEVICE_RUNNER_TRANSPORT_FAILED",
16501
+ IOS_DEVICECTL_COMMAND_FAILED: "IOS_DEVICECTL_COMMAND_FAILED",
16477
16502
  AX_QUERY_TIMEOUT: "AX_QUERY_TIMEOUT",
16478
16503
  AX_DAEMON_READY_TIMEOUT: "AX_DAEMON_READY_TIMEOUT",
16479
16504
  AX_DAEMON_EXITED_BEFORE_READY: "AX_DAEMON_EXITED_BEFORE_READY",
@@ -16644,6 +16669,7 @@ var FAILURE_CODES = {
16644
16669
  KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
16645
16670
  KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
16646
16671
  KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
16672
+ KEYBOARD_INPUT_NOT_FOCUSED: "KEYBOARD_INPUT_NOT_FOCUSED",
16647
16673
  SECRET_PLACEHOLDER_UNKNOWN: "SECRET_PLACEHOLDER_UNKNOWN",
16648
16674
  SCREENSHOT_DIFF_INPUT_INVALID: "SCREENSHOT_DIFF_INPUT_INVALID",
16649
16675
  BOOT_DEVICE_TARGET_SELECTION_INVALID: "BOOT_DEVICE_TARGET_SELECTION_INVALID",
@@ -16688,7 +16714,9 @@ var FAILURE_COMMANDS = [
16688
16714
  "electron",
16689
16715
  "npm",
16690
16716
  "npx",
16691
- "unknown"
16717
+ "unknown",
16718
+ "devicectl",
16719
+ "xcodebuild"
16692
16720
  ];
16693
16721
  var FAILURE_SIGNAL_NAMES = [
16694
16722
  "SIGABRT",