The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(computer-use): align browser authorization with live-verified cua-driver 0.19.3 contract
Teknium20cf326bd117
diff --git a/agent/prompt_builder.py b/agent/prompt_builder.pyindex f8e8208c63f..a42474bf7c2 100644--- a/agent/prompt_builder.py+++ b/agent/prompt_builder.py@@ -638,12 +638,12 @@ def computer_use_guidance(platform_name: Optional[str] = None) -> str:"browser chrome, OS permission prompts, native dialogs, and unsupported ""targets. Browser setup is a separately approved action; attaching an ""existing profile is enforced by cua-driver's immutable permission "- "mode: in standard mode ask the USER to run `hermes computer-use "- "browser-approve` and pass the pasted single-use token as "- "`approval_token` (you can never mint one); bounded mode authorizes "- "via the user's reviewed capability manifest; explicit Hermes YOLO "- "uses a private unrestricted daemon after the user's launch/session "- "risk acceptance.\n\n"+ "mode: in standard mode it requires the user's one-time config opt-in "+ "`computer_use.grant_existing_profile: true` (if unset, report the "+ "refusal and name that key — you can never grant it yourself); "+ "bounded mode authorizes via the user's reviewed capability manifest; "+ "explicit Hermes YOLO uses a private unrestricted daemon after the "+ "user's launch/session risk acceptance.\n\n""## Background mode rules\n""- Do NOT use `raise_window=true` on `focus_app` unless the user ""explicitly asked you to bring a window to front. Input routing to "diff --git a/hermes_cli/config_defaults.py b/hermes_cli/config_defaults.pyindex 7f26897a03a..72bec19fdea 100644--- a/hermes_cli/config_defaults.py+++ b/hermes_cli/config_defaults.py@@ -3277,19 +3277,28 @@ DEFAULT_CONFIG = {# cua-driver permission mode for this Hermes install.# standard (default) — cua-driver's own approval boundary. Protected# operations (e.g. attaching to an existing signed-in browser- # profile) fail closed unless the user mints a single-use token- # via `hermes computer-use browser-approve`.- # bounded — repeatable automation under a user-reviewed capability- # manifest (set capability_manifest below). No runtime prompts;- # anything outside the manifest fails closed inside cua-driver.+ # profile) fail closed unless grant_existing_profile is enabled+ # below.+ # bounded — repeatable automation under a user-reviewed session+ # policy manifest (set capability_manifest below). No runtime+ # prompts; anything outside the manifest fails closed inside+ # cua-driver.# `unrestricted` is intentionally NOT accepted here: it stays bound to# the explicit per-session YOLO toggle so a config line can never# silently bypass approvals."permission_mode": "standard",- # Absolute or ~ path to the reviewed cua-driver capability manifest- # YAML used when permission_mode is "bounded". See+ # Absolute or ~ path to the reviewed cua-driver session-policy+ # manifest YAML used when permission_mode is "bounded". See# https://cua.ai/docs/reference/cua-driver/permission-modes"capability_manifest": "",+ # Pre-authorize existing-profile browser attachment in standard mode+ # (cua-driver's trusted-launcher `--grant existing-profile`). When+ # true, the agent can attach to your already-running, signed-in+ # Chrome/Edge window — exposing that profile's live pages, cookies,+ # and storage to the browser protocol — without a per-use prompt.+ # Leave false to keep existing-profile attachment failing closed;+ # isolated driver-owned profiles work either way.+ "grant_existing_profile": False,},# =========================================================================diff --git a/skills/autonomous-ai-agents/computer-use/SKILL.md b/skills/autonomous-ai-agents/computer-use/SKILL.mdindex 353560c279b..1bd441a211f 100644--- a/skills/autonomous-ai-agents/computer-use/SKILL.md+++ b/skills/autonomous-ai-agents/computer-use/SKILL.md@@ -186,22 +186,24 @@ and storage over the browser protocol.Authorization paths for `existing_profile`, in preference order:-1. **User-minted token (standard mode).** Ask the user to run- `hermes computer-use browser-approve --pid <pid> --window-id <window_id>- --profile-mode existing_profile` in their terminal and paste back the- token. Pass it as `approval_token` on `cua_browser_prepare`. The token is- single-use and expires in ~5 minutes, so mint it right before the call.- You cannot create this token yourself; only the user can.+1. **Config grant (standard mode).** When+ `computer_use.grant_existing_profile: true` is set, the runtime is+ launched pre-authorized (`--grant existing-profile`) and the prepare+ succeeds against the exact proven `(pid, window_id)`. If it's not set,+ the prepare fails closed — tell the user to flip that config key (and+ restart the session) if they want this; do not retry or work around it.2. **Bounded manifest.** When `computer_use.permission_mode: bounded` isconfigured with a reviewed `capability_manifest`, prepares inside themanifest's scope succeed without prompts and everything else fails closed.- No token needed; do not ask for one.3. **Explicit Hermes YOLO** (`--yolo`, `/yolo`, or `approvals.mode: off`)launches a private embedded cua-driver in `unrestricted` after that riskacceptance, so there are no runtime Cua approval prompts.-Without any of these, `existing_profile` fails closed — report the refusal and-offer path 1 to the user; do not retry, downgrade trust, or work around it.+A user may also paste a token from `hermes computer-use browser-approve`+(pass it as `approval_token`); current cua-driver builds treat that as a+disabled legacy path, so expect the config grant to be the working route.+Without any of these, `existing_profile` fails closed — report the refusal+and name the config key; do not retry, downgrade trust, or work around it.Never invent, store, log, or reuse a grant token.Use the native capture/AX/pixel/foreground ladder for browser chrome, browserdiff --git a/tests/tools/test_computer_use_browser_authorization.py b/tests/tools/test_computer_use_browser_authorization.pyindex 73de1bf04a8..ff8176a066d 100644--- a/tests/tools/test_computer_use_browser_authorization.py+++ b/tests/tools/test_computer_use_browser_authorization.py@@ -215,12 +215,13 @@ def test_bounded_daemon_serves_with_approved_manifest(tmp_path, monkeypatch):command = captured["command"]assert "--permission-mode" in commandassert command[command.index("--permission-mode") + 1] == "bounded"- assert "--capability-manifest" in command+ # Flag names live-verified against cua-driver 0.19.3.+ assert "--session-policy" in commandassert (- command[command.index("--capability-manifest") + 1]+ command[command.index("--session-policy") + 1]== str(manifest))- assert "--approve-capability-manifest" in command+ assert "--approve-session-policy" in commandassert "--dangerously-bypass-approvals" not in command@@ -254,7 +255,22 @@ def test_unrestricted_daemon_serve_command_unchanged(monkeypatch):command = captured["command"]assert "--dangerously-bypass-approvals" in command- assert "--capability-manifest" not in command+ assert "--session-policy" not in command+++# ── standard-mode --grant existing-profile ──────────────────────────────+++def test_grant_existing_profile_defaults_off(monkeypatch):+ monkeypatch.setattr(cb, "_computer_use_cfg", dict)+ assert cb._cua_grant_existing_profile() is False+++def test_grant_existing_profile_reads_config(monkeypatch):+ monkeypatch.setattr(+ cb, "_computer_use_cfg", lambda: {"grant_existing_profile": True}+ )+ assert cb._cua_grant_existing_profile() is True# ── permission-mode resolution ──────────────────────────────────────────diff --git a/tools/computer_use/cua_backend.py b/tools/computer_use/cua_backend.pyindex ae6a2e5edca..9801c4a900c 100644--- a/tools/computer_use/cua_backend.py+++ b/tools/computer_use/cua_backend.py@@ -266,6 +266,23 @@ def _cua_capability_manifest() -> Optional[str]:return raw.strip()+def _cua_grant_existing_profile() -> bool:+ """True when the user pre-authorized existing-profile browser attachment.++ Reads ``computer_use.grant_existing_profile`` (default False). This is+ cua-driver's trusted-launcher grant: Hermes appends+ ``--grant existing-profile`` when spawning the standard-mode runtime, so+ ``browser_prepare`` with ``strategy: existing_profile`` succeeds without+ a per-use token (live-verified against cua-driver 0.19.3, where the+ interactive ``browser-approve`` token is a legacy compatibility path+ that is disabled by default). The user flips this in config.yaml — a+ deliberate, durable statement that agents on this machine may attach to+ their signed-in browser. It never applies to bounded (the manifest owns+ that decision) or unrestricted (already bypassed) daemons.+ """+ return bool(_computer_use_cfg().get("grant_existing_profile", False))++def _computer_use_max_image_dimension() -> Optional[int]:"""Longest-edge cap for cua-driver screenshots, or None to leave unset.@@ -508,11 +525,14 @@ class _EmbeddedCuaDaemon:if self.permission_mode == "unrestricted":command.append("--dangerously-bypass-approvals")else: # bounded — manifest validated in __init__+ # Live-verified against cua-driver 0.19.3: the serve flags are+ # --session-policy/--approve-session-policy (the docs' older+ # --capability-manifest names are not accepted).command.extend([- "--capability-manifest",+ "--session-policy",str(self.capability_manifest),- "--approve-capability-manifest",+ "--approve-session-policy",])self._process = subprocess.Popen(@@ -1231,6 +1251,15 @@ class _CuaDriverSession:child_env = self._embedded_daemon.child_env()else:command, args = _resolve_mcp_invocation(driver_cmd)+ # Standard-mode trusted-launcher grant: the user opted in via+ # config.yaml (computer_use.grant_existing_profile), so the+ # runtime is launched pre-authorized for existing-profile+ # browser attachment (`cua-driver mcp --grant+ # existing-profile`, live-verified on 0.19.3). Never applied+ # to embedded daemons: bounded's manifest and unrestricted's+ # bypass own that decision.+ if _cua_grant_existing_profile():+ args = [*args, "--grant", "existing-profile"]child_env = cua_driver_child_env()_t_manifest = _time.monotonic()params = StdioServerParameters(diff --git a/tools/computer_use/schema.py b/tools/computer_use/schema.pyindex 971129ed955..049940316c5 100644--- a/tools/computer_use/schema.py+++ b/tools/computer_use/schema.py@@ -292,10 +292,11 @@ COMPUTER_USE_SCHEMA: Dict[str, Any] = {"description": ("Browser preparation mode. existing_profile is decided by ""cua-driver's immutable permission mode: in standard mode "- "ask the user to mint a single-use token with `hermes "- "computer-use browser-approve` and pass it as "- "approval_token; bounded mode authorizes via the reviewed "- "capability manifest; explicit Hermes YOLO uses a private "+ "it requires the user's config opt-in "+ "computer_use.grant_existing_profile: true (if refused, "+ "report that key to the user — you cannot grant it); "+ "bounded mode authorizes via the reviewed capability "+ "manifest; explicit Hermes YOLO uses a private ""unrestricted daemon."),},@@ -303,11 +304,11 @@ COMPUTER_USE_SCHEMA: Dict[str, Any] = {"approval_token": {"type": "string","description": (- "Single-use existing-profile attachment token the USER "- "minted with `hermes computer-use browser-approve`. Ask "- "the user to run that command and give you the token; "- "never invent one. Only meaningful with "- "profile_mode='existing_profile'."+ "Optional single-use setup token the USER minted with "+ "`hermes computer-use browser-approve` and pasted to you; "+ "never invent one. Legacy path on current cua-driver "+ "builds — the supported existing-profile route is the "+ "computer_use.grant_existing_profile config opt-in."),},"allow_launch": {diff --git a/website/docs/user-guide/features/computer-use.md b/website/docs/user-guide/features/computer-use.mdindex 47400acc814..f14fc93bfc2 100644--- a/website/docs/user-guide/features/computer-use.md+++ b/website/docs/user-guide/features/computer-use.md@@ -85,30 +85,35 @@ modes. There is no second permission toggle to keep in sync:| Hermes session | cua-driver mode | Human intervention | `existing_profile` ||---|---|---|---|-| Manual or smart approvals (default) | `standard` | Normal Hermes approvals; Cua stops at its protected boundary | Refuses unless you mint a single-use token with `hermes computer-use browser-approve` |+| Manual or smart approvals (default) | `standard` | Normal Hermes approvals; Cua stops at its protected boundary | Refuses unless `computer_use.grant_existing_profile: true` (one-time config opt-in) || `computer_use.permission_mode: bounded` + reviewed manifest | private `bounded` daemon | You review and approve the capability manifest once, at launch | Allowed only within the manifest's declared profiles/origins/tools; everything else fails closed || `--yolo`, `/yolo`, or `approvals.mode: off` | private `unrestricted` daemon | One explicit Hermes risk acceptance; no runtime Cua prompts | Allowed within Cua's built-in, managed, and user policy ceilings |-### Attaching to your signed-in browser (`browser-approve`)+### Attaching to your signed-in browserThe agent can drive a Chrome/Edge window you already have open — including asigned-in profile — **without restarting the browser, copying the profile, ortouching your tabs**. Because DevTools access exposes that profile's livepages, cookies, and storage, cua-driver requires an explicit human grant that-ordinary tool approval cannot substitute for. Hermes surfaces it as:+ordinary tool approval cannot substitute for. You opt in once, in config.yaml:-```bash-# The agent will tell you the exact pid/window_id it discovered:-hermes computer-use browser-approve --pid 844 --window-id 10725 --profile-mode existing_profile+```yaml+computer_use:+ grant_existing_profile: true```-This mints a five-minute, single-use token bound to that exact process and-window. Paste the token to the agent; it passes it as `approval_token` on the-`cua_browser_prepare` action and cua-driver verifies the binding before-attaching. The grant lives only in driver memory and dies with the session.-Prefer letting the agent use an isolated profile (`isolated_new`, no token-needed beyond the normal tool approval) unless the task genuinely needs your-authenticated session.+Hermes then launches the cua-driver runtime with the trusted-launcher grant+(`--grant existing-profile`, live-verified against cua-driver 0.19.3), and+`cua_browser_prepare` with an existing profile succeeds against the exact+`(pid, window_id)` the agent proves. Leave it `false` (the default) and+existing-profile attachment fails closed; driver-owned isolated profiles work+either way and are what the agent prefers.++Older cua-driver builds also shipped an interactive `browser-approve` token+verb; current drivers treat that token as a disabled legacy compatibility+path. Hermes still exposes `hermes computer-use browser-approve` as a+passthrough and forwards a pasted token as `approval_token`, but the config+grant above is the supported route.### Bounded mode for repeatable automation@@ -370,7 +375,8 @@ Permission mode and manifest (see```yamlcomputer_use:permission_mode: standard # standard (default) | bounded- capability_manifest: "" # manifest path, required for bounded+ capability_manifest: "" # session-policy path, required for bounded+ grant_existing_profile: false # opt-in: attach to signed-in browser in standard mode```Override the driver binary path (tests / CI / local builds):