import { ReactNode } from 'react'; import { Session } from './types'; /** * A single terminal tab representing an open session. */ export interface TerminalTab { /** The session ID */ sessionId: string; /** Display name (session name) */ name: string; /** The URL to load in the iframe - either ttydUrl or agent tunnelUrl */ terminalUrl: string | null; /** * Agent id owning the session — required so TerminalIframe can mint * an F3 capability token. Optional for tabs whose owning agent is * unknown (rare; legacy sessions get null). */ agentId?: string | null; /** * Agent profile this session was created against. Threaded into * TerminalIframe → useTerminalCapabilityUrl so the * mintAgentCapability mutation targets `/api/profiles//...` * on the agent. Falls back to "default" if absent (legacy tabs). */ profile?: string | null; /** Whether ttyd is being started for this session */ loading?: boolean; /** Error message if starting failed */ error?: string | null; /** Owning agent's display name — shown as a tab tooltip/badge. */ agentName?: string | null; /** Target machine name the session runs on — shown as a tab tooltip/badge. */ targetName?: string | null; /** Target machine kind (DIRECT/SSH/...) for the tab badge. */ targetType?: string | null; /** Pinned tabs sort to the front and survive "close others". */ pinned?: boolean; } interface TerminalPanelProps { /** The currently open terminal tabs */ tabs: TerminalTab[]; /** The active tab session ID */ activeTabId: string | null; /** Called when user clicks a tab */ onTabSelect: (sessionId: string) => void; /** Called when user closes a tab */ onTabClose: (sessionId: string) => void; /** Called when user wants to open a session in a new browser tab */ onOpenExternal: (sessionId: string) => void; /** Called when panel is collapsed/expanded */ onToggleCollapse?: () => void; /** Whether the panel is collapsed */ collapsed?: boolean; /** Panel height class (e.g., 'h-96', 'h-[500px]') */ heightClass?: string; /** All available sessions for the "+" button */ sessions?: Session[]; /** Called when user clicks "+" to open a new terminal for a session */ onOpenTerminal?: (session: Session) => void; /** Called when user clicks retry on a failed terminal tab */ onRetryTerminal?: (session: Session) => void; /** Called when user renames a session tab */ onRenameSession?: (sessionId: string, newName: string) => void; /** Called when user stops a terminal */ onStopTerminal?: (sessionId: string) => void; /** Called when user restarts a terminal */ onRestartTerminal?: (sessionId: string) => void; /** * Reconnect to the still-running agent session without stopping it. * The parent re-issues the idempotent startSessionTerminal (reattach) * and refreshes the tab URL; the panel additionally remounts the iframe * with a fresh capability token. This is the fix for "terminal idles * out and the only way back was a full browser refresh". */ onReattachTerminal?: (sessionId: string) => void; /** Reorder tabs (drag-and-drop). Receives the new session-id order. */ onReorderTabs?: (orderedSessionIds: string[]) => void; /** Toggle a tab's pinned state. */ onTogglePin?: (sessionId: string) => void; /** Open the session info panel for a tab (terminal-view feature parity). */ onShowSessionInfo?: (sessionId: string) => void; /** Navigate to a tab's agent detail page. */ onViewAgent?: (sessionId: string) => void; /** Navigate to a tab's target detail page. */ onViewTarget?: (sessionId: string) => void; /** Share / offer a session to a teammate. */ onShareSession?: (sessionId: string) => void; /** Called when user stops the entire session */ onStopSession?: (sessionId: string) => void; /** Called to create a new session *with options* (opens the full form). */ onCreateSession?: () => void; /** * One-click quick-create: the primary "+" remembers the last-used * agent/vibe/type and spawns a terminal with an auto-generated name. * When set, the "+" quick-creates and the adjacent caret opens the menu * (options form / open existing). Falls back to `onCreateSession`. */ onQuickCreate?: () => void; /** * Increment to request the panel start renaming its active tab. Driven by * the page-level F2 shortcut, since rename state lives inside this panel. */ renameActiveTabNonce?: number; /** Whether this is the full-screen terminal-first mode */ fullScreen?: boolean; /** Whether the immersive fullscreen overlay is active */ isImmersiveFullscreen?: boolean; /** Called when user clicks the immersive fullscreen button */ onToggleImmersiveFullscreen?: () => void; /** Context switcher component to render in immersive fullscreen header */ contextSwitcher?: ReactNode; } /** * Tabbed terminal panel - like VS Code's integrated terminal. * Each tab is an iframe loading a ttyd web terminal via the agent's tunnel. * Supports context menu with rename, close, open in new tab, restart, stop. * Features: reconnect on failure, connection status indicators, drag-to-resize. */ export declare function TerminalPanel({ tabs, activeTabId, onTabSelect, onTabClose, onOpenExternal, onToggleCollapse, collapsed, heightClass, sessions, onOpenTerminal, onRetryTerminal, onRenameSession, onStopTerminal, onRestartTerminal, onReattachTerminal, onReorderTabs, onTogglePin, onShowSessionInfo, onViewAgent, onViewTarget, onShareSession, onStopSession, onCreateSession, onQuickCreate, renameActiveTabNonce, fullScreen, isImmersiveFullscreen, onToggleImmersiveFullscreen, contextSwitcher, }: TerminalPanelProps): import('react').JSX.Element | null; export {};