import { TransformStream } from 'stream/web';
import { z } from 'zod';
import { InterruptionCacheEntry } from './interruption_cache_entry.js';
import type { OverlappingSpeechEvent } from './types.js';
import type { BoundedCache } from './utils.js';
export interface WsTransportOptions {
    baseUrl: string;
    apiKey: string;
    apiSecret: string;
    sampleRate: number;
    threshold?: number;
    minFrames: number;
    timeout: number;
    connectTimeout: number;
    maxRetries?: number;
}
export interface WsTransportState {
    overlapSpeechStarted: boolean;
    overlapSpeechStartedAt: number | undefined;
    cache: BoundedCache<number, InterruptionCacheEntry>;
}
export declare const wsMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
    type: z.ZodLiteral<"session.created">;
    default_threshold: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
}, "strip", z.ZodTypeAny, {
    type: "session.created";
    default_threshold?: number | null | undefined;
}, {
    type: "session.created";
    default_threshold?: number | null | undefined;
}>, z.ZodObject<{
    type: z.ZodLiteral<"session.closed">;
}, "strip", z.ZodTypeAny, {
    type: "session.closed";
}, {
    type: "session.closed";
}>, z.ZodObject<{
    type: z.ZodLiteral<"bargein_detected">;
    created_at: z.ZodNumber;
    probabilities: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
    prediction_duration: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
    type: "bargein_detected";
    created_at: number;
    probabilities: number[];
    prediction_duration: number;
}, {
    type: "bargein_detected";
    created_at: number;
    probabilities?: number[] | undefined;
    prediction_duration?: number | undefined;
}>, z.ZodObject<{
    type: z.ZodLiteral<"inference_done">;
    created_at: z.ZodNumber;
    probabilities: z.ZodDefault<z.ZodArray<z.ZodNumber, "many">>;
    prediction_duration: z.ZodDefault<z.ZodNumber>;
    is_bargein: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
    type: "inference_done";
    created_at: number;
    probabilities: number[];
    prediction_duration: number;
    is_bargein?: boolean | undefined;
}, {
    type: "inference_done";
    created_at: number;
    probabilities?: number[] | undefined;
    prediction_duration?: number | undefined;
    is_bargein?: boolean | undefined;
}>, z.ZodObject<{
    type: z.ZodLiteral<"error">;
    message: z.ZodString;
    code: z.ZodOptional<z.ZodNumber>;
    session_id: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
    message: string;
    type: "error";
    code?: number | undefined;
    session_id?: string | undefined;
}, {
    message: string;
    type: "error";
    code?: number | undefined;
    session_id?: string | undefined;
}>]>;
/**
 * Resolve the effective interruption threshold for observability only — the server makes the
 * actual decision. Precedence: user override, then server default; null when neither is known.
 */
export declare function resolveEffectiveThreshold(threshold: number | undefined, defaultThreshold: number | null | undefined): number | null;
export interface WsTransportResult {
    transport: TransformStream<Int16Array | OverlappingSpeechEvent, OverlappingSpeechEvent>;
    reconnect: () => Promise<void>;
    close: () => void;
}
/**
 * Creates a WebSocket transport TransformStream for interruption detection.
 *
 * This transport receives Int16Array audio slices and outputs InterruptionEvents.
 * It maintains a persistent WebSocket connection with automatic retry on failure.
 * Returns both the transport and a reconnect function for option updates.
 */
export declare function createWsTransport(options: WsTransportOptions, getState: () => WsTransportState, setState: (partial: Partial<WsTransportState>) => void, updateUserSpeakingSpan?: (entry: InterruptionCacheEntry) => void, onRequestSent?: () => void, getAndResetNumRequests?: () => number): WsTransportResult;
//# sourceMappingURL=ws_transport.d.ts.map