Flue runtime hook, runtime extras, and message conversion utilities for assistant-ui React applications.
API Reference
convertFlueMessage
Convert one materialized Flue message into an assistant-ui message.
const convertFlueMessage: (message: FlueConversationMessage, options?: ConvertFlueMessagesOptions) => useExternalMessageConverter.Message | useExternalMessageConverter.Message[];convertFlueMessages
Convert the visible Flue conversation into assistant-ui thread messages.
const convertFlueMessages: (messages: readonly FlueConversationMessage[], options?: ConvertFlueMessagesOptions) => ThreadMessage[];getFlueSendMessage
Convert one assistant-ui append into Flue's text-and-images send shape.
const getFlueSendMessage: (message: AppendMessage) => FlueSendMessage;useFlueRuntime
Connect a durable Flue conversation to an assistant-ui runtime.
- options?UseFlueRuntimeOptions
- UseFlueRuntimeOptions
- url?string
URL of one agent conversation: wherever the application mounts the agent's routes plus the caller-chosen conversation id (`/api/agents/triage/123`). Relative URLs resolve against the browser origin; during server rendering they leave the hook dormant until hydration. Omit (together with `client`) to keep the hook dormant.
- client?FlueClient$1
Pre-configured conversation client, for custom headers, auth, or fetch behavior (`createFlueClient({ url, headers })`). Takes precedence over `url`. Memoize it — a new client instance replaces the session.
FlueClient- urlstring
The fully resolved conversation URL this client addresses.
- send(options: AgentPromptOptions) => Promise<AgentSendResult>
Starts one message delivery without waiting for completion (202 admission).
- read(target: AgentSendResult | string, options?: AgentReadOptions) => Promise<AgentReadResult>
Awaits one submission's settlement and resolves with its reply. The target is the admission `send()` resolved with, or a bare submission id — the re-attach form, which follows the conversation from the stream origin, so any process can read a submission at any later time; one that already settled resolves immediately. Throws `FlueExecutionError` when the submission settles failed or aborted. Composes `wait()`, `history()`, and `readSubmissionReply()` — use those directly when you only need the outcome, or already hold the conversation via `observe()`.
- wait(admission: AgentSendResult, options?: AgentWaitOptions) => Promise<void>
Awaits the admitted submission's completion. Resolves void when it settles completed and throws `FlueExecutionError` when it settles failed or aborted. The agent's reply is not returned here — `read()` returns it, or read it from the conversation via `onEvent` chunks, `observe()`, or `history()`.
- abort(options?: { signal?: AbortSignal; }) => Promise<AgentAbortResult>
Aborts all in-flight and queued durable work for the conversation (the currently running submission and any queued behind it). Resolves once the abort intent is recorded; the work settles to the distinct aborted outcome asynchronously.
- history(options?: FlueConversationHistoryOptions) => Promise<FlueConversationSnapshot>
Reads one materialized conversation snapshot — the whole conversation, or only its newest messages with `limit`.
- historyBefore(cursor: string, options: FlueConversationHistoryBeforeOptions) => Promise<FlueConversationHistoryPage>
Reads one page (at most `limit` messages) older than a `before` cursor from a bounded `history({ limit })` snapshot, a bounded `observe({ limit })` state, or a previous page. Rejects when the runtime predates bounded history.
- observe(options?: AgentConversationObserveOptions) => AgentConversationObservation
Observes the materialized conversation across history catch-up and live updates.
- attachmentUrl(attachmentId: string) => string
Absolute URL for one `file` part's attachment bytes, suitable as an `<img>`/`<a>` source. The download endpoint is mounted on every agent router; auth composes at the mount in `app.ts` like every other agent route.
- live?ConversationLiveMode
- suggestions?readonly ThreadSuggestion[] | undefined
- isDisabled?boolean | undefined
Whether the entire thread is disabled. When `true`, the composer input cannot be typed into, attachments cannot be added, sends (including direct `composer.send()` calls) are blocked, and messages cannot be edited. For a narrower gate that keeps the input usable but blocks only sending, use `isSendDisabled`.
- isSendDisabled?boolean | undefined
Whether sending new messages is currently disabled. When `true`, the thread composer's input remains usable but `send()` becomes a no-op and the thread composer's `canSend` is `false`. Use this to gate sending on external React state (e.g. while tool config is loading) without disabling the input itself the way `isDisabled` does. Edit composers (saving message edits) intentionally ignore this flag.
- unstable_capabilities?UseFlueRuntimeOptions["unstable_capabilities"]unstable
- UseFlueRuntimeOptions["unstable_capabilities"]
- copy?boolean | undefined
- adapters?UseFlueRuntimeOptions["adapters"]
- UseFlueRuntimeOptions["adapters"]
- attachments?AttachmentAdapter | undefined
- UseFlueRuntimeOptions["adapters"]["attachments"]
- acceptstring
- add(state: { file: File; }) => Promise<PendingAttachment> | AsyncGenerator<PendingAttachment, void>
Returns the pending attachment for the file, or an async generator yielding successive states of that one attachment. Every yield must have the same id.
- remove(attachment: Attachment) => Promise<void>
- send(attachment: PendingAttachment, options?: { signal?: AbortSignal; }) => Promise<CompleteAttachment>
- speech?SpeechSynthesisAdapter | undefined
- UseFlueRuntimeOptions["adapters"]["speech"]
- speak(text: string) => SpeechSynthesisAdapter.Utterance
- dictation?DictationAdapter | undefined
- UseFlueRuntimeOptions["adapters"]["dictation"]
- listen() => DictationAdapter.Session
- disableInputDuringDictation?boolean
- voice?RealtimeVoiceAdapter | undefined
- UseFlueRuntimeOptions["adapters"]["voice"]
- connect(options: { abortSignal?: AbortSignal; }) => RealtimeVoiceAdapter.Session
- feedback?FeedbackAdapter | undefined
- UseFlueRuntimeOptions["adapters"]["feedback"]
- submit(feedback: FeedbackAdapterFeedback) => void
- getSendOptions?((message: AppendMessage) => FlueSendOptions | undefined) | undefined
useFlueRuntimeExtras
Read the complete Flue conversation state exposed by the runtime.
const useFlueRuntimeExtras: () => FlueRuntimeExtras;