@assistant-ui/mcp-docs-server 0.1.15 → 0.1.16

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 (55) hide show
  1. package/.docs/organized/code-examples/store-example.md +112 -38
  2. package/.docs/organized/code-examples/with-ag-ui.md +248 -184
  3. package/.docs/organized/code-examples/with-ai-sdk-v5.md +247 -196
  4. package/.docs/organized/code-examples/with-assistant-transport.md +192 -240
  5. package/.docs/organized/code-examples/with-cloud.md +275 -224
  6. package/.docs/organized/code-examples/with-custom-thread-list.md +1855 -0
  7. package/.docs/organized/code-examples/with-external-store.md +244 -178
  8. package/.docs/organized/code-examples/with-ffmpeg.md +253 -187
  9. package/.docs/organized/code-examples/with-langgraph.md +291 -240
  10. package/.docs/organized/code-examples/with-parent-id-grouping.md +241 -261
  11. package/.docs/organized/code-examples/with-react-hook-form.md +260 -194
  12. package/.docs/organized/code-examples/with-tanstack.md +1574 -0
  13. package/.docs/raw/blog/2024-07-29-hello/index.mdx +2 -2
  14. package/.docs/raw/docs/api-reference/overview.mdx +6 -6
  15. package/.docs/raw/docs/api-reference/primitives/ActionBar.mdx +85 -4
  16. package/.docs/raw/docs/api-reference/primitives/AssistantIf.mdx +200 -0
  17. package/.docs/raw/docs/api-reference/primitives/Composer.mdx +0 -20
  18. package/.docs/raw/docs/api-reference/primitives/Message.mdx +0 -45
  19. package/.docs/raw/docs/api-reference/primitives/Thread.mdx +0 -50
  20. package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +2 -3
  21. package/.docs/raw/docs/cloud/persistence/langgraph.mdx +2 -3
  22. package/.docs/raw/docs/devtools.mdx +2 -3
  23. package/.docs/raw/docs/getting-started.mdx +36 -1102
  24. package/.docs/raw/docs/guides/Attachments.mdx +3 -25
  25. package/.docs/raw/docs/guides/Branching.mdx +1 -1
  26. package/.docs/raw/docs/guides/Speech.mdx +1 -1
  27. package/.docs/raw/docs/guides/ToolUI.mdx +1 -1
  28. package/.docs/raw/docs/legacy/styled/AssistantModal.mdx +2 -3
  29. package/.docs/raw/docs/legacy/styled/Decomposition.mdx +6 -5
  30. package/.docs/raw/docs/legacy/styled/Markdown.mdx +2 -3
  31. package/.docs/raw/docs/legacy/styled/Thread.mdx +2 -3
  32. package/.docs/raw/docs/react-compatibility.mdx +2 -5
  33. package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +3 -4
  34. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +3 -6
  35. package/.docs/raw/docs/runtimes/custom/external-store.mdx +2 -3
  36. package/.docs/raw/docs/runtimes/custom/local.mdx +11 -41
  37. package/.docs/raw/docs/runtimes/data-stream.mdx +15 -11
  38. package/.docs/raw/docs/runtimes/langgraph/index.mdx +3 -3
  39. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -1
  40. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +2 -3
  41. package/.docs/raw/docs/runtimes/langserve.mdx +2 -3
  42. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +2 -3
  43. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +2 -3
  44. package/.docs/raw/docs/ui/AssistantModal.mdx +3 -25
  45. package/.docs/raw/docs/ui/AssistantSidebar.mdx +2 -24
  46. package/.docs/raw/docs/ui/Attachment.mdx +3 -25
  47. package/.docs/raw/docs/ui/Markdown.mdx +2 -24
  48. package/.docs/raw/docs/ui/Mermaid.mdx +2 -24
  49. package/.docs/raw/docs/ui/Reasoning.mdx +2 -24
  50. package/.docs/raw/docs/ui/Scrollbar.mdx +4 -6
  51. package/.docs/raw/docs/ui/SyntaxHighlighting.mdx +3 -47
  52. package/.docs/raw/docs/ui/Thread.mdx +38 -53
  53. package/.docs/raw/docs/ui/ThreadList.mdx +4 -47
  54. package/.docs/raw/docs/ui/ToolFallback.mdx +2 -24
  55. package/package.json +5 -6
@@ -82,10 +82,10 @@ export default function Home() {
82
82
  <div className="min-h-screen bg-gradient-to-br from-gray-50 to-gray-100 p-8 dark:from-gray-900 dark:to-gray-800">
83
83
  <div className="mx-auto max-w-4xl">
84
84
  <div className="mb-8">
85
- <h1 className="mb-2 text-4xl font-bold text-gray-900 dark:text-white">
85
+ <h1 className="mb-2 font-bold text-4xl text-gray-900 dark:text-white">
86
86
  @assistant-ui/store Example
87
87
  </h1>
88
- <p className="text-lg text-gray-600 dark:text-gray-400">
88
+ <p className="text-gray-600 text-lg dark:text-gray-400">
89
89
  Demonstrating tap-based state management with scopes, lists, and
90
90
  providers
91
91
  </p>
@@ -104,15 +104,15 @@ export default function Home() {
104
104
  ```tsx
105
105
  "use client";
106
106
 
107
+ import { useState } from "react";
107
108
  import {
108
109
  useAssistantClient,
109
110
  AssistantProvider,
110
111
  useAssistantState,
112
+ useAssistantEvent,
111
113
  } from "@assistant-ui/store";
112
114
  import { FooList, FooListResource } from "./store/foo-store";
113
115
 
114
- import "./store/foo-scope"; // Register the fooList scope (demonstrates scope registry)
115
-
116
116
  /**
117
117
  * Single Foo component - displays and allows editing a single foo
118
118
  */
@@ -132,15 +132,15 @@ const Foo = () => {
132
132
  <div className="rounded-lg border border-gray-200 bg-white p-6 shadow-md transition-shadow hover:shadow-lg dark:border-gray-700 dark:bg-gray-800">
133
133
  <div className="space-y-3">
134
134
  <div className="flex items-center gap-2">
135
- <span className="text-sm font-semibold text-gray-500 dark:text-gray-400">
135
+ <span className="font-semibold text-gray-500 text-sm dark:text-gray-400">
136
136
  ID:
137
137
  </span>
138
- <span className="font-mono text-sm text-gray-900 dark:text-white">
138
+ <span className="font-mono text-gray-900 text-sm dark:text-white">
139
139
  {fooState.id}
140
140
  </span>
141
141
  </div>
142
142
  <div className="flex items-center gap-2">
143
- <span className="text-sm font-semibold text-gray-500 dark:text-gray-400">
143
+ <span className="font-semibold text-gray-500 text-sm dark:text-gray-400">
144
144
  Value:
145
145
  </span>
146
146
  <span className="text-gray-900 dark:text-white">{fooState.bar}</span>
@@ -148,13 +148,13 @@ const Foo = () => {
148
148
  <div className="mt-2 flex gap-2">
149
149
  <button
150
150
  onClick={handleUpdate}
151
- className="flex-1 rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none dark:focus:ring-offset-gray-800"
151
+ className="flex-1 rounded-md bg-blue-600 px-4 py-2 font-medium text-white transition-colors hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800"
152
152
  >
153
153
  Update
154
154
  </button>
155
155
  <button
156
156
  onClick={() => aui.foo().remove()}
157
- className="rounded-md bg-red-600 px-4 py-2 font-medium text-white transition-colors hover:bg-red-700 focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:outline-none dark:focus:ring-offset-gray-800"
157
+ className="rounded-md bg-red-600 px-4 py-2 font-medium text-white transition-colors hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800"
158
158
  >
159
159
  Delete
160
160
  </button>
@@ -178,13 +178,73 @@ const AddFooButton = () => {
178
178
  return (
179
179
  <button
180
180
  onClick={() => aui.fooList().addFoo()}
181
- className="rounded-md bg-green-600 px-4 py-2 font-medium text-white transition-colors hover:bg-green-700 focus:ring-2 focus:ring-green-500 focus:ring-offset-2 focus:outline-none dark:focus:ring-offset-gray-800"
181
+ className="rounded-md bg-green-600 px-4 py-2 font-medium text-white transition-colors hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800"
182
182
  >
183
183
  Add New
184
184
  </button>
185
185
  );
186
186
  };
187
187
 
188
+ type EventLogEntry = {
189
+ id: number;
190
+ event: string;
191
+ payload: unknown;
192
+ timestamp: Date;
193
+ };
194
+
195
+ let idCounter = 0;
196
+ /**
197
+ * EventLog component - demonstrates event subscription
198
+ */
199
+ const EventLog = () => {
200
+ const [logs, setLogs] = useState<EventLogEntry[]>([]);
201
+
202
+ // Subscribe to all events using the wildcard selector
203
+ useAssistantEvent("*", (data) => {
204
+ setLogs((prev) => [
205
+ {
206
+ id: ++idCounter,
207
+ event: data.event,
208
+ payload: data.payload,
209
+ timestamp: new Date(),
210
+ },
211
+ ...prev.slice(0, 9), // Keep last 10 entries
212
+ ]);
213
+ });
214
+
215
+ return (
216
+ <div className="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-700 dark:bg-gray-800">
217
+ <h3 className="mb-3 font-semibold text-gray-900 dark:text-white">
218
+ Event Log
219
+ </h3>
220
+ <div className="max-h-48 space-y-2 overflow-y-auto">
221
+ {logs.length === 0 ? (
222
+ <p className="text-gray-500 text-sm dark:text-gray-400">
223
+ No events yet. Try updating or deleting a foo.
224
+ </p>
225
+ ) : (
226
+ logs.map((log) => (
227
+ <div
228
+ key={log.id}
229
+ className="rounded border border-gray-100 bg-gray-50 p-2 font-mono text-xs dark:border-gray-600 dark:bg-gray-700"
230
+ >
231
+ <span className="font-semibold text-blue-600 dark:text-blue-400">
232
+ {log.event}
233
+ </span>
234
+ <span className="ml-2 text-gray-600 dark:text-gray-300">
235
+ {JSON.stringify(log.payload)}
236
+ </span>
237
+ <span className="ml-2 text-gray-400 dark:text-gray-500">
238
+ {log.timestamp.toLocaleTimeString()}
239
+ </span>
240
+ </div>
241
+ ))
242
+ )}
243
+ </div>
244
+ </div>
245
+ );
246
+ };
247
+
188
248
  /**
189
249
  * Example App - demonstrates the store with styled components
190
250
  *
@@ -201,18 +261,19 @@ export const ExampleApp = () => {
201
261
  <div className="space-y-6">
202
262
  <div className="rounded-lg border border-gray-200 bg-white p-4 shadow-sm dark:border-gray-700 dark:bg-gray-800">
203
263
  <div className="flex items-center justify-between">
204
- <h2 className="text-xl font-semibold text-gray-900 dark:text-white">
264
+ <h2 className="font-semibold text-gray-900 text-xl dark:text-white">
205
265
  Foo List <FooListLength />
206
266
  </h2>
207
267
  <AddFooButton />
208
268
  </div>
209
- <p className="mt-1 text-sm text-gray-600 dark:text-gray-400">
269
+ <p className="mt-1 text-gray-600 text-sm dark:text-gray-400">
210
270
  Each item is rendered in its own FooProvider with scoped access
211
271
  </p>
212
272
  </div>
213
273
  <div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
214
274
  <FooList components={{ Foo }} />
215
275
  </div>
276
+ <EventLog />
216
277
  </div>
217
278
  </AssistantProvider>
218
279
  );
@@ -223,16 +284,8 @@ export const ExampleApp = () => {
223
284
  ## lib/store/foo-scope.ts
224
285
 
225
286
  ```typescript
226
- /**
227
- * Scope registration for the foo example
228
- * Import this file to register the default fooList scope
229
- */
230
287
  import { registerAssistantScope } from "@assistant-ui/store";
231
288
 
232
- /**
233
- * Define scopes via module augmentation
234
- * Implement the scope definition raw without importing ScopeDefinition
235
- */
236
289
  declare module "@assistant-ui/store" {
237
290
  interface AssistantScopeRegistry {
238
291
  foo: {
@@ -241,8 +294,11 @@ declare module "@assistant-ui/store" {
241
294
  updateBar: (newBar: string) => void;
242
295
  remove: () => void;
243
296
  };
244
- source: "fooList";
245
- query: { index: number } | { id: string };
297
+ meta: { source: "fooList"; query: { index: number } | { id: string } };
298
+ events: {
299
+ "foo.updated": { id: string; newValue: string };
300
+ "foo.removed": { id: string };
301
+ };
246
302
  };
247
303
  fooList: {
248
304
  value: {
@@ -252,18 +308,24 @@ declare module "@assistant-ui/store" {
252
308
  ) => AssistantScopeRegistry["foo"]["value"];
253
309
  addFoo: (id?: string) => void;
254
310
  };
255
- source: "root";
256
- query: Record<string, never>;
311
+ meta: { source: "root"; query: Record<string, never> };
312
+ events: {
313
+ "fooList.added": { id: string };
314
+ };
257
315
  };
258
316
  }
259
317
  }
260
318
 
261
- // Register the fooList scope with a default implementation
262
319
  registerAssistantScope({
263
320
  name: "fooList",
264
321
  defaultInitialize: { error: "FooList is not configured" },
265
322
  });
266
323
 
324
+ registerAssistantScope({
325
+ name: "foo",
326
+ defaultInitialize: { error: "Foo is not configured" },
327
+ });
328
+
267
329
  ```
268
330
 
269
331
  ## lib/store/foo-store.tsx
@@ -271,6 +333,9 @@ registerAssistantScope({
271
333
  ```tsx
272
334
  "use client";
273
335
 
336
+ // Import scope types first to ensure module augmentation is available
337
+ import "./foo-scope";
338
+
274
339
  import React from "react";
275
340
  import { resource, tapState } from "@assistant-ui/tap";
276
341
  import {
@@ -280,12 +345,9 @@ import {
280
345
  tapStoreList,
281
346
  DerivedScope,
282
347
  useAssistantState,
348
+ tapStoreContext,
283
349
  } from "@assistant-ui/store";
284
350
 
285
- /**
286
- * Single Foo item resource
287
- * Manages the state and actions for a single foo item
288
- */
289
351
  export const FooItemResource = resource(
290
352
  ({
291
353
  initialValue: { id, initialBar },
@@ -294,6 +356,8 @@ export const FooItemResource = resource(
294
356
  initialValue: { id: string; initialBar: string };
295
357
  remove: () => void;
296
358
  }) => {
359
+ const { events } = tapStoreContext();
360
+
297
361
  const [state, setState] = tapState<{ id: string; bar: string }>({
298
362
  id,
299
363
  bar: initialBar,
@@ -301,13 +365,19 @@ export const FooItemResource = resource(
301
365
 
302
366
  const updateBar = (newBar: string) => {
303
367
  setState({ ...state, bar: newBar });
368
+ events.emit("foo.updated", { id, newValue: newBar });
369
+ };
370
+
371
+ const handleRemove = () => {
372
+ events.emit("foo.removed", { id });
373
+ remove();
304
374
  };
305
375
 
306
376
  return tapApi(
307
377
  {
308
378
  getState: () => state,
309
379
  updateBar,
310
- remove,
380
+ remove: handleRemove,
311
381
  },
312
382
  { key: id },
313
383
  );
@@ -320,6 +390,7 @@ export const FooItemResource = resource(
320
390
  */
321
391
  let counter = 3;
322
392
  export const FooListResource = resource(() => {
393
+ const { events } = tapStoreContext();
323
394
  const idGenerator = () => `foo-${++counter}`;
324
395
 
325
396
  const foos = tapStoreList({
@@ -332,10 +403,16 @@ export const FooListResource = resource(() => {
332
403
  idGenerator,
333
404
  });
334
405
 
406
+ const addFoo = (id?: string) => {
407
+ const newId = id ?? idGenerator();
408
+ foos.add(newId);
409
+ events.emit("fooList.added", { id: newId });
410
+ };
411
+
335
412
  return tapApi({
336
413
  getState: () => ({ foos: foos.state }),
337
414
  foo: foos.api,
338
- addFoo: (id?: string) => foos.add(id),
415
+ addFoo,
339
416
  });
340
417
  });
341
418
 
@@ -408,15 +485,14 @@ export default nextConfig;
408
485
  "scripts": {
409
486
  "dev": "next dev",
410
487
  "build": "next build",
411
- "start": "next start",
412
- "lint": "eslint"
488
+ "start": "next start"
413
489
  },
414
490
  "dependencies": {
415
491
  "@assistant-ui/store": "workspace:*",
416
492
  "@assistant-ui/tap": "workspace:*",
417
- "next": "16.0.4",
418
- "react": "19.2.0",
419
- "react-dom": "19.2.0"
493
+ "next": "16.0.7",
494
+ "react": "19.2.1",
495
+ "react-dom": "19.2.1"
420
496
  },
421
497
  "devDependencies": {
422
498
  "@assistant-ui/x-buildutils": "workspace:*",
@@ -424,8 +500,6 @@ export default nextConfig;
424
500
  "@types/node": "^24",
425
501
  "@types/react": "19.2.7",
426
502
  "@types/react-dom": "19.2.3",
427
- "eslint": "^9",
428
- "eslint-config-next": "16.0.4",
429
503
  "tailwindcss": "^4",
430
504
  "typescript": "^5"
431
505
  }