0
Fork 0
mirror of https://github.com/TanStack/ai.git synced 2026-11-16 19:38:41 +00:00
ai/docs/reference/interfaces/WebSocketStreamInit.md
github-actions[bot] f4f32bdcc2
docs: regenerate API documentation (#1195)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-08-22 08:16:20 +00:00

2.2 KiB

id title
WebSocketStreamInit WebSocketStreamInit

Interface: WebSocketStreamInit<TOffset>

Defined in: packages/ai/src/stream-to-websocket.ts:90

Type Parameters

TOffset

TOffset extends string = string

Properties

batch?

optional batch?: number;

Defined in: packages/ai/src/stream-to-websocket.ts:96

Chunks buffered per durability append (default 32).


debug?

optional debug?: DebugOption;

Defined in: packages/ai/src/stream-to-websocket.ts:105


durability?

optional durability?: (ctx) => StreamDurability<TOffset>;

Defined in: packages/ai/src/stream-to-websocket.ts:94

Per-TURN durability factory, keyed by the frame's runId via ctx.request.

Parameters

ctx

WsRunContext

Returns

StreamDurability<TOffset>


heartbeatMs?

optional heartbeatMs?: number;

Defined in: packages/ai/src/stream-to-websocket.ts:98

Heartbeat ping interval in ms (default 30_000).


idleTimeoutMs?

optional idleTimeoutMs?: number;

Defined in: packages/ai/src/stream-to-websocket.ts:104

Close after this many ms without any inbound frame (default 300_000). Never fires while a turn is still streaming, so a long single generation (agentic loop, >5-min turn) is safe.


onRun

onRun: (ctx) => AsyncIterable<AGUIEvent>;

Defined in: packages/ai/src/stream-to-websocket.ts:92

Build a fresh chat() stream for each inbound RunAgentInput frame.

Parameters

ctx

WsRunContext

Returns

AsyncIterable<AGUIEvent>