fix(browser): keep the panel closed when an agent opens a page
The agent's browser.open used to force the context panel open and steal the active surface, which read as panels opening by themselves. Tab upserts now take a reveal option: the agent's opener passes reveal: false, so the tab mounts invisibly (panes are kept alive regardless of visibility, so agent control still works) while the panel and the active tab stay exactly as the user left them. Manual opens are unchanged.
This commit is contained in:
@@ -452,10 +452,13 @@ export const ContextPanel: React.FC = () => {
|
||||
|
||||
// Lets an agent's browser.open create the tab it needs when none is open yet.
|
||||
// Registered from the panel because opening a tab is panel state, not
|
||||
// something the browser view itself can do before it exists.
|
||||
// something the browser view itself can do before it exists. Background on
|
||||
// purpose: an agent working a page must not pop the panel open (or steal
|
||||
// the active surface) under the user — the tab mounts invisibly, and the
|
||||
// rail is where the user opens it when curious.
|
||||
React.useEffect(() => {
|
||||
if (!effectiveDirectory) return;
|
||||
return registerBrowserOpener((url) => openContextBrowser(effectiveDirectory, url));
|
||||
return registerBrowserOpener((url) => openContextBrowser(effectiveDirectory, url, { reveal: false }));
|
||||
}, [effectiveDirectory, openContextBrowser]);
|
||||
const reorderContextPanelTabs = useUIStore((state) => state.reorderContextPanelTabs);
|
||||
const setSelectedFilePath = useFilesViewTabsStore((state) => state.setSelectedPath);
|
||||
|
||||
Reference in New Issue
Block a user