Streaming Streaming API reference

Streaming API reference

Type signatures for @pretable/stream-adapter.

See the generated stream-adapter.api.md for complete declarations. Putting the pieces together — an explicit rowModel, a StreamConnection from connectElementStream, disposed on unmount:

Streaming chat grid

Turn a streaming LLM response into rows with connectElementStream and append them to the grid as they arrive.

.md

Types

TypePurpose
RowModelLike<TRow, TRowId>Structural atomic-transaction target with string or number IDs.
StreamConnection{ done: Promise<void>; dispose(): void }.
TransactionBatcher<TRow, TRowId>RAF-batched add, { id, changes } update, remove, flush, dispose, plus error and subscribeError.
PartialStreamOptions<TRow, TRowId>Fixed rowId, optional onIssue, and optional complete-row createRow.

createBatcher(rowModel)

ts
const batcher = createBatcher(rowModel);
batcher.add([{ id: "1", role: "user", content: "Hello" }]);
batcher.update([{ id: "1", changes: { content: "Hello, world" } }]);
batcher.remove(["old-row"]);
batcher.flush();

Scheduled work coalesces into one transaction per animation frame. Calls are appended, not merged: two updates for the same row become two { id, changes } entries inside that one transaction, applied in call order.

batcher.error rejects with an asynchronous transaction failure. It is a promise, so it only ever reports the first failure; batcher.subscribeError(listener) delivers the same failure to a callback and returns an unsubscribe function. Subscribing after a failure invokes the listener immediately, so there is no race between wiring it up and the failure landing.

Connectors and parsers