> ## Documentation Index
> Fetch the complete documentation index at: https://veryfront.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# veryfront/chat

> Chat UI components and streaming hooks.

## Import

```ts theme={null}
import {
  Chat,
  useChat,
  useAgent,
  AgentCard,
  Message,
  buildChatStreamChunkMessageMetadata,
} from "veryfront/chat";
```

## Examples

### Basic chat (preset)

```tsx theme={null}
import { Chat, useChat } from "veryfront/chat";

export default function Page() {
  const chat = useChat();
  return (
    <Chat
      messages={chat.messages}
      input={chat.input}
      onChange={chat.handleInputChange}
      onSubmit={chat.handleSubmit}
    />
  );
}
```

### Custom layout (composition)

```tsx theme={null}
import { Chat, useChat } from "veryfront/chat";

export default function Page() {
  const chat = useChat();
  return (
    <Chat.Root messages={chat.messages} input={chat.input}>
      <Chat.Empty title="Ask me anything" />
      <Chat.MessageList messages={chat.messages} />
      <Chat.Composer input={chat.input} onChange={chat.handleInputChange} onSubmit={chat.handleSubmit} />
    </Chat.Root>
  );
}
```

### Per-message control (compound)

```tsx theme={null}
import { Message } from "veryfront/chat";

<Message.Root message={msg}>
  <Message.Avatar />
  <Message.Content />
  <Message.Actions />
</Message.Root>
```

## Type Reference

### `UseChatOptions`

Options accepted by use chat.

| Property           | Type                                                        | Description                                                                              | Source                                                                                                |
| ------------------ | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `api?`             | `string`                                                    | AG-UI endpoint. Defaults to "/api/ag-ui".                                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L54) |
| `transport?`       | `"ag-ui"`                                                   | Streaming response protocol used by the endpoint. AG-UI is the default.                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L56) |
| `initialMessages?` | `ChatMessage[]`                                             | Pre-populated messages                                                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L57) |
| `body?`            | <code>Record\<string, unknown></code>                       | Extra body fields sent with each request                                                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L58) |
| `headers?`         | <code>Record\<string, string></code>                        | Custom request headers                                                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L59) |
| `credentials?`     | `RequestCredentials`                                        | Fetch credentials mode                                                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L60) |
| `model?`           | `string`                                                    | Override model at runtime (e.g. "openai/gpt-4o", "Anthropic/claude-sonnet-4-5-20250929") | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L62) |
| `onResponse?`      | <code>(response: Response) => void</code>                   | Raw response callback                                                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L63) |
| `onFinish?`        | <code>(message: ChatMessage) => void</code>                 | Completion callback                                                                      | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L64) |
| `onError?`         | <code>(error: Error) => void</code>                         | Error callback                                                                           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L65) |
| `onToolCall?`      | <code>(arg: OnToolCallArg) => void \| Promise\<void></code> | Tool call handler for client-side execution                                              | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L66) |

### `UseChatResult`

Result returned from use chat.

| Property            | Type                                                                                  | Description                                                                                | Source                                                                                                 |
| ------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
| `messages`          | `ChatMessage[]`                                                                       | All messages in the conversation                                                           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L77)  |
| `input`             | `string`                                                                              | Current input value                                                                        | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L78)  |
| `isLoading`         | `boolean`                                                                             | Whether a request is in flight                                                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L79)  |
| `error`             | `Error \| null`                                                                       | Last error (if any)                                                                        | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L80)  |
| `model`             | `string \| undefined`                                                                 | Current model override (undefined = use agent default)                                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L82)  |
| `activeModel`       | `string \| undefined`                                                                 | The actual model being used after auto-upgrade (e.g. "Anthropic/claude-sonnet-4-20250514") | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L84)  |
| `inferenceMode`     | `InferenceMode`                                                                       | Where inference is currently happening                                                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L86)  |
| `setInput`          | <code>(input: string) => void</code>                                                  | Set input value                                                                            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L87)  |
| `setModel`          | <code>(model: string \| undefined) => void</code>                                     | Change the model for subsequent requests                                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L89)  |
| `sendMessage`       | <code>(message: \{ text: string }) => Promise\<void></code>                           | Send a message programmatically                                                            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L90)  |
| `editMessage`       | <code>(messageId: string, newText: string) => Promise\<void></code>                   | Edit a user message and resubmit - truncates history to that point                         | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L92)  |
| `getBranches`       | <code>(messageId: string) => BranchInfo</code>                                        | Get branch info for a message (returns { current, total }; total=1 if no branches)         | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L94)  |
| `switchBranch`      | <code>(messageId: string, branchIndex: number) => void</code>                         | Switch to a different branch at a given message                                            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L96)  |
| `reload`            | <code>() => Promise\<void></code>                                                     | Re-send last user message                                                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L97)  |
| `stop`              | <code>() => void</code>                                                               | Abort current request                                                                      | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L98)  |
| `setMessages`       | <code>(messages: ChatMessage\[]) => void</code>                                       | Replace message history                                                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L99)  |
| `addToolOutput`     | <code>(output: ToolOutput) => void</code>                                             | Submit client-side tool result                                                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L100) |
| `data?`             | `unknown`                                                                             | Extra data from server response                                                            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L101) |
| `handleInputChange` | <code>(e: React.ChangeEvent\<HTMLInputElement \| HTMLTextAreaElement>) => void</code> | Bind to input onChange                                                                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L102) |
| `handleSubmit`      | <code>(e?: React.FormEvent) => Promise\<void></code>                                  | Submit current input                                                                       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L103) |
| `onChange`          | <code>(e: React.ChangeEvent\<HTMLInputElement \| HTMLTextAreaElement>) => void</code> | Alias for `handleInputChange` - matches `ChatProps.onChange` for easy spreading            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L105) |
| `onSubmit`          | <code>(e?: React.FormEvent) => Promise\<void></code>                                  | Alias for `handleSubmit` - matches `ChatProps.onSubmit` for easy spreading                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L107) |
| `onModelChange`     | <code>(model: string \| undefined) => void</code>                                     | Alias for `setModel` - matches `ChatProps.onModelChange` for easy spreading                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L109) |

### `UseAgentOptions`

Options accepted by use agent.

| Property        | Type                                                       | Description                        | Source                                                                                           |
| --------------- | ---------------------------------------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------ |
| `agent`         | `string`                                                   | Agent ID or endpoint               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L8)  |
| `onToolCall?`   | <code>(toolCall: ToolCall) => void</code>                  | Callback when tool is called       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L11) |
| `onToolResult?` | <code>(toolCall: ToolCall, result: unknown) => void</code> | Callback when tool result received | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L14) |
| `onError?`      | <code>(error: Error) => void</code>                        | Callback when error occurs         | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L17) |

### `UseAgentResult`

Result returned from use agent.

| Property    | Type                                           | Description             | Source                                                                                           |
| ----------- | ---------------------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------ |
| `messages`  | `AgentMessage[]`                               | Message history         | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L23) |
| `toolCalls` | `ToolCall[]`                                   | Active tool calls       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L26) |
| `status`    | `AgentStatus`                                  | Agent status            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L29) |
| `thinking?` | `string`                                       | Thinking/reasoning text | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L32) |
| `invoke`    | <code>(input: string) => Promise\<void></code> | Invoke the agent        | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L35) |
| `stop`      | <code>() => void</code>                        | Stop agent execution    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L38) |
| `isLoading` | `boolean`                                      | Loading state           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L41) |
| `error`     | `Error \| null`                                | Error state             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L44) |

## Exports

### Components

| Name                                          | Description                                                                                                                                                              | Source                                                                                                                               |
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
| `AgentCard`                                   | Render agent card.                                                                                                                                                       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/agent-card.tsx#L37)                         |
| `AttachmentPill`                              | Render attachment pill.                                                                                                                                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/attachment-pill.tsx#L41)    |
| `BranchPicker`                                | Render branch picker.                                                                                                                                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/branch-picker.tsx#L13)      |
| `Chat`                                        | Render chat.                                                                                                                                                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/index.tsx#L262)                        |
| `ChatComponents`                              | Render chat components.                                                                                                                                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/index.tsx#L517)                        |
| `ChatComposer`                                | Render chat composer.                                                                                                                                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/chat-composer.tsx#L54)     |
| `ChatContextProvider`                         | Render chat context provider.                                                                                                                                            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/chat-context.tsx#L85)         |
| `ChatEmpty`                                   | Render chat empty.                                                                                                                                                       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/chat-empty.tsx#L26)        |
| `ChatIf`                                      | Render chat if.                                                                                                                                                          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/chat-if.tsx#L19)           |
| `ChatMessageList`                             | Render chat message list.                                                                                                                                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/chat-message-list.tsx#L75) |
| `ChatRoot`                                    | Render chat root.                                                                                                                                                        | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/chat-root.tsx#L70)         |
| `ChatSidebar`                                 | Render chat sidebar.                                                                                                                                                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/sidebar.tsx#L136)           |
| `ChatWithSidebar`                             | Render chat with sidebar.                                                                                                                                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat-with-sidebar.tsx#L136)                 |
| `ComposerContextProvider`                     | Render composer context provider.                                                                                                                                        | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/composer-context.tsx#L66)     |
| `ConversationEmptyState`                      | State for conversation empty.                                                                                                                                            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/empty-state.tsx#L71)        |
| `ConversationScrollButton`                    | Render conversation scroll button.                                                                                                                                       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/empty-state.tsx#L110)       |
| `DEFAULT_CHAT_STREAM_IDLE_TIMEOUT_MS`         | Default value for chat stream idle timeout ms.                                                                                                                           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/stream-watchdog.ts#L4)                                       |
| `DEFAULT_CHAT_STREAM_TOOL_RUNNING_TIMEOUT_MS` | Default value for chat stream tool running timeout ms.                                                                                                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/stream-watchdog.ts#L6)                                       |
| `DropZoneOverlay`                             | Render drop zone overlay.                                                                                                                                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/drop-zone.tsx#L11)          |
| `ErrorBanner`                                 | Render error banner.                                                                                                                                                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/error-banner.tsx#L19)      |
| `FadeIn`                                      | Render fade in.                                                                                                                                                          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/animations.tsx#L37)         |
| `InferenceBadge`                              | Render inference badge.                                                                                                                                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/inference-badge.tsx#L10)    |
| `InlineCitation`                              | Render inline citation.                                                                                                                                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/inline-citation.tsx#L14)    |
| `Loader`                                      | Render loader.                                                                                                                                                           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/animations.tsx#L14)         |
| `Message`                                     | Message shape for message.                                                                                                                                               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/message.tsx#L343)          |
| `MessageActions`                              | Render message actions.                                                                                                                                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/message-actions.tsx#L17)    |
| `MessageContextProvider`                      | Render message context provider.                                                                                                                                         | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/message-context.tsx#L56)      |
| `MessageEditForm`                             | Render message edit form.                                                                                                                                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/message-edit-form.tsx#L12)  |
| `MessageFeedback`                             | Render message feedback.                                                                                                                                                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/message-feedback.tsx#L19)   |
| `ModelAvatar`                                 | Render model avatar.                                                                                                                                                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/model-avatar.tsx#L65)      |
| `ModelSelector`                               | Render model selector.                                                                                                                                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/model-selector.tsx#L57)                     |
| `QuickActions`                                | Render quick actions.                                                                                                                                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/quick-actions.tsx#L20)      |
| `ReasoningCard`                               | Render reasoning card.                                                                                                                                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/reasoning.tsx#L14)          |
| `RichCodeBlock`                               | Render rich code block.                                                                                                                                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/code-block.tsx#L14)         |
| `Shimmer`                                     | Render shimmer.                                                                                                                                                          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/animations.tsx#L5)          |
| `SkillBadge`                                  | Render skill badge.                                                                                                                                                      | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/skill-badge.tsx#L18)        |
| `Sources`                                     | Render sources.                                                                                                                                                          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/sources.tsx#L20)            |
| `StandaloneMessage`                           | Render a standalone chat message.                                                                                                                                        | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/message.tsx#L46)                            |
| `StepIndicator`                               | Render step indicator.                                                                                                                                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/step-indicator.tsx#L13)     |
| `StreamingMessage`                            | Message shape for streaming.                                                                                                                                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/message.tsx#L151)                           |
| `Suggestion`                                  | Render suggestion.                                                                                                                                                       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/empty-state.tsx#L14)        |
| `Suggestions`                                 | Render suggestions.                                                                                                                                                      | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/empty-state.tsx#L49)        |
| `TabSwitcher`                                 | Render tab switcher.                                                                                                                                                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/tab-switcher.tsx#L28)       |
| `ThreadListContextProvider`                   | Render thread list context provider.                                                                                                                                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/thread-list-context.tsx#L47)  |
| `ToolCallCard`                                | Tool call card component - renders tool invocations with parameters and results Styled to match AI Elements ([https://ai-sdk.dev/elements](https://ai-sdk.dev/elements)) | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/tool-ui.tsx#L140)           |
| `ToolStatusBadge`                             | Render tool status badge.                                                                                                                                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/tool-ui.tsx#L45)            |
| `UploadsPanel`                                | Render uploads panel.                                                                                                                                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/uploads-panel.tsx#L30)      |

### Functions

| Name                                  | Description                                                                                                                                               | Source                                                                                                                              |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `buildChatStreamChunkMessageMetadata` | Builds chat stream chunk message metadata.                                                                                                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/chat-ui-message-helpers.ts#L142)                            |
| `createChatStreamWatchdog`            | Create chat stream watchdog.                                                                                                                              | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/stream-watchdog.ts#L156)                                    |
| `createChatStreamWatchdogState`       | State for create chat stream watchdog.                                                                                                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/stream-watchdog.ts#L49)                                     |
| `dedupeChatUiMessageChunks`           | Dedupe chat UI message chunks.                                                                                                                            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/chat-ui-message-helpers.ts#L192)                            |
| `downloadMarkdown`                    | Download messages as a .md file.                                                                                                                          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/utils/export.ts#L64)                  |
| `exportAsMarkdown`                    | Convert chat messages to a markdown string.                                                                                                               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/utils/export.ts#L12)                  |
| `extractChatMessageMetadata`          | Extract chat message metadata.                                                                                                                            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/chat-ui-message-helpers.ts#L136)                            |
| `extractSourcesFromParts`             | Extract sources from tool result parts. Looks for `documents` arrays in tool outputs and maps them to Source\[].                                          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/utils/message-parts.ts#L156)          |
| `getNextChatStreamWatchdogState`      | State for get next chat stream watchdog.                                                                                                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/stream-watchdog.ts#L81)                                     |
| `getTextContent`                      | Get text content from chat message parts                                                                                                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/utils/message-parts.ts#L15)           |
| `groupPartsInOrder`                   | Group consecutive parts for ordered rendering Returns an array of groups, each containing either consecutive text parts, a tool part, or a reasoning part | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/utils/message-parts.ts#L100)          |
| `isHeartbeatOnlyMetadataChunk`        | Check whether a chunk only carries heartbeat metadata.                                                                                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/stream-watchdog.ts#L151)                                    |
| `isLongRunningToolRunning`            | Check whether a long-running tool is active.                                                                                                              | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/stream-watchdog.ts#L69)                                     |
| `isReasoningPart`                     | Check if a part is a reasoning part                                                                                                                       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/utils/message-parts.ts#L81)           |
| `isSkillToolPart`                     | Check if a tool part is a skill-related tool.                                                                                                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/utils/message-parts.ts#L76)           |
| `isToolPart`                          | Check if a part is a tool part                                                                                                                            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/utils/message-parts.ts#L31)           |
| `mapHostedStreamPartToChatUiChunks`   | Map hosted stream part to chat UI chunks.                                                                                                                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/hosted-ui-chunk-mapping.ts#L219)                            |
| `normalizeChatMessageMetadata`        | Normalizes chat message metadata.                                                                                                                         | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/chat-ui-message-helpers.ts#L111)                            |
| `normalizeChatUiMessageChunk`         | Normalizes chat UI message chunk.                                                                                                                         | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/chat-ui-message-helpers.ts#L161)                            |
| `normalizeChatUiMessageStream`        | Normalizes chat UI message stream.                                                                                                                        | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/chat-ui-message-helpers.ts#L254)                            |
| `useAgent`                            | React hook for agent.                                                                                                                                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L48)                                    |
| `useChat`                             |                                                                                                                                                           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/use-chat.ts#L75)                            |
| `useChatContext`                      | Context for use chat.                                                                                                                                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/chat-context.tsx#L69)        |
| `useChatContextOptional`              | React hook for chat context optional.                                                                                                                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/chat-context.tsx#L80)        |
| `useChatErrorHandler`                 | Handler for use chat error.                                                                                                                               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/error-boundary.tsx#L93)                    |
| `useCompletion`                       | useCompletion hook for single text generation                                                                                                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-completion.ts#L55)                               |
| `useComposerContext`                  | Context for use composer.                                                                                                                                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/composer-context.tsx#L50)    |
| `useComposerContextOptional`          | React hook for composer context optional.                                                                                                                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/composer-context.tsx#L61)    |
| `useMessageContext`                   | Context for use message.                                                                                                                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/message-context.tsx#L40)     |
| `useMessageContextOptional`           | React hook for message context optional.                                                                                                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/message-context.tsx#L51)     |
| `useStreaming`                        | React hook for streaming.                                                                                                                                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-streaming.ts#L41)                                |
| `useThreadListContext`                | Context for use thread list.                                                                                                                              | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/thread-list-context.tsx#L31) |
| `useThreadListContextOptional`        | React hook for thread list context optional.                                                                                                              | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/thread-list-context.tsx#L42) |
| `useThreads`                          | React hook for threads.                                                                                                                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/hooks/use-threads.ts#L84)             |
| `useVoiceInput`                       | Input payload for use voice.                                                                                                                              | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-voice-input.ts#L101)                             |

### Classes

| Name                         | Description                               | Source                                                                                                           |
| ---------------------------- | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `ChatErrorBoundary`          | Implement chat error boundary.            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/error-boundary.tsx#L17) |
| `ChatStreamIdleTimeoutError` | Error shape for chat stream idle timeout. | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/stream-watchdog.ts#L33)                  |

### Types

| Name                                       | Description                                                      | Source                                                                                                                               |
| ------------------------------------------ | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `AgentCardProps`                           | Props accepted by agent card.                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/agent-card.tsx#L13)                         |
| `AgentTheme`                               | Public API contract for agent theme.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/theme.ts#L160)                              |
| `AttachmentInfo`                           | Public API contract for attachment info.                         | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/attachment-pill.tsx#L5)     |
| `AttachmentPillProps`                      | Props accepted by attachment pill.                               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/attachment-pill.tsx#L15)    |
| `BranchInfo`                               | Public API contract for branch info.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L70)                                |
| `BranchPickerProps`                        | Props accepted by branch picker.                                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/branch-picker.tsx#L5)       |
| `BuildChatStreamChunkMessageMetadataInput` | Input payload for build chat stream chunk message metadata.      | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/chat-ui-message-helpers.ts#L9)                               |
| `ChatComposerProps`                        | Props accepted by chat composer.                                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/chat-composer.tsx#L19)     |
| `ChatContextValue`                         | Public API contract for chat context value.                      | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/chat-context.tsx#L20)         |
| `ChatDynamicToolPart`                      | Public API contract for chat dynamic tool part.                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L55)                                             |
| `ChatEmptyProps`                           | Props accepted by chat empty.                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/chat-empty.tsx#L13)        |
| `ChatErrorBoundaryProps`                   | Props accepted by chat error boundary.                           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/error-boundary.tsx#L4)                      |
| `ChatFinishReason`                         | Public API contract for chat finish reason.                      | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L150)                                            |
| `ChatIfProps`                              | Props accepted by chat if.                                       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/chat-if.tsx#L12)           |
| `ChatMessage`                              | Message shape for chat.                                          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L88)                                             |
| `ChatMessageListProps`                     | Props accepted by chat message list.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/chat-message-list.tsx#L44) |
| `ChatMessageMetadata`                      | Public API contract for chat message metadata.                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L134)                                            |
| `ChatMessageMetadataUsage`                 | Public API contract for chat message metadata usage.             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L97)                                             |
| `ChatMessagePart`                          | Public API contract for chat message part.                       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L78)                                             |
| `ChatProps`                                | Props accepted by chat.                                          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/index.tsx#L194)                        |
| `ChatReasoningPart`                        | Chat message part that carries reasoning text.                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L18)                                             |
| `ChatRootProps`                            | Props accepted by chat root.                                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/chat-root.tsx#L25)         |
| `ChatSidebarProps`                         | Props accepted by chat sidebar.                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/sidebar.tsx#L7)             |
| `ChatStepPart`                             | Public API contract for chat step part.                          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L66)                                             |
| `ChatStreamEvent`                          | Event emitted for chat stream.                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L165)                                            |
| `ChatStreamWatchdogOptions`                | Options accepted by chat stream watchdog.                        | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/stream-watchdog.ts#L24)                                      |
| `ChatStreamWatchdogPhase`                  | Public API contract for chat stream watchdog phase.              | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/stream-watchdog.ts#L9)                                       |
| `ChatStreamWatchdogState`                  | State for chat stream watchdog.                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/stream-watchdog.ts#L16)                                      |
| `ChatTab`                                  | Public API contract for chat tab.                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/tab-switcher.tsx#L13)       |
| `ChatTextPart`                             | Chat message part that carries text.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L11)                                             |
| `ChatTheme`                                | Public API contract for chat theme.                              | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/theme.ts#L121)                              |
| `ChatToolPart`                             | Public API contract for chat tool part.                          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L35)                                             |
| `ChatToolResultPart`                       | Chat message part that carries a tool result.                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L46)                                             |
| `ChatToolState`                            | State for chat tool.                                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L27)                                             |
| `ChatUiMessageChunk`                       | Public API contract for chat UI message chunk.                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L342)                                            |
| `ChatWithSidebarAttachmentConfig`          | Configuration used by chat with sidebar attachment.              | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat-with-sidebar.tsx#L60)                  |
| `ChatWithSidebarChatController`            | Public API contract for chat with sidebar chat controller.       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat-with-sidebar.tsx#L18)                  |
| `ChatWithSidebarFeatureConfig`             | Configuration used by chat with sidebar feature.                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat-with-sidebar.tsx#L87)                  |
| `ChatWithSidebarGroupedProps`              | Props accepted by chat with sidebar grouped.                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat-with-sidebar.tsx#L114)                 |
| `ChatWithSidebarMessageConfig`             | Configuration used by chat with sidebar message.                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat-with-sidebar.tsx#L79)                  |
| `ChatWithSidebarModelConfig`               | Configuration used by chat with sidebar model.                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat-with-sidebar.tsx#L55)                  |
| `ChatWithSidebarProps`                     | Props accepted by chat with sidebar.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat-with-sidebar.tsx#L133)                 |
| `ChatWithSidebarQuickActionsConfig`        | Configuration used by chat with sidebar quick actions.           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat-with-sidebar.tsx#L71)                  |
| `ChatWithSidebarSidebarConfig`             | Configuration used by chat with sidebar sidebar.                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat-with-sidebar.tsx#L44)                  |
| `ChatWithSidebarTabsConfig`                | Configuration used by chat with sidebar tabs.                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat-with-sidebar.tsx#L97)                  |
| `ChatWithSidebarVoiceConfig`               | Configuration used by chat with sidebar voice.                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat-with-sidebar.tsx#L108)                 |
| `ChildRunAudit`                            | Public API contract for child run audit.                         | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L122)                                            |
| `ChildRunAuditToolCall`                    | Public API contract for child run audit tool call.               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L107)                                            |
| `ChildRunAuditToolResult`                  | Result returned from child run audit tool.                       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L114)                                            |
| `CodeBlockProps`                           | Props accepted by code block.                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/code-block.tsx#L6)          |
| `ComposerContextValue`                     | Public API contract for composer context value.                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/composer-context.tsx#L16)     |
| `ConversationEmptyStateProps`              | Props accepted by conversation empty state.                      | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/empty-state.tsx#L62)        |
| `ConversationScrollButtonProps`            | Props accepted by conversation scroll button.                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/empty-state.tsx#L103)       |
| `DropZoneOverlayProps`                     | Props accepted by drop zone overlay.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/drop-zone.tsx#L5)           |
| `ErrorBannerProps`                         | Props accepted by error banner.                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/error-banner.tsx#L12)      |
| `FeedbackValue`                            | Public API contract for feedback value.                          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/message-feedback.tsx#L5)    |
| `HostedStreamPartForUiChunkMapping`        | Public API contract for hosted stream part for UI chunk mapping. | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/hosted-ui-chunk-mapping.ts#L30)                              |
| `HostedUiChunkMappingOptions`              | Options accepted by hosted UI chunk mapping.                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/hosted-ui-chunk-mapping.ts#L4)                               |
| `InferenceBadgeProps`                      | Props accepted by inference badge.                               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/inference-badge.tsx#L5)     |
| `InferenceMode`                            | Where inference is happening.                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L15)                                |
| `InlineCitationProps`                      | Props accepted by inline citation.                               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/inline-citation.tsx#L6)     |
| `MessageActionsProps`                      | Props accepted by message actions.                               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/message-actions.tsx#L9)     |
| `MessageContextValue`                      | Public API contract for message context value.                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/message-context.tsx#L17)      |
| `MessageEditFormProps`                     | Props accepted by message edit form.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/message-edit-form.tsx#L5)   |
| `MessageFeedbackProps`                     | Props accepted by message feedback.                              | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/message-feedback.tsx#L8)    |
| `MessageProps`                             | Props accepted by message.                                       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/message.tsx#L7)                             |
| `MessageRootProps`                         | Props accepted by message root.                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/message.tsx#L58)           |
| `ModelAvatarProps`                         | Props accepted by model avatar.                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/composition/model-avatar.tsx#L14)      |
| `ModelOption`                              | A "provider/model" value and its display label.                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/model-selector.tsx#L15)                     |
| `ModelSelectorProps`                       | Props accepted by `<ModelSelector>`.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/model-selector.tsx#L29)                     |
| `OnToolCallArg`                            | Public API contract for on tool call arg.                        | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L42)                                |
| `PartGroup`                                | Part group types for ordered rendering                           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/utils/message-parts.ts#L90)            |
| `QuickAction`                              | Public API contract for quick action.                            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/quick-actions.tsx#L5)       |
| `QuickActionsProps`                        | Props accepted by quick actions.                                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/quick-actions.tsx#L13)      |
| `SkillBadgeProps`                          | Props accepted by skill badge.                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/skill-badge.tsx#L12)        |
| `Source`                                   | Public API contract for source.                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/sources.tsx#L5)             |
| `SourcesProps`                             | Props accepted by sources.                                       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/sources.tsx#L13)            |
| `StepIndicatorProps`                       | Props accepted by step indicator.                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/step-indicator.tsx#L6)      |
| `StreamingMessageProps`                    | Props accepted by streaming message.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/message.tsx#L136)                           |
| `SuggestionProps`                          | Props accepted by suggestion.                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/empty-state.tsx#L6)         |
| `SuggestionsProps`                         | Props accepted by suggestions.                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/empty-state.tsx#L42)        |
| `TabSwitcherProps`                         | Props accepted by tab switcher.                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/tab-switcher.tsx#L16)       |
| `Thread`                                   | Public API contract for thread.                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/hooks/use-threads.ts#L6)               |
| `ThreadListContextValue`                   | Public API contract for thread list context value.               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/contexts/thread-list-context.tsx#L15)  |
| `ToolOutput`                               | Output from tool.                                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L33)                                |
| `UploadedFile`                             | Public API contract for uploaded file.                           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/uploads-panel.tsx#L6)       |
| `UploadsPanelProps`                        | Props accepted by uploads panel.                                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/components/uploads-panel.tsx#L15)      |
| `UseAgentOptions`                          | Options accepted by use agent.                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L6)                                      |
| `UseAgentResult`                           | Result returned from use agent.                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-agent.ts#L21)                                     |
| `UseChatOptions`                           | Options accepted by use chat.                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L52)                                |
| `UseChatResult`                            | Result returned from use chat.                                   | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-chat/types.ts#L76)                                |
| `UseCompletionOptions`                     | Options accepted by use completion.                              | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-completion.ts#L11)                                |
| `UseCompletionResult`                      | Result returned from use completion.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-completion.ts#L32)                                |
| `UseStreamingOptions`                      | Options accepted by use streaming.                               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-streaming.ts#L5)                                  |
| `UseStreamingResult`                       | Result returned from use streaming.                              | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-streaming.ts#L20)                                 |
| `UseThreadsOptions`                        | Options accepted by use threads.                                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/hooks/use-threads.ts#L19)              |
| `UseThreadsResult`                         | Result returned from use threads.                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/react/components/chat/chat/hooks/use-threads.ts#L25)              |
| `UseVoiceInputOptions`                     | Options accepted by use voice input.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-voice-input.ts#L4)                                |
| `UseVoiceInputResult`                      | Result returned from use voice input.                            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/agent/react/use-voice-input.ts#L28)                               |

## Deep imports

These import paths group focused functionality under this module. Each is a separate barrel; import only what you need.

### `veryfront/chat/message-prep`

```ts theme={null}
import { compactForStep, compressTurn, dedupeToolHistory } from "veryfront/chat/message-prep";
```

#### Functions

| Name                                         | Description                                           | Source                                                                                         |
| -------------------------------------------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| `compactForStep`                             | Compact for step.                                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L1086) |
| `compressTurn`                               | Compress turn.                                        | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L41)   |
| `dedupeToolHistory`                          | Dedupe tool history.                                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L1107) |
| `enforceTokenBudget`                         | Enforce token budget.                                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L1174) |
| `enforceTokenBudgetWithTurnCompression`      | Enforce token budget with turn compression.           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L116)  |
| `ensureToolCallInputs`                       | Ensure tool call inputs helper.                       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L1055) |
| `estimateOverhead`                           | Estimate overhead.                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L1049) |
| `estimateTokens`                             | Estimate tokens.                                      | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L31)   |
| `isModelSupportedFileMediaType`              | Check whether the model supports the file media type. | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L217)  |
| `maskOldToolOutputs`                         | Mask old tool outputs.                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L818)  |
| `normalizeMessageFilePartMediaTypes`         | Normalizes message file part media types.             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L223)  |
| `prepareProviderModelMessagesFromUiMessages` | Prepare provider model messages from UI messages.     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L558)  |
| `repairToolPairs`                            | Repair tool pairs.                                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L906)  |
| `rewriteUnsupportedFilePartsAsAnnotations`   | Rewrite unsupported file parts as annotations.        | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L250)  |
| `sanitizeProviderModelMessages`              | Sanitize provider model messages.                     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L449)  |
| `stripPendingToolParts`                      | Strip pending tool parts.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L345)  |

#### Types

| Name                                                | Description                                                           | Source                                                                                       |
| --------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| `PrepareProviderModelMessagesFromUiMessagesOptions` | Options accepted by prepare provider model messages from UI messages. | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/message-prep.ts#L26) |

### `veryfront/chat/types`

```ts theme={null}
import { buildDataFileAnnotation, isImageFile, isTextPreviewFile } from "veryfront/chat/types";
```

#### Functions

| Name                                 | Description                                       | Source                                                                                 |
| ------------------------------------ | ------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `buildDataFileAnnotation`            | Builds data file annotation.                      | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L634) |
| `isImageFile`                        | Check whether a file is an image.                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L592) |
| `isTextPreviewFile`                  | Check whether a file supports text preview.       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L606) |
| `isValidImageFile`                   | Check whether a file is a supported image upload. | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L597) |
| `normalizeInlineAttachmentMediaType` | Normalizes inline attachment media type.          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L611) |

#### Types

| Name                       | Description                                              | Source                                                                                    |
| -------------------------- | -------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `ChatAssistantContentPart` | Public API contract for chat assistant content part.     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L250)    |
| `ChatAssistantMessage`     | Message shape for chat assistant.                        | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L271)    |
| `ChatDataUiPart`           | Chat UI part that carries custom data chunks.            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L161)    |
| `ChatDynamicToolUiPart`    | Tool UI part for a runtime-selected tool name.           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L149)    |
| `ChatFileUiPart`           | Public API contract for chat file UI part.               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L107)    |
| `ChatMessageMetadata`      | Public API contract for chat message metadata.           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L134) |
| `ChatMessageMetadataUsage` | Public API contract for chat message metadata usage.     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L97)  |
| `ChatModelFilePart`        | Public API contract for chat model file part.            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L204)    |
| `ChatModelReasoningPart`   | Provider model message part that carries reasoning text. | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L196)    |
| `ChatModelTextPart`        | Provider model message part that carries text.           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L190)    |
| `ChatNamedToolUiPart`      | Tool UI part keyed by a static tool type.                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L155)    |
| `ChatReasoningUiPart`      | Public API contract for chat reasoning UI part.          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L77)     |
| `ChatRequestContext`       | Context for chat request.                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L344)    |
| `ChatRuntimeOverrides`     | Public API contract for chat runtime overrides.          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L301)    |
| `ChatSourceDocumentUiPart` | Public API contract for chat source document UI part.    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L98)     |
| `ChatSourceUrlUiPart`      | Public API contract for chat source URL UI part.         | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L90)     |
| `ChatStepStartUiPart`      | Public API contract for chat step start UI part.         | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L85)     |
| `ChatSystemMessage`        | Message shape for chat system.                           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L258)    |
| `ChatTextUiPart`           | Public API contract for chat text UI part.               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L71)     |
| `ChatToolCallPart`         | Provider model message part that carries a tool call.    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L215)    |
| `ChatToolMessage`          | Message shape for chat tool.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L277)    |
| `ChatToolPartState`        | State for chat tool part.                                | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L121)    |
| `ChatToolResultOutput`     | Output from chat tool result.                            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L224)    |
| `ChatToolResultPart`       | Provider model message part that carries a tool result.  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L239)    |
| `ChatUiMessage`            | Message shape for chat UI.                               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L179)    |
| `ChatUiMessageChunk`       | Public API contract for chat UI message chunk.           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L342) |
| `ChatUiMessagePart`        | Public API contract for chat UI message part.            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L167)    |
| `ChatUiMessageRole`        | Public API contract for chat UI message role.            | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L68)     |
| `ChatUserContentPart`      | Public API contract for chat user content part.          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L248)    |
| `ChatUserMessage`          | Message shape for chat user.                             | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L265)    |
| `ChildRunAudit`            | Public API contract for child run audit.                 | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L122) |
| `ChildRunAuditToolCall`    | Public API contract for child run audit tool call.       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L107) |
| `ChildRunAuditToolResult`  | Result returned from child run audit tool.               | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L114) |
| `DurableRootRunDescriptor` | Public API contract for durable root run descriptor.     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L290)    |
| `FileUIPartWithUpload`     | File UI part enriched with upload metadata.              | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L115)    |
| `MessageMetadata`          | Public API contract for chat message metadata.           | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/protocol.ts#L134) |
| `ProjectFile`              | Public API contract for project file.                    | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L308)    |
| `ProjectFileListItem`      | Public API contract for project file list item.          | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L314)    |
| `ProviderModelMessage`     | Message shape for provider model.                        | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L283)    |
| `UploadedFileReference`    | Public API contract for uploaded file reference.         | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L323)    |

#### Constants

| Name                          | Description                                               | Source                                                                                 |
| ----------------------------- | --------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `getChatRequestContextSchema` | Zod schema for get chat request context.                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L333) |
| `getChatToolPartStateSchema`  | Zod schema for get chat tool part state.                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L418) |
| `getChatUiMessagePartSchema`  | Zod schema for get chat UI message part.                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L539) |
| `getChatUiMessageRoleSchema`  | Zod schema for get chat UI message role.                  | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L413) |
| `getChatUiMessageSchema`      | Zod schema for get chat UI message.                       | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L554) |
| `getChatUiMessagesSchema`     | Zod schema for get chat UI messages.                      | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L564) |
| `getMessageMetadataSchema`    | Zod schema for get message metadata.                      | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L395) |
| `imageFileTypes`              | Image media types that chat uploads can display natively. | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L53)  |
| `textFileExtensions`          | File extensions that chat uploads can inline as text.     | [source](https://github.com/veryfront/veryfront-code/blob/main/src/chat/types.ts#L50)  |
