@swmansion/argent 0.34.1-next.4 → 0.34.1-next.40

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 (54) hide show
  1. package/LICENSE +1 -0
  2. package/assets/ios-screen-stream/Info.plist +12 -0
  3. package/assets/ios-screen-stream/ios-screen-stream.swift +321 -0
  4. package/bin/argent-android-devtools-0.4.0.apk +0 -0
  5. package/bin/darwin/argent-macos-helper +0 -0
  6. package/bin/darwin/ax-service +0 -0
  7. package/bin/darwin/simulator-server +0 -0
  8. package/bin/darwin/tvos-ax-service +0 -0
  9. package/bin/darwin/tvos-hid-daemon +0 -0
  10. package/bin/linux/simulator-server +0 -0
  11. package/bin/linux-arm64/simulator-server +0 -0
  12. package/bin/network-inspector/network-inspector.jar +0 -0
  13. package/bin/tcp/ax-service +0 -0
  14. package/bin/win32/simulator-server.exe +0 -0
  15. package/dist/cli-cmds.mjs +923 -558
  16. package/dist/client.js +345 -179
  17. package/dist/flow-script-runner.mjs +1 -0
  18. package/dist/installer-help.js +4 -0
  19. package/dist/installer-help.js.map +1 -1
  20. package/dist/installer.mjs +1219 -922
  21. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentLaunchPerformanceTests.swift +21 -0
  22. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Commands.swift +9 -3
  23. package/dist/mcp-server.mjs +558 -712
  24. package/dist/preview-ui/index.html +28 -2
  25. package/dist/tool-args.generated.d.ts +58 -12
  26. package/dist/tool-server.cjs +11444 -5226
  27. package/dylibs/libArgentAudio.dylib +0 -0
  28. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  29. package/dylibs/libKeyboardPatch.dylib +0 -0
  30. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  31. package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
  32. package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
  33. package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
  34. package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
  35. package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
  36. package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
  37. package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
  38. package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
  39. package/package.json +1 -1
  40. package/rules/argent.md +6 -23
  41. package/skills/argent-create-e2e/references/e2e-yaml.md +2 -2
  42. package/skills/argent-create-e2e/references/live-authoring.md +1 -1
  43. package/skills/argent-device-interact/SKILL.md +22 -21
  44. package/skills/argent-device-interact/references/foldables.md +22 -0
  45. package/skills/argent-ios-device-interact/SKILL.md +2 -2
  46. package/skills/argent-macos-app-interact/SKILL.md +15 -5
  47. package/skills/argent-macos-app-interact/references/e2e.md +1 -1
  48. package/skills/argent-metro-debugger/SKILL.md +1 -1
  49. package/skills/argent-native-profiler/SKILL.md +14 -2
  50. package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
  51. package/skills/argent-react-native-optimization/SKILL.md +10 -1
  52. package/skills/argent-react-native-profiler/SKILL.md +4 -3
  53. package/skills/argent-screen-recording/SKILL.md +3 -2
  54. package/skills/argent-screenshot-diff/SKILL.md +1 -1
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.4",
3
+ "version": "0.34.1-next.40",
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>
@@ -38,7 +38,7 @@ executionPrerequisite: User is signed in and viewing Settings
38
38
  steps: []
39
39
  ```
40
40
 
41
- The recorder also writes `version: 1`, the file format version. Keep it. A file without it is version 1, and a version newer than the installed Argent reads is refused.
41
+ The recorder also writes `version: 2`, the file format version. Keep it. A file without it is version 1, and a version newer than the installed Argent reads is refused. Do not change the version of an existing file: on an iOS simulator with a landscape UI, version 1 coordinates use the portrait axes of the screen and version 2 coordinates the UI as the user sees it, and Argent runs each as it was recorded.
42
42
 
43
43
  E2E tests never store a device id. The runner binds the device. `launch:` restarts the process but does not clear app, account, or backend data.
44
44
 
@@ -119,7 +119,7 @@ Directives stop the test on failure and skip later steps. The available directiv
119
119
 
120
120
  - The coordinates change with the panel. Selectors resolve against a new tree.
121
121
  - A `snapshot` baseline is valid only for the posture that made it.
122
- - iOS: unfolded, the UI is landscape. `swipe` and `scroll-to` directions and the reading order stay as the user sees the UI. Coordinates stay in the space of the `describe` frames.
122
+ - iOS: unfolded, the UI is landscape. `swipe` and `scroll-to` directions, the reading order and coordinates stay as the user sees the UI, the space of `describe` frames and screenshots.
123
123
  - iOS: a fold between two angles that are not `closed` or `open` can keep the current panel. The step passes, and the report names the panel. To change panels, fold to `closed` or `open`.
124
124
 
125
125
  Use the launch map for cross-platform tests. A bare launch applies everywhere and becomes an app path on Chromium. The map takes `native:`, `ios:`, `android:`, `vega:`, `macos:`, and `chromium:`. `native:` is one id shared by iOS, Android, Vega, and macOS, and a per-platform key overrides it for that platform. `macos:` takes a Mac app's bundle id. `chromium:` accepts a relative or absolute app path. `ios:` and `macos:` also accept `{ app, args }`; Argent passes `args` to the app at launch. A launch that declares no id for the run's platform is an error, not a cue to switch platforms. A run on a remote simulator uses the `ios:` id, or the `native:` id when the map has no `ios:` key, so no test needs a key for a remote run. On an iOS simulator, a successful launch also pins later tree reads to that app until the next raw `tool:` step, so read [The runner tree is not the discovery tree](#the-runner-tree-is-not-the-discovery-tree) when a read describes the wrong screen.
@@ -195,7 +195,7 @@ e2e-finish-recording { TEST }
195
195
  After meaning-preserving conversion:
196
196
 
197
197
  ```yaml
198
- version: 1
198
+ version: 2
199
199
  steps:
200
200
  - echo: Restart Acme Notes. Expect Home
201
201
  - launch: com.acme.notes
@@ -16,27 +16,28 @@ Each tool's own description carries its parameters, defaults, return shape and e
16
16
 
17
17
  ## 2. Choosing the Right Tool
18
18
 
19
- | Action | Tool | Notes |
20
- | ------------------------------ | ------------------- | -------------------------------------------------------------- |
21
- | Several known steps | `run-sequence` | One call, one screenshot at the end (§5) |
22
- | Open an app | `launch-app` | **Never tap home-screen icons** |
23
- | Restart an app | `restart-app` | Clean in-memory state |
24
- | Open URL / deep link | `open-url` | Web pages, deep links, URL schemes |
25
- | Tap | `gesture-tap` | Buttons, links, checkboxes |
26
- | Scroll / swipe | `gesture-swipe` | Touch targets; not Chromium |
27
- | Scroll (Chromium) | `gesture-scroll` | Mouse wheel |
28
- | Drag (Chromium) | `gesture-drag` | Sliders, drag-and-drop, text selection |
29
- | Long press, drag & drop | `gesture-custom` | Also any other non-linear touch sequence |
30
- | Pinch / zoom | `gesture-pinch` | |
31
- | Two-finger rotation | `gesture-rotate` | |
32
- | Hardware key | `button` | Home, back, power, volume, appSwitch, actionButton |
33
- | Type text or press a named key | `keyboard` | Every platform; text or one key per call (§6) |
34
- | Paste text | `paste` | Only where a user would paste (§6). Sim/emu, Mac app |
35
- | Rotate device | `rotate` | Orientation changes |
36
- | Fold device | `fold` | Foldables only: `references/foldables.md` |
37
- | Shake device | `shake` | Shake handlers (sim/emu only), Undo-typing prompt, RN dev menu |
38
- | Wait for UI | `await-ui-element` | Block until an element is visible/hidden/exists/contains text |
39
- | Wait for idle | `await-screen-idle` | Block until a non-empty screen tree stops changing (§4) |
19
+ | Action | Tool | Notes |
20
+ | ------------------------------ | -------------------- | ------------------------------------------------------------------------ |
21
+ | Several known steps | `run-sequence` | One call, one screenshot at the end (§5) |
22
+ | Open an app | `launch-app` | **Never tap home-screen icons** |
23
+ | Restart an app | `restart-app` | Clean in-memory state |
24
+ | Open URL / deep link | `open-url` | Web pages, deep links, URL schemes |
25
+ | Tap | `gesture-tap` | Buttons, links, checkboxes |
26
+ | Scroll / swipe | `gesture-swipe` | Touch targets; not Chromium |
27
+ | Scroll (Chromium) | `gesture-scroll` | Mouse wheel |
28
+ | Drag (Chromium) | `gesture-drag` | Sliders, drag-and-drop, text selection |
29
+ | Long press, drag & drop | `gesture-custom` | Also any other non-linear touch sequence |
30
+ | Pinch / zoom | `gesture-pinch` | |
31
+ | Two-finger rotation | `gesture-rotate` | |
32
+ | Hardware key | `button` | Home, back, power, volume, appSwitch, actionButton |
33
+ | Type text or press a named key | `keyboard` | Every platform; text or one key per call (§6) |
34
+ | Paste text | `paste` | Only where a user would paste (§6). Sim/emu, Mac app |
35
+ | Rotate device | `rotate` | Orientation changes |
36
+ | Fold device | `fold` | Foldables only: `references/foldables.md` |
37
+ | Shake device | `shake` | Shake handlers (sim/emu only), Undo-typing prompt, RN dev menu |
38
+ | Slow or offline network | `network-conditions` | Latency, bandwidth, offline. iOS sim app, Chromium tab; Android: offline |
39
+ | Wait for UI | `await-ui-element` | Block until an element is visible/hidden/exists/contains text |
40
+ | Wait for idle | `await-screen-idle` | Block until a non-empty tree holds for `minStableMs` (§4) |
40
41
 
41
42
  ## 3. Finding Tap Targets
42
43
 
@@ -6,3 +6,25 @@ Read this for a device `list-devices` marks `foldable: true`: a foldable iOS sim
6
6
  - Fold between gestures, not during one. A gesture stays on the panel where it started.
7
7
  - iOS: if argent cannot find the active panel, it uses the cover panel and sets `warning` (a screenshot-diff summary gets a `panel:` line). Take a screenshot to see what the device shows, then do the check the warning names.
8
8
  - Android: on a closed generic foldable AVD, tap only full-width rows; test the cover panel on a Pixel Fold AVD.
9
+
10
+ ## Move a full-screen app into Split View on iPhone Duo
11
+
12
+ Start with the Duo open in landscape and the app full screen. If needed, use `fold` to open the Duo and `launch-app` to open the app.
13
+
14
+ Call `gesture-custom` once with the Duo UDID and these parameters to move the app to the **left**. The `edge` field tells iOS that the touch starts a system gesture. Keep the finger down through the pause and the sideways drag.
15
+
16
+ ```json
17
+ {
18
+ "edge": "bottom",
19
+ "interpolate": 12,
20
+ "events": [
21
+ { "type": "Down", "x": 0.5, "y": 1 },
22
+ { "type": "Move", "x": 0.5, "y": 0.5, "delayMs": 280 },
23
+ { "type": "Move", "x": 0.5, "y": 0.5, "delayMs": 300 },
24
+ { "type": "Move", "x": 0.14, "y": 0.5, "delayMs": 320 },
25
+ { "type": "Up", "x": 0.14, "y": 0.5, "delayMs": 200 }
26
+ ]
27
+ }
28
+ ```
29
+
30
+ For the **right**, change both final x coordinates to `0.86`. Check the screenshot for the app on the requested side and the Home Screen on the other. Stop here if the user asked for one app at half width.
@@ -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`, `screen-recording-start` and `screen-recording-stop` on a cabled phone (`argent-screen-recording`), 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`, `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 or profile 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 }`.
@@ -14,7 +14,7 @@ Physical iPhone: not supported; every `debugger-*` tool rejects `kind: "device"`
14
14
 
15
15
  ## 2. Tools
16
16
 
17
- Pass the same `device_id`, the id from `list-devices`, to every call. With two or more devices on one Metro, `debugger-connect` refuses a udid or serial and returns a `logicalDeviceId`: use that as `device_id` from then on, and include it in `stop-all-simulator-servers`' `devices` at teardown, or the debugger session outlives yours.
17
+ Pass the same `device_id`, the id from `list-devices`, to every call. With two or more devices on one Metro, `debugger-connect` refuses a serial, or a simulator udid it cannot match to one Metro device by name, and returns a `logicalDeviceId`: use that as `device_id` from then on, and include it in `stop-all-simulator-servers`' `devices` at teardown, or the debugger session outlives yours.
18
18
 
19
19
  | Tool | Use for |
20
20
  | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
@@ -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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-screen-recording
3
- description: Record a video of an iOS simulator or Android emulator/device screen using argent MCP tools. Use when the user asks to record the screen, capture a video of a flow, interaction, or animation, produce a screen recording, or document app behavior as a video clip.
3
+ description: Record a video of an iOS simulator, cabled iPhone, or Android emulator/device screen using argent MCP tools. Use when the user asks to record the screen, capture a video of a flow, interaction, or animation, produce a screen recording, or document app behavior as a video clip.
4
4
  ---
5
5
 
6
6
  `screen-recording-start` and `screen-recording-stop` carry the options (`timeLimitSeconds`, `trimStatic`, `showTouches`) and the result fields. One recording per device at a time; different devices can record concurrently.
@@ -24,7 +24,8 @@ A forgotten recording keeps capturing until its `timeLimitSeconds` cap fires, ho
24
24
 
25
25
  ## 3. Platform notes and limits
26
26
 
27
- - **Recordable**: iOS simulators (local and remote `remote:`), Android emulators and physical Android devices. **Unsupported**: physical iPhones, tvOS simulators, Chromium apps, Vega/Fire TV and HarmonyOS. For a still frame use `screenshot`; for a replayable interaction script use `argent-create-e2e`.
27
+ - **Recordable**: iOS simulators (local and remote `remote:`), physical iPhones on a USB cable, Android emulators and physical Android devices. **Unsupported**: iPhones reachable only over Wi-Fi, tvOS simulators, Chromium apps, Vega/Fire TV and HarmonyOS. For a still frame use `screenshot`; for a replayable interaction script use `argent-create-e2e`.
28
+ - **Physical iPhone**: needs `state: "connected"` with `transportType: "wired"` in `list-devices`. The first recording on a Mac compiles a helper (a few seconds) and macOS asks the user to allow camera access for `ios-screen-stream`; tell the user to click Allow. No touch markers are drawn.
28
29
  - **One size per video**: the video keeps the size of the screen at the start; a later size change is letterboxed. On a foldable simulator, start recording on the panel you need at full size.
29
30
  - **Remote (`remote:`) simulators**: the video keeps the screen's portrait orientation, so a device in landscape plays sideways.
30
31
  - **Android**: secure screens (DRM, some password fields) come out black.
@@ -19,7 +19,7 @@ Do not use screenshot diffing for tap-coordinate discovery. Use `describe` to fi
19
19
  ## 3. Deterministic Flow
20
20
 
21
21
  1. Navigate to the known-good state. Capture the baseline before the relevant interaction or before editing whenever feasible.
22
- 2. Save a baseline PNG with `screenshot` using `scale: 1.0` and `includeImageInContext: false`, so the full-size image stays out of context; keep the returned `path`. Use normal downscaled screenshots for everything else.
22
+ 2. Save a baseline PNG with `screenshot` using `scale: 1.0` and `includeImageInContext: false`, so the full-size image stays out of context; keep the returned `path`. Use normal downscaled screenshots for everything else. Images of different sizes return `dimension_mismatch` and are not compared, so keep one baseline per device model.
23
23
  3. Perform the interaction, apply the code change and navigate to the state under test, after the app reloads or rebuilds.
24
24
  4. Call `screenshot-diff` with that `baselinePath`, `captureCurrent: true`, `udid`, and `outputDir`. If both images are already saved, pass `currentPath` instead of `captureCurrent`.
25
25
  5. Inspect the summary and artifact paths, then combine the diff with normal visual inspection and any structural/runtime evidence needed for the assertion.