@swmansion/argent 0.5.3 → 0.6.0-next.2

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 (52) hide show
  1. package/README.md +11 -14
  2. package/bin/ax-service +0 -0
  3. package/bin/simulator-server +0 -0
  4. package/dist/bundled-paths.d.ts +2 -0
  5. package/dist/bundled-paths.js +9 -0
  6. package/dist/bundled-paths.js.map +1 -0
  7. package/dist/cli-cmds.mjs +729 -0
  8. package/dist/cli.d.ts +15 -6
  9. package/dist/cli.js +59 -12
  10. package/dist/cli.js.map +1 -1
  11. package/dist/installer.mjs +14730 -0
  12. package/dist/mcp-server.mjs +14352 -0
  13. package/dist/preview-ui/index.html +799 -0
  14. package/dist/tool-server.cjs +4223 -1169
  15. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  16. package/dylibs/libKeyboardPatch.dylib +0 -0
  17. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  18. package/package.json +15 -12
  19. package/skills/argent-react-native-profiler/SKILL.md +16 -12
  20. package/dist/auto-screenshot.d.ts +0 -22
  21. package/dist/auto-screenshot.js +0 -79
  22. package/dist/auto-screenshot.js.map +0 -1
  23. package/dist/cli/constants.d.ts +0 -6
  24. package/dist/cli/constants.js +0 -12
  25. package/dist/cli/constants.js.map +0 -1
  26. package/dist/cli/init.d.ts +0 -2
  27. package/dist/cli/init.js +0 -529
  28. package/dist/cli/init.js.map +0 -1
  29. package/dist/cli/mcp-configs.d.ts +0 -38
  30. package/dist/cli/mcp-configs.js +0 -779
  31. package/dist/cli/mcp-configs.js.map +0 -1
  32. package/dist/cli/skills.d.ts +0 -14
  33. package/dist/cli/skills.js +0 -95
  34. package/dist/cli/skills.js.map +0 -1
  35. package/dist/cli/uninstall.d.ts +0 -13
  36. package/dist/cli/uninstall.js +0 -389
  37. package/dist/cli/uninstall.js.map +0 -1
  38. package/dist/cli/update.d.ts +0 -1
  39. package/dist/cli/update.js +0 -115
  40. package/dist/cli/update.js.map +0 -1
  41. package/dist/cli/utils.d.ts +0 -38
  42. package/dist/cli/utils.js +0 -272
  43. package/dist/cli/utils.js.map +0 -1
  44. package/dist/content.d.ts +0 -31
  45. package/dist/content.js +0 -59
  46. package/dist/content.js.map +0 -1
  47. package/dist/launcher.d.ts +0 -8
  48. package/dist/launcher.js +0 -183
  49. package/dist/launcher.js.map +0 -1
  50. package/dist/mcp-server.d.ts +0 -1
  51. package/dist/mcp-server.js +0 -228
  52. package/dist/mcp-server.js.map +0 -1
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.5.3",
3
+ "version": "0.6.0-next.2",
4
4
  "description": "MCP server for iOS Simulator control",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -13,12 +13,11 @@
13
13
  "argent-simulator-server": "bin/simulator-server"
14
14
  },
15
15
  "scripts": {
16
- "build": "npm run build:mcp && npm run build:tools-bundle && npm run sync-readme",
17
- "build:mcp": "rm -rf dist tsconfig.tsbuildinfo && tsc",
16
+ "build": "npm run build:dispatcher && npm run build:bundles && npm run sync-readme",
17
+ "build:dispatcher": "rm -rf dist tsconfig.tsbuildinfo && tsc",
18
+ "build:bundles": "node scripts/bundle-tools.cjs",
18
19
  "sync-readme": "node scripts/sync-readme.cjs",
19
20
  "prepack": "node scripts/sync-readme.cjs",
20
- "build:tools-bundle": "node scripts/bundle-tools.cjs",
21
- "dev": "node --loader ts-node/esm src/cli.ts mcp",
22
21
  "test": "vitest run",
23
22
  "test:watch": "vitest",
24
23
  "observe": "node scripts/observe.cjs",
@@ -40,18 +39,22 @@
40
39
  "scripts/postinstall.cjs"
41
40
  ],
42
41
  "dependencies": {
43
- "@clack/prompts": "^1.1.0",
44
- "@modelcontextprotocol/sdk": "^1.20.0",
45
- "picocolors": "^1.1.1",
46
- "semver": "^7.7.4",
47
- "smol-toml": "^1.6.1",
48
- "yaml": "^2.8.3"
42
+ "@modelcontextprotocol/sdk": "^1.20.0"
49
43
  },
50
44
  "devDependencies": {
45
+ "@argent/cli": "file:../argent-cli",
46
+ "@argent/installer": "file:../argent-installer",
47
+ "@argent/mcp": "file:../argent-mcp",
48
+ "@argent/tools-client": "file:../argent-tools-client",
49
+ "@clack/prompts": "^1.1.0",
51
50
  "@types/node": "^22.0.0",
52
51
  "@types/semver": "^7.7.1",
53
52
  "esbuild": "^0.27.3",
53
+ "picocolors": "^1.1.1",
54
+ "semver": "^7.7.4",
55
+ "smol-toml": "^1.6.1",
54
56
  "typescript": "^5.5.0",
55
- "vitest": "^4.0.18"
57
+ "vitest": "^4.0.18",
58
+ "yaml": "^2.8.3"
56
59
  }
57
60
  }
@@ -9,14 +9,15 @@ This skill is complementary to `argent-react-native-optimization`, not a replace
9
9
 
10
10
  ### React Profiler (Hermes / React commits)
11
11
 
12
- | Tool | Purpose |
13
- | --------------------------------- | ------------------------------------------------------------------------------------------------------------- |
14
- | `react-profiler-start` | Start CPU sampling + inject React commit-capture hook. Optional: `sample_interval_us` (default 100). |
15
- | `react-profiler-stop` | Stop recording; stores cpuProfile + commitTree in session. |
16
- | `react-profiler-analyze` | Run pipeline -> report with CPU-enriched hot commits, sorted by `totalRenderMs` DESC. Saves raw data to disk. |
17
- | `react-profiler-component-source` | AST lookup: file, line, memoization status, 50 lines of source for a component. |
18
- | `react-profiler-renders` | Live fiber walk: render counts + durations per component (no profiling session required). |
19
- | `react-profiler-fiber-tree` | Live fiber walk: full component hierarchy as JSON. |
12
+ | Tool | Purpose |
13
+ | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
14
+ | `react-profiler-start` | Start CPU sampling + inject React commit-capture hook. Optional: `sample_interval_us` (default 100). |
15
+ | `react-profiler-stop` | Stop recording; stores cpuProfile + commitTree in session. |
16
+ | `react-profiler-status` | **Call if you were interrupted in the middle of the flow, never in another scenario** (debugger drop, Metro reload, pause, subagent handoff, any doubt). Returns `session_status: "active" \| "taken_over" \| "stopped" \| "no_react_runtime"`. Side-effect free. |
17
+ | `react-profiler-analyze` | Run pipeline -> report with CPU-enriched hot commits, sorted by `totalRenderMs` DESC. Saves raw data to disk. |
18
+ | `react-profiler-component-source` | AST lookup: file, line, memoization status, 50 lines of source for a component. |
19
+ | `react-profiler-renders` | Live fiber walk: render counts + durations per component (no profiling session required). |
20
+ | `react-profiler-fiber-tree` | Live fiber walk: full component hierarchy as JSON. |
20
21
 
21
22
  ### Drill-Down Query Tools (call after analyze)
22
23
 
@@ -77,10 +78,13 @@ When profiling requires a specific interaction sequence (scroll a list, navigate
77
78
 
78
79
  ### Step 1: Start profiling
79
80
 
80
- Mind the react-native and ios-native profiler selection mentioned above when starting the session and start the tools. **Save `startedAtEpochMs` from the response** — you will need it later to compute annotation offsets. Every subsequent profiler/query call in this session must use the same `device_id`. Before beginning, define lightweight success criteria with the user: which metric matters most (e.g., `totalRenderMs`, specific commit duration, render count for a component) and what threshold would be meaningful. This anchors later evaluation. On success:
81
+ Mind the react-native and ios-native profiler selection mentioned above when starting the session and start the tools. **Save `startedAtEpochMs` from the response** — you will need it for annotation offsets. Every subsequent profiler/query call in this session must use the same `device_id`. Before beginning, define lightweight success criteria with the user: which metric matters most (e.g., `totalRenderMs`, specific commit duration, render count for a component) and what threshold would be meaningful. This anchors later evaluation. On success:
81
82
 
82
83
  - if user asked you to perform the profiling, determine how to profile yourself using tools described in `argent-simulator-interact` skill.
83
84
  - if the user stated they wish to perform the interaction themselves — suggest what interaction to perform (e.g. "scroll the list", "switch tabs") and wait for their reply.
85
+ If you received information about **existing profiling session** being owned by another agent:
86
+ - if session is marked as "stale", you may overtake it without prompting the user for allowance
87
+ - if session is NOT "stale" - before taking action and terminating the other session, **stop and ask user what you should do**, explaining the situation.
84
88
 
85
89
  #### Annotate every interaction
86
90
 
@@ -88,8 +92,8 @@ After each `gesture-tap` or `gesture-swipe` call, record an annotation using the
88
92
 
89
93
  ### Step 2: Stop and collect
90
94
 
91
- Call `react-profiler-stop` **and** `ios-profiler-stop` in parallel. Only skip `ios-profiler-stop` if you did not start it in Step 1. Note `duration_ms`, `fiber_renders_captured`, `hook_installed`.
92
- If `hook_installed: false` or `fiber_renders_captured: 0`, warn the user — React commit data may be missing.
95
+ Call `react-profiler-stop` **and** `ios-profiler-stop` in parallel. Only skip `ios-profiler-stop` if you did not start it in Step 1. Note `duration_ms` and `fiber_renders_captured`.
96
+ If `fiber_renders_captured: 0`, warn the user — React commit data may be missing.
93
97
 
94
98
  ### Step 3: Analyze
95
99
 
@@ -151,7 +155,7 @@ If the user stated that they do not wish for changes, present the profiling repo
151
155
  - **Re-run after fixes**: Always re-profile after changes. Report honestly whether the metric improved, regressed, or stayed flat — do not assume improvement.
152
156
  - **`excluded` is informational**: Components in `animatedSubtrees` and `recyclerChildren` re-render by design.
153
157
  - **Strict Mode**: Double-invokes renders. The pipeline halves `normalizedRenderCount` automatically when detected.
154
- - **Debugger connection**: If interrupted, started profiling also closes. Check debugger status and restart the flow on errors.
158
+ - **Debugger connection**: If interrupted, started profiling also closes. Before attempting recovery, call `react-profiler-status` it tells you whether the session is `active`, `taken_over`, `stopped`, or `no_react_runtime`, so you can decide whether to stop, restart, or reconnect first.
155
159
  - **Confounders to watch for**:
156
160
  - Live API data may differ between runs (different payload sizes, content counts), which shifts render counts and durations independently of your fix. Note when data-dependent components show variance.
157
161
  - Profiler overhead inflates CPU measurements. If iOS Instruments shows `JSLexer`, `JSONEmitter`, or Hermes internals dominating the JS thread, that reflects profiler instrumentation cost — not app work. Discount those entries.
@@ -1,22 +0,0 @@
1
- /**
2
- * Auto-screenshot configuration and helpers.
3
- *
4
- * After a successful simulator interaction tool call, the MCP layer
5
- * automatically captures a screenshot and appends it to the response.
6
- * All tunables live in this module so they can be tested in isolation.
7
- */
8
- export declare const AUTO_SCREENSHOT_TOOLS: Set<string>;
9
- /**
10
- * Per-tool delay (ms) before capturing the screenshot.
11
- * +1 000 ms over baseline research values to cover slow devices/transitions.
12
- */
13
- export declare const AUTO_SCREENSHOT_DELAY_MS_BY_TOOL: Record<string, number>;
14
- export declare function autoScreenshotEnabled(): boolean;
15
- export declare function getUdidFromArgs(args: unknown): string | undefined;
16
- /**
17
- * Strip known MCP prefix so the allow-list matches canonical names.
18
- * Cursor sends `mcp__argent__tap`; we need `tap`.
19
- */
20
- export declare function normalizeToolName(name: string): string;
21
- export declare function shouldAutoScreenshot(toolName: string): boolean;
22
- export declare function getAutoScreenshotDelayMs(toolName: string): number;
@@ -1,79 +0,0 @@
1
- /**
2
- * Auto-screenshot configuration and helpers.
3
- *
4
- * After a successful simulator interaction tool call, the MCP layer
5
- * automatically captures a screenshot and appends it to the response.
6
- * All tunables live in this module so they can be tested in isolation.
7
- */
8
- export const AUTO_SCREENSHOT_TOOLS = new Set([
9
- "gesture-tap",
10
- "gesture-swipe",
11
- "gesture-custom",
12
- "gesture-pinch",
13
- "gesture-rotate",
14
- "button",
15
- "keyboard",
16
- "rotate",
17
- "launch-app",
18
- "restart-app",
19
- "open-url",
20
- "describe",
21
- "run-sequence",
22
- ]);
23
- /**
24
- * Per-tool delay (ms) before capturing the screenshot.
25
- * +1 000 ms over baseline research values to cover slow devices/transitions.
26
- */
27
- export const AUTO_SCREENSHOT_DELAY_MS_BY_TOOL = {
28
- "launch-app": 3000,
29
- "restart-app": 3000,
30
- "open-url": 2000,
31
- "gesture-swipe": 1500,
32
- "gesture-custom": 1500,
33
- "gesture-tap": 1500,
34
- "gesture-pinch": 1500,
35
- "gesture-rotate": 1500,
36
- "run-sequence": 15000,
37
- "button": 1500,
38
- "rotate": 1000,
39
- "keyboard": 300,
40
- "describe": 100,
41
- };
42
- const DEFAULT_DELAY_MS = 1400;
43
- export function autoScreenshotEnabled() {
44
- const v = process.env.ARGENT_AUTO_SCREENSHOT;
45
- return v === undefined || v === "" || v === "1" || v.toLowerCase() === "true";
46
- }
47
- export function getUdidFromArgs(args) {
48
- if (args &&
49
- typeof args === "object" &&
50
- "udid" in args &&
51
- typeof args.udid === "string") {
52
- return args.udid;
53
- }
54
- return undefined;
55
- }
56
- /**
57
- * Strip known MCP prefix so the allow-list matches canonical names.
58
- * Cursor sends `mcp__argent__tap`; we need `tap`.
59
- */
60
- export function normalizeToolName(name) {
61
- const idx = name.lastIndexOf("__");
62
- return idx === -1 ? name : name.slice(idx + 2);
63
- }
64
- export function shouldAutoScreenshot(toolName) {
65
- const canonical = normalizeToolName(toolName);
66
- return canonical !== "screenshot" && AUTO_SCREENSHOT_TOOLS.has(canonical);
67
- }
68
- export function getAutoScreenshotDelayMs(toolName) {
69
- const canonical = normalizeToolName(toolName);
70
- const base = AUTO_SCREENSHOT_DELAY_MS_BY_TOOL[canonical] ?? DEFAULT_DELAY_MS;
71
- const envOverride = process.env.ARGENT_AUTO_SCREENSHOT_DELAY_MS;
72
- if (envOverride) {
73
- const envMs = parseInt(envOverride, 10);
74
- if (!Number.isNaN(envMs))
75
- return Math.max(base, envMs);
76
- }
77
- return base;
78
- }
79
- //# sourceMappingURL=auto-screenshot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-screenshot.js","sourceRoot":"","sources":["../src/auto-screenshot.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IAC3C,aAAa;IACb,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,aAAa;IACb,UAAU;IACV,UAAU;IACV,cAAc;CACf,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAA2B;IACtE,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,IAAI;IAChB,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,IAAI;IACtB,aAAa,EAAE,IAAI;IACnB,eAAe,EAAE,IAAI;IACrB,gBAAgB,EAAE,IAAI;IACtB,cAAc,EAAE,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IAAI,gBAAgB,CAAC;IAC7E,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC;IAChE,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,6 +0,0 @@
1
- export declare const PACKAGE_NAME = "@swmansion/argent";
2
- export declare const NPM_REGISTRY = "https://registry.npmjs.org";
3
- export declare const MCP_SERVER_KEY = "argent";
4
- export declare const MCP_BINARY_NAME = "argent";
5
- export declare const PERMISSION_RULE = "mcp__argent";
6
- export declare const CURSOR_ALLOWLIST_PATTERN = "argent:*";
@@ -1,12 +0,0 @@
1
- // Configurable constants for the argent CLI.
2
- // Change these if the npm package name, registry, or MCP key changes.
3
- export const PACKAGE_NAME = "@swmansion/argent";
4
- // Used ONLY for single-package queries (e.g. `npm view`), never for install
5
- // commands. Install relies on the user's scoped registry in ~/.npmrc so that
6
- // third-party dependencies resolve from npmjs.org normally.
7
- export const NPM_REGISTRY = "https://registry.npmjs.org";
8
- export const MCP_SERVER_KEY = "argent";
9
- export const MCP_BINARY_NAME = "argent";
10
- export const PERMISSION_RULE = "mcp__argent";
11
- export const CURSOR_ALLOWLIST_PATTERN = "argent:*";
12
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/cli/constants.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,sEAAsE;AAEtE,MAAM,CAAC,MAAM,YAAY,GAAG,mBAAmB,CAAC;AAEhD,4EAA4E;AAC5E,6EAA6E;AAC7E,4DAA4D;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,4BAA4B,CAAC;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AACxC,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC;AAC7C,MAAM,CAAC,MAAM,wBAAwB,GAAG,UAAU,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function init(args: string[]): Promise<void>;
2
- export declare function printBanner(): void;