Skip to content

feat(browser): host the opentask extension bridge and relay browser tools per turn - #228

Merged
edenreich merged 7 commits into
mainfrom
feat/browser-bridge
Sep 14, 2026
Merged

edenreich merged 7 commits into
mainfrom
feat/browser-bridge

Conversation

@edenreich

@edenreich edenreich commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Makes the unchanged opentask extension connectable to the desktop app. The desktop now hosts the persistent extension-facing WebSocket bridge (default 127.0.0.1:52789, protocol per cli/docs/browser-extension-protocol.md) and, per agent turn, dials the child CLI's own bridge (moved to 52790 via INFER_BROWSER_USE_EXTENSION_PORT) as if it were the extension, relaying browser_command / browser_result frames. Browser frames are relayed verbatim; side-panel frames are answered by the desktop (see below). A dot above the composer shows connected/disconnected while browser use is enabled.

Closes #189.
Closes #229 - the approval deny shortcut is now d (matching the Deny label) instead of r; a still approves. Both e2e specs that pressed r updated.

Resolved open questions from the issue:

  1. No CLI change needed - INFER_BROWSER_USE_EXTENSION_PORT already works through the CLI's viper sidecar-env walker (verified against infer v0.192.0: the headless bridge binds the env port and logs a bind failure gracefully when it is taken).
  2. Side-panel chat mirroring is included: the desktop answers list_conversations, resume_conversation, new_session, user_message, interrupt, list_models/select_model, set_mode, list_skills, list_history and approval_response itself from its own conversation store and sessions, and mirrors the running turn as raw AG-UI chat_event frames plus the user echo. tool_request (the extension GitHub features) gets a graceful unsupported tool_result.
  3. Port contention with a standalone infer session is documented as "desktop wins while running".

Changes

  • backend/src/browser_bridge.rs (new): extension server (/ws path + extension-origin check, browser_hello token gate with constant-time compare, browser_hello_ack, newest connection wins, 20s pings), per-turn CLI relay with a fast synthesized browser_result error when no extension is connected, clean stop() (listener closed, sockets shut down, accept thread joined). One thread per socket, no lock held across I/O.
  • backend/src/lib.rs, backend/src/agent.rs: AppState.browser_bridge, autostart in setup, stop on exit, per-turn env + relay dial; commands browser_use_status / set_browser_use_enabled (writes ~/.infer/browser_use.yaml, seeds a token, preserves CLI-owned keys).
  • backend/Cargo.toml: add tungstenite 0.30 and rand 0.10.
  • Frontend: Settings > General "Browser Use" toggle with port/token + copy button; BrowserBridgeDot next to the status bar driven by the browser-bridge Tauri event.
  • Tests: relay frame filtering, hello/token gate, yaml merge, and a loopback test that runs a fake extension + fake CLI through the real bridge.
  • Docs: README section, AGENTS.md tree.

Docs follow-up

Filed: inference-gateway/docs#676

  • Title: [DOCS] Desktop: browser use via the opentask extension
  • Pages: desktop user guide (Settings > General > Browser Use: enable, copy port/token into the extension, connection dot), opentask extension setup page (link both ways), troubleshooting: "desktop holds port 52789 while running".
  • Source: this PR / [FEATURE] The browser extension should be connectable to the desktop app #189.

@edenreich
edenreich merged commit ba74243 into main Sep 14, 2026
1 check passed
@edenreich
edenreich deleted the feat/browser-bridge branch September 14, 2026 12:53
@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.33.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@inference-gateway-maintainer inference-gateway-maintainer Bot added the released Shipped in a release label Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

1 participant