Repository navigation
feat(clipper): ask the Lens assistant from the extension's side panel - #322
Merged
Merged
Conversation
The web clipper gets a side panel with the Lens assistant: Ask Lens in the popup, on the right-click menu or by a shortcut. It signs in through Lens's own consent page (OAuth with PKCE and launchWebAuthFlow, nothing to copy), or with an API token where the browser can't show that page (Safari, which opens it in a tab). Conversations are the same ones the web app shows: cited answers rendered as Markdown through DOMPurify, the steps taken, approvals to approve or decline, Stop, and Open in Lens. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PhTrpdr3XSgcD91oFxAiMQ
Firefox has no side_panel; its target maps the panel to sidebar_action (not opened at install) and drops the sidePanel permission. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PhTrpdr3XSgcD91oFxAiMQ
…-mr9hx9 # Conflicts: # threat-model.yaml
This was referenced Oct 10, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Adeel · project thread
Description
Before: the web clipper could only clip pages into Lens. To ask the assistant you had to open Lens's web app.
After: the extension has the Lens assistant in a side panel (Firefox's sidebar in Firefox). Open it with Ask Lens in the popup, Ask Lens… on the right-click menu, or a shortcut you assign. Signing in takes one click: the address comes from the clipper's Lens, and Lens's own consent page lets the extension in (OAuth with PKCE through
identity.launchWebAuthFlow, nothing to copy). Conversations are the same ones the web app shows. Answers are cited and linked to the moment they came from, the steps taken are listed, and approvals wait for Approve or Decline. Enter sends, Esc stops, New starts a new conversation and Open in Lens continues it in the web app.This is the second of three PRs; #311 added the server side. The next PR lets the assistant use the browser from this panel.
How:
src/core/account.jssigns in: it discovers the server (RFC 8414), registers once (RFC 7591), uses PKCE S256 and checksstate. Tokens renew themselves, with a single renewal in flight, and sign-out revokes them (RFC 7009). Safari has nolaunchWebAuthFlow, so it falls back to an API token.src/core/assistant.jsis the chat API client. It reads SSE witheventsource-parserand renders answers withmarked, then DOMPurify (no scripts, images or forms; only http and https links).src/ui/sidepanel.*is the panel. The manifest addsside_paneland thesidePanelandidentitypermissions, neither of which shows an install warning, plus anopen-assistantcommand with no suggested key, since Chrome allows four and the clipper uses them. Safari has no side panel, so its target opens the panel in a tab. Firefox (feat(clipper): build the web clipper for Firefox #282) maps it tosidebar_action, not opened at install, without thesidePanelpermission;web-ext lintondist/firefoxhas 0 errors.Motivation and Context
Adeel asked to chat with the assistant from the browser extension and let it do tasks in the browser ("check my email and import important attachments").
Types of changes
!in the title)Checklist:
test/account.test.jsandtest/assistant.test.js(34 extension tests pass), plus the Edge smoke test.docs/accordingly (docs/browser-assistant.md,docs/web-clipper.md);mkdocs build --strictis clean.## UnreleasedinCHANGELOG.md.Done questions (AGENTS.md)
/chats,/approvals), so agents already have all of it..envchange or manual step is needed.docs/browser-assistant.mdandDEVLOG.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01PhTrpdr3XSgcD91oFxAiMQ
Generated by Claude Code