Patch Changes
-
#1368
2fe85cbThanks @threepointone! - AddisToolContinuation: booleantouseAgentChat()so consumers can disambiguate a fresh user-initiatedstatus === "submitted"from one driven by a server-pushed tool continuation. See #1365.statusalready tracks the whole tool round-trip (submitted→streaming→ready) afteraddToolOutput/addToolApprovalResponse, on purpose — that's what #1157 asked for and what many loading-spinner UIs now rely on. But some consumers want a typing indicator only for new user messages, not for mid-turn continuations, and previously had to inspect message history to tell them apart.isToolContinuationistruefrom the momentaddToolOutput/addToolApprovalResponsekicks off an auto-continuation until the continuation stream closes (or is aborted bystop()). It isfalseotherwise — including during cross-tab server broadcasts, which surface viaisServerStreamingonly.const { status, isStreaming, isToolContinuation } = useAgentChat({ ... }); const isLoading = isStreaming || status === "submitted"; const showTypingIndicator = status === "submitted" && !isToolContinuation;
Purely additive — no change to
status,isServerStreaming, orisStreamingsemantics. -
#1366
53600d0Thanks @threepointone! - FixuseAgentChat()going silent while anonToolCallhandler is running. The server'sstreamTextends the stream as soon as the model emits a client-tool call, which droppedstatusback toreadyandisStreaming/isServerStreamingtofalsefor the full duration of the client-sidetool.execute()— often afetchtaking several seconds. Consumers had no single flag that covered the whole "turn in progress" window. See #1365.useAgentChat()now treats any unresolved client-side tool call on the latest assistant message as an active server-driven phase:isServerStreamingistruefrom the moment the tool part appears ininput-available(with an active handler —onToolCallor a deprecatedtoolsentry withexecute) until it transitions out viaaddToolOutput/addToolResult.isStreaming(status === "streaming" || isServerStreaming) staystrueacross the whole tool round-trip, including the gap between the model emitting the call and the server pushing its continuation.statusis untouched — it still means "user-initiated submission awaiting a response." Tools waiting for explicit user confirmation are excluded from the busy signal (nothing is happening until the user acts).
Consumer code simplifies to:
const { isStreaming, status } = useAgentChat({ ... }); const isLoading = isStreaming || status === "submitted"; const showTypingIndicator = status === "submitted";
No API changes. Existing code that only looked at
statusbehaves the same.