import type { SessionsListParams, SessionsPatchParams, SessionsPatchResult } from "../gateway/protocol/index.js"; import type { ResponseUsageMode, SessionInfo, SessionScope } from "./tui-types.js"; export type ChatSendOptions = { sessionKey: string; sessionId?: string | null; message: string; thinking?: string; deliver?: boolean; timeoutMs?: number; runId?: string; }; export type TuiEvent = { event: string; payload?: unknown; seq?: number; }; export type TuiSessionList = { ts: number; path: string; count: number; totalCount?: number; limitApplied?: number; hasMore?: boolean; defaults?: { model?: string | null; modelProvider?: string | null; contextTokens?: number | null; thinkingLevels?: Array<{ id: string; label: string; }>; }; sessions: Array & { key: string; sessionId?: string; updatedAt?: number | null; fastMode?: boolean; sendPolicy?: string; responseUsage?: ResponseUsageMode; label?: string; provider?: string; groupChannel?: string; space?: string; subject?: string; chatType?: string; origin?: { label?: string; provider?: string; surface?: string; }; lastChannel?: string; lastProvider?: string; lastTo?: string; lastAccountId?: string; derivedTitle?: string; lastMessagePreview?: string; }>; }; export type TuiAgentsList = { defaultId: string; mainKey: string; scope: SessionScope; agents: Array<{ id: string; name?: string; }>; }; export type TuiModelChoice = { id: string; name: string; provider: string; contextWindow?: number; reasoning?: boolean; }; export type TuiBackend = { connection: { url: string; token?: string; password?: string; }; onEvent?: (evt: TuiEvent) => void; onConnected?: () => void; onDisconnected?: (reason: string) => void; onGap?: (info: { expected: number; received: number; }) => void; start: () => void; stop: () => void; sendChat: (opts: ChatSendOptions) => Promise<{ runId: string; }>; abortChat: (opts: { sessionKey: string; runId: string; }) => Promise<{ ok: boolean; aborted: boolean; }>; loadHistory: (opts: { sessionKey: string; limit?: number; }) => Promise; listSessions: (opts?: SessionsListParams) => Promise; listAgents: () => Promise; patchSession: (opts: SessionsPatchParams) => Promise; resetSession: (key: string, reason?: "new" | "reset") => Promise; getGatewayStatus: () => Promise; listModels: () => Promise; };