Skip to content

Commit ecf202e

Browse files
fix(web): agent browsers open as a right-panel tab when floating previews are off
Devices an agent opens already fall back to a right-panel tab when "Auto-show floating preview" is off, but browsers were not shown at all unless the agent forced it, and a forced reveal still used the floating player. Agent browsers now follow the same rule as devices: floating when the setting is on, a right-panel tab when it is off. Sheet layouts are unchanged.
1 parent 528233e commit ecf202e

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

‎apps/web/src/components/preview/useAgentOpenedPreviews.ts‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ export function useAgentOpenedPreviews(input: {
9797
deviceState.sessions,
9898
deviceState.devices,
9999
]);
100-
// Baseline loaded tabs so reloads never reopen previews the user dismissed.
100+
// Like a device, an agent's browser floats over chat or, with floating
101+
// previews off, opens as a right-panel tab. Baseline loaded tabs so reloads never reopen previews the user dismissed.
101102
const previousServerPreviewTabs = useRef(new Map<string, Map<string, string | undefined>>());
102103
useEffect(() => {
103104
if (!threadRef || !serverBrowserAvailable || !previewState.listLoaded) return;
@@ -117,16 +118,19 @@ export function useAgentOpenedPreviews(input: {
117118
? previous.get(session.tabId) !== requested.id
118119
: !previous.has(session.tabId);
119120
if (!fresh || session.reveal !== true) continue;
120-
if (!autoShowFloatingPreview && requested?.force !== true) continue;
121121
const surface = panelSurfaces.find(
122122
(surface) => surface.kind === "preview" && surface.resourceId === session.tabId,
123123
);
124-
if (surface && requested?.force === true) {
125-
useRightPanelStore.getState().activateSurface(threadRef, surface.id);
126-
} else if (!surface) {
124+
if (surface) {
125+
if (requested?.force === true) {
126+
useRightPanelStore.getState().activateSurface(threadRef, surface.id);
127+
}
128+
} else if (autoShowFloatingPreview) {
127129
usePreviewMiniPlayerStore
128130
.getState()
129131
.open(threadRef, browserMiniPlayerSource(session.tabId));
132+
} else if (!sheetLayout) {
133+
useRightPanelStore.getState().openBrowser(threadRef, session.tabId);
130134
}
131135
}
132136
}, [
@@ -136,6 +140,7 @@ export function useAgentOpenedPreviews(input: {
136140
threadRef,
137141
autoShowFloatingPreview,
138142
panelSurfaces,
143+
sheetLayout,
139144
]);
140145
// A floating device follows its session: once the agent or another client
141146
// closes the device there is nothing left to stream.

‎apps/web/src/components/settings/IntegrationsSettings.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ function BrowserAutoShowFloatingPreviewSetting({ disabled }: { readonly disabled
11211121
return (
11221122
<SettingsRow
11231123
{...searchableSetting("browser-auto-show-floating-preview")}
1124-
description="Show the floating preview when an agent opens a browser or device unless the agent says otherwise."
1124+
description="Show the floating preview when an agent opens a browser or device unless the agent says otherwise. When off, it opens as a right-panel tab."
11251125
resetAction={
11261126
!disabled && autoShow !== DEFAULT_BROWSER_AUTO_SHOW_FLOATING_PREVIEW ? (
11271127
<SettingResetButton

0 commit comments

Comments
 (0)