feat: show agent side panel in every tab the agent interacts with#461
Open
feat: show agent side panel in every tab the agent interacts with#461
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Greptile SummaryThis PR automatically opens the agent side panel on every tab the agent interacts with during a conversation. It does so by extending Key changes:
Issues found:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Agent as Agent (streaming)
participant Hook as useNotifyActiveTab
participant BG as Background index.ts
participant Chrome as chrome.sidePanel
Agent->>Hook: tool result with tabId
Hook->>Hook: check knownTabsRef
alt First time seeing tabId
Hook->>BG: open-sidepanel-on-tab (tabId, conversationId)
BG->>BG: check agentTabSets
alt Not tracked yet
BG->>BG: agentTabSets.add(tabId)
BG->>Chrome: openSidePanel(tabId)
end
end
Note over Hook,BG: On conversation reset
Hook->>BG: clear-agent-tabs (conversationId)
BG->>BG: agentTabSets.delete(conversationId)
Note over BG,Chrome: On tab close
Chrome-->>BG: onRemoved(tabId)
BG->>BG: remove tabId from all sets
Last reviewed commit: dc3e7de |
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.
Summary
new_page), the side panel now automatically opens on that tabuseNotifyActiveTabhook tracks which tabs the agent has touched and relays new ones to the background script viachrome.runtime.sendMessageconversationId → Set<tabId>and callsopenSidePanel(tabId)for each new tabDesign
The solution extends the existing
useNotifyActiveTabhook with aSet<number>ref that accumulates all tab IDs seen during the current conversation. When a tool'stabIdis new, the hook sends anopen-sidepanel-on-tabmessage to the background script, which callsopenSidePanel(tabId). Since Chrome's side panel is a single instance per extension, the same conversation renders regardless of which tab the user switches to. Tab tracking is cleaned up on conversation reset and when tabs are closed.Changed files
apps/agent/entrypoints/sidepanel/index/useNotifyActiveTab.tsx— Track seen tabs, sendopen-sidepanel-on-tabmessage to backgroundapps/agent/entrypoints/background/index.ts— Handleopen-sidepanel-on-tabandclear-agent-tabsmessages, maintain tab tracking map with cleanupapps/agent/entrypoints/sidepanel/index/useChatSession.ts— Sendclear-agent-tabson conversation resetTest plan
🤖 Generated with Claude Code