hermes-agent/website/docs/user-guide/features
Teknium b07791db05
feat(computer-use): cua-driver backend, universal any-model schema
Background macOS desktop control via cua-driver MCP — does NOT steal the
user's cursor or keyboard focus, works with any tool-capable model.

Replaces the Anthropic-native `computer_20251124` approach from the
abandoned #4562 with a generic OpenAI function-calling schema plus SOM
(set-of-mark) captures so Claude, GPT, Gemini, and open models can all
drive the desktop via numbered element indices.

## What this adds

- `tools/computer_use/` package — swappable ComputerUseBackend ABC +
  CuaDriverBackend (stdio MCP client to trycua/cua's cua-driver binary).
- Universal `computer_use` tool with one schema for all providers.
  Actions: capture (som/vision/ax), click, double_click, right_click,
  middle_click, drag, scroll, type, key, wait, list_apps, focus_app.
- Multimodal tool-result envelope (`_multimodal=True`, OpenAI-style
  `content: [text, image_url]` parts) that flows through
  handle_function_call into the tool message. Anthropic adapter converts
  into native `tool_result` image blocks; OpenAI-compatible providers
  get the parts list directly.
- Image eviction in convert_messages_to_anthropic: only the 3 most
  recent screenshots carry real image data; older ones become text
  placeholders to cap per-turn token cost.
- Context compressor image pruning: old multimodal tool results have
  their image parts stripped instead of being skipped.
- Image-aware token estimation: each image counts as a flat 1500 tokens
  instead of its base64 char length (~1MB would have registered as
  ~250K tokens before).
- COMPUTER_USE_GUIDANCE system-prompt block — injected when the toolset
  is active.
- Session DB persistence strips base64 from multimodal tool messages.
- Trajectory saver normalises multimodal messages to text-only.
- `hermes tools` post-setup installs cua-driver via the upstream script
  and prints permission-grant instructions.
- CLI approval callback wired so destructive computer_use actions go
  through the same prompt_toolkit approval dialog as terminal commands.
- Hard safety guards at the tool level: blocked type patterns
  (curl|bash, sudo rm -rf, fork bomb), blocked key combos (empty trash,
  force delete, lock screen, log out).
- Skill `apple/macos-computer-use/SKILL.md` — universal (model-agnostic)
  workflow guide.
- Docs: `user-guide/features/computer-use.md` plus reference catalog
  entries.

## Tests

44 new tests in tests/tools/test_computer_use.py covering schema
shape (universal, not Anthropic-native), dispatch routing, safety
guards, multimodal envelope, Anthropic adapter conversion, screenshot
eviction, context compressor pruning, image-aware token estimation,
run_agent helpers, and universality guarantees.

469/469 pass across tests/tools/test_computer_use.py + the affected
agent/ test suites.

## Not in this PR

- `model_tools.py` provider-gating: the tool is available to every
  provider. Providers without multi-part tool message support will see
  text-only tool results (graceful degradation via `text_summary`).
- Anthropic server-side `clear_tool_uses_20250919` — deferred;
  client-side eviction + compressor pruning cover the same cost ceiling
  without a beta header.

## Caveats

- macOS only. cua-driver uses private SkyLight SPIs
  (SLEventPostToPid, SLPSPostEventRecordTo,
  _AXObserverAddNotificationAndCheckRemote) that can break on any macOS
  update. Pin with HERMES_CUA_DRIVER_VERSION.
- Requires Accessibility + Screen Recording permissions — the post-setup
  prints the Settings path.

Supersedes PR #4562 (pyautogui/Quartz foreground backend, Anthropic-
native schema). Credit @0xbyt4 for the original #3816 groundwork whose
context/eviction/token design is preserved here in generic form.
2026-04-23 16:44:24 -07:00
..
_category_.json feat: add documentation website (Docusaurus) 2026-03-05 05:24:55 -08:00
acp.md docs(acp): fix zed config 2026-04-03 01:46:45 -07:00
api-server.md feat(api-server): inline image inputs on /v1/chat/completions and /v1/responses (#12969) 2026-04-20 04:16:13 -07:00
batch-processing.md fix: normalize remaining reasoning effort orderings and add missing 'minimal' 2026-04-09 14:20:16 -07:00
browser.md feat(browser): add browser_cdp raw DevTools Protocol passthrough (#12369) 2026-04-19 00:03:10 -07:00
built-in-plugins.md feat(plugins): make all plugins opt-in by default 2026-04-20 04:46:45 -07:00
code-execution.md docs(execute_code): document project/strict execution modes (#12073) 2026-04-18 01:53:09 -07:00
computer-use.md feat(computer-use): cua-driver backend, universal any-model schema 2026-04-23 16:44:24 -07:00
context-files.md feat: progressive subdirectory hint discovery (#5291) 2026-04-05 12:33:47 -07:00
context-references.md docs: comprehensive documentation audit — fix stale info, expand thin pages, add depth (#5393) 2026-04-05 19:45:50 -07:00
credential-pools.md docs: comprehensive docs audit — cover 13 features from last week's PRs (#5815) 2026-04-07 10:21:03 -07:00
cron.md docs(cron): explain runtime resolution for null model/provider 2026-04-23 02:04:45 -07:00
dashboard-plugins.md docs: add dashboard themes and plugins documentation 2026-04-16 04:10:06 -07:00
delegation.md docs: document delegation width + depth knobs (#13745) 2026-04-21 17:54:39 -07:00
fallback-providers.md docs: fix fallback behavior description — it is per-turn, not per-session 2026-04-22 21:29:49 -07:00
honcho.md feat(honcho): wizard cadence default 2, surface reasoning level, backwards-compat fallback 2026-04-18 22:50:55 -07:00
hooks.md feat: shell hooks — wire shell scripts as Hermes hook callbacks 2026-04-20 20:53:51 -07:00
image-generation.md feat(image-gen): add GPT Image 2 to FAL catalog (#13677) 2026-04-21 13:35:31 -07:00
mcp.md docs: deep quality pass — expand 10 thin pages, fix specific issues (#4134) 2026-03-30 20:30:11 -07:00
memory-providers.md feat(hindsight): richer session-scoped retain metadata 2026-04-22 05:27:10 -07:00
memory.md docs: add Supermemory to memory providers docs, env vars, CLI reference 2026-04-06 22:15:58 -07:00
overview.md feat(delegate): orchestrator role and configurable spawn depth (default flat) 2026-04-21 14:23:45 -07:00
personality.md docs: document SOUL.md as primary agent identity (#1927) 2026-03-18 04:18:08 -07:00
plugins.md feat(plugins): make all plugins opt-in by default 2026-04-20 04:46:45 -07:00
provider-routing.md docs: fallback providers + /background command documentation 2026-03-15 06:24:28 -07:00
rl-training.md fix(docs): Add links to Atropos and wandb in user guide 2026-04-23 03:07:06 -07:00
skills.md feat(skills): add 'hermes skills reset' to un-stick bundled skills (#11468) 2026-04-17 00:41:31 -07:00
skins.md feat(skin): add warm-lightmode skin from PR #4811 2026-04-13 23:51:21 -07:00
tool-gateway.md feat(image_gen): upgrade Recraft V3 → V4 Pro, Nano Banana → Pro (#11406) 2026-04-16 22:05:41 -07:00
tools.md docs: add Nous Tool Gateway documentation 2026-04-16 12:36:49 -07:00
tts.md feat(tts): complete KittenTTS integration (tools/setup/docs/tests) 2026-04-21 01:28:32 -07:00
vision.md fix(tui): improve macOS paste and shortcut parity 2026-04-21 08:00:00 -07:00
voice-mode.md feat(voice): add cli beep toggle 2026-04-21 00:29:29 -07:00
web-dashboard.md feat(dashboard): reskin extension points for themes and plugins (#14776) 2026-04-23 15:31:01 -07:00