@assistant-ui/mcp-docs-server 0.1.26 → 0.1.28

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 (43) hide show
  1. package/.docs/organized/code-examples/waterfall.md +2 -2
  2. package/.docs/organized/code-examples/with-a2a.md +2 -2
  3. package/.docs/organized/code-examples/with-ag-ui.md +3 -3
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +4 -4
  5. package/.docs/organized/code-examples/with-artifacts.md +4 -4
  6. package/.docs/organized/code-examples/with-assistant-transport.md +2 -2
  7. package/.docs/organized/code-examples/with-chain-of-thought.md +4 -4
  8. package/.docs/organized/code-examples/with-cloud-standalone.md +4 -4
  9. package/.docs/organized/code-examples/with-cloud.md +4 -4
  10. package/.docs/organized/code-examples/with-custom-thread-list.md +4 -4
  11. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +511 -0
  12. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +6 -6
  13. package/.docs/organized/code-examples/with-expo.md +17 -17
  14. package/.docs/organized/code-examples/with-external-store.md +2 -2
  15. package/.docs/organized/code-examples/with-ffmpeg.md +217 -63
  16. package/.docs/organized/code-examples/with-generative-ui.md +841 -0
  17. package/.docs/organized/code-examples/with-google-adk.md +3 -3
  18. package/.docs/organized/code-examples/with-heat-graph.md +2 -2
  19. package/.docs/organized/code-examples/with-interactables.md +67 -9
  20. package/.docs/organized/code-examples/with-langgraph.md +3 -3
  21. package/.docs/organized/code-examples/with-livekit.md +591 -0
  22. package/.docs/organized/code-examples/with-parent-id-grouping.md +3 -3
  23. package/.docs/organized/code-examples/with-react-hook-form.md +5 -5
  24. package/.docs/organized/code-examples/with-react-ink.md +1 -1
  25. package/.docs/organized/code-examples/with-react-router.md +7 -7
  26. package/.docs/organized/code-examples/with-store.md +8 -3
  27. package/.docs/organized/code-examples/with-tanstack.md +4 -4
  28. package/.docs/organized/code-examples/with-tap-runtime.md +2 -2
  29. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +9 -1
  30. package/.docs/raw/docs/(docs)/guides/interactables.mdx +99 -37
  31. package/.docs/raw/docs/(docs)/guides/mentions.mdx +406 -0
  32. package/.docs/raw/docs/(docs)/guides/slash-commands.mdx +275 -0
  33. package/.docs/raw/docs/(docs)/guides/tool-ui.mdx +29 -0
  34. package/.docs/raw/docs/(docs)/guides/voice.mdx +333 -0
  35. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +23 -0
  36. package/.docs/raw/docs/primitives/composer.mdx +27 -4
  37. package/.docs/raw/docs/runtimes/a2a/index.mdx +4 -0
  38. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +2 -2
  39. package/.docs/raw/docs/runtimes/assistant-transport.mdx +6 -2
  40. package/.docs/raw/docs/ui/context-display.mdx +2 -2
  41. package/.docs/raw/docs/ui/model-selector.mdx +1 -1
  42. package/.docs/raw/docs/ui/voice.mdx +172 -0
  43. package/package.json +5 -6
@@ -488,14 +488,14 @@ export default nextConfig;
488
488
  "dependencies": {
489
489
  "@assistant-ui/store": "workspace:*",
490
490
  "@assistant-ui/tap": "workspace:*",
491
- "next": "^16.2.1",
491
+ "next": "^16.2.2",
492
492
  "react": "^19.2.4",
493
493
  "react-dom": "^19.2.4"
494
494
  },
495
495
  "devDependencies": {
496
496
  "@assistant-ui/x-buildutils": "workspace:*",
497
497
  "@tailwindcss/postcss": "^4.2.2",
498
- "@types/node": "^25.5.0",
498
+ "@types/node": "^25.5.2",
499
499
  "@types/react": "^19.2.14",
500
500
  "@types/react-dom": "^19.2.3",
501
501
  "postcss": "^8.5.8",
@@ -645,7 +645,12 @@ useAuiEvent("*", (data) => {
645
645
  {
646
646
  "extends": "@assistant-ui/x-buildutils/ts/next",
647
647
  "compilerOptions": {
648
- "paths": { "@/*": ["./*"] }
648
+ "paths": {
649
+ "@/*": ["./*"]
650
+ },
651
+ "allowJs": true,
652
+ "incremental": true,
653
+ "jsx": "preserve"
649
654
  },
650
655
  "include": ["**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
651
656
  "exclude": ["node_modules"]
@@ -65,8 +65,8 @@
65
65
  "@assistant-ui/react": "workspace:*",
66
66
  "@assistant-ui/react-markdown": "workspace:*",
67
67
  "@tailwindcss/vite": "^4.2.2",
68
- "@tanstack/react-router": "^1.168.4",
69
- "@tanstack/react-start": "^1.167.8",
68
+ "@tanstack/react-router": "^1.168.10",
69
+ "@tanstack/react-start": "^1.167.16",
70
70
  "class-variance-authority": "^0.7.1",
71
71
  "clsx": "^2.1.1",
72
72
  "lucide-react": "^1.7.0",
@@ -81,12 +81,12 @@
81
81
  },
82
82
  "devDependencies": {
83
83
  "@assistant-ui/x-buildutils": "workspace:*",
84
- "@types/node": "^25.5.0",
84
+ "@types/node": "^25.5.2",
85
85
  "@types/react": "^19.2.14",
86
86
  "@types/react-dom": "^19.2.3",
87
87
  "@vitejs/plugin-react": "^6.0.1",
88
88
  "typescript": "5.9.3",
89
- "vite": "^8.0.2"
89
+ "vite": "^8.0.5"
90
90
  }
91
91
  }
92
92
 
@@ -598,7 +598,7 @@ export default nextConfig;
598
598
  "class-variance-authority": "^0.7.1",
599
599
  "clsx": "^2.1.1",
600
600
  "lucide-react": "^1.7.0",
601
- "next": "^16.2.1",
601
+ "next": "^16.2.2",
602
602
  "react": "^19.2.4",
603
603
  "react-dom": "^19.2.4",
604
604
  "tailwind-merge": "^3.5.0"
@@ -606,7 +606,7 @@ export default nextConfig;
606
606
  "devDependencies": {
607
607
  "@assistant-ui/x-buildutils": "workspace:*",
608
608
  "@tailwindcss/postcss": "^4.2.2",
609
- "@types/node": "^25.5.0",
609
+ "@types/node": "^25.5.2",
610
610
  "@types/react": "^19.2.14",
611
611
  "@types/react-dom": "^19.2.3",
612
612
  "postcss": "^8.5.8",
@@ -14,17 +14,25 @@ System instructions define the base behavior and knowledge available to the assi
14
14
  ```tsx
15
15
  import {
16
16
  useAssistantInstructions,
17
+ useAssistantContext,
17
18
  makeAssistantVisible,
18
19
  } from "@assistant-ui/react";
19
20
 
20
- // Via useAssistantInstructions
21
+ // Static instructions
21
22
  useAssistantInstructions("You are a helpful assistant...");
22
23
 
24
+ // Dynamic context — callback is evaluated lazily at send-time
25
+ useAssistantContext({
26
+ getContext: () => `Current page: ${window.location.href}`,
27
+ });
28
+
23
29
  // Via makeAssistantVisible
24
30
  const ReadableComponent = makeAssistantVisible(MyComponent);
25
31
  // Automatically provides component HTML as system context
26
32
  ```
27
33
 
34
+ `useAssistantInstructions` takes a static string that re-registers when changed. `useAssistantContext` takes a callback that is evaluated fresh each time the model context is read, making it ideal for injecting frequently-changing application state without triggering re-registrations.
35
+
28
36
  ### Tools
29
37
 
30
38
  Tools are functions that the assistant can use to interact with your application. They can be provided through various mechanisms:
@@ -58,7 +58,7 @@ function MyRuntimeProvider({ children }: { children: React.ReactNode }) {
58
58
  </Callout>
59
59
 
60
60
  ```tsx
61
- import { useInteractable } from "@assistant-ui/react";
61
+ import { useAssistantInteractable, useInteractableState } from "@assistant-ui/react";
62
62
  import { z } from "zod";
63
63
 
64
64
  const taskBoardSchema = z.object({
@@ -74,11 +74,12 @@ const taskBoardSchema = z.object({
74
74
  const taskBoardInitialState = { tasks: [] };
75
75
 
76
76
  function TaskBoard() {
77
- const [state, setState] = useInteractable("taskBoard", {
77
+ const id = useAssistantInteractable("taskBoard", {
78
78
  description: "A task board showing the user's tasks",
79
79
  stateSchema: taskBoardSchema,
80
80
  initialState: taskBoardInitialState,
81
81
  });
82
+ const [state, { setState }] = useInteractableState(id, taskBoardInitialState);
82
83
 
83
84
  return (
84
85
  <div>
@@ -147,7 +148,7 @@ This is especially useful for large state objects where regenerating the entire
147
148
  You can render multiple interactables with the same `name` but different `id`s. Each gets its own update tool:
148
149
 
149
150
  ```tsx
150
- import { useInteractable } from "@assistant-ui/react";
151
+ import { useAssistantInteractable, useInteractableState } from "@assistant-ui/react";
151
152
  import { z } from "zod";
152
153
 
153
154
  const noteSchema = z.object({
@@ -159,12 +160,13 @@ const noteSchema = z.object({
159
160
  const noteInitialState = { title: "New Note", content: "", color: "yellow" as const };
160
161
 
161
162
  function NoteCard({ noteId }: { noteId: string }) {
162
- const [state] = useInteractable("note", {
163
+ useAssistantInteractable("note", {
163
164
  id: noteId,
164
165
  description: "A sticky note",
165
166
  stateSchema: noteSchema,
166
167
  initialState: noteInitialState,
167
168
  });
169
+ const [state] = useInteractableState(noteId, noteInitialState);
168
170
 
169
171
  return <div>{state.title}</div>;
170
172
  }
@@ -187,12 +189,13 @@ When multiple interactables are present, you can mark one as "selected" to tell
187
189
 
188
190
  ```tsx
189
191
  function NoteCard({ noteId }: { noteId: string }) {
190
- const [state, setState, { setSelected }] = useInteractable("note", {
192
+ useAssistantInteractable("note", {
191
193
  id: noteId,
192
194
  description: "A sticky note",
193
195
  stateSchema: noteSchema,
194
196
  initialState: noteInitialState,
195
197
  });
198
+ const [state, { setSelected }] = useInteractableState(noteId, noteInitialState);
196
199
 
197
200
  return (
198
201
  <div onClick={() => setSelected(true)}>
@@ -206,12 +209,12 @@ The AI sees `(SELECTED)` in the system prompt for the focused interactable, allo
206
209
 
207
210
  ## API Reference
208
211
 
209
- ### `useInteractable`
212
+ ### `useAssistantInteractable`
210
213
 
211
- Hook that registers an interactable and returns its state with a setter.
214
+ Registers an interactable with the AI assistant. Returns the instance id.
212
215
 
213
216
  ```tsx
214
- const [state, setState, meta] = useInteractable<TState>(name, config);
217
+ const id = useAssistantInteractable(name, config);
215
218
  ```
216
219
 
217
220
  **Parameters:**
@@ -221,43 +224,37 @@ const [state, setState, meta] = useInteractable<TState>(name, config);
221
224
  | `name` | `string` | Name for the interactable (used in tool names) |
222
225
  | `config.description` | `string` | Description shown to the AI |
223
226
  | `config.stateSchema` | `StandardSchemaV1 \| JSONSchema7` | Schema for the state (e.g., a Zod schema) |
224
- | `config.initialState` | `TState` | Initial state value |
227
+ | `config.initialState` | `unknown` | Initial state value |
225
228
  | `config.id` | `string?` | Optional unique instance ID (auto-generated if omitted) |
226
229
  | `config.selected` | `boolean?` | Whether this interactable is selected |
227
230
 
228
- **Returns:** `[state, setState, { id, setSelected }]`
231
+ **Returns:** `string` the instance id (auto-generated or provided).
229
232
 
230
- | Return | Type | Description |
231
- | --- | --- | --- |
232
- | `state` | `TState` | Current state |
233
- | `setState` | `(updater: TState \| (prev: TState) => TState) => void` | State setter (like `useState`) |
234
- | `meta.id` | `string` | The instance ID (auto-generated or provided) |
235
- | `meta.setSelected` | `(selected: boolean) => void` | Mark this interactable as selected |
236
-
237
- ### `makeInteractable`
233
+ ### `useInteractableState`
238
234
 
239
- Declarative API that creates a component which registers an interactable when mounted. Useful for static configurations.
235
+ Reads and writes the state of a registered interactable.
240
236
 
241
237
  ```tsx
242
- import { makeInteractable } from "@assistant-ui/react";
238
+ const [state, { setState, setSelected, isPending, error, flush }] = useInteractableState<TState>(id, fallback?);
239
+ ```
243
240
 
244
- const TaskBoardInteractable = makeInteractable({
245
- name: "taskBoard",
246
- description: "A task board showing the user's tasks",
247
- stateSchema: taskBoardSchema,
248
- initialState: taskBoardInitialState,
249
- });
241
+ **Parameters:**
250
242
 
251
- // Mount it anywhere renders nothing, just registers the interactable
252
- function App() {
253
- return (
254
- <>
255
- <TaskBoardInteractable />
256
- <Thread />
257
- </>
258
- );
259
- }
260
- ```
243
+ | Parameter | Type | Description |
244
+ | --- | --- | --- |
245
+ | `id` | `string` | The interactable instance id (from `useAssistantInteractable`) |
246
+ | `fallback` | `TState?` | Fallback value before the interactable is registered |
247
+
248
+ **Returns:** `[state, methods]`
249
+
250
+ | Return | Type | Description |
251
+ | --- | --- | --- |
252
+ | `state` | `TState` | Current state |
253
+ | `setState` | `(updater: TState \| (prev: TState) => TState) => void` | State setter (like `useState`) |
254
+ | `setSelected` | `(selected: boolean) => void` | Mark this interactable as selected |
255
+ | `isPending` | `boolean` | Whether a persistence save is in-flight |
256
+ | `error` | `unknown` | Error from the last failed save |
257
+ | `flush` | `() => Promise<void>` | Force an immediate persistence save |
261
258
 
262
259
  ### `Interactables`
263
260
 
@@ -271,7 +268,7 @@ const aui = useAui({
271
268
 
272
269
  ## How It Works
273
270
 
274
- When you call `useInteractable("taskBoard", config)`:
271
+ When you call `useAssistantInteractable("taskBoard", config)`:
275
272
 
276
273
  1. **Registration** — the interactable is registered in the `interactables` scope with its name, description, schema, and initial state.
277
274
  2. **Tool generation** — an `update_taskBoard` frontend tool is automatically created with a partial schema (all fields optional). For multiple instances, tools are named `update_{name}_{id}`.
@@ -280,6 +277,62 @@ When you call `useInteractable("taskBoard", config)`:
280
277
  5. **Partial merge** — only the fields the AI sends are updated; the rest are preserved.
281
278
  6. **Bidirectional updates** — when the AI calls the tool, the state updates and React re-renders. When the user updates state via `setState`, the model context is notified so the AI sees the latest state on the next turn.
282
279
 
280
+ ## Persistence
281
+
282
+ By default, interactable state is in-memory and lost on page refresh. You can add persistence by providing a save callback:
283
+
284
+ ```tsx
285
+ import { useEffect } from "react";
286
+ import { useAui, Interactables } from "@assistant-ui/react";
287
+
288
+ function MyRuntimeProvider({ children }) {
289
+ const aui = useAui({ interactables: Interactables() });
290
+
291
+ useEffect(() => {
292
+ // Set up persistence adapter
293
+ aui.interactables().setPersistenceAdapter({
294
+ save: async (state) => {
295
+ localStorage.setItem("interactables", JSON.stringify(state));
296
+ },
297
+ });
298
+
299
+ // Restore saved state on mount
300
+ const saved = localStorage.getItem("interactables");
301
+ if (saved) {
302
+ aui.interactables().importState(JSON.parse(saved));
303
+ }
304
+ }, [aui]);
305
+
306
+ return /* ... */;
307
+ }
308
+ ```
309
+
310
+ ### Sync Status
311
+
312
+ When a persistence adapter is set, `useInteractableState` exposes sync metadata:
313
+
314
+ ```tsx
315
+ const [state, { setState, isPending, error, flush }] = useInteractableState(id, fallback);
316
+
317
+ // isPending — true while a save is in-flight
318
+ // error — the error from the last failed save, if any
319
+ // flush() — force an immediate save (useful before navigation)
320
+ ```
321
+
322
+ State changes are automatically debounced (500ms) before saving. When a component unregisters, any pending save is flushed immediately.
323
+
324
+ ### Export / Import
325
+
326
+ For custom persistence strategies, use `exportState` and `importState` directly:
327
+
328
+ ```tsx
329
+ const snapshot = aui.interactables().exportState();
330
+ // => { "note-1": { name: "note", state: { title: "Hello" } }, ... }
331
+
332
+ aui.interactables().importState(snapshot);
333
+ // Imported state is picked up when components next register
334
+ ```
335
+
283
336
  ## Combining with Tools
284
337
 
285
338
  You can use `Interactables` alongside `Tools`:
@@ -290,3 +343,12 @@ const aui = useAui({
290
343
  interactables: Interactables(),
291
344
  });
292
345
  ```
346
+
347
+ ## Full Example
348
+
349
+ See the complete [with-interactables example](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-interactables) for a working implementation featuring:
350
+
351
+ - **Task Board** — single-instance interactable with a custom `manage_tasks` tool
352
+ - **Sticky Notes** — multi-instance interactables with selection and partial updates
353
+ - **localStorage persistence** — state survives page refresh via `setPersistenceAdapter`
354
+ - **Sync indicator** — spinning icon while a save is in-flight (`isPending`)