import { AIInterface } from '@happyvertical/ai'; import { PrincipalAuditSink } from '@happyvertical/smrt-agents'; import { SmrtClassOptions } from '@happyvertical/smrt-core'; import { VoiceSession } from './models/VoiceSession.js'; import { ConversationPersona, PersonaRecallOptions } from './persona-conversation.js'; import { ChatService } from './services/index.js'; export declare const SMRT_CHAT_VOICE_TARGET = "smrt:chat"; export declare const MAX_VOICE_GATEWAY_TEXT_LENGTH = 12000; export interface VoiceGatewayTurnMetadata { tenantId?: string; actorProfileId?: string; chatRoomId?: string; threadId?: string; agentSessionId?: string; personaId?: string; voiceSessionId?: string; source?: string; [key: string]: unknown; } export interface VoiceGatewayTurnPayload { session_id: string; turn_id: string; target: string; actor?: string; text: string; metadata?: VoiceGatewayTurnMetadata; } export interface VoiceGatewayTurnResponseMetadata { tenantId: string; chatRoomId: string; threadId: string | null; agentSessionId: string; userMessageId: string; assistantMessageId: string | null; personaId: string; correlationId: string; voiceSessionId: string; source: string; } export interface VoiceGatewayTurnResponse { session_id: string; turn_id: string; text: string; metadata: VoiceGatewayTurnResponseMetadata; } export interface CreateVoiceChatSessionOptions { chatService: ChatService; db: SmrtClassOptions['db']; tenantId: string; actorProfileId: string; actorUserId?: string | null; persona: ConversationPersona; /** Existing agent session to bind voice to. Omit to create/reuse one. */ agentSessionId?: string; /** Agent profile/session author id when creating a new agent session. */ agentId?: string; /** Optional existing thread within the bound session room. */ threadId?: string | null; /** Stable gateway-level `session_id`. Generated when omitted. */ gatewaySessionId?: string; /** Subject key forwarded to ChatService.createAgentSession(). */ sessionKey?: string | null; /** Voice binding TTL. Ignored when `expiresAt` is supplied. */ ttlSeconds?: number; expiresAt?: Date; metadata?: Record; target?: string; maxTokens?: number; maxMessages?: number; instructions?: string; } export interface VoiceChatSessionCreationResult { voiceSession: VoiceSession; voiceSessionId: string; gatewaySessionId: string; expiresAt: Date; tenantId: string; actorProfileId: string; personaId: string; agentSessionId: string; chatRoomId: string; threadId: string | null; metadata: VoiceGatewayTurnMetadata; } export interface HandleVoiceGatewayTurnOptions { chatService: ChatService; db: SmrtClassOptions['db']; ai: AIInterface; payload: VoiceGatewayTurnPayload; now?: Date; historyLimit?: number; recall?: PersonaRecallOptions | false; model?: string; temperature?: number; maxTokens?: number; maxSteps?: number; postgresRls?: boolean; audit?: PrincipalAuditSink; } export interface VoiceGatewayTurnHandlerOptions extends Omit { gatewayToken: string | (() => string | Promise); } export declare class VoiceGatewayError extends Error { readonly status: number; readonly code: string; constructor(message: string, status: number, code: string); } export declare class VoiceGatewayBadRequestError extends VoiceGatewayError { constructor(message: string); } export declare class VoiceGatewayUnauthorizedError extends VoiceGatewayError { constructor(message?: string); } export declare class VoiceSessionRejectedError extends VoiceGatewayError { constructor(message: string); } export declare class VoiceSessionExpiredError extends VoiceGatewayError { constructor(message?: string); } export declare class VoiceGatewayReplayError extends VoiceGatewayError { constructor(message?: string); } export declare function createVoiceChatSession(options: CreateVoiceChatSessionOptions): Promise; export declare function handleVoiceGatewayTurn(options: HandleVoiceGatewayTurnOptions): Promise; export declare function createVoiceGatewayTurnHandler(options: VoiceGatewayTurnHandlerOptions): (request: Request) => Promise; export declare function assertVoiceGatewayBearer(headers: Headers, expectedToken: string): Promise; //# sourceMappingURL=voice.d.ts.map