Files
17467da514 docs: simplify the README and repo docs (#481)
* docs: simplify the README and repo docs

The README opened with vague paragraphs and internal detail, and the FAQ
used feature tables with marketing claims. Rewrite them to match the docs
site: say what the tool does, show the commands, link out for the rest.

- README: computer-use tagline, short install and quick start, the
  architecture diagram, links to agent-browser.dev/desktop.
- FAQ, install, CONTRIBUTING and the FFI, benchmark and test READMEs:
  cut filler and fix claims the code contradicts (Windows DLL name,
  ad_init is optional, FFI threading, Homebrew/Scoop status, TMPDIR).
- Skills: small wording fixes only; no rule changed.

* docs: use --allow-scripts for global installs in install guide

npm install-scripts approve only edits a project's package.json and fails
for global installs, so it can't fix the global install shown above. Both
npm 11 and 12 accept --allow-scripts on npm install -g. Keep the approve
command for project installs only.

* fix: point blocked-install users at commands that work

The launcher notice and the docs site told npm 12 users to run
npm install-scripts approve, which fails for global installs, and
labeled the --allow-scripts reinstall as npm 11 only. Both npm 11 and 12
accept --allow-scripts on npm install -g, and re-running it over a
blocked install links the native binary.

In a project, approving alone does nothing until the script runs, and a
plain npm install does not re-run it. npm rebuild agent-desktop does, so
the project step now says that. Tested on npm 11.20 and 12.2 with
throwaway prefixes and projects.

* Fix: The macOS installation guide now claims that commands require a private TMPDIR for a background command host, although the merged CLI no longer runs that host, directing users to troubleshoot a nonexistent installation requirement.

This commit fixes the issue reported at docs/install.md:56

The new merge base removed `src/command_host`; `src/main.rs` now stops legacy hosts and runs commands directly. `src/tests/command_host_absent.rs` also asserts that commands never connect to or create host socket files. This paragraph reintroduces the removed architecture and its former `INVALID_ARGS` condition into the installation requirements, misleading users with custom temporary directories.

The suggested patch removes only the obsolete host/TMPDIR sentences. Verified against the current entry point and absence tests; `git diff --check` passes. Native macOS tests were not run.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: lahfir <nmhlahfir2@gmail.com>

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
2026-11-03 10:01:44 -08:00

3.9 KiB

FFI Python smoke harness

Proves the C ABI works from a non-Rust host (Python ctypes) and gates it in CI.

What it tests

Leg Check
1 ad_abi_version() equals AD_ABI_VERSION_MAJOR from the header. Catches a header and dylib mismatch at import.
2 Every ad_*_size() getter equals its AD_*_SIZE macro. Catches struct layout drift.
3 ad_version() returns ok:true JSON with data.version.
4 ad_adapter_create → ad_snapshot → ad_free_string → ad_adapter_destroy runs without a crash or leak. A stub adapter returns a clean PLATFORM_NOT_SUPPORTED envelope.
5 Opt-in with AD_EXPECT_REAL=1 (optional AD_APP, default gnome-calculator). The real adapter returns a complete snapshot with refs for the app, on the main thread and on a worker thread. Run by tests/linux-dist/run-consumer.sh.
Linux helper Opt-in with AD_EXPECT_LINUX_HELPER=1 and AD_HELPER_EMPTY_PATH. Run by scripts/ci-ffi-helper-discovery-smoke.sh. With an empty PATH, the library finds the clipboard owner beside it, a foreign GTK reader sees the text it sets, and clear empties the selection.
6 Opt-in with AD_EXPECT_MACOS_HELPER=1. Run by scripts/ci-ffi-helper-discovery-smoke.sh. Checks macOS helper discovery.

Building the dylib

# From the repo root:
cargo build --locked --profile release-ffi -p agent-desktop-ffi --features stub-adapter

The dylib lands at target/release-ffi/libagent_desktop_ffi.dylib on macOS, or target/release-ffi/libagent_desktop_ffi.so on Linux.

Use --profile release-ffi. The default release profile sets panic = "abort", which silently disables the FFI's catch_unwind traps.

--features stub-adapter replaces the real adapter with one that returns PLATFORM_NOT_SUPPORTED for every call. CI uses this build, so the harness runs without Accessibility permission.

Running locally

The examples use macOS paths. On Linux, pass the .so instead.

python3 tests/ffi-python/smoke.py \
  target/release-ffi/libagent_desktop_ffi.dylib \
  crates/ffi/include/agent_desktop.h

Or set environment variables:

export AD_DYLIB_PATH=target/release-ffi/libagent_desktop_ffi.dylib
export AD_HEADER_PATH=crates/ffi/include/agent_desktop.h
python3 tests/ffi-python/smoke.py

Stub enforcement (AD_EXPECT_STUB=1)

Set AD_EXPECT_STUB=1 when you run the harness against a stub build. The harness then fails if ad_snapshot() returns ok:true, which would mean the dylib was not built with --features stub-adapter. The arm64 macOS leg of the ffi-panic-guard CI job sets this variable. A real-adapter dylib therefore cannot pass the stub gate.

Dependencies

smoke.py uses only the Python standard library, so no pip install is needed. The Linux helper leg is the exception. linux_helper.py reads the clipboard as a foreign GTK client, so it needs PyGObject with the GTK 3 typelib (python3-gi and gir1.2-gtk-3.0).

Real-adapter happy path

Legs 1 to 4 cover the surface that needs no permission: the ABI version, struct sizes, ad_version, and the PLATFORM_NOT_SUPPORTED path. A successful ad_snapshot from the real adapter is tested elsewhere. On macOS, tests/e2e/run.sh covers it through scenarios/acceptance.sh, which runs ffi_live.py against the release FFI library. That run needs Accessibility permission. On Linux, leg 5 covers it.

Other files

File Purpose
linux_helper.py The Linux helper leg, and verify_cli for the installed CLI (used by tests/linux-dist/run-npm-install.sh)
test_linux_helper.py Unit tests for linux_helper.py: python3 -I -m unittest discover -s tests/ffi-python -p 'test_linux_helper.py'
leak_probe.py Linux only, not run by CI: python3 tests/ffi-python/leak_probe.py <library.so> [--calls N]. It points the library at a silent X11 TCP server and checks that repeated timed-out ad_list_displays calls keep the host's thread and descriptor counts flat.