State and methods

Every scope's state fields and methods, as read with useAuiState and called through useAui.

Read a scope with useAuiState((s) => s.thread.isRunning) and call its methods through const aui = useAui() from @assistant-ui/vue. A missing required scope throws; s.optional.message and aui.optional.message return undefined when the message scope is absent. See State and actions for provider placement and reactive reads.

Each State table describes the object selected from s.scope; each Methods table describes calls on aui.scope. getState() returns a snapshot for a one-off read.

Threads

threads is available under a provider with a thread list, including the single-thread list used for an external thread.

State

FieldTypeDescription
mainThreadIdstringID of the selected thread.
newThreadIdstring | nullID of the new thread, when one is selected.
isLoadingbooleanWhether the thread list is loading.
loadErrorunknownError from loading the list, when present.
isLoadingMorebooleanWhether another page is loading.
hasMorebooleanWhether another page is available.
threadIdsreadonly string[]IDs of unarchived list items.
archivedThreadIdsreadonly string[]IDs of archived list items.
threadItemsreadonly ThreadListItemState[]State of list items.
mainThreadStateState of the selected thread.

Methods

MethodSignatureDescription
getStategetState(): ThreadsStateRead the current list state.
switchToThreadswitchToThread(threadId: string, options?: { unarchive?: boolean }): voidSelect a thread, optionally unarchiving it.
switchToNewThreadswitchToNewThread(): voidSelect a new thread.
itemitem(selector: "main" | { id: string } | { index: number; archived?: boolean }): ThreadListItemMethodsAccess a list item by selection, ID, or index.
threadthread(selector: "main"): ThreadMethodsAccess the selected thread.
getLoadThreadsPromisegetLoadThreadsPromise(): Promise<void>Wait for the list load to be reported by state or its load error, subject to the client's commit timeout.
reloadreload(): Promise<void>Refetch the thread list.
reloadMainThreadreloadMainThread(): Promise<void>Reload the selected thread.
loadMoreloadMore(): Promise<void>Load the next list page.

Thread list item

threadListItem is set for each ThreadListPrimitiveItems row and can also refer to the selected item at the thread-list provider level.

State

FieldTypeDescription
idstringLocal thread ID.
remoteIdstring | undefinedRemote thread ID, when initialized.
externalIdstring | undefinedExternal thread ID, when present.
titlestring | undefinedThread title.
lastMessageAtDate | undefinedTime of the last message, when known.
statusThreadListItemStatusList item status.
customRecord<string, unknown> | undefinedCustom item data.
isRunningbooleanWhether this thread has a run in progress.

Methods

MethodSignatureDescription
getStategetState(): ThreadListItemStateRead this item's current state.
switchToswitchTo(options?: { unarchive?: boolean }): voidSelect this item, optionally unarchiving it.
renamerename(newTitle: string): voidChange the title.
updateCustomupdateCustom(custom: Record<string, unknown> | undefined): voidReplace custom item data.
archivearchive(): voidArchive this item.
unarchiveunarchive(): voidRestore this item.
deletedelete(): voidDelete this item.
generateTitlegenerateTitle(options?: ThreadListItemGenerateTitleOptions): voidGenerate a title.
initializeinitialize(): Promise<{ remoteId: string; externalId: string | undefined }>Initialize the remote item and return its IDs.
detachdetach(): voidDetach this item from its runtime.

Thread

thread is the selected thread under a provider with a thread runtime; message and part rows retain it.

State

FieldTypeDescription
isEmptybooleanNo messages are present and history is not loading.
isDisabledbooleanNew messages cannot be sent.
isLoadingbooleanHistory is loading.
hasEarlierbooleanEarlier messages are available.
isLoadingEarlierbooleanAn earlier page is loading.
isRunningbooleanA run is in progress, including while client tools execute.
capabilitiesRuntimeCapabilitiesSupported actions, including edit, reload, cancel, attachments, queue, and answerToolCall.
messagesreadonly MessageState[]Messages on the selected branch.
tasksreadonly TaskState[]Nested work derived from tool calls, in document order.
stateReadonlyJSONValueDeprecated experimental thread state.
suggestionsreadonly ThreadSuggestion[]Follow-up suggestions from the runtime.
extrasunknownRuntime-specific extra data.
speechSpeechState | undefinedDeprecated speech state.
voiceVoiceSessionState | undefinedVoice session state.
composerComposerStateThread composer state.

Methods

MethodSignatureDescription
getStategetState(): ThreadStateRead the current thread state.
composercomposer(): ComposerMethodsAccess the thread composer.
suggestionssuggestions(): SuggestionsMethodsAccess the thread suggestions.
tasktask(selector: { index: number } | { id: string }): TaskMethodsAccess nested work by index or tool call ID.
appendappend(message: CreateAppendMessage): voidAppend a message; a string is accepted as user text.
deleteMessagedeleteMessage(messageId: string): void | Promise<void>Delete a message by ID.
startRunstartRun(config: CreateStartRunConfig): voidStart a run from a parent message.
resumeRunresumeRun(config: CreateResumeRunConfig): voidResume a run from a parent message.
cancelRuncancelRun(): voidCancel the current run.
loadEarlierloadEarlier(): Promise<void>Load the page before the first loaded message.
unstable_refetchThreadunstable_refetchThread?(): Promise<void>Refetch in place when supplied; check capabilities.refetchThread for support.
getModelContextgetModelContext(): ModelContextRead the current model context.
exportexport(): ExportedMessageRepositoryExport the message repository.
importimport(repository: ExportedMessageRepository): voidImport a message repository.
resetreset(initialMessages?: readonly ThreadMessageLike[]): voidReset with optional initial messages.
importExternalStateimportExternalState(state: unknown): voidImport runtime-specific external state.
messagemessage(selector: { id: string } | { index: number }): MessageMethodsAccess a message by ID or index.
stopSpeakingstopSpeaking(): voidDeprecated speech control.
connectVoiceconnectVoice(): voidConnect a voice session.
disconnectVoicedisconnectVoice(): voidDisconnect the voice session.
getVoiceVolumegetVoiceVolume(): numberRead the current voice volume.
subscribeVoiceVolumesubscribeVoiceVolume(callback: () => void): UnsubscribeSubscribe to voice volume updates.
muteVoicemuteVoice(): voidMute the voice session.
unmuteVoiceunmuteVoice(): voidUnmute the voice session.

Composer

composer is the thread composer outside a message row and the edit composer inside ThreadPrimitiveMessages.

State

FieldTypeDescription
textstringDraft text.
roleMessageRoleRole of the draft message.
attachmentsreadonly Attachment[]Pending draft attachments.
runConfigRunConfigConfiguration for the next run.
isEditingbooleanWhether a message edit is active.
canCancelbooleanWhether the active run can be canceled.
canSendbooleanWhether this composer can send its draft; a running thread may impose another gate.
attachmentAcceptstringFile picker accept value for this composer.
isEmptybooleanWhether the draft has no content.
type"thread" | "edit"Which composer is selected.
dictationDictationState | undefinedActive dictation state.
quoteQuoteInfo | undefinedQuote for the next message.
queuereadonly QueueItemState[]Messages waiting to be processed.
submissionComposerSubmission | undefinedMessage whose attachments are being prepared for sending.
inTransitreadonly ComposerSubmission[] | undefinedSent messages not yet shown by the runtime.

Methods

MethodSignatureDescription
getStategetState(): ComposerStateRead current composer state.
setTextsetText(text: string): voidReplace draft text.
setRolesetRole(role: MessageRole): voidChange the draft role.
setRunConfigsetRunConfig(runConfig: RunConfig): voidSet configuration for the next run.
addAttachmentaddAttachment(fileOrAttachment: File | CreateAttachment): Promise<void>Add a file or prepared attachment.
clearAttachmentsclearAttachments(): Promise<void>Remove draft attachments.
attachmentattachment(selector: { index: number } | { id: string }): AttachmentMethodsAccess a draft attachment.
resetreset(): Promise<void>Reset the composer.
sendsend(opts?: ComposerSendOptions): voidSend the draft; options include startRun and steer.
cancelcancel(): voidCancel a run or discard an edit, according to composer type.
beginEditbeginEdit(): voidBegin editing the message.
startDictationstartDictation(): voidStart dictation with a configured adapter.
stopDictationstopDictation(): voidStop dictation.
setQuotesetQuote(quote: QuoteInfo | undefined): voidSet or clear the quote.
queueItemqueueItem(selector: { index: number } | { id: string }): QueueItemMethodsAccess a queued message.

Message

message is set inside each ThreadPrimitiveMessages row. Its state includes ThreadMessage fields, whose role determines which fields are present.

State

FieldTypeDescription
idstringMessage ID.
createdAtDateMessage creation time.
roleMessageRolesystem, user, or assistant.
contentThreadMessage["content"]Parts allowed for that role.
metadataThreadMessage["metadata"]Custom metadata and role-specific run data.
attachmentsreadonly CompleteAttachment[] | undefinedDelivered user attachments.
statusMessageStatus | undefinedAssistant message status.
parentIdstring | nullParent message ID on the branch.
isLastbooleanWhether this is the last message on the selected branch.
branchNumbernumberSelected branch number at this message.
branchCountnumberNumber of branches at this message.
speechSpeechState | undefinedDeprecated speech state.
composerComposerStateEdit composer state.
partsreadonly PartState[]Content parts with resolved status.
isCopiedbooleanWhether this message was marked copied.
isHoveringbooleanWhether this message is marked hovered.
indexnumberPosition in the thread, starting at zero.
submissionComposerSubmission | undefinedIn-flight composer submission shown in this row.

Methods

MethodSignatureDescription
getStategetState(): MessageStateRead the current message state.
composercomposer(): ComposerMethodsAccess its edit composer.
deletedelete(): void | Promise<void>Delete this message.
reloadreload(config?: { runConfig?: RunConfig }): voidRegenerate this assistant message.
speakspeak(): voidDeprecated speech control.
stopSpeakingstopSpeaking(): voidDeprecated speech control.
submitFeedbacksubmitFeedback(feedback: { type: "positive" | "negative"; comment?: string }): voidSubmit feedback on this message.
switchToBranchswitchToBranch(options: { position?: "previous" | "next"; branchId?: string }): voidSelect an adjacent branch or a branch by ID.
getCopyTextgetCopyText(): stringGet text for copying.
partpart(selector: { index: number } | { toolCallId: string }): PartMethodsAccess a part by index or tool call ID.
attachmentattachment(selector: { index: number } | { id: string }): AttachmentMethodsAccess a message attachment.
setIsCopiedsetIsCopied(value: boolean): voidSet the copied flag.
setIsHoveringsetIsHovering(value: boolean): voidSet the hovering flag.

Part

part is set inside MessagePrimitiveParts and within ChainOfThoughtPrimitiveParts when a chain-of-thought scope is supplied.

State

PartState is a discriminated union. Read type before accessing fields specific to a part kind. See Message for rendering parts.

FieldTypeDescription
typeThreadUserMessagePart["type"] | ThreadAssistantMessagePart["type"]Part kind.
statusMessagePartStatus | ToolCallMessagePartStatusResolved part status.
idstring | undefinedOptional stable part ID on supported kinds.
parentIdstring | undefinedParent part ID on supported kinds.
providerMetadataPartProviderMetadata | undefinedProvider metadata on supported kinds.
textstringText or reasoning content.
imagestringImage payload on an image part.
filenamestring | undefinedFilename on image, file, or document source parts.
datastring or data payloadFile payload or named data payload, according to kind.
mimeTypestringMIME type on a file part.
sourceType"url" | "id" or "url" | "document"Optional file source form, or required source part kind.
urlstring | undefinedURL on a source part.
titlestring | undefinedTitle on a source part.
mediaTypestringMedia type on a document source part.
audio{ data: string; format: "mp3" | "wav" }Deprecated audio part payload.
namestringName of a data part.
specGenerativeUISpecGenerative UI tree spec.
toolCallIdstringTool invocation ID on a tool-call part.
toolNamestringTool name on a tool-call part.
argsReadonlyJSONObjectTool arguments on a tool-call part.
argsTextstringRaw streamed argument text on a tool-call part.
resultunknownTool result, when present.
isErrorboolean | undefinedWhether the result represents an error.
isPreliminaryboolean | undefinedWhether the result is interim.
artifactunknownUI artifact, when present.
timingMessagePartTiming | ToolCallTiming | undefinedTiming on reasoning and tool-call parts.
unstable_summarystring | undefinedOptional reasoning summary.
modelContentreadonly ToolModelContentPart[] | undefinedContent returned to the model.
mcpToolCallMessagePartMcpMetadata | undefinedMCP app metadata.
interrupt{ type: "human"; payload: unknown } | undefinedHuman input request.
approvalToolCallMessagePart["approval"]Server approval request and resolution.
messagesreadonly ThreadMessage[] | undefinedNested conversation from the tool call.
unstable_interactionsUnstable_ToolInteractionLog | undefinedRecorded tool UI interactions.

Methods

MethodSignatureDescription
getStategetState(): PartStateRead the current part state.
addToolResultaddToolResult(result: unknown | ToolResponse<unknown>): voidAdd a missing tool result.
resumeToolCallresumeToolCall(payload: unknown): voidResume a tool call waiting for human input.
respondToToolApprovalrespondToToolApproval(response: ToolApprovalResponse): Promise<void>Answer a server-side approval request.
unstable_recordInteractionunstable_recordInteraction?(input: Unstable_ToolInteractionInput): Promise<void>Record a tool UI interaction when supported.

Attachment

attachment is set inside ComposerPrimitiveAttachments or MessagePrimitiveAttachments through AttachmentByIndexProvider.

State

FieldTypeDescription
idstringAttachment ID.
typestringAttachment kind, commonly image, document, or file.
namestringAttachment name.
contentTypestring | undefinedMIME type, when known.
fileFile | undefinedSource file; required while pending.
contentThreadUserMessagePart[] | undefinedContent parts; required when complete.
statusAttachmentStatusUpload state or completion state.

Methods

MethodSignatureDescription
getStategetState(): AttachmentStateRead attachment state.
removeremove(): Promise<void>Remove the attachment.

Suggestions

suggestions belongs to the current thread under a provider with a thread runtime, including outside ThreadPrimitiveSuggestions.

State

FieldTypeDescription
suggestionsSuggestion[]Current suggestion entries, each with title, label, and prompt strings.

Methods

MethodSignatureDescription
getStategetState(): SuggestionsStateRead the suggestion list.
suggestionsuggestion(query: { index: number }): SuggestionMethodsAccess a suggestion by index.

Suggestion

suggestion is set for each ThreadPrimitiveSuggestions item.

State

FieldTypeDescription
titlestringSuggestion heading.
labelstringSecondary display text.
promptstringText used when this suggestion is selected.

Methods

MethodSignatureDescription
getStategetState(): SuggestionStateRead this suggestion.

Chain of thought

chainOfThought is available only when a provider supplies that scope; Vue's chain-of-thought primitives consume it but do not create it.

State

FieldTypeDescription
partsreadonly ChainOfThoughtPart[]Reasoning and tool-call parts in this group.
collapsedbooleanWhether the group is collapsed.
statusMessagePartStatus | ToolCallMessagePartStatusStatus of the group.

Methods

MethodSignatureDescription
getStategetState(): ChainOfThoughtStateRead the group state.
setCollapsedsetCollapsed(collapsed: boolean): voidSet the collapsed state.
partpart(selector: { index: number }): PartMethodsAccess a part within the group.

Model context

modelContext is available under an AuiProvider configured with a model context scope.

State

FieldTypeDescription
modelNamestring | undefinedConfigured model name.
toolNamesreadonly string[]Names of registered model tools.

Methods

MethodSignatureDescription
getStategetState(): ModelContextStateRead model context state.
getModelContextgetModelContext(): ModelContextRead the merged model context.
subscribesubscribe?(callback: () => void): UnsubscribeSubscribe to model context changes, when implemented by the provider.
registerregister(provider: ModelContextProvider): UnsubscribeRegister a model context provider; call the returned function to unregister it.

Tools

tools is available under an AuiProvider configured with the tools scope; MessagePrimitiveParts reads it to render registered tool UIs.

State

FieldTypeDescription
toolUIsRecord<string, readonly ToolRegistration[]>UI registrations by tool name, with renderer and presentation options.
mcpAppMcpAppResourceOutput | undefinedMCP app renderer, when configured.

Methods

MethodSignatureDescription
getStategetState(): ToolsStateRead registered tool UIs.
setToolUIsetToolUI(toolName: string, render: ToolCallMessagePartComponent, options?: { standalone?: boolean }): UnsubscribeRegister a tool UI and return its cleanup function.

Data renderers

dataRenderers is available under an AuiProvider configured with that scope; MessagePrimitiveParts reads it for data parts.

State

FieldTypeDescription
renderersRecord<string, DataMessagePartComponent[]>Data UI renderers by part name.
fallbacksDataMessagePartComponent[]Fallback data UI renderers.

Methods

MethodSignatureDescription
getStategetState(): DataRenderersStateRead registered data renderers.
setDataUIsetDataUI(name: string, render: DataMessagePartComponent): UnsubscribeRegister a named renderer and return its cleanup function.
setFallbackDataUIsetFallbackDataUI(render: DataMessagePartComponent): UnsubscribeRegister a fallback and return its cleanup function.

The queueItem, task, interactables, and unstable_interactables scopes also exist, but no Vue primitive uses them.