import type { ExportFormat } from '../../session/types.js'; import type { SessionTimelineItem } from '../../session/transcript-outline.js'; import type { ChatSendOptions, HistoryMessage, TuiBackend, TuiCompactionResult, TuiChatInputState, TuiComposerHistoryItem, TuiEvent, TuiModelChoice, TuiShareRequest, TuiShareResult, TuiSessionStats, TuiSessionItem, TuiStartupResources, TuiTranscriptTreeEntry, TuiAgentInfo, TuiWorkspaceFileSearchEntry, TuiWorkflowRunStartRequest, TuiWorkflowRunStartResult, TuiStartupProjectResult } from '../tui-backend.js'; import type { SessionInfo } from '../tui-types.js'; import type { ReviewContext } from '../../review/review-git.js'; import { type GatewayCredential } from '../../gateway/credential.js'; interface GatewayRealtimeOptions { url: string; credential?: GatewayCredential; } /** * TUI backend that communicates with a running xopc gateway via REST + realtime WebSocket. * * - Agent input: durable session input REST plus replayable run topics * - Broadcast events: gateway realtime topic * - REST calls for sessions, models, etc. */ export declare class GatewayRealtimeBackend implements TuiBackend { private readonly baseUrl; private readonly credential; private readonly clientId; private realtime; private activeRunId; private observedConversationId; private chatAbort; private readonly drafts; private readonly pendingInputs; private draftDirectory?; private draftInitialization?; onEvent?: (evt: TuiEvent) => void; onConnected?: () => void; onDisconnected?: (reason: string) => void; onGap?: (info: { expected: number; received: number; }) => void; constructor(opts: GatewayRealtimeOptions); get connectionLabel(): string; getComposerDraftDirectory(): Promise; private initializeDrafts; private persistDraft; start(): void; stop(): void; getActiveSignal(): AbortSignal | undefined; getComposerInputHistory(): Promise; recordComposerInputHistory(text: string): Promise; private acceptReceipt; private reconcileInput; private prepareInput; sendChat(opts: ChatSendOptions): Promise<{ runId: string; }>; searchWorkspaceFiles(conversationId: string, query: string, options?: { limit?: number; }): Promise; getReviewContext(conversationId: string): Promise; startWorkflowRun(opts: TuiWorkflowRunStartRequest): Promise; resolveStartupProject(opts: { workspacePath: string; conversationId: string; agentId: string; autoCreate?: boolean; }): Promise; resumeChat(opts: { conversationId: string; runId: string; }): Promise<{ ok: boolean; reason?: string; }>; abortChat(opts: { conversationId: string; runId: string; }): Promise<{ ok: boolean; }>; submitChatInput(opts: { conversationId: string; message: string; delivery: 'next' | 'steer'; }): Promise<{ ok: boolean; effectiveDelivery?: 'next' | 'steer'; state?: TuiChatInputState; }>; getChatInputState(conversationId: string): Promise; updateChatInput(opts: { conversationId: string; inputId: string; version: number; content: string; }): Promise<{ ok: boolean; state?: TuiChatInputState; }>; removeChatInput(opts: { conversationId: string; inputId: string; version: number; }): Promise<{ ok: boolean; state?: TuiChatInputState; }>; getStartupResources(conversationId: string): Promise; loadHistory(opts: { conversationId: string; limit?: number; }): Promise<{ messages: HistoryMessage[]; }>; loadHistoryWindow(opts: { conversationId: string; rowNumber: number; before?: number; after?: number; }): Promise<{ messages: import("../../session/client-history.js").ClientHistoryMessage[]; startRowNumber: number; endRowNumber: number; totalRows: number; }>; loadTranscriptTree(conversationId: string): Promise; loadTimeline(conversationId: string): Promise; getSessionStats(conversationId: string): Promise; listSessions(): Promise; listAgents(): Promise; setTuiDefaultAgent(agentId: string): Promise<{ agentId: string; }>; createConversation(agentId: string, conversationId?: string): Promise; getSessionInfo(conversationId: string): Promise; listModels(): Promise; resetSession(conversationId: string): Promise; compactSession(conversationId: string, options?: { force?: boolean; instructions?: string; }): Promise; exportSession(conversationId: string, format: ExportFormat): Promise; importSession(targetConversationId: string, jsonContent: string): Promise<{ conversationId: string; rowCount: number; }>; createShare(conversationId: string, request: TuiShareRequest, options?: { agentId?: string; }): Promise; btwQuery(conversationId: string, question: string): Promise<{ text: string; error?: string; }>; forkSession(sourceConversationId: string, targetConversationId: string): Promise<{ conversationId: string; rowCount: number; }>; forkSessionAt(sourceConversationId: string, targetConversationId: string, entryId: string): Promise<{ conversationId: string; rowCount: number; }>; setTranscriptLabel(conversationId: string, entryId: string, label: string | undefined): Promise<{ ok: boolean; }>; appendCustomEntry(conversationId: string, customType: string, data?: unknown): Promise<{ ok: boolean; }>; appendCustomMessage(conversationId: string, message: { customType: string; content?: string | unknown[]; display?: boolean; details?: unknown; }): Promise<{ ok: boolean; }>; appendBashExecution(conversationId: string, entry: { command: string; output?: string; exitCode?: number | null; signal?: string | null; excludeFromContext?: boolean; truncated?: boolean; fullOutputPath?: string; }): Promise<{ ok: boolean; }>; patchSession(conversationId: string, patch: Record): Promise; renameSession(conversationId: string, name: string): Promise<{ ok: boolean; }>; deleteSession(conversationId: string): Promise<{ ok: boolean; }>; private startRealtime; private handleRealtimeEvent; private unsubscribeActiveRun; } export {};