@swmansion/argent 0.33.1-next.8 → 0.34.0

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 (39) hide show
  1. package/assets/Argent.tracetemplate +0 -0
  2. package/bin/argent-android-devtools-0.4.0.apk +0 -0
  3. package/bin/darwin/argent-macos-helper +0 -0
  4. package/bin/darwin/ax-service +0 -0
  5. package/bin/darwin/tvos-ax-service +0 -0
  6. package/bin/darwin/tvos-hid-daemon +0 -0
  7. package/bin/network-inspector/network-inspector.jar +0 -0
  8. package/bin/tcp/ax-service +0 -0
  9. package/dist/cli-cmds.mjs +338 -95
  10. package/dist/client.js +256 -56
  11. package/dist/flow-script-runner.mjs +148 -5
  12. package/dist/installer.mjs +41 -25
  13. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Snapshot.swift +110 -4
  14. package/dist/mcp-server.mjs +330 -68
  15. package/dist/tool-args.generated.d.ts +22 -20
  16. package/dist/tool-server.cjs +3763 -2146
  17. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  18. package/dylibs/libKeyboardPatch.dylib +0 -0
  19. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  20. package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
  21. package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
  22. package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
  23. package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
  24. package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
  25. package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
  26. package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
  27. package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
  28. package/package.json +2 -3
  29. package/rules/argent.md +1 -1
  30. package/skills/argent-create-e2e/references/e2e-yaml.md +11 -1
  31. package/skills/argent-create-e2e/references/reliability-and-recovery.md +1 -1
  32. package/skills/argent-device-interact/SKILL.md +2 -2
  33. package/skills/argent-device-interact/references/harmonyos.md +1 -1
  34. package/skills/argent-macos-app-interact/SKILL.md +5 -1
  35. package/skills/argent-native-profiler/SKILL.md +14 -5
  36. package/skills/argent-react-native-profiler/SKILL.md +7 -0
  37. package/skills/argent-test-ui-flow/SKILL.md +1 -1
  38. package/assets/trace-processor/SHA256SUMS +0 -4
  39. package/assets/trace-processor/engine.mjs +0 -42423
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.33.1-next.8",
3
+ "version": "0.34.0",
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",
@@ -15,7 +15,6 @@
15
15
  "default": "./dist/client.js"
16
16
  },
17
17
  "./assets/manifest": "./assets/manifest.json",
18
- "./assets/trace-processor/engine": "./assets/trace-processor/engine.mjs",
19
18
  "./assets/trace-processor/engine_bundle.node": "./assets/trace-processor/engine_bundle.node.js",
20
19
  "./bin/argent-simulator-server": "./bin/argent-simulator-server.cjs",
21
20
  "./dist/bundled-paths": "./dist/bundled-paths.js",
@@ -52,7 +51,7 @@
52
51
  },
53
52
  "private": false,
54
53
  "engines": {
55
- "node": ">=20.12.0"
54
+ "node": "^22.18.0 || >=23.8.0"
56
55
  },
57
56
  "publishConfig": {
58
57
  "registry": "https://registry.npmjs.org",
package/rules/argent.md CHANGED
@@ -9,7 +9,7 @@ Argent - general rules:
9
9
  - use the platform the user named; otherwise prefer a device `list-devices` shows already running, and don't default to iOS; in a single-platform project boot that platform.
10
10
  - if tap fails twice, stop retrying and re-run a discovery tool
11
11
  - Prefer mcp-tool calls over raw commands like `xcrun` or `adb`; use them as fallback.
12
- - Interaction tools return screenshot and element tree automatically.
12
+ - Interaction tools return screenshot and element tree automatically; an identical earlier tree is named by its tree id, not repeated.
13
13
  - prefer `launch-app` or `open-url` than tapping icons on home screen.
14
14
  - If a task can require a saved e2e test, load `argent-create-e2e` (`argent-qa-e2e` for acceptance tests) before the first launch or in-app action; recording is not retroactive.
15
15
  - Load the matching `argent-*` skill before React Native build/debug, profiling, a physical phone, a Mac app or a TV.
@@ -252,7 +252,17 @@ A `run:` target is a YAML path resolved against the directory of the test file c
252
252
 
253
253
  Use the map form shown above. A bare `script: scripts/seed.mjs` is invalid.
254
254
 
255
- `path` is relative to the test file that contains the step. Include `.mjs` and match the file name's letter case. `timeout` is in milliseconds, as in `e2e-add-script`.
255
+ `path` is relative to the test file that contains the step. Use an `.mjs` or `.js` file, or an `.mts` or `.ts` file for TypeScript, and match the file name's letter case. `timeout` is in milliseconds, as in `e2e-add-script`.
256
+
257
+ `.mjs` and `.mts` are always ES modules. `.js` and `.ts` take their module type from the project's `package.json` `type` field; with no `type`, Node reads a file with `import`, `export` or top-level `await` as an ES module, and each other file as CommonJS. So prefer `.mjs` or `.mts` for a new script and use `.js` or `.ts` for a script the project already has. `.cjs` and `.cts` are invalid: under `"type": "module"`, use `import` in the script, not `require`.
258
+
259
+ Node runs `.mts` and `.ts` by removing the types, and it does not read `tsconfig.json`. In an `.mts` or `.ts` script:
260
+
261
+ - Use no `enum`, runtime `namespace`, parameter property or `paths` alias.
262
+ - Write the extension in each relative import (`./helpers.mts`), and import shared code only from `.mts` or `.mjs` files.
263
+ - Import a type with `import type`.
264
+
265
+ If the reason says that the Node.js of the tool-server cannot run TypeScript, use `.mjs` or `.js` files.
256
266
 
257
267
  Over a link (`argent link` or `ARGENT_TOOLS_URL`, also to 127.0.0.1), `e2e-add-script` refuses the call, and a replay rejects a test with a `script:` step. Record and replay a test with a script without a link.
258
268
 
@@ -99,7 +99,7 @@ When an overlay intersects the next target:
99
99
  3. Record the same selector as `hidden`.
100
100
  4. Only then touch the covered region.
101
101
 
102
- Do not rely on auto-dismiss timers. Prefer an app e2e affordance that disables transient overlays. On iOS, use `native-user-interactable-view-at-point` for hit-test diagnosis. Other platforms rely on the recorded visibility trio.
102
+ Do not rely on auto-dismiss timers. Prefer an app e2e affordance that disables transient overlays. On iOS, use `native-view-at-point` with `hitTest: true` for hit-test diagnosis. Other platforms rely on the recorded visibility trio.
103
103
 
104
104
  Keep a dismissal swipe only when the UI supports it. Pass it through the coordinate gate and hard-check that the overlay disappeared.
105
105
 
@@ -40,13 +40,13 @@ Each tool's own description carries its parameters, defaults, return shape and e
40
40
 
41
41
  ## 3. Finding Tap Targets
42
42
 
43
- After an action moves you to a different screen, or whenever you don't know an element's coordinates, discover before tapping. Interaction results already carry the element tree (`--- Elements after action (describe) ---`): use it, and call a discovery tool only when no fresh tree covers the current screen.
43
+ After an action moves you to a different screen, or whenever you don't know an element's coordinates, discover before tapping. Interaction results already carry the element tree (`--- Elements after action (describe) ---`): use it, and call a discovery tool only when no fresh tree covers the current screen. Each tree has a `Tree id`. When the tree is identical to an earlier one, the result names that id in place of the tree: use that tree, and call `describe` if it is not in your context. An identical tree does not mean the action did nothing.
44
44
 
45
45
  | Need | Tool |
46
46
  | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
47
47
  | Any screen: app, system dialog, Home screen | `describe` |
48
48
  | UIKit properties of a view (iOS simulator) | `native-find-views` (needs `bundleId` and a class, id, label, tag or `nativeID` to match) |
49
- | What sits at a known raw point (iOS simulator) | `native-user-interactable-view-at-point` (the view that receives touch) or `native-view-at-point` (the visually deepest view) |
49
+ | What sits at a known raw point (iOS simulator) | `native-view-at-point` (the visually deepest view; `hitTest: true` for the view that receives touch) |
50
50
  | Final visual fallback | `screenshot`, only when the tools above cannot expose the control. Do not derive routine in-app navigation targets from pixels |
51
51
 
52
52
  If `describe` returns an empty tree, follow its `hint`; with no hint, the screen is blank, loading or unlabeled: check the attached screenshot and retry once content has loaded.
@@ -17,7 +17,7 @@ Refused as unsupported on harmony:
17
17
 
18
18
  - `gesture-rotate` and `gesture-custom`: the device moves each contact along one straight line per call, so there is no arc and no long-press. There is no long-press tool on HarmonyOS.
19
19
  - `gesture-drag` and `gesture-scroll` (Chromium-only), and `rotate`: the device has no orientation command.
20
- - `native-view-at-point`, `native-user-interactable-view-at-point`, `debugger-component-tree`, the rest of the debugger (`debugger-evaluate`, `debugger-log-registry`), `view-network-logs` and the profilers.
20
+ - `native-view-at-point`, `debugger-component-tree`, the rest of the debugger (`debugger-evaluate`, `debugger-log-registry`), `view-network-logs` and the profilers.
21
21
  - `paste`, so a `{{secret:...}}` placeholder goes through `keyboard` only.
22
22
  - Screen recording: HarmonyOS exposes no readable frame stream. Use `screenshot` for a still frame.
23
23
 
@@ -35,10 +35,14 @@ description: Drive a native Mac app (AppKit, SwiftUI, react-native-macos) throug
35
35
  - Hint `The Mac is locked` or `fallback walk`: clicks and typing still work, elements can be missing (an open context menu among them), and a `hidden` check cannot pass. Ask the user to unlock when a target is missing.
36
36
  - An action that fails or has no effect: a minimized window takes no input. Restore it by choosing it in the Window menu with `menu-bar`; without such an item, ask the user.
37
37
 
38
+ ## Profiling
39
+
40
+ Use `argent-native-profiler` for native profiling or `argent-react-native-profiler` to capture React performance on a react-native-macos app. Instruments can pause the app during leak checks, delaying actions and inspection. After `MACOS_APP_RPC_TIMEOUT`, use `describe` before retrying because the action may already have taken effect.
41
+
38
42
  ## E2E tests
39
43
 
40
44
  Read `references/e2e.md` before recording or writing a test for a Mac app.
41
45
 
42
46
  ## react-native-macos
43
47
 
44
- A Debug build loads JavaScript from Metro: start Metro before `boot-device` (see `argent-react-native-app-workflow`). `debugger-*` and the React profiler do not take a Mac app id: read the screen with `describe`.
48
+ Start Metro before launching a react-native-macos Debug build with `boot-device`. See `argent-react-native-app-workflow` for Metro setup. Use `describe` to inspect the screen. The JavaScript debugger tools are unavailable for Mac apps.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-native-profiler
3
- description: Native profiling for CPU hotspots, UI hangs, memory issues. iOS via xctrace; Android via Perfetto. Use when diagnosing native-level performance issues.
3
+ description: Diagnose native CPU hotspots, UI hangs, and memory issues. Use Instruments (xctrace) on iOS simulators and Mac apps, or Perfetto on Android. Use when diagnosing native-level performance issues.
4
4
  ---
5
5
 
6
6
  ## 1. Tools and platforms
@@ -13,14 +13,23 @@ description: Native profiling for CPU hotspots, UI hangs, memory issues. iOS via
13
13
 
14
14
  **Android** (Perfetto): emulator or physical device. Reports CPU hotspots and UI hangs (with jank reasons and the main thread's blocking function), plus an RSS-growth signal for memory pressure: treat it as a hint to confirm, not a confirmed leak. The app must be debuggable or declare `<profileable android:shell="true"/>` in its manifest, or no `perf_sample` callstacks are captured.
15
15
 
16
+ For **Mac apps** (`platform: "macos"`), use Instruments with full Xcode. If start returns `NATIVE_PROFILER_APP_NOT_DEBUGGABLE`, use a development-signed build. In a background session such as SSH, `template_path: "Time Profiler"` also works for CPU and hangs on a signed build without the debugging entitlement. Do not sign files or add entitlements.
17
+
18
+ If `native-profiler-start` returns `NATIVE_PROFILER_APP_HAS_WEBKIT_HEAP` or `NATIVE_PROFILER_APP_HEAP_CHECK_FAILED` on a Mac app, choose the retry based on what you need to measure.
19
+
20
+ - For CPU and hangs, use `template_path: "Time Profiler"` to keep the app running in its current state.
21
+ - For leaks, use the bundled template with `malloc_stack_logging: true`, even for allocations made during the recording. Save any state you need before retrying because this restarts the app.
22
+
23
+ While logging is off, avoid `Leaks`, `Allocations`, and other templates that use the Allocations instrument on these apps. They can freeze the app.
24
+
16
25
  `argent-react-native-profiler` starts native profiling alongside React profiling by default; this skill's workflow and investigation patterns apply in both cases.
17
26
 
18
27
  ## 2. Workflow
19
28
 
20
29
  **Complete all steps in order; do not break mid-flow.**
21
30
 
22
- 1. **Start.** Make sure the app is running (`launch-app` if not); `native-profiler-start` detects it. Pass `app_process` only if it reports several running user apps (e.g. dev and prod flavors) or picks the wrong one. Then let the user interact, or drive the app yourself (`argent-device-interact` skill). While a profiler records, interaction tools return no automatic screenshot or element tree, so the capture does not load the app. Call `screenshot` or `describe` when you need to see the screen; interaction tools still wait for the screen to settle before they return, so add no wait of your own; on an Android emulator each screenshot during a profile takes one frame in about 100 ms and does not wake the screen capture; on a physical Android device it takes about 150–200 ms and briefly wakes the device screen capture, so take them sparingly there.
23
- 2. **Stop.** `native-profiler-stop`. On iOS, check `exportDiagnostics` for export warnings.
31
+ 1. **Start.** Launch the app through Argent if needed, then call `native-profiler-start`. On iOS and Android, use `app_process` if auto-detection is ambiguous or selects the wrong app. On a Mac, the device ID identifies the app. Then let the user interact, or follow `argent-device-interact` on mobile and `argent-macos-app-interact` on Mac. During recording, use `screenshot` or `describe` when needed because interaction tools omit the automatic screenshot and tree. Actions still wait for the screen to settle. On Android emulators, screenshots capture one frame in about 100 ms. On physical Android devices, they briefly wake screen capture and take about 150–200 ms, so use them sparingly.
32
+ 2. **Stop.** Keep the app running through `native-profiler-stop`. For Instruments, read `warning` and `exportDiagnostics` before interpreting the report. If the app ended, Instruments stalled, or exports were skipped, repeat the recording when you need the missing data.
24
33
  3. **Analyze.** `native-profiler-analyze`. Findings are 🔴 RED (act on it) or 🟡 YELLOW (worth investigating, may be acceptable).
25
34
  4. **Present and ask.** Summarize the key findings, then ask the user whether to investigate further, implement fixes, or stop. Do not move on silently.
26
35
  5. **Drill down** with `profiler-stack-query` (patterns below).
@@ -28,9 +37,9 @@ description: Native profiling for CPU hotspots, UI hangs, memory issues. iOS via
28
37
 
29
38
  ### Investigation patterns
30
39
 
31
- - **Hang** → mode `hang_stacks` for the native call chain → `function_callers` for the suspected function → read the native source.
40
+ - **Hang** → mode `hang_stacks` for the native call chain → `function_callers` for the suspected function → read the native source. If a Mac hang overlaps a leak-check pause, repeat the scenario with `template_path: "Time Profiler"` to measure the hang without leak checks.
32
41
  - **CPU hotspot** → `thread_breakdown` for the per-thread split → `function_callers` for the dominant function.
33
- - **Memory leak** (iOS) → `leak_stacks`, filtered by `object_type`, for the responsible frames and libraries. To attribute leaks shown as `<Call stack limit reached>`, re-run `native-profiler-start` with `malloc_stack_logging: true`; it restarts the app and adds overhead, so not for CPU or hang passes.
42
+ - **Memory leak** (iOS simulator or Mac app). Keep recording about 25 seconds after the suspected leak so Instruments has time to finish a check. If the report warns that the capture was too short, repeat the recording before drawing conclusions about leaks. Use `leak_stacks` with `object_type` to find allocation stacks. For missing stacks such as `<Call stack limit reached>`, save any needed app state and use `malloc_stack_logging: true` on a separate leak pass. On Mac, reserve it for allocations that predate recording and use `restart-app` to clear the overhead before measuring CPU or hangs.
34
43
 
35
44
  ## 3. Caveats
36
45
 
@@ -7,6 +7,13 @@ This skill is complementary to `argent-react-native-optimization`, not a replace
7
7
 
8
8
  Physical iPhone: not supported; `react-profiler-*` reject `kind: "device"`. Profile on a simulator.
9
9
 
10
+ For react-native-macos, start Metro and use `argent-macos-app-interact` to launch a Debug build of
11
+ version 0.76 or later with Hermes. Pass the Mac app's `device_id` from `list-devices` and call
12
+ `react-profiler-start` directly. Use the same ID and Metro port for the rest of the session.
13
+ If Metro cannot find the runtime, make sure the app is running, wait for its bundle to load, and
14
+ check the port (8081 by default). Retry with the same app ID, even if Metro lists other devices.
15
+ If the retry fails, report the error.
16
+
10
17
  ## 1. Tools
11
18
 
12
19
  ### React Profiler (Hermes / React commits)
@@ -16,7 +16,7 @@ For implementation tasks that modify visible UI, this workflow also serves as a
16
16
  1. **Baseline screenshot**: call `screenshot` to see the current UI state. For visual regression comparison or UI change verification, capture the baseline at `scale: 1.0` with `includeImageInContext: false` and keep the returned `path` before editing whenever feasible.
17
17
  2. **Find target**: get element coordinates from a discovery tool before tapping:
18
18
  - **App screens (React Native included), in-app modals and system dialogs**: `describe`. Fall back to `screenshot` only if an overlay is not exposed reliably. When the app raises its own permission dialog, answer it here; that's the real flow under test. To take a prompt _out_ of the flow, use `argent-settings-permissions` during setup.
19
- 3. **Interact**: perform the action (`gesture-tap`, `gesture-swipe`, `keyboard`, `button`, ...); you receive a screenshot and element tree automatically.
19
+ 3. **Interact**: perform the action (`gesture-tap`, `gesture-swipe`, `keyboard`, `button`, ...); you receive a screenshot and element tree automatically (an identical earlier tree is named by its `Tree id`, not repeated).
20
20
  4. **Verify**: check the returned screenshot. If it shows a loading/transitional state, block with `await-ui-element` (expected element `visible`, or a spinner `hidden`) rather than a guessed delay (its result carries the new screenshot and element tree), but only with a selector you can trust (`text`/`identifier`/`role`) that the screen is known to have or that you saw in a prior `describe`; a guessed one just times out. Otherwise use a short fixed wait. Pick evidence by what's being asserted:
21
21
  - **Visual** (layout, spacing, color, typography, image/icon rendering, clipping, overflow, text rendering): prefer `screenshot-diff` against the step 1 baseline: it surfaces pixel-visible changes the auto-screenshot might miss. Fall back to inspecting the auto-screenshot only when a stable baseline isn't available.
22
22
  - **Structural** (navigation state, element existence, accessibility labels/values, selection, hierarchy, route): verify with `describe` or `debugger-component-tree`.
@@ -1,4 +0,0 @@
1
- c1c25c299b74cc9b9651592c94b669c91916434a2990f214f03c8135c848d3fa trace_processor.wasm
2
- 390f39007f0a617c44d88df051cbec33f52b1cffad145748a51f5b4961a4ffd9 engine_bundle.node.js
3
- 321e956788280009b2f7a89be8f6c8c745107642e3288c71c6c180100ffbaac4 engine.mjs
4
- 73f3b0eee3d8d064888f928c52211f33bdcc9145925a9e1340d07cd78ed62351 LICENSE