import type { HumanInputQuestion, HumanInputResponse } from "@opengeni/contracts"; import type { Database } from "./database.js"; import * as schema from "./schema.js"; export type SessionRealtimeMirrorChannel = "speakable" | "commentary" | null; export type MirrorSessionRealtimeContextInput = { accountId: string; workspaceId: string; sessionId: string; /** Lifecycle facts target their own mode; ordinary updates reach every ringing phone. */ realtimeId?: string | undefined; sourceKind: "human_input" | "human_input_request" | "human_input_response" | "assistant_progress" | "assistant_terminal" | "agent_call"; sourceId: string; text: string; channel: SessionRealtimeMirrorChannel; turnId?: string | null; payload?: Record | undefined; now?: Date | undefined; }; export type MirrorSessionRealtimeContextResult = { entry: typeof schema.sessionRealtimeEntries.$inferSelect; replay: boolean; } | null; /** * Append one canonical same-session fact to the active realtime conversation. * The caller already owns the session event-write lock. Locking the active mode * serializes sequence allocation with lifecycle end and browser ledger sync. */ export declare function mirrorSessionRealtimeContextInTransaction(db: Database, input: MirrorSessionRealtimeContextInput): Promise; export declare function renderRealtimeHumanInputContext(input: { delivery: "send" | "steer"; routing: "accepted_for_execution" | "queued_for_execution" | "accepted_for_steering"; text: string; }): string; /** * The opening of a call the agent placed (call_user) and the person answered: * the voice side speaks first and says why it called. */ export declare function renderRealtimeAgentCallContext(input: { reason: string; }): string; export type RealtimeHumanInputRequestContext = { id: string; questions: HumanInputQuestion[]; allowSkip: boolean; expiresAt?: Date | string | null; }; /** * Render the exact durable question contract for the conversational surface. * The structured form remains authoritative, while a conversational answer is * ordinary new user input that the realtime model delegates once with enough * question context for the next underlying turn. */ export declare function renderRealtimeHumanInputRequestContext(input: { requests: RealtimeHumanInputRequestContext[]; }): string; export declare function renderRealtimeHumanInputResponseContext(input: { requestId: string; questions: HumanInputQuestion[]; response: HumanInputResponse; }): string;