Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
006ad75
Add reasoning toggle
JoVictorNunes May 26, 2026
4c73b58
ui: Tailwind v4 + shadcn migration, Tagus tokens, unified composer
JoVictorNunes May 26, 2026
d1344ff
ui(conversations): refactor App.tsx for switchable conversations
JoVictorNunes May 26, 2026
f269970
ui(conversations): add ConversationList component
JoVictorNunes May 26, 2026
1fcad8c
ui(conversations): refetch list on new/delete/first-message
JoVictorNunes May 26, 2026
abab8a1
ui(conversations): render sidebar with conversation list
JoVictorNunes May 26, 2026
87a4d97
ui(conversations): polish loading/empty/error states
JoVictorNunes May 26, 2026
dbfabde
spec: reflect bundled UI consuming GET /conversations
JoVictorNunes May 26, 2026
a0cca9f
ui: install shadcn sidebar primitives
JoVictorNunes May 26, 2026
7d859f3
ui(sidebar): refactor App.tsx layout to SidebarProvider/SidebarInset
JoVictorNunes May 26, 2026
f7675bc
ui(sidebar): port ConversationList to SidebarMenu primitives
JoVictorNunes May 26, 2026
69f4b3f
spec: bump code-pointers to post-sidebar-refactor commit
JoVictorNunes May 26, 2026
5d4e0e2
ui: migrate thread list to assistant-ui RemoteThreadListRuntime
JoVictorNunes May 26, 2026
a8c3af4
ui: replace emoji glyphs with lucide icons
JoVictorNunes May 26, 2026
faa8e2e
ui: thin scrollbars and full-height root layout
JoVictorNunes May 26, 2026
644518b
spec: reflect ThreadList ownership migration
JoVictorNunes May 26, 2026
ec24b17
Add assistant-ui skills and MCP
JoVictorNunes May 26, 2026
b0654d3
fix: use class for dark theme
JoVictorNunes May 27, 2026
6cd5cb7
Merge branch 'trace-conversations' into improvements
JoVictorNunes May 27, 2026
3f9bf6d
fix: restore code lost on merge
JoVictorNunes May 27, 2026
d0b4a27
feat(auth+ui): persistent JWT secret + strict iframe origin check
JoVictorNunes May 28, 2026
d2ff1df
feat(mtls): out-of-process TLS termination + reverse-proxy trust midd…
JoVictorNunes May 28, 2026
44b8e5a
feat(sessions): POST /sessions in prod + per-session MCP/RAG ownership
JoVictorNunes May 28, 2026
44498f7
feat(sessions): DELETE /sessions/:session_id with abort + final flush
JoVictorNunes May 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions .agents/skills/assistant-ui/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
name: assistant-ui
description: Guide for assistant-ui library - AI chat UI components. Use when asking about architecture, debugging, or understanding the codebase.
version: 0.0.1
license: MIT
---

# assistant-ui

**Always consult [assistant-ui.com/llms.txt](https://assistant-ui.com/llms.txt) for latest API.**

React library for building AI chat interfaces with composable primitives.

## References

- [./references/architecture.md](./references/architecture.md) -- Core architecture and layered system
- [./references/packages.md](./references/packages.md) -- Package overview and selection guide

## When to Use

| Use Case | Best For |
|----------|----------|
| Chat UI from scratch | Full control over UX |
| Existing AI backend | Connects to any streaming backend |
| Custom message types | Tools, images, files, custom parts |
| Multi-thread apps | Built-in thread list management |
| Production apps | Cloud persistence, auth, analytics |

## Architecture

```
┌─────────────────────────────────────────────────────────┐
│ UI Components (Primitives) │
│ ThreadPrimitive, MessagePrimitive, ComposerPrimitive │
└─────────────────────────┬───────────────────────────────┘
┌─────────────────────────▼───────────────────────────────┐
│ Context Hooks │
│ useAui, useAuiState, useAuiEvent │
└─────────────────────────┬───────────────────────────────┘
┌─────────────────────────▼───────────────────────────────┐
│ Runtime Layer │
│ AssistantRuntime → ThreadRuntime → MessageRuntime │
└─────────────────────────┬───────────────────────────────┘
┌─────────────────────────▼───────────────────────────────┐
│ Adapters/Backend │
│ AI SDK · LangGraph · Custom · Cloud Persistence │
└─────────────────────────────────────────────────────────┘
```

## Pick a Runtime

```
Using AI SDK?
├─ Yes → useChatRuntime (recommended)
└─ No
├─ External state (Redux/Zustand)? → useExternalStoreRuntime
├─ LangGraph agent? → useLangGraphRuntime
├─ AG-UI protocol? → useAgUiRuntime
├─ A2A protocol? → useA2ARuntime
└─ Custom API → useLocalRuntime
```

## Core Packages

| Package | Purpose |
|---------|---------|
| `@assistant-ui/react` | UI primitives & hooks |
| `@assistant-ui/react-ai-sdk` | Vercel AI SDK v6 adapter |
| `@assistant-ui/react-langgraph` | LangGraph adapter |
| `@assistant-ui/react-markdown` | Markdown rendering |
| `assistant-stream` | Streaming protocol |
| `assistant-cloud` | Cloud persistence |

## Quick Start

```tsx
import { AssistantRuntimeProvider } from "@assistant-ui/react";
import { Thread } from "@/components/assistant-ui/thread";
import { useChatRuntime, AssistantChatTransport } from "@assistant-ui/react-ai-sdk";

function App() {
const runtime = useChatRuntime({
transport: new AssistantChatTransport({ api: "/api/chat" }),
});
return (
<AssistantRuntimeProvider runtime={runtime}>
<Thread />
</AssistantRuntimeProvider>
);
}
```

## State Access

```tsx
import { useAui, useAuiState } from "@assistant-ui/react";

const api = useAui();
api.thread().append({ role: "user", content: [{ type: "text", text: "Hi" }] });
api.thread().cancelRun();

const messages = useAuiState(s => s.thread.messages);
const isRunning = useAuiState(s => s.thread.isRunning);
```

## Related Skills

- `/setup` - Installation and configuration
- `/primitives` - UI component customization
- `/runtime` - State management deep dive
- `/tools` - Tool registration and UI
- `/streaming` - Streaming protocols
- `/cloud` - Persistence and auth
- `/thread-list` - Multi-thread management
- `/update` - Version updates and migrations
175 changes: 175 additions & 0 deletions .agents/skills/assistant-ui/references/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# assistant-ui Architecture

## Layered System

assistant-ui follows a 4-layer architecture where each layer depends only on layers below it.

### Layer 1: RuntimeCore (Internal)

Internal implementations that manage state:

- `LocalRuntimeCore` - In-browser state
- `ExternalStoreRuntimeCore` - External state sync
- `ThreadListRuntimeCore` - Thread management

```typescript
// Internal - not directly used
interface ThreadRuntimeCore {
readonly messages: readonly ThreadMessage[];
readonly isRunning: boolean;
append(message: AppendMessage): void;
cancelRun(): void;
subscribe(callback: () => void): Unsubscribe;
}
```

### Layer 2: Runtime (Public API)

Public API exposed via hooks:

```typescript
type AssistantRuntime = {
thread(): ThreadRuntime;
threads(): ThreadListRuntime;
getState(): AssistantState;
subscribe(callback: () => void): Unsubscribe;
};

type ThreadRuntime = {
getState(): ThreadState;
append(message: AppendMessage): void;
cancelRun(): void;
message(index: number): MessageRuntime;
composer(): ComposerRuntime;
};

type MessageRuntime = {
getState(): MessageState;
edit(message: EditMessage): void;
reload(): void;
part(index: number): MessagePartRuntime;
};
```

### Layer 3: Context Hooks

React hooks for accessing runtime:

```tsx
// Modern API (recommended)
import { useAui, useAuiState, useAuiEvent } from "@assistant-ui/react";

// Get API for imperative actions
const api = useAui();

// Subscribe to state changes
const messages = useAuiState(s => s.thread.messages);

// Listen to events
useAuiEvent("composer.send", (e) => console.log(e));
```

### Layer 4: Primitives (UI)

Composable UI components:

```tsx
import {
ThreadPrimitive,
ComposerPrimitive,
MessagePrimitive,
ActionBarPrimitive,
} from "@assistant-ui/react";
```

## Data Flow

```
User Action (send message)
Primitive captures event
Calls runtime API (thread.append)
RuntimeCore processes action
State updates
Subscribers notified
Primitives re-render with new state
```

## Message Model

```typescript
type ThreadMessage =
| ThreadUserMessage
| ThreadAssistantMessage
| ThreadSystemMessage;

interface ThreadUserMessage {
id: string;
role: "user";
content: MessagePart[];
attachments?: Attachment[];
createdAt: Date;
}

interface ThreadAssistantMessage {
id: string;
role: "assistant";
content: MessagePart[];
status: "running" | "complete" | "incomplete" | "requires-action";
createdAt: Date;
}

type MessagePart =
| { type: "text"; text: string }
| { type: "image"; image: string }
| {
type: "tool-call";
toolCallId: string;
toolName: string;
args: unknown;
argsText: string;
result?: unknown;
isError?: boolean;
artifact?: unknown;
}
| { type: "reasoning"; text: string }
| {
type: "source";
sourceType: "url";
id: string;
url: string;
title?: string;
}
| {
type: "file";
filename?: string;
data: string;
mimeType: string;
};
```

## Branching Model

Messages form a tree structure supporting edits:

```
User: "Hello"
└─ Assistant: "Hi there!"
└─ User: "Tell me a joke" ← Current branch
└─ Assistant: "Why did..."
└─ User: "Tell me a fact" (edit) ← Alternative branch
└─ Assistant: "The sun..."
```

Navigate branches with `BranchPickerPrimitive` or runtime API.
Loading