Minor Changes
-
#1192
28925b6Thanks @whoiskatrin! - AddAIChatAgent.messageConcurrencyto control overlappingsendMessage()
submits withqueue,latest,merge,drop, anddebouncestrategies.
EnhancesaveMessages()to accept a functional form for deriving messages
from the latest transcript, and return{ requestId, status }so callers
can detect skipped turns. -
#1228
53f27b1Thanks @threepointone! - AddonChatResponsehook and client-side server-streaming indicators.Server:
onChatResponsehook onAIChatAgentNew protected method that fires after a chat turn completes and the assistant message has been persisted. The turn lock is released before the hook runs, so it is safe to call
saveMessagesfrom inside. Responses triggered fromonChatResponseare drained sequentially via a built-in drain loop.protected async onChatResponse(result: ChatResponseResult) { if (result.status === "completed") { this.broadcast(JSON.stringify({ streaming: false })); } }
New exported type:
ChatResponseResultwithmessage,requestId,continuation,status, anderrorfields.Client:
isServerStreamingandisStreamingonuseAgentChatisServerStreamingistruewhen a server-initiated stream (fromsaveMessages, auto-continuation, or another tab) is active. Independent of the AI SDK'sstatuswhich only tracks client-initiated requests.isStreamingis a convenience flag:truewhen either the client-initiated stream (status === "streaming") or a server-initiated stream is active.Behavioral fix: stream error propagation
Non-abort reader errors in
_streamSSEReplyand_sendPlaintextReplynow propagate correctly instead of being silently swallowed. The client receiveserror: trueon the done message, and partial messages are not persisted. Previously, stream errors were silently treated as completions and partial content was persisted.
Patch Changes
- #1225
599390cThanks @threepointone! - FixuseAgentChatcache key including query params, which broke stream resume with cross-domain auth. Auth tokens (and other query params) change across page loads, causing cache misses that re-trigger Suspense and interrupt the stream resume handshake. The cache key now uses agent identity only (origin + pathname + agent + name), keeping it stable across token rotations.