/**
* AgentPanel — unified agent component with chat, CLI, and workspace modes.
*
* A self-contained panel with no layout opinions — drop it into a sidebar,
* popover, dialog, full page, or any container. It fills its parent via
* flex and min-h-0.
*
* Features:
* - Chat mode: assistant-ui powered chat with tool calls
* - CLI mode: embedded xterm.js terminal (dev mode only)
* - Toggle between modes via header buttons
*
* Usage:
* // In a sidebar
*
*
* // In a popover
*
*
* // Full page chat surface
*
*/
import React from "react";
import type { AgentChatSurfaceKind } from "./agent-chat-adapter.js";
import type { AssistantChatProps } from "./AssistantChat.js";
import type { MultiTabAssistantChatHeaderProps, MultiTabAssistantChatProps } from "./MultiTabAssistantChat.js";
type PanelMode = "chat" | "cli" | "resources" | "settings";
export declare function normalizeAgentPanelModeForSurface(mode: PanelMode, allowSettingsMode: boolean): PanelMode;
export declare function getAgentPanelChatTabGroups(tabs: MultiTabAssistantChatHeaderProps["tabs"], activeTabId: string): {
activeTab: import("./MultiTabAssistantChat.js").ChatTab | undefined;
childTabs: import("./MultiTabAssistantChat.js").ChatTab[];
focusParentId: string;
hasSubTabs: boolean;
mainTabs: import("./MultiTabAssistantChat.js").ChatTab[];
};
export declare function shouldShowAgentPanelChatTabBar(tabs: MultiTabAssistantChatHeaderProps["tabs"], activeTabId: string): boolean;
export declare function shouldShowAgentPanelSidebarChatTabs(tabs: MultiTabAssistantChatHeaderProps["tabs"]): boolean;
export declare function shouldShowAgentPanelPageNewChatButton(tabs: MultiTabAssistantChatHeaderProps["tabs"], activeTabId: string, activeTabMessageCount: number): boolean;
export declare function shouldShowAgentPanelCliTabBar(cliTabs: string[]): boolean;
export declare function shouldShowAgentPanelModeButtons(isSidebar: boolean): boolean;
export declare function shouldShowAgentPanelFullViewAction(agentPageHref: string | undefined, mode: PanelMode): boolean;
export interface AgentPanelCodeAccess {
/** Whether this surface can safely edit source and run shell commands. */
enabled: boolean;
/** Heading shown when code access is unavailable. */
unavailableTitle?: string;
/** Detail copy shown when code access is unavailable. */
unavailableDescription?: string;
/** Optional CTA label for the unavailable state. */
unavailableCtaLabel?: string;
/** Optional CTA URL for the unavailable state. */
unavailableCtaHref?: string;
/** Optional secondary CTA label, usually for Builder cloud code changes. */
unavailableSecondaryCtaLabel?: string;
/** Optional secondary CTA URL, usually the Builder connect URL. */
unavailableSecondaryCtaHref?: string;
/** @deprecated Chat stays available when code access is unavailable. */
unavailableComposerPlaceholder?: string;
}
export interface AgentPanelProps extends Omit {
/** Initial mode. Default: "chat" */
defaultMode?: "chat" | "cli";
/** CSS class for the outer container */
className?: string;
/** Inline styles for the outer container. */
style?: React.CSSProperties;
/** Called when the user clicks the collapse button. If provided, a collapse button appears in the header. */
onCollapse?: () => void;
/** Whether the panel is currently in fullscreen (Claude-style centered) mode. */
isFullscreen?: boolean;
/** Called when the user clicks the maximize/minimize button. If provided, the button appears next to the collapse button. */
onToggleFullscreen?: () => void;
/** URL of the app being developed (shown as "Open app in new tab" in settings). Set by frame. */
devAppUrl?: string;
/** Namespace for localStorage keys — used to isolate chat state per app in the frame. */
storageKey?: string;
/** Restore the previously active chat thread on mount. Default: true. */
restoreActiveThread?: boolean;
/** Ambient resource context rendered as a composer chip. */
scope?: import("./use-chat-threads.js").ChatThreadScope | null;
/** @deprecated Scope context now appears inside the composer. */
showScopeBadge?: MultiTabAssistantChatProps["showScopeBadge"];
/** Stable browser tab id used for tab-scoped app-state context. */
browserTabId?: string;
/** Keep chat thread selection in URL state. */
threadUrlSync?: MultiTabAssistantChatProps["threadUrlSync"];
/** Optional notice rendered below the main header while Chat mode is active. */
chatNotice?: React.ReactNode;
/** Show the chat thread tab row when the panel header is hidden. Default: true. */
showTabBar?: boolean;
/** Show a compact New chat action in page chat when the main header is hidden. */
showPageNewChatButton?: boolean;
/** Allow the sidebar settings view to render inside this panel. Default: true. */
allowSettingsMode?: boolean;
/** Optional link shown in Resources and Settings modes for the full Agent page. */
agentPageHref?: string;
/** Capability gate for source edits and CLI access. */
codeAccess?: AgentPanelCodeAccess;
}
export declare function resolveAgentPanelChatSurface(explicitSurface: AgentChatSurfaceKind | undefined, desktopCodeSurfaceRequested: boolean): AgentChatSurfaceKind;
export declare function getActiveTabScrollDelta(containerRect: Pick, tabRect: Pick, margin?: number): number;
export declare function AgentPanel(props: AgentPanelProps): React.JSX.Element;
export type AgentChatSurfaceMode = "panel" | "page";
export interface AgentChatSurfaceProps extends AgentPanelProps {
/**
* Layout treatment for the reusable chat surface. Use "page" when rendering
* chat as the primary route content instead of inside the sidebar shell.
* Default: "panel". Inline header and chat-tab chrome are hidden by default;
* pass `showHeader` or `showTabBar` to opt into those controls.
*/
mode?: AgentChatSurfaceMode;
/**
* Apply the shared chat view-transition marker/name to this surface. Pair
* with `AgentSidebar chatViewTransition` and navigate via
* `startAgentChatViewTransition` or `useAgentRouteState`.
*/
chatViewTransition?: boolean;
}
export declare function shouldDefaultAgentChatSurfacePageNewChatButton(mode: AgentChatSurfaceMode | undefined, _showTabBar: boolean | undefined): boolean;
export declare function shouldAllowAgentChatSurfaceSettingsMode(mode: AgentChatSurfaceMode | undefined, allowSettingsMode: boolean | undefined): boolean;
/**
* Reusable chat surface backed by AgentPanel internals.
*
* This gives page-level routes the same tabbed conversations, composer,
* model controls, context chips, and recovery boundary used by the
* sidebar without introducing a second chat implementation.
*/
export declare function AgentChatSurface({ mode, className, defaultMode, showHeader, showTabBar, isFullscreen, style, chatViewTransition, showPageNewChatButton, ...props }: AgentChatSurfaceProps): React.JSX.Element;
export interface AgentSidebarProps {
children: React.ReactNode;
/** Placeholder text for the empty chat state */
emptyStateText?: string;
/** Suggestion prompts shown when no messages */
suggestions?: string[];
/** Context-aware suggestions merged with `suggestions`. Enabled by default. */
dynamicSuggestions?: AssistantChatProps["dynamicSuggestions"];
/** Optional controls rendered in the chat composer toolbar. */
composerToolbarSlot?: AssistantChatProps["composerToolbarSlot"];
/** Optional contextual content rendered just above the chat composer. */
composerSlot?: AssistantChatProps["composerSlot"];
/** Observe the active chat composer's current plain text. */
onComposerTextChange?: AssistantChatProps["onComposerTextChange"];
/** Optional secondary model menu shown inside the chat composer model picker. */
imageModelMenu?: AssistantChatProps["imageModelMenu"];
/** Optional content rendered at the bottom of the chat thread. */
threadFooterSlot?: AssistantChatProps["threadFooterSlot"];
/** Initial sidebar width in pixels. Mount-only; user resize and a saved
* localStorage value override this. Default: 380 */
defaultSidebarWidth?: number;
/** @deprecated Use `defaultSidebarWidth` — this prop is mount-only. */
sidebarWidth?: number;
/** Which side the sidebar appears on. Default: "right" */
position?: "left" | "right";
/** Whether the sidebar starts open. Default: false */
defaultOpen?: boolean;
/** Animate the mobile overlay in a sheet-style slide transition. Default: true */
animateMobile?: boolean;
/** Animate desktop open/close by resizing the sidebar. Default: true */
animateDesktop?: boolean;
/**
* Apply the shared chat view-transition marker/name to the sidebar panel so a
* page-level AgentChatSurface can morph into it on navigation.
*/
chatViewTransition?: boolean;
/**
* Mark the initial panel mount as the destination of a page-to-sidebar chat
* handoff. This suppresses only the drawer's initial entry animation; normal
* sidebar open/close transitions remain enabled.
*/
chatViewTransitionHandoff?: boolean;
/** Namespace for persisted chat state. Use the same key as AgentChatHome. */
storageKey?: string;
/** Open the sidebar when a chat run is active or reconnects. */
openOnChatRunning?: boolean;
/** Override the fullscreen menu action, for templates with a chat-first page. */
onFullscreenRequest?: () => void;
/** Ambient resource context rendered as a composer chip. */
scope?: import("./use-chat-threads.js").ChatThreadScope | null;
/** @deprecated Scope context now appears inside the composer. */
showScopeBadge?: MultiTabAssistantChatProps["showScopeBadge"];
/** Stable browser tab id used for tab-scoped app-state context. */
browserTabId?: string;
/** Keep chat thread selection in URL state. */
threadUrlSync?: MultiTabAssistantChatProps["threadUrlSync"];
/** Optional link shown in Resources and Settings modes for the full Agent page. */
agentPageHref?: string;
}
/**
* Wraps app content with a toggleable agent sidebar.
* Use AgentToggleButton in your header to open/close it.
*/
export declare function AgentSidebar({ children, emptyStateText, suggestions, dynamicSuggestions, composerToolbarSlot, composerSlot, onComposerTextChange, imageModelMenu, threadFooterSlot, defaultSidebarWidth, sidebarWidth, position, defaultOpen, animateMobile, animateDesktop, chatViewTransition, chatViewTransitionHandoff, storageKey, openOnChatRunning, onFullscreenRequest, scope, showScopeBadge, browserTabId, threadUrlSync, agentPageHref, }: AgentSidebarProps): React.JSX.Element;
/**
* Focus the agent chat composer input.
* Opens the sidebar if closed, then focuses the text input.
*/
export declare function focusAgentChat(): void;
/**
* Button to toggle the agent sidebar. Place this in your app's header/toolbar.
* Dispatches a custom event that AgentSidebar listens for.
*/
export declare function AgentToggleButton({ className }: {
className?: string;
}): React.JSX.Element | null;
export {};
//# sourceMappingURL=AgentPanel.d.ts.map