Commit Graph

301 Commits

Author SHA1 Message Date
Filip131311 8bcbf1236e fix: log stdout/stderr errors instead of rethrowing 2026-04-16 11:12:59 +02:00
Filip131311 ea99e945f8 fix: default download:native-binaries tag to argent-main 2026-04-16 00:17:59 +02:00
filip131311 c990e98839 fix: use launchctl getenv to avoid simctl 127-byte truncation of DYLD_INSERT_LIBRARIES (#127)
`xcrun simctl getenv` silently truncates return values at 127 bytes.
The code was reading with `simctl getenv` but writing with
`simctl spawn ... launchctl setenv`, causing each ensureEnv() cycle to
read a truncated value, fail to recognize the truncated argent path
fragments, preserve them, and append a fresh bootstrap — corrupting
the variable and clobbering third-party dylibs like SimCam.

Fix:
- Read via `simctl spawn <udid> launchctl getenv` (same store, no limit)
- Restore fs.existsSync guard to strip truncated/stale entries while
  keeping third-party dylibs that exist on disk (e.g. SimCam)
- Bump mcp version to 0.4.4
2026-04-16 00:16:10 +02:00
Ignacy Łątka bef319134e fix: add project_root arg to flow-start-recording (#114)
* fix: detect project root via .argent dir instead of git

Flow tools previously shelled out to 'git rev-parse --show-toplevel' to
locate the project root, which failed outside git repos and pulled flows
from the wrong place in nested worktrees. Walk up from cwd looking for
an existing .argent/ directory; fall back to cwd so the first
flow-start-recording still creates it in place.

* fix: skip $HOME when walking up for .argent/

The MCP launcher stores its own state in ~/.argent/ (logs, tool-server
pid). Without this guard, running any flow tool from anywhere under
$HOME — but outside a real project with its own .argent/ — would stop
at the home directory and treat it as the project root, mixing personal
MCP state with flow files.

* revert: restore getGitRoot in flow-utils

The walk-up .argent approach is fundamentally broken because the
tool-server is a singleton daemon — its process.cwd() is not the
calling project's cwd. Reverting both 882ed4c and 83e6ae6 so the
next commit can replace the resolution with an AsyncLocalStorage
context populated from an X-Argent-Project-Root header sent by the
argent mcp proxy.

This reverts commit 882ed4c.
This reverts commit 83e6ae6.

* feat: resolve project root via AsyncLocalStorage from mcp proxy header

The tool-server is a singleton daemon shared by every MCP client,
so its process.cwd() is never the calling project's cwd. The git-
root and walk-up heuristics both ran inside the daemon and silently
returned the wrong directory.

Shift the source of truth: the argent mcp proxy is per-client, so
it IS in the client's workspace. Stamp process.cwd() on every POST
to the tool-server as X-Argent-Project-Root, run invokeTool inside
an AsyncLocalStorage scope, and expose requireProjectRoot() to any
tool that needs it. Missing/malformed headers surface a clear error
from the getter instead of silently defaulting to the daemon's cwd.

- packages/mcp/src/mcp-server.ts: callTool sends the header
- packages/tool-server/src/request-context.ts: ALS module
- packages/tool-server/src/http.ts: extract header, wrap invokeTool
- packages/tool-server/src/tools/flows/flow-utils.ts: requireProjectRoot
- packages/tool-server/test/http-project-root.test.ts: integration tests
  covering present/missing/empty/malformed header, unicode roundtrip,
  non-flow tools bypassing the getter, and concurrent-request isolation

* refactor: profiler tools resolve project root via requireProjectRoot

Drop the project_root input parameter from react-profiler-analyze
and react-profiler-component-source. Both now pull the root from
the AsyncLocalStorage context stamped by the argent mcp proxy,
matching flow-utils.

Second caller for requireProjectRoot so the mechanism is exercised
beyond flows. If the ALS approach turns out flaky, these two tools
break in the same way as the flow tools and fail loudly with the
same clear error message.

Update the profiler skill doc to drop the project_root arg since
agents no longer pass it.

* test: stress-test AsyncLocalStorage projectRoot mechanism

Four comprehensive test files generated by a parallel swarm audit of
the new request-context.ts / requireProjectRoot() approach, covering
every realistic way it could break.

- test/als-propagation.test.ts — 15 tests documenting what Node's
  AsyncLocalStorage actually does under every async boundary the
  tool-server uses. Split into SAFE baselines (Promise chains,
  microtasks, timers, streams, synchronous EventEmitter emits,
  concurrent frames) and LATENT TRAPS (listeners fired outside
  an active frame, worker_threads, child_process). Serves as the
  authoritative reference for "can I read projectRoot here?".

- test/als-nested-invocation.test.ts — 10 tests proving propagation
  through registry.invokeTool nesting: two-level, deep (A→B→C→D→E),
  mixed sync/async, parallel fan-out, cross-request isolation,
  flow-execute style loops, error mid-chain, long chains, explicit
  runWithContext re-entry overrides.

- test/als-http-edge-cases.test.ts — HTTP boundary stress tests:
  malformed percent-encoding, null-byte injection, header case
  variants, duplicate headers, unicode round-trip, abort mid-flight,
  relative/Windows/URL-shaped paths.

- test/als-state-contamination.test.ts — adversarial audit that
  surfaced two PRE-EXISTING P0 bugs the ALS fix does NOT solve:
    * activeFlowName module-level singleton in flow-utils.ts
      leaks between concurrent projects on a shared daemon
    * profilerPathsCache in react-profiler-session.ts is keyed
      only by Metro port, not projectRoot — two projects sharing
      port 8081 see each other's cached profiler sessions
  Both are documented via it.fails() so vitest passes today; the
  day a fix lands the it.fails flips to an alert and the test
  becomes a regression guard.

449/449 tool-server tests pass.

* revert: drop AsyncLocalStorage project-root approach

Reverts the ALS-based project root resolution because the approach
isn't working well in practice. Restores the previous getGitRoot
implementation in flow-utils, the project_root input parameter on
the profiler tools, and the skill doc that describes it.

Reverts:
- 3932eb5 test: stress-test AsyncLocalStorage projectRoot mechanism
- 5398cbc refactor: profiler tools resolve project root via requireProjectRoot
- b7ae895 feat: resolve project root via AsyncLocalStorage from mcp proxy header

A follow-up commit adds clearer error handling around the git call
so the agent gets a useful message when the tool-server's cwd isn't
inside a git repo.

* fix: clearer error when getGitRoot fails outside a git repo

Wrap the `git rev-parse --show-toplevel` call in getGitRoot so that
the failure surfaces a useful message to the agent instead of the
raw child_process stderr. The tool-server daemon's cwd is not the
calling project's cwd, so if the daemon happens to be launched
outside any git repository the git command fails with a terse
"fatal: not a git repository" that tells the agent nothing about
what to do next.

The new error reports the daemon's cwd, explains that flows are
anchored to a git root, and points the user at `git init`.

* refactor: require project_root as a flow tool parameter

The tool-server is a singleton daemon — its process.cwd() is never
the calling project's cwd, so flow-utils cannot infer the project
root on its own. Instead of guessing via git or walking the
filesystem, ask the calling agent directly: every flow tool now
takes project_root as a required parameter and the agent supplies
the absolute path it is working in.

This matches the existing pattern used by react-profiler-analyze,
react-profiler-component-source, and gather-workspace-data, all of
which already accept an agent-provided project/workspace path.

Changes:
- flow-utils.ts: drop getGitRoot/execFile; getFlowsDir and
  getFlowPath become pure functions that take projectRoot; throw
  on non-absolute paths at the boundary.
- flow-start-recording, flow-add-step, flow-add-echo,
  flow-finish-recording, flow-read-prerequisite, flow-execute:
  add project_root to each zod schema and plumb it through.
- argent-create-flow SKILL.md: document project_root on every
  example tool call; note that it must be passed every time.
- flow-tools.test.ts: remove the flow-utils vi.mock (no longer
  needed) and pass project_root: tmpDir on every call; add a
  regression test rejecting relative project_root.

* prettier

* cleanup skill

* refactor: store project_root on flow-start-recording, not on every tool

The tool-server cannot infer the calling project's working directory
on its own. The agent now provides it once — as project_root on
flow-start-recording, which stores it alongside activeFlowName in
module state. All other flow tools (flow-add-step, flow-add-echo,
flow-finish-recording, flow-execute, flow-read-prerequisite) read
the stored value and require no project_root parameter.

This matches the existing "active flow" pattern: just as flow name
is tracked automatically after flow-start-recording, so is the
project root.

* feat: require project_root on flow-execute and flow-read-prerequisite

These tools are independent entry points that may be called without a
prior recording session (e.g. after daemon restart), so they cannot
rely on module state set by flow-start-recording. Adding project_root
as an explicit parameter mirrors the pattern already used by
flow-start-recording and react-profiler-analyze.

* fix: make requireActiveProjectRoot error message tool-agnostic

The previous message pointed only at flow-start-recording, but the
check is now reached from flow-execute and flow-read-prerequisite as
well.

* refactor: store flows in .argent/flows/ instead of .argent/

Keeps the .argent/ directory clean for other argent-related artifacts
and groups flow files under a dedicated subdirectory.

* style: prettier --write
2026-04-15 19:10:48 +02:00
filip131311 09eadbbfd8 fix: download:native-binaries should not derive version locally (#126) 2026-04-15 16:35:16 +02:00
filip131311 7db8305fff feat: pin native binaries to versioned release tags and publish to npm (#125)
- download-native-binaries.sh now requires an explicit release tag (e.g.
  argent-v0.4.3) and fails fast with a clear error if the release doesn't
  exist in argent-private-releases
- publish.yml is now manual-only (workflow_dispatch) with a ref input
  (branch/tag/SHA); derives the binaries tag as argent-{ref} and checks
  out the repo at that ref
- publish.yml now targets npm (registry.npmjs.org + NPM_TOKEN) instead
  of GitHub Packages
- download:native-binaries npm script auto-derives the tag from
  packages/mcp/package.json version for local pack:mcp usage
2026-04-15 16:26:55 +02:00
Ignacy Łątka a7d4aeedff fix: drain stdout before process.exit in tool-server CLI paths (#123)
process.exit() is synchronous and does not flush Node's WriteStream
buffer when stdout is a pipe. For large outputs like the ~61 KB
tool manifest from `-t`, the tail was being truncated, causing
`argent init` to fail with "Unterminated string in JSON" when
parsing the child's output in getAvailableToolIds.
2026-04-15 15:25:00 +02:00
filip131311 bad7049f87 feat: add download:native-binaries script and include it in pack:mcp (#124) 2026-04-15 14:46:31 +02:00
filip131311 5a9aa79c4d chore: update argent-private submodule with build-native-binaries workflow (#122)
* chore: update argent-private submodule with build-native-binaries workflow

* chore: update argent-private submodule to latest main
2026-04-15 14:20:28 +02:00
Paweł Fornagiel 0f15b2d753 refactor: optimize source map handling in SourceMapsRegistry (#119) 2026-04-15 14:19:36 +02:00
Ignacy Łątka 27858c7390 remove duplicate method (#118) 2026-04-15 13:02:05 +02:00
Filip131311 f30948fe46 feat: download native binaries from argent-private-releases instead of building locally 2026-04-15 11:41:10 +02:00
Paweł Fornagiel 73b619bfed Require device_id for debugger/profiler; React profiler session metadata; skill updates (#117)
* Reapply "feat: enhance React profiler session handling with device ID support"

This reverts commit 2bf25cb950.

* Reapply "refactor: remove device-related fields from React profiler session"

This reverts commit badf127411.

* Reapply "refactor: unify device ID handling across debugger and profiler tools, make device_id required, not optional"

This reverts commit c6f1fd7578.

* format: run format

* refactor: enforce device ID requirement in JsRuntimeDebugger and ReactProfilerSession blueprints

* feat: add appName and deviceName to React profiler session and related tools

* fix: update React profiler session output to reflect accurate field names for runtime and project details

* skills: enhance skills for Metro debugger and React profiler tools to clarify device_id usage and connection diagnostics

* format: run format

* test: update NetworkInspector integration tests to include mock-device in service resolutions
2026-04-15 10:32:58 +02:00
filip131311 594bf05791 chore: update argent-private submodule URL to software-mansion org (#121)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 10:29:54 +02:00
Filip131311 d082ea2fd2 feat: download simulator server 2026-04-14 15:09:58 +02:00
Filip131311 448ec604f2 Feat: download singen simulator server from github insteado of building localy 2026-04-14 13:55:41 +02:00
pFornagiel 2bf25cb950 Revert "feat: enhance React profiler session handling with device ID support"
This reverts commit 1efa4c001e.
2026-04-13 20:29:03 +02:00
pFornagiel badf127411 Revert "refactor: remove device-related fields from React profiler session"
This reverts commit f8f7337ffa.
2026-04-13 20:29:03 +02:00
pFornagiel c6f1fd7578 Revert "refactor: unify device ID handling across debugger and profiler tools, make device_id required, not optional"
This reverts commit 066b9ba3c0.
2026-04-13 20:29:03 +02:00
pFornagiel 066b9ba3c0 refactor: unify device ID handling across debugger and profiler tools, make device_id required, not optional 2026-04-13 20:26:48 +02:00
pFornagiel f8f7337ffa refactor: remove device-related fields from React profiler session 2026-04-13 19:56:36 +02:00
pFornagiel 1efa4c001e feat: enhance React profiler session handling with device ID support 2026-04-13 19:53:42 +02:00
pFornagiel 76cc876c2c chore: bump package versions to 0.4.3 2026-04-13 17:49:38 +02:00
Paweł Fornagiel 42cc5e3c09 Enhance error handling in registry and tool server blueprints (#115)
* feat: enhance error handling in registry and tool server blueprints

* test: add tests for error handling in registry and tool server blueprints

* refactor: streamline exception detail formatting in CDP client

* format: run format
2026-04-13 17:17:18 +02:00
filip131311 4eef3e7dd1 fix: Removing skills removed skills external to argent (#112) 2026-04-13 16:06:28 +02:00
Ignacy Łątka 8464dbe8ed fix: tool allowlist for Codex (#110)
* add `getAllTools` + tests

* add minimap hints

* cleanup - don't use hardcoded filename

* make cli depend on tool server

* cleanup gemini function - will be used as template for further work

* add allowlist logic

* move codex config type to types section

* add package module and exports to tool server

* revert package changes

* make tool server a CLI

* make the tool server start with `start` command

* add tool printing command

* use CLI tools getter inside mcp configs

* remove artifacts

* add help to help menu

* revert artifacts

* remove redundant null getters

* add codex tests
2026-04-13 15:27:56 +02:00
Ignacy Łątka 724ffc8ca5 ci: add prettier format check (#111)
* ci: add prettier format check workflow

* test: prettier err

* Revert "test: prettier err"

This reverts commit a5f7a18ddd.
2026-04-13 15:00:11 +02:00
Ignacy Łątka 53d66d5a0a fix: errors in Gemini >=0.36 (#107)
* fix(agents): update agent schema for v0.37 compliance

* Apply suggestion from @latekvo
2026-04-13 10:53:59 +02:00
Filip131311 faf6911801 Fix: removeing other dylibs injected into the simulator (simCam compatibility) 2026-04-10 16:38:55 +02:00
Filip131311 5f7e7cbc21 Remove unecessery simulator server tool and run format 2026-04-10 16:08:24 +02:00
Filip131311 ffd1f58db4 bump version to 4.2 v0.4.2 2026-04-10 12:28:31 +02:00
Ignacy Łątka b4271bdf15 fix: correct inaccurate tool documentation in skills (#95)
* fix: correct inaccurate tool documentation in skills

- Remove fabricated JWT token parameter references from simulator-interact
  (simulator-server and screenshot don't accept JWT params)
- Remove "setting breakpoints, pausing JS execution" from metro-debugger
  description (these tools were removed)
- Document that debugger-inspect-element uses logical pixel coordinates,
  not normalized 0-1 (metro-debugger + app-workflow)
- Fix restart-app description from "Reinstall or reconnect to Metro" to
  accurate "Terminate and relaunch by bundle ID"
- Fix react-profiler-analyze meta field references — meta is embedded in
  the markdown report, not a structured return field
- Fix step cross-references in profiler skill (Step 4→3, Step 2→1)
- Remove fabricated level/limit params from debugger-log-registry docs
  in diagnostic-tools.md (only port param exists)
- Remove reference to non-existent debugger-console-listen

* fix: add LOW severity documentation fixes

- Add missing default values for gesture tool durationMs (all 300ms)
- Add default angle: 0 for gesture-pinch
- Document keyboard delayMs param (default 50ms)
- Document screenshot scale range (0.01-1.0)
- Add appSwitch and actionButton to button tool summary
- Fix UUID→UDID typo in app-workflow
- Add missing required udid param to launch-app, restart-app, open-url,
  reinstall-app in app-workflow tables
- Remove stale "breakpoints, stepping" references from app-workflow
  (metro-debugger no longer has these capabilities)
- Document that includeSkipped applies to debugger-inspect-element too
- Add missing return fields to debugger-connect and debugger-status
- Document sample_interval_us param for react-profiler-start
- Document template_path param for ios-profiler-start
- Fix ios-profiler section numbering (was 2,4,5,6 → now 2,3,4,5)

* fix: remove fabricated license/activation note from simulator-interact

The note claimed screenshots require a Pro license and referenced
activate-sso/activate-license-key tools — neither exists in the
tool-server.

---------

Co-authored-by: Filip131311 <Filip.kaminski@swmansion.com>
2026-04-10 12:15:53 +02:00
Ignacy Łątka f11dda23bf fix: remove references to deprecated/removed tools in skills (#93)
Replace `tap`/`swipe` with `gesture-tap`/`gesture-swipe` in
argent-test-ui-flow code examples, and remove reference to
non-existent `debugger-console-listen` in argent-react-native-app-workflow.
2026-04-10 11:56:35 +02:00
Paweł Fornagiel 011754986d refactor: rewrite argent rule and minor skills/tool description updates (#99)
* refactor: rewrite the `argent` main rule

* fix: minor skills and tool description updates

* feat: add "use when" for CI

---------

Co-authored-by: Filip131311 <Filip.kaminski@swmansion.com>
2026-04-10 11:53:30 +02:00
Paweł Fornagiel 3a6580943e feat: enhance debugger API with app and device context (#96) 2026-04-10 11:29:09 +02:00
Paweł Fornagiel 82418eeb92 feat: AXService daemon, describe tool native-devtools path, and submodule bump (#98)
* feat: first implementation integration of ax-service for enhanced accessibility support

* feat: enhance ax-service with automation enablement and daemon management

* feat: export ensureAutomationEnabled function for improved accessibility automation in simulator server

* feat: add new build scripts for native development and update binary files

* feat: enhance describe tool to support native-devtools fallback and introduce DescribeResult interface

* chore: bump version to 0.4.1

* chore: bump argent-private to main; list ax-service in LICENSE

- Point packages/argent-private at current main and set submodule branch.
- Declare packages/native-devtools-ios/bin/ax-service as proprietary alongside simulator-server and dylibs.

Made-with: Cursor

* docs: document ax-service as proprietary across LICENSE and README

- Extend root README and CONTRIBUTING requirements (mcp README syncs from root at build).
- List bin/ax-service in @swmansion/argent and native-devtools-ios LICENSE.
- Assert ax-service is present and executable in publish workflow.

Made-with: Cursor

---------

Co-authored-by: Filip131311 <Filip.kaminski@swmansion.com>
2026-04-10 11:25:23 +02:00
Paweł Fornagiel eb2d9222b9 fix: update LICENSE link in README.md 2026-04-09 11:59:48 +02:00
Paweł Fornagiel 04819fd4fc chore: update README banner with dark/light mode support and new assets (#97)
* chore: update README to improve branding and layout

* chore: update README to include responsive banner images and fix minor text typo

* chore: update README to enhance banner image responsiveness and adjust layout

* feat: adjust banner image display

* feat: merge changes

* fix: update README with absolute image URLs and correct text typo; add new banner images
2026-04-09 11:03:40 +02:00
Ignacy Łątka 4169e30ae9 chore: bump packages to 0.4.0 (#94) 2026-04-08 18:54:17 +02:00
filip131311 a1d2cf5b3b fix: restore GitHub Packages publishing fallback (#92)
Unblocks internal releases while npm private publishing is unavailable for the org by switching the publish workflow back to GitHub Packages.

Made-with: Cursor
2026-04-08 17:42:43 +02:00
filip131311 f65f2ce792 fix: use npm token for private npm publish (#91)
Bootstraps the first restricted npm release from GitHub Actions, which cannot complete interactive 2FA, and aligns the package version with the planned 0.4.0 tag.

Made-with: Cursor
2026-04-08 17:30:54 +02:00
filip131311 e8cb2e2d56 fix: publish private npm releases from GitHub Actions (#90)
Switch the release workflow from GitHub Packages to npm trusted publishing and validate the bundled native artifacts before publish.

Made-with: Cursor
2026-04-08 17:01:12 +02:00
Paweł Fornagiel f4fc5032c9 fix: enable accessibility flags for iOS 26 hierarchy support (#88)
* chore: Update subproject commit for argent-private and refresh native devtools binaries with fixes for ios26

* chore: Update subproject commit for argent-private and refresh native devtools binaries

* fix: prime native devtools during simulator boot (#89)

Wait for full simulator boot and resolve the NativeDevtools service before boot-simulator returns so immediate launches cannot beat the watcher. Add a focused regression test for both fresh boots and already-booted simulators.

Made-with: Cursor

---------

Co-authored-by: filip131311 <159789821+filip131311@users.noreply.github.com>
2026-04-08 16:20:33 +02:00
pFornagiel 869786bdfe chore: fix readme img links 2026-04-08 13:04:43 +02:00
Paweł Fornagiel cacf0d3f1b chore: update README files for production release (#85)
* feat: update README and MCP documentation with new capabilities and installation instructions; add banner and placeholder images.

* chore: remove outdated badge section from README files in root and MCP packages

* chore: add horizontal rule to README files in root and MCP packages for improved visual separation

* chore: update README files in root and MCP packages to include detailed information about Software Mansion and its services

* chore: update logo links in README files for root and MCP packages to reflect new branding

* chore: update banner image to align with new branding

* chore: update installation command in README to reflect correct usage

* chore: replace placeholder image in README files with a GIF for improved visual appeal

* chore: update placeholder GIF to enhance visual consistency across assets

* chore: adjust image width in README files for consistent presentation

* chore: reposition placeholder GIF in README files for improved layout consistency

* chore: update installation command in README files to ensure consistency across documentation

* chore: update README files to use absolute image URLs and synchronize content between root and MCP README

* chore: remove MCP README.md file and update .gitignore to track README.md

* chore: update README.md for clarity and consistency in naming conventions
2026-04-08 13:00:24 +02:00
Ignacy Łątka c41359937b fix: Rework descriptions to fix failing CIs (#80)
* rework descriptions

* add action guidance after restart required is returned

* change threshold to 9.0

* fix native devtools status desc
2026-04-07 19:12:39 +02:00
Ignacy Łątka d7a597da32 feat: Publish to NPM privately (#84)
* switch to NPM private registry for @swmansion/argent publishing

* switch publish workflow, constants, and test to npmjs.org registry

* revert publish.yml — deprecated workflow
2026-04-07 19:12:12 +02:00
Filip131311 d19d32b405 fix: bump argent-private for native devtools crash safety
Pull in the native devtools guards and payload sanitization so injected inspection failures stop crashing host apps.

Made-with: Cursor
2026-04-07 19:11:05 +02:00
Filip131311 f7348886d2 fix: new describe crashes 2026-04-07 19:09:12 +02:00
Paweł Fornagiel 167ccf409d fix: move simulator-server binary to native-devtools-ios and fix esbuild bundling (#82)
* chore: update simulator-server path references across documentation and scripts

* feat: add native-devtools-ios entry to bundle-tools script
2026-04-07 18:25:48 +02:00