import type { Observable } from 'rxjs'; /** Options for **`channel.llm.ask`** / **`stream`** / **`makePersistentStream`**. */ export interface LlmOptions { /** Override dialog UUID for Omni/LLM tracing (defaults to script dialog). */ dialogUuid?: string; /** Chat role sent with the message, e.g. **`"assistant"`**, **`"user"`**. */ role?: string; /** When `true`, message may be hidden from user-visible transcript (host-dependent). */ hidden?: boolean; /** * **LLM-only**: speaker / persona label in multi-party chat. **Not** related to * {@link import('./mixer').PlayOptions.name} (TTS **`key_storage.name`**). */ name?: string; /** Route the request to a specific Omni agent profile (UUID). */ agentUuid?: string; /** Multi-agent: current alias for routing. */ currentAgentAlias?: string; /** Opaque payload forwarded to the Omni LLM backend. */ payload?: Record; /** Verbose logging on the LLM path. */ debug?: boolean; /** Restrict which agent aliases may handle the request. */ agentAliasFilter?: string[]; /** * Manual same-turn pseudo-reasoning hint for the answering agent. * When set, Omni skips the assigned reasoner LLM call and injects this text * as a hidden reasoning message before the user turn. */ pseudoReasoning?: string; /** * Multiplex id for persistent WS turns. Generated by `send()` when omitted. * Echoed on every `stream.chunk` / `stream.complete` / `stream.error`. */ requestId?: string; } /** Create an Omni dialog (HTTP or persistent `dialog.create`). */ export interface CreateDialogOptions { /** Omni agent UUID (required). */ agentUuid: string; /** Optional fixed dialog UUID; Omni generates one when omitted. */ uuid?: string; /** Extra dialog prompt appended after agent system prompt. */ prompt?: string; /** Human-readable dialog name. */ name?: string; /** Template variables persisted on the dialog (`dialog.payload`). */ payload?: Record; /** Optional seed history. */ history?: Array<{ role?: string; content: string; hidden?: boolean; name?: string; }>; } /** Patch Omni dialog fields (HTTP `/meta` or persistent `dialog.update`). */ export interface UpdateDialogOptions { /** Target dialog UUID; defaults to the channel / persistent stream dialog. */ dialogUuid?: string; /** Required when the dialog may need to be created on first update. */ agentUuid?: string; prompt?: string; name?: string; /** Replaces stored `dialog.payload` when set. */ payload?: Record; metadata?: Record; currentAgentAlias?: string; } /** Result of {@link ChannelLlm.createDialog} / {@link PersistentLlmStreamHandle.createDialog}. */ export interface DialogInfo { uuid: string; agentUuid?: string; payload?: Record | null; prompt?: string | null; currentAgentAlias?: string | null; } /** Options for **`channel.llm.extract`**. All fields except `dialogUuid` are forwarded to Omni extract. */ export interface ExtractOptions { /** Override dialog UUID for extraction context; defaults to the current script dialog. */ dialogUuid?: string; /** Optional extraction prompt/instruction forwarded to Omni. */ prompt?: string; /** Model name or id understood by the Omni backend. */ model?: string; /** Nucleus sampling value forwarded to Omni. */ topP?: number; /** Temperature forwarded to Omni. */ temperature?: number; /** Custom model descriptor forwarded as-is. */ customModel?: Record; [key: string]: unknown; } /** One chunk from **`channel.llm.stream`**. */ export interface LlmStreamChunk { id: string; chunkId: number; content: string; finishReason: string | null; event: any; toolMessages?: any[]; raw: Record; /** Set on persistent WS chunks so parallel sends on one socket can be demuxed. */ requestId?: string; /** Alias that produced this chunk when the backend includes it. */ currentAgentAlias?: string; } /** * One in-flight turn on a {@link PersistentLlmStreamHandle}. * Several sends may run in parallel on the same Socket.IO connection. */ export interface PersistentLlmSendHandle { readonly requestId: string; readonly stream$: Observable; /** Cancel this turn only (`stream.abort`); other in-flight sends keep running. */ abort(): void; } /** * Long-lived LLM Socket.IO stream — amortizes connection setup across many user turns. */ export interface PersistentLlmStreamHandle { /** Merged chunks from every in-flight `send` (filter by `chunk.requestId` if needed). */ readonly stream$: Observable; /** * Send one turn over the existing socket. * Returns a per-turn stream so several agents can run in parallel on one connection. */ send(message: string, options?: LlmOptions): PersistentLlmSendHandle; /** Create a dialog (and optional payload) over the persistent socket (`dialog.create`). */ createDialog(options: CreateDialogOptions): Promise; /** Update dialog fields / payload over the persistent socket (`dialog.update`). */ updateDialog(options: UpdateDialogOptions): Promise; /** Cancel one in-flight turn by `requestId` (`stream.abort`). */ abort(requestId: string): void; /** Close the underlying Socket.IO stream without destroying the handle object. */ disconnect(): void; /** Re-open the underlying Socket.IO stream after {@link disconnect}. */ reconnect(): void; } /** LLM facade on the media channel. */ export interface ChannelLlm { /** Single-shot completion for **`message`**; consumes the Omni SSE stream and returns concatenated text. */ ask(message: string, options?: LlmOptions): Promise; /** Token/chunk stream for **`message`** parsed from Omni SSE `data:` events. */ stream(message: string, options?: LlmOptions): Observable; /** Structured extraction / JSON-style fill from conversation context via Omni extract. */ extract(options?: ExtractOptions): Promise>; /** Create an Omni dialog with optional payload (HTTP `POST /v1/chat`). */ createDialog(options: CreateDialogOptions): Promise; /** Update Omni dialog payload / prompt / alias (HTTP `POST /v1/chat/:uuid/meta`). */ updateDialog(options: UpdateDialogOptions): Promise; /** * Open a persistent Omni chat stream. * @param options - Default **`agentUuid`**, **`dialogUuid`**, etc.; per-**`send`** overrides allowed. */ makePersistentStream(options?: LlmOptions): PersistentLlmStreamHandle; } //# sourceMappingURL=llm.d.ts.map