assistant-ui
bindThread
Connect one assistant-ui ThreadRuntime and send its public events to a core runtime supplied by your app.
Signature and import
Create one binding per thread scope and dispose it when that subscription owner unmounts.
import { bindThread } from "@generative-a11y/assistant-ui";
const binding = bindThread({
runtime,
scopeId: "support-thread",
thread,
maxTrackedEntities: 1_000,
});
// Removes only the subscription and adapter state.
binding.dispose();Walkthrough
Use the app runtime
ThreadBinding sends events to core without disposing your runtime.
Separate thread IDs
scopeId prevents ID collisions across mounted conversations.
Read public thread state
ThreadBinding needs only getState and subscribe from ThreadRuntime.
Dispose the binding
dispose removes the subscription without changing the thread runtime.
Prop
Type
Events reported from thread state
Each public thread snapshot is compared with its previous value, and confirmed changes become events.
| assistant-ui state | generative-a11y event | Source |
|---|---|---|
| Assistant message starts running | response.started | Public message state |
| Text grows | response.text.delta | New text only |
| Message finishes, stops, or fails | completed, interrupted, failed | Public message status |
| Tool call and result parts | tool lifecycle | Public content parts |
| Approval state | approval requested or resolved | Public content parts |
| Source parts | citation.available | Optional content parts |