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 observedSessionKey; private chatAbort; onEvent?: (evt: TuiEvent) => void; onConnected?: () => void; onDisconnected?: (reason: string) => void; onGap?: (info: { expected: number; received: number; }) => void; constructor(opts: GatewayRealtimeOptions); get connectionLabel(): string; start(): void; stop(): void; getActiveSignal(): AbortSignal | undefined; getComposerInputHistory(): Promise; recordComposerInputHistory(text: string): Promise; sendChat(opts: ChatSendOptions): Promise<{ runId: string; }>; searchWorkspaceFiles(sessionKey: string, query: string, options?: { limit?: number; }): Promise; getReviewContext(sessionKey: string): Promise; startWorkflowRun(opts: TuiWorkflowRunStartRequest): Promise; resolveStartupProject(opts: { workspacePath: string; sessionKey: string; agentId: string; autoCreate?: boolean; }): Promise; resumeChat(opts: { sessionKey: string; runId: string; }): Promise<{ ok: boolean; reason?: string; }>; abortChat(opts: { sessionKey: string; runId: string; }): Promise<{ ok: boolean; }>; submitChatInput(opts: { sessionKey: string; message: string; delivery: 'next' | 'steer'; }): Promise<{ ok: boolean; effectiveDelivery?: 'next' | 'steer'; }>; getChatInputState(sessionKey: string): Promise; getStartupResources(sessionKey: string): Promise; loadHistory(opts: { sessionKey: string; limit?: number; }): Promise<{ messages: HistoryMessage[]; }>; loadHistoryWindow(opts: { sessionKey: string; rowNumber: number; before?: number; after?: number; }): Promise<{ messages: import("../../session/client-history.js").ClientHistoryMessage[]; startRowNumber: number; endRowNumber: number; totalRows: number; }>; loadTranscriptTree(sessionKey: string): Promise; loadTimeline(sessionKey: string): Promise; getSessionStats(sessionKey: string): Promise; listSessions(): Promise; listAgents(): Promise; setTuiDefaultAgent(agentId: string): Promise<{ agentId: string; }>; getSessionInfo(sessionKey: string): Promise; listModels(): Promise; resetSession(sessionKey: string): Promise; compactSession(sessionKey: string, options?: { force?: boolean; instructions?: string; }): Promise; exportSession(sessionKey: string, format: ExportFormat): Promise; importSession(targetSessionKey: string, jsonContent: string): Promise<{ sessionKey: string; rowCount: number; }>; createShare(sessionKey: string, request: TuiShareRequest, options?: { agentId?: string; }): Promise; btwQuery(sessionKey: string, question: string): Promise<{ text: string; error?: string; }>; forkSession(sourceSessionKey: string, targetSessionKey: string): Promise<{ sessionKey: string; rowCount: number; }>; forkSessionAt(sourceSessionKey: string, targetSessionKey: string, entryId: string): Promise<{ sessionKey: string; rowCount: number; }>; setTranscriptLabel(sessionKey: string, entryId: string, label: string | undefined): Promise<{ ok: boolean; }>; appendCustomEntry(sessionKey: string, customType: string, data?: unknown): Promise<{ ok: boolean; }>; appendCustomMessage(sessionKey: string, message: { customType: string; content?: string | unknown[]; display?: boolean; details?: unknown; }): Promise<{ ok: boolean; }>; appendBashExecution(sessionKey: string, entry: { command: string; output?: string; exitCode?: number | null; signal?: string | null; excludeFromContext?: boolean; truncated?: boolean; fullOutputPath?: string; }): Promise<{ ok: boolean; }>; patchSession(sessionKey: string, patch: Record): Promise; renameSession(sessionKey: string, name: string): Promise<{ ok: boolean; }>; deleteSession(sessionKey: string): Promise<{ ok: boolean; }>; private startRealtime; private handleRealtimeEvent; private unsubscribeActiveRun; } export {};