@swmansion/argent 0.34.1-next.2 → 0.34.1-next.21

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/LICENSE +1 -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 +111 -25
  10. package/dist/client.js +58 -10
  11. package/dist/installer-help.js +4 -0
  12. package/dist/installer-help.js.map +1 -1
  13. package/dist/installer.mjs +230 -160
  14. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentLaunchPerformanceTests.swift +21 -0
  15. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Commands.swift +9 -3
  16. package/dist/mcp-server.mjs +68 -15
  17. package/dist/tool-args.generated.d.ts +31 -1
  18. package/dist/tool-server.cjs +5433 -2503
  19. package/dylibs/libArgentAudio.dylib +0 -0
  20. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  21. package/dylibs/libKeyboardPatch.dylib +0 -0
  22. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  23. package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
  24. package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
  25. package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
  26. package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
  27. package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
  28. package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
  29. package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
  30. package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
  31. package/package.json +1 -1
  32. package/rules/argent.md +6 -23
  33. package/skills/argent-ios-device-interact/SKILL.md +2 -2
  34. package/skills/argent-macos-app-interact/SKILL.md +15 -5
  35. package/skills/argent-macos-app-interact/references/e2e.md +1 -1
  36. package/skills/argent-native-profiler/SKILL.md +14 -2
  37. package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
  38. package/skills/argent-react-native-optimization/SKILL.md +10 -1
  39. package/skills/argent-react-native-profiler/SKILL.md +4 -3
Binary file
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.34.1-next.2",
3
+ "version": "0.34.1-next.21",
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",
package/rules/argent.md CHANGED
@@ -1,34 +1,17 @@
1
1
  ---
2
- description: Always-on Argent rules for driving, testing and profiling apps on simulators, emulators, phones, TVs and Chromium
2
+ description: What to do when this project uses Argent but Argent is not available in this environment
3
3
  alwaysApply: true
4
4
  ---
5
5
 
6
- Argent - general rules:
6
+ This project uses Argent, through its `argent` MCP server, to drive, test and profile apps on simulators, emulators, phones, TVs and Chromium. The server's own instructions carry the usage guidance.
7
7
 
8
- - do not derive tap coordinates from screenshot pixels; use inspection tools that give coordinates
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
- - if tap fails twice, stop retrying and re-run a discovery tool
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; an identical earlier tree is named by its tree id, not repeated.
13
- - prefer `launch-app` or `open-url` than tapping icons on home screen.
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
- - Load the matching `argent-*` skill before React Native build/debug, profiling, a physical phone, a Mac app or a TV.
16
- - Do not stop simulator servers when a task finishes: the next task reuses them. Call `stop-all-simulator-servers` when the user asks to clean up or ends the session, or when a skill tells you to recycle a device's services, with devices this session used. One tool-server is shared by every other agent, so unscoped call tears down their devices too. Never stop a Metro the user started unless they ask.
17
- - Use the `await-ui-element` tool to block until the UI settles instead of polling using screenshot.
18
- - The `argent` CLI manages the toolkit: `argent --help` lists commands, `argent --version` shows the installed version.
8
+ Check once per session whether argent is available; do not re-probe before later calls:
19
9
 
20
- <availability_check>
21
- Run this check once per session. Do not re-probe before later calls.
22
- Confirm argent is available:
23
-
24
- 1. Are `mcp__argent__*` tools in your tool list? If none, argent is not available.
10
+ 1. Are argent tools (such as `mcp__argent__*`) in your tool list? If none, argent is not available.
25
11
  2. If unsure, run `command -v argent`. Non-zero exit = the CLI is not on PATH.
26
12
 
27
- If argent IS available, ignore the rest of this block and follow this rule normally.
13
+ If argent is available, ignore this rule.
28
14
 
29
- If argent is ABSENT, treat it as an expected state, not an error to retry. Do not call `mcp__argent__*` tools, do not run `argent` commands, do not attempt any argent workflow.
30
- Tell the user once, and ask if you should continue without argent:
15
+ If argent is absent, treat it as an expected state, not an error to retry. Do not call argent tools, run `argent` commands or attempt any argent workflow. Tell the user once, and ask if you should continue without argent:
31
16
 
32
17
  > Argent isn't installed in this environment. To enable the mobile/Chromium tooling this repo is configured for, run `npx @swmansion/argent@latest init -y` (or `npm i -g @swmansion/argent@latest && argent init -y`).
33
-
34
- </availability_check>
@@ -15,5 +15,5 @@ Read this only for a physical iPhone. `argent-device-interact` still applies for
15
15
 
16
16
  ## Tools on hardware
17
17
 
18
- - Only these exist: `list-devices`, `launch-app`, `restart-app`, `reinstall-app`, `open-url`, `describe`, `screenshot`, `screenshot-diff`, `gesture-tap`, `gesture-swipe`, `gesture-custom`, `gesture-pinch`, `gesture-rotate`, `button` (`home`, `volumeUp`, `volumeDown`, `actionButton` on models that have one), `keyboard`, `await-ui-element`, `await-screen-idle`, `run-sequence`, the e2e tools, `stop-simulator-server` and `stop-all-simulator-servers` (session end). Every other device tool fails with `not supported on ios device`.
19
- - No `rotate` (the orientation tool), `shake`, `paste`, `settings-permissions`, screen recording, `debugger-*`, `react-profiler-*`, `native-profiler-*`, `native-*`, `boot-device`: move the phone by hand, type with `keyboard`, change permissions in the phone's Settings, and debug, profile or record on a simulator.
18
+ - Only these exist: `list-devices`, `launch-app`, `restart-app`, `reinstall-app`, `open-url`, `describe`, `screenshot`, `screenshot-diff`, `gesture-tap`, `gesture-swipe`, `gesture-custom`, `gesture-pinch`, `gesture-rotate`, `button` (`home`, `volumeUp`, `volumeDown`, `actionButton` on models that have one), `keyboard`, `await-ui-element`, `await-screen-idle`, `run-sequence`, the e2e tools, `stop-simulator-server` and `stop-all-simulator-servers` (session end), and for launch time `native-profiler-launch-analysis` with `profiler-load` and `profiler-stack-query` on its session (`argent-native-profiler` §4). Every other device tool fails with `not supported on ios device`.
19
+ - No `rotate` (the orientation tool), `shake`, `paste`, `settings-permissions`, screen recording, `debugger-*`, `react-profiler-*`, `native-*` other than `native-profiler-launch-analysis`, `boot-device`: move the phone by hand, type with `keyboard`, change permissions in the phone's Settings, and debug, profile or record on a simulator.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-macos-app-interact
3
- description: Drive a native Mac app (AppKit, SwiftUI, react-native-macos) through argent. Use when a list-devices entry has platform "macos", or the user names a Mac app, a macOS app or a native desktop app. Never for an iOS simulator, an iPhone, or an Electron or Chromium app (platform "chromium").
3
+ description: Drive a native Mac app (AppKit, SwiftUI, react-native-macos, Mac Catalyst) through argent. Use when a list-devices entry has platform "macos", or the user names a Mac app, a macOS app or a native desktop app. Never for an iOS simulator, an iPhone, or an Electron or Chromium app (platform "chromium").
4
4
  ---
5
5
 
6
6
  `argent-device-interact` still applies for everything not listed here (`run-sequence`, `await-ui-element`, secrets).
@@ -23,6 +23,7 @@ description: Drive a native Mac app (AppKit, SwiftUI, react-native-macos) throug
23
23
  - Swipe or drag: `gesture-drag`. Long press: `gesture-drag` with the same start and end point. Scroll: `gesture-scroll`.
24
24
  - Zoom or rotate: `gesture-pinch` and `gesture-rotate` fail; use the app's own controls or shortcuts.
25
25
  - After a right-click (`gesture-tap` with `button: "right"`), the returned tree lists the menu items; a plain `gesture-tap` on one chooses it (the menu can stay in the tree for a moment while it closes). `keyboard` `escape` closes the menu; `enter` chooses nothing after a right-click, so tap the item.
26
+ - For a Command-click or Shift-click, pass `modifiers` in the `gesture-tap` call. Check the returned tree for the expected selection.
26
27
  - No hover: a tooltip is out of reach.
27
28
  - `open-url`: the URL goes to the running app. A custom scheme must be one the app declares; `http` and `https` go to the app, not the browser; a `file:` URL opens that document in the app.
28
29
  - A SwiftUI `DisclosureGroup` opens only at its chevron, near the left end of its frame: a tap at the centre passes and does nothing. Tap along the left end in steps of about 0.008 until its `value` changes.
@@ -31,18 +32,27 @@ description: Drive a native Mac app (AppKit, SwiftUI, react-native-macos) throug
31
32
 
32
33
  ## Tree
33
34
 
34
- - Identifiers: AppKit accessibility identifier, SwiftUI `.accessibilityIdentifier()`, web `data-testid` (else `id`), React Native `testID` (also on a plain `View` or `Text`).
35
+ - Identifiers: AppKit and UIKit `accessibilityIdentifier`, SwiftUI `.accessibilityIdentifier()`, web `data-testid` (else `id`), React Native `testID` (also on a plain `View` or `Text` in react-native-macos).
35
36
  - 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
37
  - 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
38
 
39
+ ## Mac Catalyst (kind `catalyst`)
40
+
41
+ - Build with `xcodebuild -scheme <scheme> -destination 'platform=macOS,variant=Mac Catalyst' build`. Add `-workspace <name>.xcworkspace` for a workspace (React Native, CocoaPods), or `-project <name>.xcodeproj` to select a project. Without `-scheme`, xcodebuild ignores the destination and builds for iOS. A Debug build is in DerivedData under `Build/Products/Debug-maccatalyst/`, not `Debug-iphonesimulator/`. Pass that `.app` to `boot-device`. If it reports "Designed for iPad", ask for the Mac Catalyst build or suggest testing on an iOS simulator.
42
+ - Use `describe` to find UIKit controls and their frames. AppKit view-tree tools are unavailable.
43
+ - Switch to the intended window with `menu-bar` and the Window menu. Tap the target field before typing, since keyboard focus can be in another window and SwiftUI Tab order can differ from the visible order.
44
+ - Tap alert buttons directly. Return depends on a default action, and Escape can leave a UIKit text-field alert open.
45
+ - Find toolbar menu buttons by label if **Optimize Interface for Mac** leaves them without identifiers.
46
+ - If typing, paste, or scrolling reports success without changing the app, check whether the installed native library supports Mac Catalyst input.
47
+
38
48
  ## Profiling
39
49
 
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.
50
+ Use `argent-native-profiler` for native profiling or `argent-react-native-profiler` to capture React performance on a react-native-macos or Mac Catalyst React Native 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
51
 
42
52
  ## E2E tests
43
53
 
44
54
  Read `references/e2e.md` before recording or writing a test for a Mac app.
45
55
 
46
- ## react-native-macos
56
+ ## React Native
47
57
 
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.
58
+ For React Native Debug builds on macOS, including Mac Catalyst, start Metro before `boot-device` (see `argent-react-native-app-workflow`). Inspect the UI with `describe`. The JavaScript debugger tools are unavailable for Mac apps.
@@ -2,5 +2,5 @@
2
2
 
3
3
  - Record the launch as a `restart-app` step, then write it as `launch: { macos: <bundle id> }` (keep `{ app, args }` if the recorder wrote args) so the runner picks the Mac app and starts it. Otherwise run with `--platform macos` or the device id: without them the runner never picks a Mac app.
4
4
  - A `swipe` is a mouse drag, a `long-press` a press and hold. `pinch` and `rotate` fail.
5
- - A right-click is `tap: { on: <selector>, button: right }`.
5
+ - A right-click is `tap: { on: <selector>, button: right }`. For a Command-click, write `tap: { on: <selector>, modifiers: [command] }`. The recorder preserves `modifiers` from `gesture-tap` so replay holds the same keys.
6
6
  - A file panel is a `tool: file-panel` step, a menu command a `tool: menu-bar` step (`args: { action: choose, path: [Edit, Select All] }`). Gate a branch with `when: { platform: macos }`.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-native-profiler
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.
3
+ description: Diagnose native CPU hotspots, UI hangs, memory issues, and iOS app launch time. Use Instruments (xctrace) on iOS simulators, iPhones (launch time only) and Mac apps, or Perfetto on Android. Use when diagnosing native-level performance issues.
4
4
  ---
5
5
 
6
6
  ## 1. Tools and platforms
@@ -9,7 +9,7 @@ description: Diagnose native CPU hotspots, UI hangs, and memory issues. Use Inst
9
9
  - `profiler-stack-query`: drill into the analyzed data (hang stacks, function callers, thread breakdown, leaks).
10
10
  - `profiler-load`: reload an earlier session from disk.
11
11
 
12
- **iOS** (Instruments via `xctrace`): simulator only; a physical iPhone is not supported. Needs full Xcode (`xcrun xctrace version`). Reports CPU hotspots, UI hangs and memory leaks.
12
+ **iOS** (Instruments via `xctrace`): the profiling session (`native-profiler-start`) runs on a simulator only; `native-profiler-launch-analysis` (§4) also runs on a physical iPhone. Needs full Xcode (`xcrun xctrace version`). Reports CPU hotspots, UI hangs and memory leaks.
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
 
@@ -47,3 +47,15 @@ While logging is off, avoid `Leaks`, `Allocations`, and other templates that use
47
47
  - **Profiler overhead:** if `JSLexer`, `JSONEmitter` or Hermes internals dominate the JS thread, that is instrumentation cost, not app work. Discount those entries.
48
48
  - **Run-to-run variance:** treat only consistent, directional changes (across 2+ runs, or a >15% delta) as signal.
49
49
  - **Live data:** if the app fetches live API data, different responses change the workload independently of code changes. Note when data-dependent screens vary.
50
+
51
+ ## 4. App Launch (iOS)
52
+
53
+ For any iOS app (Swift, Objective-C, React Native, Flutter) when the user asks about launch or startup time.
54
+
55
+ 1. Build a Release build and install it yourself with the project's own scripts or build setup (for React Native, find them as `argent-react-native-app-workflow` describes); the tool only measures an installed build. Debug-build timings are not meaningful.
56
+ 2. Target a physical iPhone on USB. Ask the user before you use a booted simulator: its timings reflect the Mac hardware.
57
+ 3. Run `native-profiler-launch-analysis`: `mode: "measure"` for the baseline and to verify fixes, `mode: "profile"` to find the cause of a slow launch. On an iPhone, `measure` runs on Argent's on-device runner (see `argent-ios-device-setup`); `profile` does not need it. If the runner cannot be signed, tell the user how to fix it. A profile still shows the cause, but it does not replace the five-launch baseline.
58
+ 4. For a profile, run `profiler-stack-query` `thread_breakdown` on the main thread, then `function_callers` for the dominant function. Typical causes: static initializers, dylib loading, heavy `didFinishLaunching` work.
59
+ 5. Rebuild and reinstall the Release build after each native or JS change, before you measure again.
60
+
61
+ `native-profiler-launch-analysis` ends at the first frame. Framework work before it (e.g. React Native runtime creation) appears in the launch profile. Work after it (e.g. a JS bundle, startup data loading, the first screen's render) is not in the result, and the first frame is often only a splash screen. For the time until the app is usable, investigate that work separately; for React Native, see Startup time in `argent-react-native-optimization`.
@@ -3,7 +3,7 @@ name: argent-react-native-app-workflow
3
3
  description: Step-by-step workflows for developing or debugging React Native apps on iOS simulator or Android emulator. Use when starting the app, debugging Metro, fixing builds, diagnosing runtime errors, or running tests.
4
4
  ---
5
5
 
6
- Physical iPhone (`kind: "device"`): Metro debugging and profiling tools reject it. Use a simulator.
6
+ Physical iPhone (`kind: "device"`): Metro debugging and profiling tools reject it. Use a simulator. Exception: measure and profile app launch on the iPhone with `native-profiler-launch-analysis` (`argent-native-profiler` §4).
7
7
 
8
8
  react-native-macos app: start Metro (§1.2), then follow `argent-macos-app-interact` instead of `run-macos`.
9
9
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-react-native-optimization
3
- description: Optimizes a React Native app by profiling first to find real bottlenecks, then sweeping for mechanical issues. Entry-point for all performance work. Use when the app feels slow, user asks to optimize, fix re-renders, reduce jank, or improve startup. Delegates to argent-react-native-profiler for measurement.
3
+ description: Optimizes a React Native app by profiling first to find real bottlenecks, then sweeping for mechanical issues. Entry-point for all performance work. Use when the app feels slow, user asks to optimize, fix re-renders, reduce jank, or improve startup / TTI (including iOS launch time). Delegates to argent-react-native-profiler for measurement.
4
4
  ---
5
5
 
6
6
  ## Rules
@@ -45,3 +45,12 @@ See [references/semantic-checklist.md](references/semantic-checklist.md) for ful
45
45
  ### Phase 4: Verify no regressions
46
46
 
47
47
  Navigate every screen and UI flow within scope (the entire app if no scope was given, via `argent-device-interact`) and confirm each renders without errors. Check `debugger-log-registry` for warnings and errors (`Grep` its log file). Argent hides LogBox toasts once a `debugger-*` tool connects, so screenshots catch only full-screen red errors. Look for regressions the fixes introduced (e.g. fewer re-renders but higher CPU, or new jank on a different screen). Main agent only.
48
+
49
+ ## Startup time (TTI)
50
+
51
+ TTI lasts until the first usable screen shows real content. The first native frame is often only the splash screen: bundle evaluation, startup data loading and the first screen's render usually come after it.
52
+
53
+ 1. **Up to the first frame (iOS)**: measure and profile it on a Release build as §4 of `argent-native-profiler` describes. Runtime creation and JS that runs before the first frame show up in this profile.
54
+ 2. **After the first frame**: `native-profiler-launch-analysis` does not cover it, so do not stop at the first frame. Find what the app waits for and renders before the first usable screen (what hides the splash, the startup data loading, the first screen) and measure it with the tools that fit. `react-profiler-*` cannot record startup: an app restart discards the JS runtime it attaches to.
55
+
56
+ State exactly what was measured, and what comes only from reading the code.
@@ -7,9 +7,10 @@ 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.
10
+ Mac profiling supports react-native-macos 0.76 or later and React Native built for Mac Catalyst.
11
+ Start Metro, then use `argent-macos-app-interact` to launch a Debug build with Hermes. In
12
+ `react-profiler-start`, pass `id` from the app's `list-devices` entry as `device_id`. Use the same ID
13
+ and Metro port throughout the session.
13
14
  If Metro cannot find the runtime, make sure the app is running, wait for its bundle to load, and
14
15
  check the port (8081 by default). Retry with the same app ID, even if Metro lists other devices.
15
16
  If the retry fails, report the error.