import type { ProviderDriver, ProviderSettingsUpdate, WindowCreateOptions, WindowMutation } from "../provider-engine.js"; import type { ProviderDirectoryList, ProviderFileDeleteOptions, ProviderFileDeleteResult, ProviderFileMkdirOptions, ProviderFileMkdirResult, ProviderFileRenameOptions, ProviderFileRenameResult, ProviderFileStat, ProviderFileWriteOptions, ProviderFileWriteResult } from "@termfleet/core/contracts/files.js"; import type { AgentProvider } from "@termfleet/core/internal/agent-session-index.js"; import type { Bounds, OrphanSessionPruneResult, ProviderFilesystem, ProviderHealth, ProviderSnapshot, ProviderWindow, TerminalEffect, TerminalEffectKind, TerminalThemeProfile, WindowLaunchFailure } from "@termfleet/core/types.js"; import { type AgentSessionReadResult } from "@termfleet/core/internal/agent-session-tail.js"; import { type AgentSessionDetails } from "@termfleet/core/internal/agent-session.js"; import { type CooperativeSignalEvent, type LifecycleSnapshot } from "@termfleet/core/internal/session-lifecycle.js"; export type PersistedAgentLaunch = { agent: AgentProvider; agentCwd?: string; agentSessionId: string; }; export type PersistedAgentWindow = PersistedAgentLaunch & { bounds: Bounds; id: number; terminalId: string; }; export declare class VirtualTmuxDriver implements ProviderDriver { readonly kind: "virtual-tmux"; private readonly count; private readonly cwd; private displayBounds; private readonly maxWindows; private readonly prefix; private readonly filesystemRoot; private readonly socket; private terminalThemeProfile; private windows; private nextWindowId; private readonly lifecycleStore; private readonly cooperativeSignalStore; private readonly sessionRollTracker; private readonly effects; private readonly iframeResolver; constructor({ count, cwd, maxWindows, prefix, socket }: { count: number; cwd: string; maxWindows?: number; prefix: string; socket?: string; }); private tmuxArgs; initialize(): Promise; private readonly agentWindowSeen; private readonly agentlessSince; private readonly agentSessionByTerminal; private readonly agentLaunchByTerminal; private readonly controlByTerminal; private readonly agentSessionStampObservedLive; reapEndedSessions(lifecycle: LifecycleSnapshot, thresholdMs: number, nowMs: number): void; disposeOwnedSessions(): void; pruneOrphanSessions(): OrphanSessionPruneResult; getHealth(): ProviderHealth; getLifecycle(): Promise; getMaxSessionCount(): number; getMaxWindowCount(): number; recordCooperativeSignal(options: { atMs: number; event: CooperativeSignalEvent; sessionId: string; }): void; getSnapshot(): Promise>; getWindows(lifecycle: LifecycleSnapshot): ProviderWindow[]; getTrackedWindowCount(): number; private ensureSessionsForMissingWindows; private buildWindows; getDisplayBounds(): Bounds; getFilesystems(): ProviderFilesystem[]; createWindow(options?: WindowCreateOptions): Promise<{ id: number; terminalId: string; bounds: Bounds; cwd?: string; src?: string; }>; markWindowLaunchFailure({ id, launchFailure }: { id: number; launchFailure: WindowLaunchFailure; }): { id: number; }; moveWindow({ bounds, id }: WindowMutation): { id: number; bounds: Bounds; }; renameWindow({ id, name }: { id: number; name: string; }): { id: number; name: string; }; setTerminalEffect({ durationMs, kind, terminalId }: { durationMs?: number; kind: TerminalEffectKind; terminalId: string; }): TerminalEffect; closeWindow(id: number): { id: number; terminalId: string; }; noteAgentSessionId({ agentSessionId, terminalId }: { agentSessionId: string; terminalId: string; }): void; noteAgentLaunch({ agent, agentCwd, agentSessionId, terminalId }: { agent: PersistedAgentLaunch["agent"]; agentCwd?: string; agentSessionId: string; terminalId: string; }): void; listPersistedAgentWindows(): PersistedAgentWindow[]; noteControlSession({ cwd, terminalId }: { cwd?: string; terminalId: string; }): void; isControlTerminal(terminalId: string): boolean; isControlWindow(id: number): boolean; updateProviderSettings(settings: ProviderSettingsUpdate): { terminalThemeProfile: TerminalThemeProfile; }; resizeDisplay(bounds: Bounds): Bounds; captureTerminal({ lines, preserveEscapes, terminalId }: { preserveEscapes?: boolean; terminalId: string; lines?: number; }): Promise; getAgentSession({ cwd, sessionId }: { cwd?: string; sessionId: string; }): Promise; getAgentSessionTailed({ cwd, sessionId }: { cwd?: string; sessionId: string; }): Promise; sendTerminalInput({ data, deadlineMs, submitMode, terminalId }: { terminalId: string; data: string; deadlineMs?: number; submitMode?: "retry" | "single"; }): Promise<{ terminalId: string; bytes: number; delivery: string; }>; interruptTerminal({ terminalId }: { terminalId: string; }): Promise; readFile({ path, terminalId }: { terminalId: string; path: string; }): Buffer; readFileByFilesystem({ filesystemId, length, offset, path }: { filesystemId: string; length?: number; offset?: number; path: string; }): Buffer; listDirectory({ path, terminalId }: { terminalId: string; path: string; }): ProviderDirectoryList; listDirectoryByFilesystem({ filesystemId, path, terminalId }: { filesystemId: string; path: string; terminalId?: string; }): ProviderDirectoryList; statFile({ path, terminalId }: { terminalId: string; path: string; }): ProviderFileStat; statFileByFilesystem({ filesystemId, path, terminalId }: { filesystemId: string; path: string; terminalId?: string; }): ProviderFileStat; writeFile(options: ProviderFileWriteOptions): ProviderFileWriteResult; writeFileByFilesystem(options: Omit & { filesystemId: string; }): ProviderFileWriteResult; deleteFile(options: ProviderFileDeleteOptions): ProviderFileDeleteResult; deleteFileByFilesystem(options: Omit & { filesystemId: string; }): ProviderFileDeleteResult; makeDirectory(options: ProviderFileMkdirOptions): ProviderFileMkdirResult; makeDirectoryByFilesystem(options: Omit & { filesystemId: string; }): ProviderFileMkdirResult; renameFile(options: ProviderFileRenameOptions): ProviderFileRenameResult; renameFileByFilesystem(options: Omit & { filesystemId: string; }): ProviderFileRenameResult; private nextBounds; private expandDisplayToFitWindows; private expandDisplayToFitWindow; private persistLayout; private ensureWindowSession; private createWindowSession; private resizeWindowSession; private createFolderWindow; private createFileWindow; private createIframeWindow; private requireOwnedSession; private requireOwnedFilesystem; private defaultSession; private observeLifecycle; private reapEndedAgentSessionStamps; private listPanesWithRecovery; } export declare function resolveMaxVirtualWindows(option: number | undefined, count: number): number;