/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import type { AudioFrame } from '@livekit/rtc-node';
import { EventEmitter } from 'events';
import type { ReadableStream } from 'node:stream/web';
import type { TimedString } from '../voice/io.js';
import type { ChatContext, FunctionCall } from './chat_context.js';
import type { ToolChoice, ToolContext } from './tool_context.js';
export type InputSpeechStartedEvent = object;
export interface InputSpeechStoppedEvent {
    userTranscriptionEnabled: boolean;
}
export interface MessageGeneration {
    messageId: string;
    /**
     * Text stream that may contain plain strings or TimedString objects with timestamps.
     */
    textStream: ReadableStream<string | TimedString>;
    audioStream: ReadableStream<AudioFrame>;
    modalities?: Promise<('text' | 'audio')[]>;
}
export interface GenerationCreatedEvent {
    messageStream: ReadableStream<MessageGeneration>;
    functionStream: ReadableStream<FunctionCall>;
    userInitiated: boolean;
    /** Response ID for correlating metrics with spans */
    responseId?: string;
}
export interface RealtimeModelError {
    type: 'realtime_model_error';
    timestamp: number;
    label: string;
    error: Error;
    recoverable: boolean;
}
export interface RealtimeCapabilities {
    messageTruncation: boolean;
    turnDetection: boolean;
    userTranscription: boolean;
    autoToolReplyGeneration: boolean;
    audioOutput: boolean;
}
export interface InputTranscriptionCompleted {
    itemId: string;
    transcript: string;
    isFinal: boolean;
}
export interface RealtimeSessionReconnectedEvent {
}
export declare abstract class RealtimeModel {
    private _capabilities;
    constructor(capabilities: RealtimeCapabilities);
    get capabilities(): RealtimeCapabilities;
    /** The model name/identifier used by this realtime model */
    abstract get model(): string;
    abstract session(): RealtimeSession;
    abstract close(): Promise<void>;
}
export declare abstract class RealtimeSession extends EventEmitter {
    protected _realtimeModel: RealtimeModel;
    private deferredInputStream;
    private _mainTask;
    constructor(realtimeModel: RealtimeModel);
    get realtimeModel(): RealtimeModel;
    abstract get chatCtx(): ChatContext;
    abstract get tools(): ToolContext;
    abstract updateInstructions(instructions: string): Promise<void>;
    /**
     * @throws RealtimeError on Timeout
     */
    abstract updateChatCtx(chatCtx: ChatContext): Promise<void>;
    abstract updateTools(tools: ToolContext): Promise<void>;
    abstract updateOptions(options: {
        toolChoice?: ToolChoice | null;
    }): void;
    abstract pushAudio(frame: AudioFrame): void;
    /**
     * @throws RealtimeError on Timeout
     */
    abstract generateReply(instructions?: string): Promise<GenerationCreatedEvent>;
    /**
     * Commit the input audio buffer to the server
     */
    abstract commitAudio(): Promise<void>;
    /**
     * Clear the input audio buffer to the server
     */
    abstract clearAudio(): Promise<void>;
    /**
     * Cancel the current generation (do nothing if no generation is in progress)
     */
    abstract interrupt(): Promise<void>;
    /**
     * Truncate the message at the given audio end time
     */
    abstract truncate(options: {
        messageId: string;
        audioEndMs: number;
        modalities?: ('text' | 'audio')[];
        audioTranscript?: string;
    }): Promise<void>;
    close(): Promise<void>;
    /**
     * Notifies the model that user activity has started
     */
    startUserActivity(): void;
    private _mainTaskImpl;
    setInputAudioStream(audioStream: ReadableStream<AudioFrame>): void;
}
//# sourceMappingURL=realtime.d.ts.map