fix(web): keep agent browser preview visible (#9484)

Co-authored-by: maria-rcks <[email protected]>
This commit is contained in:
mariaandmaria-rcks authored and GitHub committed 2026-09-03 18:50:04 -04:00
1 parent c726c30a14
commit 12e8997e58
19 files changed
+228 -38

No files matched your search

+7 -3
View File
@@ -8,6 +8,7 @@ export function BrowserSurfaceSlot(props: {
readonly tabId: string;
readonly visible: boolean;
readonly cornerRadius?: number;
readonly zIndex?: number;
readonly layoutVersion?: string | number;
readonly className?: string;
readonly fitSourceContent?: boolean;
@@ -16,12 +17,13 @@ export function BrowserSurfaceSlot(props: {
tabId,
visible,
cornerRadius = 0,
zIndex = 30,
layoutVersion,
className,
fitSourceContent = false,
} = props;
const elementRef = useRef<HTMLDivElement | null>(null);
const presentationRef = useRef({ visible, cornerRadius });
const presentationRef = useRef({ visible, cornerRadius, zIndex });
const updateRef = useRef<(() => void) | null>(null);
useLayoutEffect(() => {
@@ -40,6 +42,7 @@ export function BrowserSurfaceSlot(props: {
},
presentation.visible && rect.width > 0 && rect.height > 0,
presentation.cornerRadius,
presentation.zIndex,
);
if (presentation.visible && !presented) {
lease.release();
@@ -53,6 +56,7 @@ export function BrowserSurfaceSlot(props: {
},
rect.width > 0 && rect.height > 0,
presentation.cornerRadius,
presentation.zIndex,
);
}
};
@@ -72,9 +76,9 @@ export function BrowserSurfaceSlot(props: {
}, [fitSourceContent, tabId]);
useLayoutEffect(() => {
presentationRef.current = { visible, cornerRadius };
presentationRef.current = { visible, cornerRadius, zIndex };
updateRef.current?.();
}, [cornerRadius, layoutVersion, visible]);
}, [cornerRadius, layoutVersion, visible, zIndex]);
return <div ref={elementRef} className={className} data-browser-surface-slot={tabId} />;
}
@@ -83,6 +83,7 @@ export function HostedBrowserWebview(props: {
fittedSourceContent: current?.fittedSourceContent ?? null,
rect: resolveBrowserSurfacePanelRect(state.byTabId, runtimeTabId),
visible: current?.visible ?? false,
zIndex: current?.zIndex ?? 30,
};
}),
);
@@ -259,6 +260,7 @@ export function HostedBrowserWebview(props: {
// suspend them, and automation continues to see the macOS guests as inactive.
keepPaintableWhenInactive: isMacPlatform(navigator.platform),
cornerRadius: presentation.cornerRadius,
zIndex: presentation.zIndex,
rect: lastRect,
hiddenSize,
});
@@ -107,6 +107,7 @@ describe("browserSurfaceStore", () => {
hidden: {
rect: staleRect,
visible: false,
zIndex: 30,
content: null,
fittedSourceContent: null,
fitSourceContent: false,
@@ -117,6 +118,7 @@ describe("browserSurfaceStore", () => {
active: {
rect: liveRect,
visible: true,
zIndex: 30,
content: null,
fittedSourceContent: null,
fitSourceContent: false,
@@ -162,6 +164,17 @@ describe("browserSurfaceStore", () => {
});
});
it("keeps the requested layer with the active surface lease", () => {
const tabId = "layered-browser-surface";
const lease = acquireBrowserSurface(tabId);
lease.present({ x: 10, y: 20, width: 320, height: 200 }, true, 12, 48);
expect(useBrowserSurfaceStore.getState().byTabId[tabId]).toMatchObject({
visible: true,
zIndex: 48,
});
});
it("clears fitted presentation state when its lease is released", () => {
const tabId = "released-fitted-browser-surface";
const fittedLease = acquireBrowserSurface(tabId, true);
+15 -5
View File
@@ -10,6 +10,7 @@ export interface BrowserSurfaceRect {
export interface BrowserSurfacePresentation {
readonly rect: BrowserSurfaceRect | null;
readonly visible: boolean;
readonly zIndex: number;
readonly content: BrowserSurfaceContentPresentation | null;
readonly fittedSourceContent: BrowserSurfaceContentPresentation | null;
readonly fitSourceContent: boolean;
@@ -39,13 +40,19 @@ interface BrowserSurfaceStoreState {
rect: BrowserSurfaceRect,
visible: boolean,
cornerRadius: number,
zIndex: number,
) => void;
readonly presentContent: (tabId: string, content: BrowserSurfaceContentPresentation) => void;
readonly release: (tabId: string, owner: symbol) => void;
}
export interface BrowserSurfaceLease {
readonly present: (rect: BrowserSurfaceRect, visible: boolean, cornerRadius?: number) => boolean;
readonly present: (
rect: BrowserSurfaceRect,
visible: boolean,
cornerRadius?: number,
zIndex?: number,
) => boolean;
readonly release: () => void;
}
@@ -97,6 +104,7 @@ export const useBrowserSurfaceStore = create<BrowserSurfaceStoreState>()((set) =
[tabId]: {
rect: current?.rect ?? null,
visible: false,
zIndex: current?.zIndex ?? 30,
content: current?.content ?? null,
fittedSourceContent: fitSourceContent ? (current?.content ?? null) : null,
fitSourceContent,
@@ -107,7 +115,7 @@ export const useBrowserSurfaceStore = create<BrowserSurfaceStoreState>()((set) =
},
};
}),
present: (tabId, owner, rect, visible, cornerRadius) =>
present: (tabId, owner, rect, visible, cornerRadius, zIndex) =>
set((state) => {
const current = state.byTabId[tabId];
if (current?.owner !== owner) return state;
@@ -115,6 +123,7 @@ export const useBrowserSurfaceStore = create<BrowserSurfaceStoreState>()((set) =
current &&
current.visible === visible &&
current.cornerRadius === cornerRadius &&
current.zIndex === zIndex &&
rectEquals(current.rect, rect)
) {
return state;
@@ -122,7 +131,7 @@ export const useBrowserSurfaceStore = create<BrowserSurfaceStoreState>()((set) =
return {
byTabId: {
...state.byTabId,
[tabId]: { ...current, rect, visible, cornerRadius, updatedAt: Date.now() },
[tabId]: { ...current, rect, visible, cornerRadius, zIndex, updatedAt: Date.now() },
},
};
}),
@@ -136,6 +145,7 @@ export const useBrowserSurfaceStore = create<BrowserSurfaceStoreState>()((set) =
[tabId]: {
rect: null,
visible: false,
zIndex: 30,
content,
fittedSourceContent: null,
fitSourceContent: false,
@@ -206,10 +216,10 @@ export function acquireBrowserSurface(
useBrowserSurfaceStore.getState().claim(tabId, owner, fitSourceContent);
return {
present: (rect, visible, cornerRadius = 0) => {
present: (rect, visible, cornerRadius = 0, zIndex = 30) => {
if (released) return false;
if (useBrowserSurfaceStore.getState().byTabId[tabId]?.owner !== owner) return false;
useBrowserSurfaceStore.getState().present(tabId, owner, rect, visible, cornerRadius);
useBrowserSurfaceStore.getState().present(tabId, owner, rect, visible, cornerRadius, zIndex);
return true;
},
release: () => {
@@ -30,6 +30,7 @@ describe("resolveHostedBrowserWebviewWrapperStyle", () => {
active: true,
renderingActive: true,
cornerRadius: 12,
zIndex: 48,
rect: { x: 12, y: 34, width: 360, height: 203 },
hiddenSize: { width: 1280, height: 800 },
}),
@@ -39,6 +40,7 @@ describe("resolveHostedBrowserWebviewWrapperStyle", () => {
width: 360,
height: 203,
borderRadius: 12,
zIndex: 48,
});
});
@@ -23,6 +23,7 @@ export function resolveHostedBrowserWebviewWrapperStyle(input: {
readonly renderingActive: boolean;
readonly keepPaintableWhenInactive?: boolean;
readonly cornerRadius?: number;
readonly zIndex?: number;
readonly rect: BrowserSurfaceRect | null;
readonly hiddenSize: HostedBrowserWebviewSize;
}): HostedBrowserWebviewWrapperStyle {
@@ -33,6 +34,7 @@ export function resolveHostedBrowserWebviewWrapperStyle(input: {
keepPaintableWhenInactive = false,
rect,
renderingActive,
zIndex = 30,
} = input;
if (active && rect) {
return {
@@ -40,7 +42,7 @@ export function resolveHostedBrowserWebviewWrapperStyle(input: {
top: rect.y,
width: rect.width,
height: rect.height,
zIndex: 30,
zIndex,
pointerEvents: "auto",
...(cornerRadius > 0 ? { borderRadius: cornerRadius } : {}),
};
@@ -50,6 +50,7 @@ import {
shouldReleaseTimelineAnchorForToolActivity,
shouldOpenProactivePullRequest,
shouldOpenProactiveTurnDiff,
shouldRenderPreviewMiniPlayer,
shouldShowBranchMismatchBanner,
shouldShowPlanFollowUpPrompt,
shouldWriteThreadErrorToCurrentServerThread,
@@ -93,6 +94,27 @@ describe("agent browser close confirmation", () => {
});
});
describe("floating browser preview", () => {
it("only hides the duplicate while the same browser is rendered in the panel", () => {
expect(shouldRenderPreviewMiniPlayer(null, null)).toBe(false);
expect(
shouldRenderPreviewMiniPlayer("tab-1", {
id: "browser:one",
kind: "preview",
resourceId: "tab-1",
}),
).toBe(false);
expect(
shouldRenderPreviewMiniPlayer("tab-1", {
id: "browser:two",
kind: "preview",
resourceId: "tab-2",
}),
).toBe(true);
expect(shouldRenderPreviewMiniPlayer("tab-1", { id: "diff", kind: "diff" })).toBe(true);
});
});
describe("proactive panels", () => {
it("opens a pull request only after a newly observed link appears", () => {
expect(shouldOpenProactivePullRequest(undefined, "project:repo:42")).toBe(false);
+13
View File
@@ -86,6 +86,19 @@ export function agentControlledBrowserCloseConfirmation(
].join("\n");
}
export function shouldRenderPreviewMiniPlayer(
miniPlayerTabId: string | null,
renderedRightPanelSurface: RightPanelSurface | null,
): boolean {
return (
miniPlayerTabId !== null &&
!(
renderedRightPanelSurface?.kind === "preview" &&
renderedRightPanelSurface.resourceId === miniPlayerTabId
)
);
}
export function shouldOpenProactivePullRequest(
previousTargetKey: string | null | undefined,
targetKey: string | null,
+9 -13
View File
@@ -366,6 +366,7 @@ import {
shouldShowPlanFollowUpPrompt,
shouldOpenProactivePullRequest,
shouldOpenProactiveTurnDiff,
shouldRenderPreviewMiniPlayer,
getStartedThreadModelChangeBlockReason,
LAST_INVOKED_SCRIPT_BY_PROJECT_KEY,
LastInvokedScriptByProjectSchema,
@@ -1847,6 +1848,10 @@ function ChatViewContent(props: ChatViewProps) {
rightPanelPresent && (!shouldUseRightPanelSheet || rightPanelOpen);
const renderedRightPanelSurface = rightPanelPresence.value?.activeSurface ?? null;
const renderedRightPanelSurfaces = rightPanelPresence.value?.surfaces ?? [];
const previewMiniPlayerVisible = shouldRenderPreviewMiniPlayer(
activePreviewMiniPlayer?.tabId ?? null,
renderedRightPanelSurface,
);
const canMaximizeRightPanel = rightPanelOpen && !shouldUseRightPanelSheet;
const rightPanelMaximized =
canMaximizeRightPanel && maximizedRightPanelThreadKey === routeThreadKey;
@@ -1862,20 +1867,10 @@ function ChatViewContent(props: ChatViewProps) {
useEffect(() => {
if (!activeThreadRef || !activePreviewMiniPlayer) return;
const miniTabStillExists = Boolean(activePreviewState.sessions[activePreviewMiniPlayer.tabId]);
const sameTabOpenInPanel =
previewPanelOpen &&
activeRightPanelSurface?.kind === "preview" &&
activeRightPanelSurface.resourceId === activePreviewMiniPlayer.tabId;
if (!miniTabStillExists || sameTabOpenInPanel) {
if (!miniTabStillExists) {
usePreviewMiniPlayerStore.getState().close(activeThreadRef);
}
}, [
activePreviewMiniPlayer,
activePreviewState.sessions,
activeRightPanelSurface,
activeThreadRef,
previewPanelOpen,
]);
}, [activePreviewMiniPlayer, activePreviewState.sessions, activeThreadRef]);
const existingOpenTerminalThreadKeys = useMemo(() => {
const existingThreadKeys = new Set<string>([...serverThreadKeys, ...draftThreadKeys]);
@@ -7919,7 +7914,7 @@ function ChatViewContent(props: ChatViewProps) {
</div>
</div>
{activeThreadRef && activePreviewMiniPlayer ? (
{activeThreadRef && activePreviewMiniPlayer && previewMiniPlayerVisible ? (
<ThreadPreviewMiniPlayer
key={`${activeThreadKey}:${activePreviewMiniPlayer.tabId}`}
threadRef={activeThreadRef}
@@ -8040,6 +8035,7 @@ function ChatViewContent(props: ChatViewProps) {
<RightPanelSheet
animationDurationMs={panelAnimationsActive ? panelAnimationDurationMs : 0}
open={rightPanelOpen}
underFloatingPreview={previewMiniPlayerVisible}
onClose={closePreviewPanel}
>
<RightPanelTabs
+11 -1
View File
@@ -1,12 +1,16 @@
import { type ReactNode } from "react";
import { RIGHT_PANEL_SHEET_CLASS_NAME } from "../rightPanelLayout";
import {
RIGHT_PANEL_SHEET_CLASS_NAME,
RIGHT_PANEL_SHEET_LAYER_CLASS_NAME,
} from "../rightPanelLayout";
import { Sheet, SheetPopup } from "./ui/sheet";
export function RightPanelSheet(props: {
animationDurationMs: number;
children: ReactNode;
open: boolean;
underFloatingPreview?: boolean;
onClose: () => void;
}) {
return (
@@ -23,6 +27,12 @@ export function RightPanelSheet(props: {
side="right"
showCloseButton={false}
keepMounted
{...(props.underFloatingPreview
? {
backdropClassName: RIGHT_PANEL_SHEET_LAYER_CLASS_NAME,
viewportClassName: RIGHT_PANEL_SHEET_LAYER_CLASS_NAME,
}
: {})}
className={RIGHT_PANEL_SHEET_CLASS_NAME}
>
{props.children}
@@ -20,7 +20,7 @@ import {
type ScopedThreadRef,
} from "@t3tools/contracts";
import { resolvePreviewViewport } from "@t3tools/shared/previewViewport";
import { useCallback, useContext, useEffect, useMemo, useState } from "react";
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
import { Atom } from "effect/unstable/reactivity";
import {
@@ -29,7 +29,7 @@ import {
reconcilePreviewServerSessions,
updatePreviewServerSnapshot,
} from "~/previewStateStore";
import { usePreviewMiniPlayerStore } from "~/previewMiniPlayerStore";
import { selectThreadPreviewMiniPlayer, usePreviewMiniPlayerStore } from "~/previewMiniPlayerStore";
import { resolveBrowserNavigationTarget } from "~/browser/browserTargetResolver";
import {
readActiveBrowserRecordingTargets,
@@ -59,8 +59,10 @@ import {
PreviewAutomationViewportTimeoutError,
} from "./previewAutomationErrors";
import {
explicitlySuppressesPreviewMiniPlayer,
previewAutomationDefaultViewport,
previewAutomationOpenNeedsOverlay,
shouldAutoShowPreviewForAutomationUse,
shouldOpenPreviewMiniPlayer,
} from "./previewAutomationOpenReadiness";
import {
@@ -311,6 +313,7 @@ function PreviewAutomationHost(props: { readonly environmentId: EnvironmentId })
);
const [automationConnectionAtom] = useState(() => Atom.make<string | null>(null));
const automationConnectionId = useAtomValue(automationConnectionAtom);
const presentationSuppressedRuntimeTabsRef = useRef(new Map<string, Set<string>>());
const handleRequest = useCallback(
async (request: PreviewAutomationRequest): Promise<unknown> => {
@@ -353,6 +356,21 @@ function PreviewAutomationHost(props: { readonly environmentId: EnvironmentId })
}
const readyState = readThreadPreviewState(threadRef);
const runtimeTabId = previewRuntimeTabId(threadRef, readyState.serverEpoch, readyTabId);
if (request.operation !== "open") {
const { autoShowFloatingPreview } = await resolveBrowserDefaults();
if (
shouldAutoShowPreviewForAutomationUse({
operation: request.operation,
autoShowFloatingPreview,
presentationSuppressed:
presentationSuppressedRuntimeTabsRef.current
.get(request.threadId)
?.has(runtimeTabId) ?? false,
})
) {
usePreviewMiniPlayerStore.getState().open(threadRef, readyTabId);
}
}
browserActivity.release ??= acquireBrowserSurfaceActivity(runtimeTabId);
await waitForDesktopOverlay(
threadRef,
@@ -450,6 +468,32 @@ function PreviewAutomationHost(props: { readonly environmentId: EnvironmentId })
input,
(await resolveBrowserDefaults()).autoShowFloatingPreview,
);
const explicitlySuppressed = explicitlySuppressesPreviewMiniPlayer(input);
const suppressedTabs = presentationSuppressedRuntimeTabsRef.current.get(
request.threadId,
);
if (explicitlySuppressed) {
if (suppressedTabs) {
suppressedTabs.add(activeRuntimeTabId);
} else {
presentationSuppressedRuntimeTabsRef.current.set(
request.threadId,
new Set([activeRuntimeTabId]),
);
}
const miniPlayer = selectThreadPreviewMiniPlayer(
usePreviewMiniPlayerStore.getState().byThreadKey,
threadRef,
);
if (miniPlayer?.tabId === activeTabId) {
usePreviewMiniPlayerStore.getState().close(threadRef);
}
} else if (shouldPresentPreview) {
suppressedTabs?.delete(activeRuntimeTabId);
if (suppressedTabs?.size === 0) {
presentationSuppressedRuntimeTabsRef.current.delete(request.threadId);
}
}
if (shouldPresentPreview) {
usePreviewMiniPlayerStore.getState().open(threadRef, activeTabId);
}
@@ -19,6 +19,7 @@ import {
clampPreviewMiniPlayerSize,
PREVIEW_MINI_PLAYER_DEFAULT_SIZE,
PREVIEW_MINI_PLAYER_EDGE_GAP,
PREVIEW_MINI_PLAYER_WEBVIEW_Z_INDEX,
} from "./previewMiniPlayerLayout";
interface DragState {
@@ -243,7 +244,7 @@ export function ThreadPreviewMiniPlayer({ threadRef, tabId, bottomInset }: Props
}
}
>
<div className="group pointer-events-auto absolute right-2 top-2 z-[34] size-3">
<div className="group pointer-events-auto absolute right-2 top-2 z-[49] size-3">
<div
aria-hidden="true"
className="absolute right-0 top-0 size-2 rounded-full bg-foreground/25 shadow-sm ring-1 ring-background/70 transition-opacity group-hover:opacity-0 group-focus-within:opacity-0"
@@ -316,11 +317,12 @@ export function ThreadPreviewMiniPlayer({ threadRef, tabId, bottomInset }: Props
</div>
<div className="relative h-full min-h-0">
<div className="absolute inset-0 z-[29] rounded-xl bg-muted shadow-2xl/35" />
<div className="absolute inset-0 z-[47] rounded-xl bg-muted shadow-2xl/35" />
<BrowserSurfaceSlot
tabId={runtimeTabId}
visible={Boolean(desktopOverlay?.hasWebContents)}
cornerRadius={12}
zIndex={PREVIEW_MINI_PLAYER_WEBVIEW_Z_INDEX}
fitSourceContent
layoutVersion={
position
@@ -329,16 +331,16 @@ export function ThreadPreviewMiniPlayer({ threadRef, tabId, bottomInset }: Props
}
className="absolute inset-0"
/>
<div className="pointer-events-none absolute inset-0 z-[31] rounded-xl ring-1 ring-inset ring-border/80" />
<div className="pointer-events-none absolute inset-0 z-[49] rounded-xl ring-1 ring-inset ring-border/80" />
{!desktopOverlay?.hasWebContents ? (
<div className="pointer-events-none absolute inset-0 z-[32] flex items-center justify-center rounded-xl bg-muted text-xs text-muted-foreground">
<div className="pointer-events-none absolute inset-0 z-[49] flex items-center justify-center rounded-xl bg-muted text-xs text-muted-foreground">
Reconnecting preview…
</div>
) : null}
<button
type="button"
aria-label="Resize floating preview"
className="pointer-events-auto absolute bottom-0 right-0 z-[33] size-5 cursor-nwse-resize rounded-br-xl after:absolute after:bottom-1 after:right-1 after:size-2 after:border-b after:border-r after:border-foreground/45"
className="pointer-events-auto absolute bottom-0 right-0 z-[49] size-5 cursor-nwse-resize rounded-br-xl after:absolute after:bottom-1 after:right-1 after:size-2 after:border-b after:border-r after:border-foreground/45"
onPointerDown={handleResizePointerDown}
onPointerMove={handleResizePointerMove}
onPointerUp={endResize}
@@ -3,8 +3,10 @@ import { describe, expect, it } from "vite-plus/test";
import {
DEFAULT_PREVIEW_AUTOMATION_VIEWPORT,
explicitlySuppressesPreviewMiniPlayer,
previewAutomationDefaultViewport,
previewAutomationOpenNeedsOverlay,
shouldAutoShowPreviewForAutomationUse,
shouldOpenPreviewMiniPlayer,
} from "./previewAutomationOpenReadiness";
@@ -91,4 +93,49 @@ describe("shouldOpenPreviewMiniPlayer with the floating-preview preference", ()
expect(shouldOpenPreviewMiniPlayer({ open: false }, true)).toBe(false);
expect(shouldOpenPreviewMiniPlayer({ show: true }, false)).toBe(true);
});
it("distinguishes an explicit background request from a disabled preference", () => {
expect(explicitlySuppressesPreviewMiniPlayer({ open: false })).toBe(true);
expect(explicitlySuppressesPreviewMiniPlayer({ show: false })).toBe(true);
expect(explicitlySuppressesPreviewMiniPlayer({})).toBe(false);
});
});
describe("auto-show for existing automation tabs", () => {
it("records floating-preview intent whenever an agent uses the tab", () => {
expect(
shouldAutoShowPreviewForAutomationUse({
operation: "navigate",
autoShowFloatingPreview: true,
presentationSuppressed: false,
}),
).toBe(true);
});
it("leaves explicit opens and background-only tabs alone", () => {
expect(
shouldAutoShowPreviewForAutomationUse({
operation: "open",
autoShowFloatingPreview: true,
presentationSuppressed: false,
}),
).toBe(false);
expect(
shouldAutoShowPreviewForAutomationUse({
operation: "click",
autoShowFloatingPreview: true,
presentationSuppressed: true,
}),
).toBe(false);
});
it("honours the auto-show preference for reused tabs", () => {
expect(
shouldAutoShowPreviewForAutomationUse({
operation: "snapshot",
autoShowFloatingPreview: false,
presentationSuppressed: false,
}),
).toBe(false);
});
});
@@ -1,5 +1,6 @@
import {
FILL_PREVIEW_VIEWPORT,
type PreviewAutomationOperation,
type PreviewAutomationOpenInput,
type PreviewSessionSnapshot,
type PreviewViewportSetting,
@@ -29,6 +30,20 @@ export function shouldOpenPreviewMiniPlayer(
return input.open ?? input.show ?? autoShowFloatingPreview;
}
export function shouldAutoShowPreviewForAutomationUse(input: {
readonly operation: PreviewAutomationOperation;
readonly autoShowFloatingPreview: boolean;
readonly presentationSuppressed: boolean;
}): boolean {
return (
input.operation !== "open" && input.autoShowFloatingPreview && !input.presentationSuppressed
);
}
export function explicitlySuppressesPreviewMiniPlayer(input: PreviewAutomationOpenInput): boolean {
return (input.open ?? input.show) === false;
}
export function previewAutomationOpenNeedsOverlay(
input: PreviewAutomationOpenInput,
snapshot: PreviewSessionSnapshot,
@@ -1,6 +1,8 @@
import type { PreviewMiniPlayerPosition, PreviewMiniPlayerSize } from "~/previewMiniPlayerStore";
export const PREVIEW_MINI_PLAYER_EDGE_GAP = 12;
// The mini-player shell straddles this webview at 47 and 49; dialogs begin at 50.
export const PREVIEW_MINI_PLAYER_WEBVIEW_Z_INDEX = 48;
export const PREVIEW_MINI_PLAYER_DEFAULT_SIZE = { width: 320, height: 200 } as const;
export const PREVIEW_MINI_PLAYER_MIN_SIZE = { width: 240, height: 150 } as const;
@@ -560,7 +560,7 @@ function BrowserAutoShowFloatingPreviewSetting({ disabled }: { readonly disabled
return (
<SettingsRow
{...searchableSetting("browser-auto-show-floating-preview")}
description="Pop the floating preview into view when an agent opens a browser. An agent that explicitly asks to show or hide its preview still gets what it asked for."
description="Pop the floating preview into view when an agent uses a browser. An agent that explicitly asks to show or hide its preview still gets what it asked for."
resetAction={
!disabled && autoShow !== DEFAULT_BROWSER_AUTO_SHOW_FLOATING_PREVIEW ? (
<SettingResetButton
+10 -6
View File
@@ -64,6 +64,8 @@ function SheetPopup({
showCloseButton = true,
keepMounted = false,
transitionDurationMs,
backdropClassName,
viewportClassName,
side = "right",
variant = "default",
style,
@@ -72,6 +74,8 @@ function SheetPopup({
showCloseButton?: boolean;
keepMounted?: boolean;
transitionDurationMs?: number;
backdropClassName?: string;
viewportClassName?: string;
side?: "right" | "left" | "top" | "bottom";
variant?: "default" | "inset";
}) {
@@ -84,14 +88,14 @@ function SheetPopup({
return (
<SheetPortal keepMounted={keepMounted}>
<SheetBackdrop
className={
instant
? "transition-none! data-ending-style:opacity-100! data-starting-style:opacity-100!"
: undefined
}
className={cn(
instant &&
"transition-none! data-ending-style:opacity-100! data-starting-style:opacity-100!",
backdropClassName,
)}
style={transitionStyle}
/>
<SheetViewport side={side} variant={variant}>
<SheetViewport className={viewportClassName} side={side} variant={variant}>
<SheetPrimitive.Popup
className={cn(
"relative flex max-h-full min-h-0 w-full min-w-0 flex-col bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 transition-[opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:opacity-0 data-starting-style:opacity-0 max-sm:before:hidden dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
+2
View File
@@ -1,3 +1,5 @@
export const RIGHT_PANEL_INLINE_LAYOUT_MEDIA_QUERY = "(max-width: 980px)";
// Applied only while a floating preview overlaps the compact sheet.
export const RIGHT_PANEL_SHEET_LAYER_CLASS_NAME = "z-[35]";
export const RIGHT_PANEL_SHEET_CLASS_NAME =
"w-[min(42vw,28rem)] min-w-80 max-w-[28rem] p-0 max-[760px]:w-[min(88vw,24rem)] max-[760px]:min-w-0 wco:mt-[env(titlebar-area-height)] wco:h-[calc(100%-env(titlebar-area-height))] wco:max-h-[calc(100%-env(titlebar-area-height))]";
+1 -1
View File
@@ -226,7 +226,7 @@ export const ClientSettingsSchema = Schema.Struct({
Schema.withDecodingDefault(Effect.succeed(DEFAULT_BROWSER_LINK_TARGET)),
),
/**
* Whether an agent opening a preview pops the floating mini player into
* Whether an agent using a preview pops the floating mini player into
* view. Only applies when the agent didn't ask either way — an explicit
* `open`/`show` on `preview_open` still wins, since that is the agent
* deliberately showing or hiding its work.