ai_ui_stream 1.0.1
ai_ui_stream: ^1.0.1 copied to clipboard
Transport-agnostic Dart client for the AI SDK UI Message Stream protocol: SSE parser, message reducer and chat controller with tool approval.
Changelog #
1.0.1 - 2026-11-01 #
- Package description and library docs reworded. No code changes.
1.0.0 - 2026-10-31 #
First public release. Covers every chunk type of the AI SDK v7 UI Message
Stream, verified against byte-exact fixtures generated from ai@7.0.133.
ChatControllerwithuseChatparity:sendText/sendMessage,regenerate,continueTurn,resumeStream,stop,addToolOutput/addToolOutputError,respondToApprovals/addToolApprovalResponse,clearError,onFinish/onErrorcallbacks,dataEventsstream.- Spec tool-approval flow (
tool-approval-request/-response,ToolApproval,outputDenied). The old finish-time heuristic is opt-in viainferApprovalOnFinish. - All part types: text, reasoning, tool (static and dynamic), step-start,
source-url, source-document, file, data, unknown. Serialization matches the
AI SDK's own
UIMessagebyte for byte. - Frame-based SSE decoder (WHATWG EventSource rules,
[DONE]), response validation (ChatProtocolException), abort signal to the transport. - Optional
HttpChatTransportbehindpackage:ai_ui_stream/http.dart.
Upgrading from 0.1.0 #
0.1.0 was never published; these notes are for git-ref users.
ChatTransport.send(request, {required abort})returnsFuture<ChatResponse>;extends ChatTransportto inheritreconnect.ToolUIPart.approvedis nowapproval?.approved;ApprovalDecisionandPendingApprovalrequireapprovalId;PendingApproval.inputisObject?.respondToApprovalswithoutuserTextcontinues the last assistant message instead of adding a placeholder.removeLastExchangereturns({String? userText, List<UIMessage> removed}).ToolState.inputErroris gone:tool-input-errorends inoutputError.ToolUIPart.inputisObject?. UnknownstatethrowsFormatException.start-stepinsertsStepStartUIPart;abortleaves open parts streaming.- Finish-time approval inference is off unless
inferApprovalOnFinish: true.
0.1.0 #
Initial unpublished version.