Skip to content

bodhi-realtime-agent / AssistantOutputInterceptor

Interface: AssistantOutputInterceptor ​

Defined in: src/types/session-seams.ts:50

Host hooks that sit between the provider's native assistant output and the session, set once through VoiceSessionConfig.outputInterceptor, for example to screen what the assistant says. Every hook is optional. Hooks run inline on the output path. A throwing hook is reported through hooks.onError and the output path fails open, continuing as it would without that hook.

Methods ​

audio()? ​

optional audio(chunkBase64): boolean

Defined in: src/types/session-seams.ts:66

Receives each native assistant audio chunk (base64, in the transport's output encoding). Return false to drop the chunk before the session handles it: it is neither observed nor sent to the client. If the hook throws, the chunk is delivered.

Parameters ​

chunkBase64 ​

string

Returns ​

boolean


beforeTranscriptFlush()? ​

optional beforeTranscriptFlush(): void

Defined in: src/types/session-seams.ts:74

Runs at the start of every transcript flush (for example when a turn ends or is interrupted, on resetConversationContext() and at close), before the buffered assistant text is committed, so text forwarded from here joins the message being committed. If the hook throws, the flush still commits the buffers, so turn finalization and close() complete.

Returns ​

void


transcript()? ​

optional transcript(chunk, forward): void

Defined in: src/types/session-seams.ts:59

Receives each assistant transcript chunk before it reaches the session's transcript. Call forward with the text to keep, now or later (for example from beforeTranscriptFlush); a chunk never forwarded is dropped. Without this hook every chunk is forwarded unchanged. If the hook throws, the original chunk is forwarded unchanged, after any text the hook forwarded before throwing.

Parameters ​

chunk ​

string

forward ​

(text) => void

Returns ​

void

Built with VitePress