interface UseStreamReturnPromise that settles when the current thread's initial hydration
completes. Exposed so Suspense wrappers can throw it until the
first StreamController.hydrate call resolves (or rejects)
for the active thread. A fresh promise is installed on every
switchThread/threadId change.
The root message projection. Assembled from two sources and merged in real time:
messages-channel deltas — token-level streaming events
(message-start, content-block-delta, message-finish)
emitted by the runtime. These drive live, token-by-token
updates.values.messages snapshots — the authoritative ordering
and any messages the agent produces without token streaming
(human turns, tool results, echoes from subagents).If the backend only emits values events (no messages
channel), every message will appear fully-formed on each
values update rather than streaming. This is a backend/runtime
concern — the React layer faithfully renders whatever the
server sends.
Equivalent to calling useMessages(stream) with no target.
Subagents discovered on the root run. For DeepAgent-typed
streams the key set is narrowed to the subagent names declared
on the agent brand (keyof InferSubagentStates<T>).
Subgraphs discovered on the root run.
A namespace is classified as a subgraph iff at least one
strictly-deeper namespace has been observed with it as a prefix.
This is inferred from the lifecycle event stream — plain function
nodes (orchestrator, writer in the nested-stategraph example)
never appear here even though the server emits namespaced
lifecycle events for them. Promotion is monotonic and retroactive;
an entry appears as soon as the first descendant event lands.
Subgraphs indexed by the graph node that produced them
(addNode("visualizer_0", …)). Each value is an array because
parallel fan-outs and loops can spawn multiple invocations of
the same node; arrays preserve insertion order. Updates in
lock-step with subgraphs.
The most recent values-channel snapshot emitted at the root
namespace — i.e. the thread-level state as the server sees it
after each superstep. Updated on every root values event, not
on token-level deltas: if you render values.messages directly
you'll see full turns appear at once instead of streaming
token-by-token. Use messages (or useMessages) for the
token-streamed view.
Equivalent to calling useValues(stream).
v2 escape hatch — returns the bound ThreadStream.
Dispatch a new run on the bound thread.
input is typed as Partial<StateType> so IDE autocompletion
surfaces the state keys declared on the root hook. Pass null
(or omit fields) when resuming an interrupt via options.command.resume
— the server accepts a null payload in that case.