/** * Sidebar layout. * * Fullscreen mode: pi renders one layout root (a VStack of transcript + input dock). We wrap it in * an HStack with the sidebar as a fixed-width right column, which is what OpenCode looks like. * There is no extension API for this: it relies on the TUI's `layoutRoot` field and * `setLayoutRoot()` (pi-tui ViewportTUI), verified on pi 1.4.0 and 1.5.0. If either is missing, or pi * swaps the root back (renderer switch), the guard widget re-wraps it or we fall back. * * Regular mode has no layout root, so the sidebar is a toggleable overlay instead. * * Home screen: until the session has a message, the same root swaps to OpenCode's home layout * (home.ts): logo, centred prompt, tip and a bottom bar, with no transcript or sidebar. The root * picks its layout node each frame, so the switch happens on the first message with no remount. */ import type { ExtensionContext } from "@earendil-works/pi-coding-agent"; import type { UiState } from "./state.ts"; /** * The tree to search for pi's own components. Once chassis has wrapped the layout root in its * sidebar split, `tui.layoutRoot` is a plain object with no children; pi's real root hangs off it * under a symbol. Without it, a search for message and tool components finds nothing. */ export declare function piRootOf(tui: unknown): unknown; export interface LayoutOptions { width: number; /** Hide the split sidebar below this terminal width. */ minTerminalWidth: number; piVersion: string; /** True while the home screen should show (no message in the session yet). */ home: () => boolean; /** Tip index for this launch. */ tipIndex: number; } export interface LayoutHandle { /** True when the sidebar is currently on screen. */ isShown(): boolean; toggle(): void; dispose(): void; } export declare function installLayout(ctx: ExtensionContext, state: UiState, opts: LayoutOptions): LayoutHandle;