diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index 788a82b228253..82cfa81e245ec 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -184,16 +184,20 @@ import {
useLazurioThreadTabs,
} from "../lazurio/LazurioEnvironmentBrowser";
import {
+ BuddyBackToConversation,
BuddyThreadDetailsPanel,
buddyRightPanelState,
buddyRuntimeMode,
buddyTerminalUiState,
useBuddyChatShortcuts,
useBuddyPage,
+ useBuddyPanelEscape,
+ useBuddyPanels,
useBuddyQueuedRunCount,
useBuddyWindowInView,
useBuddyHermesControls,
} from "../lazurio/BuddySurface";
+import { buddyPanelOpensItself } from "../lazurio/buddySurfaceFrame";
import { BuddyPageChip } from "../lazurio/BuddySurfacePageChip";
import {
ThreadPreviewMiniPlayer,
@@ -604,6 +608,15 @@ export default function ChatView(props: ChatViewProps) {
// default and the chat is only the conversation; Buddy's window on the shared server is a whole
// T3 thread (GEN4).
const buddySurface = useBuddyHermesControls(environmentId);
+ // Lazurio overlay: Buddy's small window offers neither the right panel nor the terminal, and in his
+ // full-screen window the right panel opens over the whole window (BuddySurface.tsx).
+ // Read as plain values: the React Compiler memoizes what reads them.
+ const {
+ offered: buddyPanelsOffered,
+ wholeWindow: buddyWholeWindow,
+ framed: buddyFramed,
+ backLabel: buddyBackLabel,
+ } = useBuddyPanels();
// The page Buddy is asked from travels with the person's next message (buddySurfacePage.ts).
const buddyPage = useBuddyPage(environmentId);
const buddyInView = useBuddyWindowInView(environmentId);
@@ -799,7 +812,7 @@ export default function ChatView(props: ChatViewProps) {
// (BuddySurface.tsx). Read inside the selector, as the right panel's state below is.
const terminalUiState = useTerminalUiStateStore((state) =>
buddyTerminalUiState(
- buddySurface,
+ buddySurface || !buddyPanelsOffered,
selectThreadTerminalUiState(state.terminalUiStateByThreadKey, routeThreadRef),
),
);
@@ -1112,8 +1125,9 @@ export default function ChatView(props: ChatViewProps) {
// changed on every render and looped as soon as the panel opened.
const rightPanelState = useRightPanelStore((state) =>
buddyRightPanelState(
- buddySurface,
+ buddySurface || !buddyPanelsOffered,
selectThreadRightPanelState(state.byThreadKey, activeThreadRef),
+ buddyWholeWindow,
),
);
const shouldUsePlanSidebarSheet = prefersPlanSidebarSheet && rightPanelState.maximized !== true;
@@ -1140,7 +1154,7 @@ export default function ChatView(props: ChatViewProps) {
// A side chat has no panel of its own (upstream's `embedded`); its parent's strip serves it.
// Buddy's surface, with no panel, does not follow them either (plan DEV-6676).
useLazurioThreadTabs(buddySurface || embedded ? null : activeThreadRef, {
- inlinePanel: !shouldUsePlanSidebarSheet,
+ inlinePanel: buddyPanelOpensItself(!shouldUsePlanSidebarSheet, buddyFramed),
draft: !isServerThread,
});
const { active: panelAnimationsActive, durationMs: panelAnimationDurationMs } =
@@ -2081,7 +2095,9 @@ export default function ChatView(props: ChatViewProps) {
const activeRunningTurnId = activeRuntime?.activeRunId ?? null;
useProactivePanels({
threadRef: isServerThread && !embedded ? activeThreadRef : null,
- enabled: settings.proactivePanelsEnabled && !shouldUsePlanSidebarSheet && !embedded,
+ // Lazurio overlay: nothing opens by itself over Buddy's conversation in his window.
+ enabled:
+ settings.proactivePanelsEnabled && !shouldUsePlanSidebarSheet && !embedded && !buddyFramed,
settingsHydrated: clientSettingsHydrated,
threadDetailLoading,
runningTurnId: activeRunningTurnId,
@@ -2480,6 +2496,7 @@ export default function ChatView(props: ChatViewProps) {
onDiffPanelOpen,
closeRightPanelSurface,
});
+ useBuddyPanelEscape(buddyWholeWindow && rightPanelOpen, toggleRightPanelStable);
const pullRequestSurfaceAvailable = supportsPullRequests && pullRequestPanelTarget !== null;
const {
acknowledgeActiveThreadWoke,
@@ -2794,9 +2811,9 @@ export default function ChatView(props: ChatViewProps) {
}
});
- // Lazurio overlay (plan DEV-6676): Buddy's surface has no terminal or right panel, so their keys
- // stay the browser's there (buddySurfaceControls.ts).
- useBuddyChatShortcuts(buddySurface, {
+ // Lazurio overlay (plan DEV-6676): Buddy's surface, and his small window, have no terminal or right
+ // panel, so their keys stay the browser's there (buddySurfaceControls.ts).
+ useBuddyChatShortcuts(buddySurface || !buddyPanelsOffered, {
enabled: activeThreadId !== null && !backgroundThread,
embedded,
composerElement: composerOverlayElement,
@@ -3383,6 +3400,8 @@ export default function ChatView(props: ChatViewProps) {
onToggleTerminal: toggleTerminalVisibilityStable,
onToggleThreadPanel: toggleThreadPanelStable,
onToggleRightPanel: toggleRightPanelStable,
+ showTerminalControl: buddyPanelsOffered,
+ showRightPanelControl: buddyPanelsOffered,
} satisfies PanelLayoutControlsProps;
const panelToggleControls = (
;
const panelLayoutControls = (
+ {buddyWholeWindow && rightPanelOpen ? (
+
+ ) : null}
{panelToggleControls}
);
diff --git a/apps/web/src/lazurio/BuddySurface.tsx b/apps/web/src/lazurio/BuddySurface.tsx
index 9d3e859f97dff..c649998fb517b 100644
--- a/apps/web/src/lazurio/BuddySurface.tsx
+++ b/apps/web/src/lazurio/BuddySurface.tsx
@@ -61,7 +61,14 @@ import { pageRecordOf } from "./buddySurfacePage";
import { useLinkedUnlistedProjectIds } from "./unlistedRows";
import { BUDDY_WORKING_ROW, buddyConversationRows, buddyFailureOf } from "./buddySurfaceTimeline";
import { prefersCzech } from "./threadTabs";
-import { buddyHostOfWindow, buddyWindowInView } from "./buddySurfaceFrame";
+import { RIGHT_PANEL_INLINE_LAYOUT_MEDIA_QUERY } from "../rightPanelLayout";
+import {
+ buddyEscapeTaken,
+ buddyHostOfWindow,
+ buddyPanelOverWholeWindow,
+ buddyPanelsOffered,
+ buddyWindowInView,
+} from "./buddySurfaceFrame";
import { useBuddyFrame } from "./useBuddyFrame";
type BuddyConfig = { readonly lazurioBuddy?: true; readonly lazurioBuddyOrigin?: string } | null;
@@ -101,6 +108,64 @@ export function useBuddyWindowInView(environmentId: string): boolean {
return buddyWindowInView(framed, shown, context !== null);
}
+/**
+ * Buddy's window's panels: `offered` the right panel and the terminal, never in his small window;
+ * `wholeWindow` the right panel opens over the whole window, as Matěj decided on 2026-11-21, with
+ * `backLabel` on its control back to the conversation. Elsewhere T3's own layout.
+ */
+export function useBuddyPanels() {
+ const framed = buddyHostOfWindow(window) !== null;
+ const narrow = useMediaQuery(RIGHT_PANEL_INLINE_LAYOUT_MEDIA_QUERY);
+ const { mode } = useBuddyFrame(framed);
+ const czech = useCzech(framed);
+ const offered = buddyPanelsOffered(framed, mode, narrow);
+ return {
+ framed,
+ offered,
+ wholeWindow: framed && offered,
+ backLabel: TEXT[czech ? "cs" : "en"].backToConversation,
+ };
+}
+
+/** In Buddy's window, the way from the right panel over the whole window back to the conversation. */
+export function BuddyBackToConversation(props: {
+ readonly label: string;
+ readonly onBack: () => void;
+}) {
+ return (
+
+ );
+}
+
+/**
+ * Escape over the right panel that covers Buddy's window goes back to the conversation, before the
+ * frame would make the window small (buddySurfaceFrame.ts). A field or a dialog keeps its own.
+ */
+export function useBuddyPanelEscape(active: boolean, back: () => void) {
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- listens to the window's keys while the panel covers it.
+ useEffect(() => {
+ if (!active) return;
+ const onKeyDown = (event: KeyboardEvent) => {
+ if (event.key !== "Escape" || event.isComposing) return;
+ if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
+ const target = event.target instanceof HTMLElement ? event.target : null;
+ if (target?.closest("input, textarea, select, [contenteditable='true']")) return;
+ if (buddyEscapeTaken(document)) return;
+ back();
+ };
+ window.addEventListener("keydown", onKeyDown);
+ return () => window.removeEventListener("keydown", onKeyDown);
+ }, [active, back]);
+}
+
/** Buddy's surface, read outside React when a command runs: false until the config is known. */
export const isBuddySurfaceNow = (): boolean =>
isBuddySurfaceConfig(appAtomRegistry.get(primaryServerConfigAtom));
@@ -133,6 +198,7 @@ function useCzech(buddy: boolean): boolean {
const TEXT = {
cs: {
fullscreen: "Na celou obrazovku",
+ backToConversation: "Zpět k rozhovoru",
panel: "Zmenšit do panelu",
close: "Zavřít",
days: "Dny",
@@ -153,6 +219,7 @@ const TEXT = {
},
en: {
fullscreen: "Full screen",
+ backToConversation: "Back to the conversation",
panel: "Back to the panel",
close: "Close",
days: "Days",
@@ -458,13 +525,18 @@ export const buddyTerminalUiState = (buddy: boolean, state: TerminalUiState): Te
type RightPanelState = ReturnType;
/**
- * The thread's right panel as the chat reads it: in Buddy's surface closed and empty, whatever the
- * thread holds (a panel opened on it earlier, a link followed into it, a page an agent showed),
- * since Buddy's chat is only the conversation (root decision 0210, addendum of
- * HumanAndMachines/Lazurio#648). The stored panel stays as it is. As T3's elsewhere.
+ * The thread's right panel as the chat reads it: closed and empty in Buddy's surface, which is only
+ * the conversation (root decision 0210, addendum of HumanAndMachines/Lazurio#648); maximized over
+ * his whole window (`wholeWindow`). The stored panel stays as it is. As T3's elsewhere.
*/
-export const buddyRightPanelState = (buddy: boolean, state: RightPanelState): RightPanelState =>
- buddy ? selectThreadRightPanelState({}, null) : state;
+export const buddyRightPanelState = (
+ buddy: boolean,
+ state: RightPanelState,
+ wholeWindow = false,
+): RightPanelState => {
+ if (buddy) return selectThreadRightPanelState({}, null);
+ return wholeWindow ? buddyPanelOverWholeWindow(state) : state;
+};
/** The chat's shortcuts, without those Buddy's surface has no use for there. */
export function useBuddyChatShortcuts(buddy: boolean, input: ChatShortcutsInput) {
diff --git a/apps/web/src/lazurio/buddySurfaceFrame.test.ts b/apps/web/src/lazurio/buddySurfaceFrame.test.ts
index 8c5d5d000e8c4..3772996c02c42 100644
--- a/apps/web/src/lazurio/buddySurfaceFrame.test.ts
+++ b/apps/web/src/lazurio/buddySurfaceFrame.test.ts
@@ -1,6 +1,13 @@
import { describe, expect, it } from "vite-plus/test";
-import { buddyHostOfWindow, buddyWindowInView, startBuddyFrame } from "./buddySurfaceFrame";
+import {
+ buddyHostOfWindow,
+ buddyPanelOpensItself,
+ buddyPanelOverWholeWindow,
+ buddyPanelsOffered,
+ buddyWindowInView,
+ startBuddyFrame,
+} from "./buddySurfaceFrame";
const HOST = "https://launchpad.example-person.lazurio.io";
// What the host sends after the frame's ready, about its own Environment.
@@ -17,7 +24,13 @@ const personalContext = {
};
/** A frame's window as far as the frame uses it: its parent, its ancestors and its listeners. */
-function frameWindow(options: { readonly host?: string; readonly openMenu?: boolean } = {}) {
+function frameWindow(
+ options: {
+ readonly host?: string;
+ readonly openMenu?: boolean;
+ readonly panelOverWindow?: boolean;
+ } = {},
+) {
const posted: Array<{ readonly message: unknown; readonly origin: string }> = [];
const listeners = new Map void>();
const parent = {
@@ -28,7 +41,14 @@ function frameWindow(options: { readonly host?: string; readonly openMenu?: bool
location: { ancestorOrigins: [options.host ?? HOST] },
document: {
referrer: "",
- querySelector: () => (options.openMenu === true ? {} : null),
+ // As the DOM does, it also finds the hidden dialog below.
+ querySelector: (selector: string) =>
+ selector.includes("maximized-away") ? (options.panelOverWindow === true ? {} : null) : {},
+ // A narrow window keeps a closed sheet mounted as a hidden dialog.
+ querySelectorAll: () => [
+ { checkVisibility: () => false },
+ ...(options.openMenu === true ? [{ checkVisibility: () => true }] : []),
+ ],
},
addEventListener: (type: string, listener: (event: unknown) => void) =>
listeners.set(type, listener),
@@ -69,12 +89,18 @@ describe("Buddy's frame", () => {
expect(frame.layout()).toBe("panel");
});
- it("leaves Escape to an open menu, a modifier or an input method", () => {
+ it("leaves Escape to an open menu, a panel over the window, a modifier or an input method", () => {
const menu = frameWindow({ openMenu: true });
startBuddyFrame(menu.win);
menu.key();
expect(layouts(menu.posted)).toEqual([]);
+ // Escape over the panel goes back to the conversation first (BuddySurface.tsx).
+ const panel = frameWindow({ panelOverWindow: true });
+ startBuddyFrame(panel.win).requestLayout("fullscreen");
+ panel.key();
+ expect(layouts(panel.posted)).toEqual(["fullscreen"]);
+
const { win, posted, key } = frameWindow();
startBuddyFrame(win);
key({ shiftKey: true });
@@ -136,6 +162,61 @@ describe("Buddy's frame", () => {
).toBe(true);
});
+ it("takes the size the host's window shows, also one the host chose itself, and drops a defect", () => {
+ const { win, posted, key, receive } = frameWindow();
+ const frame = startBuddyFrame(win);
+ expect(frame.mode()).toBeNull();
+ // The launcher opened the remembered full screen: one Escape leaves it.
+ receive({ type: "lazurio.buddy.layout", v: 1, mode: "fullscreen" });
+ expect(frame.mode()).toBe("fullscreen");
+ key();
+ expect(layouts(posted)).toEqual(["panel"]);
+ for (const defect of [
+ { type: "lazurio.buddy.layout", v: 2, mode: "panel" },
+ { type: "lazurio.buddy.layout", v: 1, mode: "huge" },
+ { type: "lazurio.buddy.layout", v: 1, mode: "panel", extra: true },
+ ])
+ receive(defect);
+ receive({ type: "lazurio.buddy.layout", v: 1, mode: "panel" }, "https://example.com");
+ receive({ type: "lazurio.buddy.layout", v: 1, mode: "panel" }, HOST, {});
+ expect(frame.mode()).toBe("fullscreen");
+ receive({ type: "lazurio.buddy.layout", v: 1, mode: "closed" });
+ expect(frame.mode()).toBe("closed");
+ expect(frame.layout()).toBe("panel");
+ });
+
+ it("offers the panels in the full-screen window, also a phone's, and never in the small one", () => {
+ const { win } = frameWindow();
+ const framed = buddyHostOfWindow(win) !== null;
+ // As the host says: full screen on a phone or a computer offers both, the small window neither.
+ expect(buddyPanelsOffered(framed, "fullscreen", true)).toBe(true);
+ expect(buddyPanelsOffered(framed, "fullscreen", false)).toBe(true);
+ expect(buddyPanelsOffered(framed, "panel", true)).toBe(false);
+ expect(buddyPanelsOffered(framed, "closed", false)).toBe(false);
+ // An older host never says: a frame too narrow for the panels reads as the small window.
+ expect(buddyPanelsOffered(framed, null, true)).toBe(false);
+ expect(buddyPanelsOffered(framed, null, false)).toBe(true);
+ // Chat on its own page, also a narrow one, keeps T3's own layout.
+ expect(buddyPanelsOffered(false, null, true)).toBe(true);
+ });
+
+ it("reads the right panel over the whole window as maximized, the same object for the same state", () => {
+ const stored: { isOpen: boolean; surfaces: string[]; maximized?: true } = {
+ isOpen: true,
+ surfaces: [],
+ };
+ const whole = buddyPanelOverWholeWindow(stored);
+ expect(whole).toEqual({ isOpen: true, surfaces: [], maximized: true });
+ expect(buddyPanelOverWholeWindow(stored)).toBe(whole);
+ expect(stored).toEqual({ isOpen: true, surfaces: [] });
+ const maximized = { isOpen: true, maximized: true as const };
+ expect(buddyPanelOverWholeWindow(maximized)).toBe(maximized);
+ // A page an agent reveals never opens the panel by itself in Buddy's window.
+ expect(buddyPanelOpensItself(true, false)).toBe(true);
+ expect(buddyPanelOpensItself(true, true)).toBe(false);
+ expect(buddyPanelOpensItself(false, false)).toBe(false);
+ });
+
it("talks to nobody outside a host's frame", () => {
const { win, posted, key } = frameWindow({ host: "https://example.com" });
const frame = startBuddyFrame(win);
diff --git a/apps/web/src/lazurio/buddySurfaceFrame.ts b/apps/web/src/lazurio/buddySurfaceFrame.ts
index 20c0ab79b8542..09be6e88c00c2 100644
--- a/apps/web/src/lazurio/buddySurfaceFrame.ts
+++ b/apps/web/src/lazurio/buddySurfaceFrame.ts
@@ -1,11 +1,12 @@
/**
* Lazurio overlay (root decision 0210, plan DEV-6676): Buddy's surface as the frame of the bubble
- * (buddySurfaceProtocol.ts). The host draws no controls over the frame and sees no keys inside it,
- * so Escape asks for the panel unless something in the surface took it (the composer's editor marks
- * every Escape handled, so that alone does not count). The frame keeps the size it asked for last.
+ * (buddySurfaceProtocol.ts). The host sees no keys inside the frame, so Escape asks for the panel
+ * unless something in the surface took it (the composer's editor marks every Escape handled, so that
+ * alone does not count). The frame keeps the size it asked for or the host said last.
*/
import {
acceptBuddyContext,
+ acceptBuddyLayout,
acceptBuddyShown,
type BuddyContext,
type BuddyLayout,
@@ -18,10 +19,12 @@ export interface BuddyFrame {
/** The page around the frame, a host of the bubble; null outside a frame or another page. */
readonly hostOrigin: string | null;
readonly context: () => BuddyContext | null;
- /** The size the frame asked for last; the panel until it asks. */
+ /** The size the frame asked for or the host said last; the panel until either. */
readonly layout: () => Exclude;
/** Whether the host's window shows the frame; null until the host says (an older Lazurio never does). */
readonly shown: () => boolean | null;
+ /** The size the host's window shows; null until the host says (an older Lazurio never does). */
+ readonly mode: () => BuddyLayout | null;
readonly subscribe: (listener: () => void) => () => void;
readonly requestLayout: (mode: BuddyLayout) => void;
readonly stop: () => void;
@@ -38,8 +41,53 @@ export const buddyWindowInView = (
heardContext: boolean,
): boolean => !framed || shown === true || (shown === null && heardContext);
-/** An open menu, dialog or list inside the surface takes Escape before the frame does. */
-const ESCAPE_TAKERS = '[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"]';
+/**
+ * Whether Buddy's window offers the right panel and the terminal: in his full-screen window, never in
+ * the small one (LazurioPlatform F47, addendum of 2026-11-20). Before the host says its size (an older
+ * Lazurio), a frame too narrow for the panels reads as the small window.
+ */
+export const buddyPanelsOffered = (
+ framed: boolean,
+ mode: BuddyLayout | null,
+ narrow: boolean,
+): boolean => !framed || (mode === null ? !narrow : mode === "fullscreen");
+
+/**
+ * Whether a page an agent reveals may open the right panel by itself: never in Buddy's window,
+ * where nothing opens over his conversation (F60); its tab still joins the strip.
+ */
+export const buddyPanelOpensItself = (inlinePanel: boolean, framed: boolean): boolean =>
+ inlinePanel && !framed;
+
+const overWholeWindow = new WeakMap