8000 feat(assistant): let the assistant use a browser connected through the Lens side panel by adeelahmad · Pull Request #311 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(assistant): let the assistant use a browser connected through the Lens side panel - #311

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-mr9hx9
Oct 10, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-mr9hx9

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: the assistant could only look things up in Lens and import what it was given. It couldn't do anything in the person's browser.

After: a browser's Lens side panel can connect a session to Lens. While it's connected, a question asked from that side panel gets seven browser_ tools (tabs, open, read, click, type, press, import). Each action goes to the side panel, which carries it out in the browser and sends back what happened. The tool waits for that answer in the database, so it works whichever server process holds the side panel's stream. Agents can do the same through POST /browser/sessions/{id}/run.

This is the server half. The side panel (chat, OAuth sign-in) and the browser control itself (site permissions, asking before consequential actions, the action log) come in the next two PRs in extensions/browser.

How:

  • app/domain/browser.py holds the browser_session and browser_action tables, run() (writes an action and waits for its answer, honouring Stop, a closed side panel and a timeout) and the tool specs. It also has the system note: look in the archive first, treat pages as third-party text, mark consequential actions.
  • app/api/v1/routes/browser.py connects and lists sessions and streams actions as SSE (> for polling). It also answers actions, runs one action for agents and ends a session. Only the session's own person reaches any of it.
  • Toolbox(browser=…) offers the tools only for the person's own live session. browser_import checks that the upload it gets back is the person's and is held, then hands it to import_files, which still asks for approval.
  • New settings in Settings → AI assistant: ai.browser (on) and ai.browser_steps (25).
  • With feat(assistant): mark third-party text as data in the model's prompts #302 in, page text reaches the model marked as third-party text. The test checks this.

Motivation and Context

Adeel asked to chat with the assistant from the browser extension and let it do tasks by controlling the browser, like the Claude browser extension: "check my email and import important attachments".

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (ruff, mypy, eslint, prettier clean).
  • I added or updated tests (tests/api/test_browser.py; the full backend suite passes locally: 857 passed).
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/browser-assistant.md, docs/api.md, docs/assistant.md).
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md: this goes in with the extension PR, when people can use it.

Done questions (AGENTS.md)

  • Goal: this is the first of three PRs. It merges on green, and the goal is met when the extension PRs land.
  • Agents: POST /browser/sessions/{id}/run and the whole session API are open to API and app tokens. MCP is n/a for now: the MCP server is read-only (noted under Refine later).
  • Zero setup: nothing new to install. Tables are created like every other.
  • Fewest clicks: n/a here; the side panel PR adds the clicks.
  • Configurable: ai.browser and ai.browser_steps are in Settings → AI assistant, with defaults, and not in the wizard.
  • Light: no new dependency. The side panel's stream polls the database four times a second only while it's open.
  • Private and secure: only the session's person sees and answers its actions. Admins can turn it off. Threat model gains P-BROWSER.
  • Cost: no model calls of its own. Answers that use the browser take up to ai.browser_steps steps, and those calls go through the ledger as usual.
  • User decides: nothing happens without a connected side panel. The extension asks before consequential actions (next PRs), imports still wait for approval, and existing defaults are unchanged.
  • Upgrades: two new tables and no change to stored data.
  • Honest: the docs label the side panel "in progress".
  • Tests, docs and generated files updated (openapi.json and the client via tooling).
  • Open standards: SSE, OAuth for the extension next. No new dependencies.
  • Refine later items are in docs/browser-assistant.md and DEVLOG.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PhTrpdr3XSgcD91oFxAiMQ


Generated by Claude Code

…e Lens side panel

Server side: a side panel connects a session and listens for actions; while it's
connected, a question sent from it gets the browser_ tools (tabs, open, read,
click, type, press, import), each carried out by the side panel and waited for
in the database. Agents can do the same through POST /browser/sessions/{id}/run.
ai.browser turns it off; ai.browser_steps caps the steps of such an answer.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PhTrpdr3XSgcD91oFxAiMQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0