@assistant-ui/mcp-docs-server 0.1.23 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/.docs/organized/code-examples/waterfall.md +5 -3
  2. package/.docs/organized/code-examples/with-a2a.md +676 -0
  3. package/.docs/organized/code-examples/with-ag-ui.md +7 -8
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +28 -16
  5. package/.docs/organized/code-examples/with-artifacts.md +5 -5
  6. package/.docs/organized/code-examples/with-assistant-transport.md +3 -3
  7. package/.docs/organized/code-examples/with-chain-of-thought.md +34 -26
  8. package/.docs/organized/code-examples/with-cloud-standalone.md +10 -8
  9. package/.docs/organized/code-examples/with-cloud.md +5 -5
  10. package/.docs/organized/code-examples/with-custom-thread-list.md +7 -7
  11. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +8 -8
  12. package/.docs/organized/code-examples/with-expo.md +571 -539
  13. package/.docs/organized/code-examples/with-external-store.md +3 -4
  14. package/.docs/organized/code-examples/with-ffmpeg.md +5 -5
  15. package/.docs/organized/code-examples/with-google-adk.md +353 -0
  16. package/.docs/organized/code-examples/with-heat-graph.md +304 -0
  17. package/.docs/organized/code-examples/with-langgraph.md +25 -23
  18. package/.docs/organized/code-examples/with-parent-id-grouping.md +4 -4
  19. package/.docs/organized/code-examples/with-react-hook-form.md +6 -9
  20. package/.docs/organized/code-examples/with-react-ink.md +265 -0
  21. package/.docs/organized/code-examples/with-react-router.md +10 -11
  22. package/.docs/organized/code-examples/with-store.md +29 -18
  23. package/.docs/organized/code-examples/with-tanstack.md +7 -7
  24. package/.docs/organized/code-examples/with-tap-runtime.md +6 -4
  25. package/.docs/raw/blog/2025-01-31-changelog/index.mdx +1 -1
  26. package/.docs/raw/blog/2026-03-launch-week/index.mdx +227 -0
  27. package/.docs/raw/docs/(docs)/architecture.mdx +1 -1
  28. package/.docs/raw/docs/(docs)/cli.mdx +14 -9
  29. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +8 -3
  30. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +5 -1
  31. package/.docs/raw/docs/(docs)/copilots/{make-assistant-readable.mdx → make-assistant-visible.mdx} +14 -5
  32. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +11 -11
  33. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +2 -2
  34. package/.docs/raw/docs/(docs)/devtools.mdx +3 -2
  35. package/.docs/raw/docs/(docs)/guides/attachments.mdx +9 -11
  36. package/.docs/raw/docs/(docs)/guides/branching.mdx +11 -6
  37. package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +18 -16
  38. package/.docs/raw/docs/(docs)/guides/context-api.mdx +81 -43
  39. package/.docs/raw/docs/(docs)/guides/dictation.mdx +5 -5
  40. package/.docs/raw/docs/(docs)/guides/editing.mdx +16 -7
  41. package/.docs/raw/docs/(docs)/guides/latex.mdx +3 -0
  42. package/.docs/raw/docs/(docs)/guides/message-timing.mdx +2 -1
  43. package/.docs/raw/docs/(docs)/guides/multi-agent.mdx +173 -0
  44. package/.docs/raw/docs/(docs)/guides/quoting.mdx +55 -206
  45. package/.docs/raw/docs/(docs)/guides/speech.mdx +1 -4
  46. package/.docs/raw/docs/(docs)/guides/suggestions.mdx +9 -15
  47. package/.docs/raw/docs/(docs)/guides/tool-ui.mdx +17 -7
  48. package/.docs/raw/docs/(docs)/guides/tools.mdx +24 -9
  49. package/.docs/raw/docs/(docs)/index.mdx +3 -3
  50. package/.docs/raw/docs/(docs)/installation.mdx +69 -46
  51. package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +20 -6
  52. package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +24 -4
  53. package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +1 -1
  54. package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +20 -19
  55. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +28 -53
  56. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +4 -4
  57. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +7 -1
  58. package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +20 -14
  59. package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +1 -1
  60. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +99 -45
  61. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +52 -40
  62. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +343 -23
  63. package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +4 -6
  64. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +4 -2
  65. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +3 -5
  66. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +169 -22
  67. package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +14 -4
  68. package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +15 -26
  69. package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +39 -21
  70. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +33 -9
  71. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +48 -21
  72. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +36 -7
  73. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +30 -10
  74. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +12 -10
  75. package/.docs/raw/docs/(reference)/migrations/deprecation-policy.mdx +1 -1
  76. package/.docs/raw/docs/(reference)/migrations/react-langgraph-v0-7.mdx +9 -4
  77. package/.docs/raw/docs/(reference)/migrations/v0-11.mdx +7 -5
  78. package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +9 -7
  79. package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +159 -0
  80. package/.docs/raw/docs/(reference)/react-compatibility.mdx +5 -134
  81. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +89 -7
  82. package/.docs/raw/docs/cloud/ai-sdk.mdx +19 -5
  83. package/.docs/raw/docs/cloud/langgraph.mdx +13 -3
  84. package/.docs/raw/docs/ink/adapters.mdx +41 -0
  85. package/.docs/raw/docs/ink/custom-backend.mdx +203 -0
  86. package/.docs/raw/docs/ink/hooks.mdx +448 -0
  87. package/.docs/raw/docs/ink/index.mdx +239 -0
  88. package/.docs/raw/docs/ink/migration.mdx +140 -0
  89. package/.docs/raw/docs/ink/primitives.mdx +699 -0
  90. package/.docs/raw/docs/react-native/adapters.mdx +63 -87
  91. package/.docs/raw/docs/react-native/custom-backend.mdx +11 -14
  92. package/.docs/raw/docs/react-native/hooks.mdx +214 -232
  93. package/.docs/raw/docs/react-native/index.mdx +118 -159
  94. package/.docs/raw/docs/react-native/migration.mdx +144 -0
  95. package/.docs/raw/docs/react-native/primitives.mdx +431 -302
  96. package/.docs/raw/docs/runtimes/a2a/index.mdx +294 -0
  97. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +9 -9
  98. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +14 -3
  99. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +53 -0
  100. package/.docs/raw/docs/runtimes/assistant-transport.mdx +59 -25
  101. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +13 -6
  102. package/.docs/raw/docs/runtimes/custom/external-store.mdx +138 -38
  103. package/.docs/raw/docs/runtimes/custom/local.mdx +184 -42
  104. package/.docs/raw/docs/runtimes/data-stream.mdx +92 -19
  105. package/.docs/raw/docs/runtimes/google-adk/index.mdx +624 -0
  106. package/.docs/raw/docs/runtimes/helicone.mdx +6 -6
  107. package/.docs/raw/docs/runtimes/langgraph/index.mdx +38 -27
  108. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +1 -1
  109. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +15 -20
  110. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +7 -11
  111. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +8 -11
  112. package/.docs/raw/docs/runtimes/langserve.mdx +6 -7
  113. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +18 -3
  114. package/.docs/raw/docs/ui/context-display.mdx +147 -0
  115. package/.docs/raw/docs/ui/file.mdx +5 -4
  116. package/.docs/raw/docs/ui/image.mdx +5 -4
  117. package/.docs/raw/docs/ui/markdown.mdx +3 -1
  118. package/.docs/raw/docs/ui/model-selector.mdx +8 -8
  119. package/.docs/raw/docs/ui/part-grouping.mdx +7 -10
  120. package/.docs/raw/docs/ui/quote.mdx +210 -0
  121. package/.docs/raw/docs/ui/reasoning.mdx +12 -11
  122. package/.docs/raw/docs/ui/sources.mdx +88 -17
  123. package/.docs/raw/docs/ui/streamdown.mdx +16 -7
  124. package/.docs/raw/docs/ui/thread-list.mdx +11 -13
  125. package/.docs/raw/docs/ui/thread.mdx +28 -33
  126. package/.docs/raw/docs/ui/tool-fallback.mdx +5 -6
  127. package/.docs/raw/docs/ui/tool-group.mdx +9 -8
  128. package/.docs/raw/docs/utilities/heat-graph.mdx +236 -0
  129. package/.docs/raw/docs/utilities/tw-shimmer.mdx +211 -0
  130. package/package.json +4 -4
  131. package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +0 -77
  132. package/.docs/raw/docs/(reference)/legacy/styled/decomposition.mdx +0 -635
  133. package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +0 -77
  134. package/.docs/raw/docs/(reference)/legacy/styled/scrollbar.mdx +0 -72
  135. package/.docs/raw/docs/(reference)/legacy/styled/thread-width.mdx +0 -22
  136. package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +0 -77
  137. /package/.docs/raw/docs/cloud/{overview.mdx → index.mdx} +0 -0
@@ -1,118 +1,94 @@
1
1
  ---
2
2
  title: Adapters
3
- description: Storage and title generation adapters for React Native.
3
+ description: Persistence and title generation adapters for React Native.
4
4
  ---
5
5
 
6
- Adapters customize how the local runtime persists threads and generates titles. Pass them to `useLocalRuntime` via options.
6
+ Adapters customize runtime behavior. They can be passed as options to `useLocalRuntime` or `useRemoteThreadListRuntime`.
7
7
 
8
- ```tsx
9
- import AsyncStorage from "@react-native-async-storage/async-storage";
10
- import {
11
- useLocalRuntime,
12
- createSimpleTitleAdapter,
13
- } from "@assistant-ui/react-native";
14
-
15
- const runtime = useLocalRuntime(chatModel, {
16
- storage: AsyncStorage,
17
- titleGenerator: createSimpleTitleAdapter(),
18
- });
19
- ```
8
+ ## Persistence
20
9
 
21
- ## Storage
22
-
23
- The `storage` option accepts any object with `getItem`, `setItem`, and `removeItem` methods (matching the `AsyncStorage` interface). When provided, threads and messages are persisted across app restarts.
24
-
25
- ```tsx
26
- type AsyncStorageLike = {
27
- getItem(key: string): Promise<string | null>;
28
- setItem(key: string, value: string): Promise<void>;
29
- removeItem(key: string): Promise<void>;
30
- };
31
- ```
10
+ By default, `useLocalRuntime` stores threads and messages in memory only -- they are lost when the app restarts. To persist data, use one of these approaches:
32
11
 
33
- ### AsyncStorage
12
+ ### Assistant Cloud
34
13
 
35
- The most common choice for React Native:
14
+ The simplest way to add persistence. Pass a `cloud` option to `useLocalRuntime`:
36
15
 
37
16
  ```tsx
38
- import AsyncStorage from "@react-native-async-storage/async-storage";
17
+ import { useLocalRuntime } from "@assistant-ui/react-native";
18
+ import { AssistantCloud } from "@assistant-ui/cloud";
39
19
 
40
- const runtime = useLocalRuntime(chatModel, {
41
- storage: AsyncStorage,
20
+ const cloud = new AssistantCloud({
21
+ baseUrl: "https://backend.assistant-ui.com",
22
+ authToken: () => fetchTokenFromYourBackend(),
42
23
  });
43
- ```
44
-
45
- An optional `storagePrefix` parameter namespaces the keys:
46
24
 
47
- ```tsx
48
- const runtime = useLocalRuntime(chatModel, {
49
- storage: AsyncStorage,
50
- storagePrefix: "chat:",
51
- // Keys: "chat:threads", "chat:messages:<threadId>", ...
52
- });
25
+ const runtime = useLocalRuntime(chatModel, { cloud });
53
26
  ```
54
27
 
55
- ### No storage (default)
56
-
57
- When `storage` is omitted, threads live in memory only — lost on app restart.
58
-
59
- ```tsx
60
- const runtime = useLocalRuntime(chatModel);
61
- ```
28
+ This gives you multi-thread support with server-side persistence, cross-device sync, and automatic title generation.
62
29
 
63
- ### Advanced: createLocalStorageAdapter
30
+ ### History adapter
64
31
 
65
- For more control, use `createLocalStorageAdapter` directly to create a `RemoteThreadListAdapter`:
32
+ For custom persistence (e.g. saving message history to your own backend), pass a `ThreadHistoryAdapter` via `adapters.history`:
66
33
 
67
34
  ```tsx
68
- import AsyncStorage from "@react-native-async-storage/async-storage";
69
- import {
70
- createLocalStorageAdapter,
71
- createSimpleTitleAdapter,
72
- } from "@assistant-ui/react-native";
73
-
74
- const adapter = createLocalStorageAdapter({
75
- storage: AsyncStorage,
76
- prefix: "chat:",
77
- titleGenerator: createSimpleTitleAdapter(),
78
- });
79
- ```
80
-
81
- ## TitleGenerationAdapter
82
-
83
- Generates a title for a thread based on its messages.
35
+ import { useLocalRuntime } from "@assistant-ui/react-native";
36
+ import type { ThreadHistoryAdapter } from "@assistant-ui/react-native";
37
+
38
+ const myHistoryAdapter: ThreadHistoryAdapter = {
39
+ async load() {
40
+ // Load saved messages from your storage
41
+ const data = await fetchMessagesFromBackend();
42
+ return data; // { headId, messages }
43
+ },
44
+ async append(item) {
45
+ // Persist a new message
46
+ await saveMessageToBackend(item);
47
+ },
48
+ };
84
49
 
85
- ```tsx
86
- interface TitleGenerationAdapter {
87
- generateTitle(messages: ThreadMessage[]): Promise<string>;
88
- }
50
+ const runtime = useLocalRuntime(chatModel, {
51
+ adapters: {
52
+ history: myHistoryAdapter,
53
+ },
54
+ });
89
55
  ```
90
56
 
91
- ### Built-in implementations
57
+ ### RemoteThreadListAdapter
92
58
 
93
- #### Simple title adapter
59
+ For full backend thread management (thread list, archiving, cross-device sync), use `useRemoteThreadListRuntime`. See the [Custom Backend](/docs/react-native/custom-backend) page for a full example.
94
60
 
95
- Returns the first 50 characters of the first user message.
61
+ ## RemoteThreadListAdapter
96
62
 
97
- ```tsx
98
- import { createSimpleTitleAdapter } from "@assistant-ui/react-native";
99
-
100
- const titleGenerator = createSimpleTitleAdapter();
101
- ```
102
-
103
- ### Custom implementation
63
+ Title generation is configured via the `generateTitle` method on `RemoteThreadListAdapter`. See the [Custom Backend](/docs/react-native/custom-backend) page for a full example.
104
64
 
105
65
  ```tsx
106
- import type { TitleGenerationAdapter } from "@assistant-ui/react-native";
107
-
108
- const aiTitleGenerator: TitleGenerationAdapter = {
109
- async generateTitle(messages) {
110
- const response = await fetch("/api/generate-title", {
111
- method: "POST",
112
- body: JSON.stringify({ messages }),
66
+ import type { RemoteThreadListAdapter } from "@assistant-ui/react-native";
67
+ import { createAssistantStream } from "assistant-stream";
68
+
69
+ const myAdapter: RemoteThreadListAdapter = {
70
+ // ... other methods ...
71
+
72
+ async generateTitle(remoteId, unstable_messages) {
73
+ return createAssistantStream(async (controller) => {
74
+ const res = await fetch(`/api/threads/${remoteId}/title`, {
75
+ method: "POST",
76
+ headers: { "Content-Type": "application/json" },
77
+ body: JSON.stringify({ messages: unstable_messages }),
78
+ });
79
+ const { title } = await res.json();
80
+ controller.appendText(title);
113
81
  });
114
- const { title } = await response.json();
115
- return title;
116
82
  },
117
83
  };
118
84
  ```
85
+
86
+ ## Which option to choose?
87
+
88
+ | | ChatModelAdapter + `useLocalRuntime` | RemoteThreadListAdapter + `useRemoteThreadListRuntime` |
89
+ |---|---|---|
90
+ | **Thread storage** | In-memory (or cloud) | Your backend |
91
+ | **Message storage** | In-memory (can add history adapter) | In-memory (can add history adapter for server-side) |
92
+ | **Cross-device sync** | Only with cloud | Yes |
93
+ | **Setup complexity** | Minimal | Moderate |
94
+ | **Best for** | Single-device apps, prototypes | Production apps with user accounts |
@@ -40,22 +40,19 @@ export const myChatAdapter: ChatModelAdapter = {
40
40
  ```
41
41
 
42
42
  ```tsx title="hooks/use-app-runtime.ts"
43
- import AsyncStorage from "@react-native-async-storage/async-storage";
44
43
  import { useLocalRuntime } from "@assistant-ui/react-native";
45
44
  import { myChatAdapter } from "@/adapters/my-chat-adapter";
46
45
 
47
46
  export function useAppRuntime() {
48
- return useLocalRuntime(myChatAdapter, {
49
- storage: AsyncStorage, // threads + messages persisted locally
50
- });
47
+ return useLocalRuntime(myChatAdapter);
51
48
  }
52
49
  ```
53
50
 
54
51
  This gives you:
55
52
 
56
53
  - Streaming chat responses from your API
57
- - Local thread list with persistence (AsyncStorage)
58
- - Message history saved across app restarts
54
+ - In-memory thread and message management
55
+ - Automatic features like message editing, reloading, and branch switching
59
56
 
60
57
  ## Option 2: Full backend thread management
61
58
 
@@ -129,12 +126,12 @@ export const myThreadListAdapter: RemoteThreadListAdapter = {
129
126
  };
130
127
  },
131
128
 
132
- async generateTitle(remoteId, messages) {
129
+ async generateTitle(remoteId, unstable_messages) {
133
130
  return createAssistantStream(async (controller) => {
134
131
  const res = await fetch(`${API_BASE}/threads/${remoteId}/title`, {
135
132
  method: "POST",
136
133
  headers: { "Content-Type": "application/json" },
137
- body: JSON.stringify({ messages }),
134
+ body: JSON.stringify({ messages: unstable_messages }),
138
135
  });
139
136
  const { title } = await res.json();
140
137
  controller.appendText(title);
@@ -170,15 +167,15 @@ export function useAppRuntime() {
170
167
  ### Use in your app
171
168
 
172
169
  ```tsx title="app/index.tsx"
173
- import { AssistantProvider } from "@assistant-ui/react-native";
170
+ import { AssistantRuntimeProvider } from "@assistant-ui/react-native";
174
171
  import { useAppRuntime } from "@/hooks/use-app-runtime";
175
172
 
176
173
  export default function App() {
177
174
  const runtime = useAppRuntime();
178
175
  return (
179
- <AssistantProvider runtime={runtime}>
176
+ <AssistantRuntimeProvider runtime={runtime}>
180
177
  {/* your chat UI */}
181
- </AssistantProvider>
178
+ </AssistantRuntimeProvider>
182
179
  );
183
180
  }
184
181
  ```
@@ -197,14 +194,14 @@ export default function App() {
197
194
  | `unarchive(remoteId)` | Restore archived thread |
198
195
  | `delete(remoteId)` | Permanently remove thread |
199
196
  | `fetch(remoteId)` | Fetch single thread metadata |
200
- | `generateTitle(remoteId, messages)` | Return an `AssistantStream` with the generated title |
197
+ | `generateTitle(remoteId, unstable_messages)` | Return an `AssistantStream` with the generated title |
201
198
 
202
199
  ## Which option to choose?
203
200
 
204
201
  | | Option 1: ChatModelAdapter | Option 2: RemoteThreadListAdapter |
205
202
  |---|---|---|
206
- | **Thread storage** | On-device (AsyncStorage) | Your backend |
207
- | **Message storage** | On-device (AsyncStorage) | On-device (can add history adapter for server-side) |
203
+ | **Thread storage** | In-memory | Your backend |
204
+ | **Message storage** | In-memory | In-memory (can add history adapter for server-side) |
208
205
  | **Cross-device sync** | No | Yes |
209
206
  | **Setup complexity** | Minimal | Moderate |
210
207
  | **Best for** | Single-device apps, prototypes | Production apps with user accounts |