@assistant-ui/mcp-docs-server 0.1.29 → 0.1.31

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 (214) hide show
  1. package/.docs/organized/code-examples/waterfall.md +15 -7
  2. package/.docs/organized/code-examples/with-a2a.md +9 -21
  3. package/.docs/organized/code-examples/with-ag-ui.md +11 -8
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +10 -10
  5. package/.docs/organized/code-examples/with-artifacts.md +12 -10
  6. package/.docs/organized/code-examples/with-assistant-transport.md +11 -12
  7. package/.docs/organized/code-examples/with-chain-of-thought.md +83 -54
  8. package/.docs/organized/code-examples/with-cloud-standalone.md +14 -11
  9. package/.docs/organized/code-examples/with-cloud.md +9 -10
  10. package/.docs/organized/code-examples/with-custom-thread-list.md +61 -16
  11. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +17 -12
  12. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +13 -13
  13. package/.docs/organized/code-examples/with-expo.md +25 -21
  14. package/.docs/organized/code-examples/with-external-store.md +8 -8
  15. package/.docs/organized/code-examples/with-ffmpeg.md +17 -12
  16. package/.docs/organized/code-examples/with-generative-ui.md +9 -9
  17. package/.docs/organized/code-examples/with-google-adk.md +8 -8
  18. package/.docs/organized/code-examples/with-heat-graph.md +5 -5
  19. package/.docs/organized/code-examples/with-interactables.md +10 -25
  20. package/.docs/organized/code-examples/with-langchain.md +437 -0
  21. package/.docs/organized/code-examples/with-langgraph.md +16 -16
  22. package/.docs/organized/code-examples/with-livekit.md +18 -13
  23. package/.docs/organized/code-examples/with-opencode.md +105 -62
  24. package/.docs/organized/code-examples/with-parent-id-grouping.md +10 -10
  25. package/.docs/organized/code-examples/with-react-hook-form.md +220 -148
  26. package/.docs/organized/code-examples/with-react-ink.md +2 -2
  27. package/.docs/organized/code-examples/with-react-router.md +12 -12
  28. package/.docs/organized/code-examples/with-store.md +8 -5
  29. package/.docs/organized/code-examples/with-tanstack.md +10 -10
  30. package/.docs/organized/code-examples/with-tap-runtime.md +10 -6
  31. package/.docs/raw/docs/(docs)/cli.mdx +2 -1
  32. package/.docs/raw/docs/(docs)/copilots/assistant-frame.mdx +1 -0
  33. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +10 -3
  34. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +8 -3
  35. package/.docs/raw/docs/(docs)/copilots/make-assistant-visible.mdx +1 -0
  36. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +1 -0
  37. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +1 -0
  38. package/.docs/raw/docs/(docs)/copilots/use-assistant-instructions.mdx +1 -0
  39. package/.docs/raw/docs/(docs)/devtools.mdx +1 -0
  40. package/.docs/raw/docs/(docs)/index.mdx +1 -0
  41. package/.docs/raw/docs/(docs)/installation.mdx +1 -0
  42. package/.docs/raw/docs/(docs)/rtl.mdx +80 -0
  43. package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +34 -0
  44. package/.docs/raw/docs/(reference)/api-reference/adapters/feedback-speech.mdx +41 -0
  45. package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +26 -0
  46. package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +34 -0
  47. package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +31 -0
  48. package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +20 -0
  49. package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +26 -0
  50. package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +72 -0
  51. package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +41 -0
  52. package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +48 -0
  53. package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +30 -0
  54. package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +23 -0
  55. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +21 -0
  56. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +7 -0
  57. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +149 -40
  58. package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +65 -0
  59. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +2 -0
  60. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +50 -6
  61. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +15 -0
  62. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +36 -1
  63. package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +38 -0
  64. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +9 -0
  65. package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +144 -6
  66. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +231 -3
  67. package/.docs/raw/docs/cloud/ai-sdk.mdx +221 -3
  68. package/.docs/raw/docs/cloud/langgraph.mdx +274 -2
  69. package/.docs/raw/docs/{(docs)/guides → guides}/attachments.mdx +41 -36
  70. package/.docs/raw/docs/guides/branching.mdx +76 -0
  71. package/.docs/raw/docs/guides/chain-of-thought.mdx +166 -0
  72. package/.docs/raw/docs/{(docs)/guides → guides}/context-api.mdx +50 -22
  73. package/.docs/raw/docs/{(docs)/guides → guides}/dictation.mdx +2 -0
  74. package/.docs/raw/docs/guides/editing.mdx +102 -0
  75. package/.docs/raw/docs/guides/index.mdx +103 -0
  76. package/.docs/raw/docs/{(docs)/guides → guides}/interactables.mdx +49 -0
  77. package/.docs/raw/docs/{(docs)/guides → guides}/latex.mdx +51 -8
  78. package/.docs/raw/docs/guides/mentions.mdx +520 -0
  79. package/.docs/raw/docs/{(docs)/guides → guides}/message-timing.mdx +8 -2
  80. package/.docs/raw/docs/{(docs)/guides → guides}/multi-agent.mdx +64 -4
  81. package/.docs/raw/docs/{(docs)/guides → guides}/quoting.mdx +10 -17
  82. package/.docs/raw/docs/guides/slash-commands.mdx +361 -0
  83. package/.docs/raw/docs/guides/speech.mdx +156 -0
  84. package/.docs/raw/docs/{(docs)/guides → guides}/suggestions.mdx +21 -83
  85. package/.docs/raw/docs/{(docs)/guides → guides}/tool-ui.mdx +108 -36
  86. package/.docs/raw/docs/{(docs)/guides → guides}/tools.mdx +131 -35
  87. package/.docs/raw/docs/{(docs)/guides → guides}/voice.mdx +39 -0
  88. package/.docs/raw/docs/ink/index.mdx +1 -3
  89. package/.docs/raw/docs/ink/migration.mdx +1 -3
  90. package/.docs/raw/docs/ink/primitives.mdx +37 -1
  91. package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +520 -0
  92. package/.docs/raw/docs/integrations/auth/better-auth.mdx +191 -0
  93. package/.docs/raw/docs/integrations/auth/clerk.mdx +172 -0
  94. package/.docs/raw/docs/integrations/auth/next-auth.mdx +196 -0
  95. package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +79 -0
  96. package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +188 -0
  97. package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +57 -0
  98. package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +201 -0
  99. package/.docs/raw/docs/integrations/gateways/index.mdx +157 -0
  100. package/.docs/raw/docs/integrations/index.mdx +173 -0
  101. package/.docs/raw/docs/integrations/observability/helicone.mdx +130 -0
  102. package/.docs/raw/docs/integrations/observability/langfuse.mdx +156 -0
  103. package/.docs/raw/docs/integrations/observability/langsmith.mdx +146 -0
  104. package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +712 -0
  105. package/.docs/raw/docs/integrations/tools/mcp.mdx +267 -0
  106. package/.docs/raw/docs/primitives/action-bar.mdx +1 -0
  107. package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -0
  108. package/.docs/raw/docs/primitives/attachment.mdx +1 -0
  109. package/.docs/raw/docs/primitives/branch-picker.mdx +1 -0
  110. package/.docs/raw/docs/primitives/chain-of-thought.mdx +90 -85
  111. package/.docs/raw/docs/primitives/composer.mdx +96 -63
  112. package/.docs/raw/docs/primitives/error.mdx +1 -0
  113. package/.docs/raw/docs/primitives/index.mdx +2 -1
  114. package/.docs/raw/docs/primitives/message.mdx +68 -5
  115. package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -0
  116. package/.docs/raw/docs/primitives/suggestion.mdx +1 -0
  117. package/.docs/raw/docs/primitives/thread-list.mdx +39 -0
  118. package/.docs/raw/docs/primitives/thread.mdx +16 -13
  119. package/.docs/raw/docs/react-native/index.mdx +1 -3
  120. package/.docs/raw/docs/react-native/migration.mdx +1 -3
  121. package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +396 -0
  122. package/.docs/raw/docs/runtimes/a2a/overview.mdx +60 -0
  123. package/.docs/raw/docs/runtimes/a2a/quickstart.mdx +216 -0
  124. package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +70 -0
  125. package/.docs/raw/docs/runtimes/ag-ui/quickstart.mdx +243 -0
  126. package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +123 -0
  127. package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +52 -0
  128. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +71 -131
  129. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +69 -63
  130. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +365 -101
  131. package/.docs/raw/docs/runtimes/concepts/adapters.mdx +265 -0
  132. package/.docs/raw/docs/runtimes/concepts/architecture.mdx +125 -0
  133. package/.docs/raw/docs/runtimes/concepts/stability.mdx +67 -0
  134. package/.docs/raw/docs/runtimes/concepts/threads.mdx +428 -0
  135. package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +703 -0
  136. package/.docs/raw/docs/runtimes/custom/data-stream.mdx +323 -0
  137. package/.docs/raw/docs/runtimes/custom/external-store.mdx +253 -1236
  138. package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +746 -0
  139. package/.docs/raw/docs/runtimes/custom/overview.mdx +71 -0
  140. package/.docs/raw/docs/runtimes/google-adk/api.mdx +256 -0
  141. package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +717 -0
  142. package/.docs/raw/docs/runtimes/google-adk/overview.mdx +69 -0
  143. package/.docs/raw/docs/runtimes/google-adk/quickstart.mdx +229 -0
  144. package/.docs/raw/docs/runtimes/langchain.mdx +533 -0
  145. package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +305 -0
  146. package/.docs/raw/docs/runtimes/langgraph/interrupts.mdx +104 -0
  147. package/.docs/raw/docs/runtimes/langgraph/overview.mdx +84 -0
  148. package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +496 -0
  149. package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +127 -0
  150. package/.docs/raw/docs/runtimes/langgraph/threads.mdx +113 -0
  151. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +3 -3
  152. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +0 -23
  153. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -1
  154. package/.docs/raw/docs/runtimes/opencode/hooks.mdx +191 -0
  155. package/.docs/raw/docs/runtimes/opencode/overview.mdx +48 -0
  156. package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +119 -0
  157. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +74 -198
  158. package/.docs/raw/docs/ui/accordion.mdx +1 -0
  159. package/.docs/raw/docs/ui/assistant-modal.mdx +1 -0
  160. package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -0
  161. package/.docs/raw/docs/ui/attachment.mdx +1 -0
  162. package/.docs/raw/docs/ui/badge.mdx +1 -0
  163. package/.docs/raw/docs/ui/composer-trigger-popover.mdx +200 -0
  164. package/.docs/raw/docs/ui/context-display.mdx +1 -0
  165. package/.docs/raw/docs/ui/diff-viewer.mdx +1 -0
  166. package/.docs/raw/docs/ui/directive-text.mdx +114 -0
  167. package/.docs/raw/docs/ui/file.mdx +1 -0
  168. package/.docs/raw/docs/ui/image.mdx +1 -0
  169. package/.docs/raw/docs/ui/markdown.mdx +2 -14
  170. package/.docs/raw/docs/ui/mermaid.mdx +1 -0
  171. package/.docs/raw/docs/ui/message-timing.mdx +3 -2
  172. package/.docs/raw/docs/ui/model-selector.mdx +1 -0
  173. package/.docs/raw/docs/ui/part-grouping.mdx +325 -313
  174. package/.docs/raw/docs/ui/quote.mdx +1 -0
  175. package/.docs/raw/docs/ui/reasoning.mdx +69 -32
  176. package/.docs/raw/docs/ui/scrollbar.mdx +1 -0
  177. package/.docs/raw/docs/ui/select.mdx +1 -0
  178. package/.docs/raw/docs/ui/sources.mdx +1 -0
  179. package/.docs/raw/docs/ui/streamdown.mdx +1 -0
  180. package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -0
  181. package/.docs/raw/docs/ui/tabs.mdx +1 -0
  182. package/.docs/raw/docs/ui/thread-list.mdx +17 -0
  183. package/.docs/raw/docs/ui/thread.mdx +56 -1
  184. package/.docs/raw/docs/ui/tool-fallback.mdx +1 -0
  185. package/.docs/raw/docs/ui/tool-group.mdx +39 -11
  186. package/.docs/raw/docs/ui/voice.mdx +1 -0
  187. package/.docs/raw/docs/utilities/heat-graph.mdx +1 -0
  188. package/.docs/raw/docs/utilities/react-o11y.mdx +278 -0
  189. package/.docs/raw/docs/utilities/tw-shimmer.mdx +1 -0
  190. package/dist/utils/logger.js +1 -1
  191. package/dist/utils/logger.js.map +1 -1
  192. package/package.json +4 -4
  193. package/src/tools/tests/path-traversal.test.ts +1 -1
  194. package/src/utils/logger.ts +1 -1
  195. package/.docs/raw/docs/(docs)/guides/branching.mdx +0 -65
  196. package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +0 -164
  197. package/.docs/raw/docs/(docs)/guides/editing.mdx +0 -66
  198. package/.docs/raw/docs/(docs)/guides/mentions.mdx +0 -406
  199. package/.docs/raw/docs/(docs)/guides/slash-commands.mdx +0 -275
  200. package/.docs/raw/docs/(docs)/guides/speech.mdx +0 -38
  201. package/.docs/raw/docs/runtimes/a2a/index.mdx +0 -298
  202. package/.docs/raw/docs/runtimes/assistant-transport.mdx +0 -1033
  203. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +0 -268
  204. package/.docs/raw/docs/runtimes/custom/local.mdx +0 -1464
  205. package/.docs/raw/docs/runtimes/data-stream.mdx +0 -422
  206. package/.docs/raw/docs/runtimes/google-adk/index.mdx +0 -686
  207. package/.docs/raw/docs/runtimes/helicone.mdx +0 -61
  208. package/.docs/raw/docs/runtimes/langgraph/index.mdx +0 -607
  209. package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +0 -12
  210. package/.docs/raw/docs/runtimes/langserve.mdx +0 -116
  211. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -218
  212. package/.docs/raw/docs/runtimes/mastra/overview.mdx +0 -18
  213. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -217
  214. package/.docs/raw/docs/ui/mention.mdx +0 -168
@@ -0,0 +1,278 @@
1
+ ---
2
+ title: react-o11y
3
+ description: Headless primitives for visualizing observability spans (traces, waterfalls).
4
+ platforms: ["react"]
5
+ ---
6
+
7
+ <Callout type="warn">
8
+ `@assistant-ui/react-o11y` is currently v0.0.11 and experimental. The API may change without notice.
9
+ </Callout>
10
+
11
+ `@assistant-ui/react-o11y` provides headless, Radix-style primitives for rendering observability spans as collapsible, indented hierarchical UIs. Use it to build trace inspectors, waterfall debug panels, or LLM call timelines on top of your own span data source.
12
+
13
+ - **Headless** — Zero styling opinions, bring your own CSS / Tailwind.
14
+ - **Composable** — Radix-style primitive parts you fully control.
15
+ - **Tree-aware** — Automatic depth, parent / child collapse, time range computation.
16
+ - **Tap-powered** — Built on the same `@assistant-ui/tap` reactive primitives as the runtimes.
17
+
18
+ ## Installation
19
+
20
+ <InstallCommand npm={["@assistant-ui/react-o11y"]} />
21
+
22
+ ## Quick start
23
+
24
+ Mount `SpanResource` with your span data, then render primitives that read from the resource's state:
25
+
26
+ ```tsx title="components/trace-view.tsx"
27
+ "use client";
28
+
29
+ import {
30
+ SpanPrimitive,
31
+ SpanResource,
32
+ type SpanData,
33
+ } from "@assistant-ui/react-o11y";
34
+ import { useAui, AuiProvider } from "@assistant-ui/store";
35
+
36
+ function SpanRow() {
37
+ return (
38
+ <SpanPrimitive.Root className="flex items-center gap-2 py-1">
39
+ <SpanPrimitive.Indent />
40
+ <SpanPrimitive.CollapseToggle className="size-4 cursor-pointer">
41
+ ▸
42
+ </SpanPrimitive.CollapseToggle>
43
+ <SpanPrimitive.StatusIndicator className="size-2 rounded-full data-[span-status=running]:bg-yellow-500 data-[span-status=completed]:bg-green-500 data-[span-status=failed]:bg-red-500" />
44
+ <SpanPrimitive.TypeBadge className="rounded bg-muted px-1.5 text-xs" />
45
+ <SpanPrimitive.Name className="text-sm" />
46
+ <SpanPrimitive.Children components={{ Span: SpanRow }} />
47
+ </SpanPrimitive.Root>
48
+ );
49
+ }
50
+
51
+ export function TraceView({ spans }: { spans: SpanData[] }) {
52
+ const aui = useAui({ resource: SpanResource({ spans }) });
53
+
54
+ return (
55
+ <AuiProvider value={aui}>
56
+ <SpanPrimitive.Children components={{ Span: SpanRow }} />
57
+ </AuiProvider>
58
+ );
59
+ }
60
+ ```
61
+
62
+ `SpanData` is the input shape your code produces (see [SpanData](#spandata)). `SpanResource` enriches it with depth, child counts, time range, and collapse state.
63
+
64
+ ## Anatomy
65
+
66
+ ```tsx
67
+ import {
68
+ SpanPrimitive,
69
+ SpanResource,
70
+ SpanByIndexProvider,
71
+ } from "@assistant-ui/react-o11y";
72
+
73
+ // Top-level: mount SpanResource via useAui
74
+ const aui = useAui({ resource: SpanResource({ spans }) });
75
+
76
+ <AuiProvider value={aui}>
77
+ {/* Render visible spans (flat-list output respecting collapsed state) */}
78
+ <SpanPrimitive.Children components={{ Span: SpanRow }} />
79
+ </AuiProvider>;
80
+
81
+ // Each <SpanRow /> sits inside its own SpanByIndexProvider context and reads via primitives
82
+ function SpanRow() {
83
+ return (
84
+ <SpanPrimitive.Root>
85
+ <SpanPrimitive.Indent />
86
+ <SpanPrimitive.CollapseToggle />
87
+ <SpanPrimitive.StatusIndicator />
88
+ <SpanPrimitive.TypeBadge />
89
+ <SpanPrimitive.Name />
90
+ </SpanPrimitive.Root>
91
+ );
92
+ }
93
+ ```
94
+
95
+ `SpanPrimitive.Children` produces a flat list of visible spans (collapsed subtrees are excluded). Each rendered child is wrapped in a `SpanByIndexProvider` so its primitives resolve to that specific span's state.
96
+
97
+ ## API reference
98
+
99
+ ### SpanResource
100
+
101
+ Tap resource that ingests raw span data and exposes a tree-aware reactive state to primitives.
102
+
103
+ ```ts
104
+ SpanResource({ spans }: { spans: SpanData[] }): ClientOutput<"span">;
105
+ ```
106
+
107
+ Mount through `useAui({ resource: SpanResource({ spans }) })`.
108
+
109
+ The resource computes:
110
+
111
+ - **depth** of each span based on parent chain.
112
+ - **hasChildren** flag.
113
+ - **timeRange** (`min` / `max` across all spans).
114
+ - **collapse state** managed internally; toggles through primitives.
115
+
116
+ ### SpanData
117
+
118
+ Input shape you provide to `SpanResource`:
119
+
120
+ | Field | Type | Description |
121
+ | --- | --- | --- |
122
+ | `id` | `string` | Unique span identifier. |
123
+ | `parentSpanId` | `string \| null` | Parent span id, or `null` for root spans. |
124
+ | `name` | `string` | Display name. |
125
+ | `type` | `string` | Span category (e.g. `llm`, `tool`, `http`). Used by `TypeBadge`. |
126
+ | `status` | `"running" \| "completed" \| "failed" \| "skipped"` | Lifecycle state. Used by `StatusIndicator`. |
127
+ | `startedAt` | `number` | Start timestamp (ms). |
128
+ | `endedAt` | `number \| null` | End timestamp (ms), or `null` if still running. |
129
+ | `latencyMs` | `number \| null` | Pre-computed latency, or `null` if running. |
130
+
131
+ ### SpanState
132
+
133
+ Returned by `useAuiState((s) => s.span)` inside any span-scoped subtree:
134
+
135
+ ```ts
136
+ type SpanState = {
137
+ id: string;
138
+ parentSpanId: string | null;
139
+ name: string;
140
+ type: string;
141
+ status: "running" | "completed" | "failed" | "skipped";
142
+ startedAt: number;
143
+ endedAt: number | null;
144
+ latencyMs: number | null;
145
+ depth: number;
146
+ hasChildren: boolean;
147
+ isCollapsed: boolean;
148
+ children: SpanItemState[];
149
+ timeRange: { min: number; max: number };
150
+ };
151
+ ```
152
+
153
+ ### SpanPrimitive.Root
154
+
155
+ Container `<div>` exposing span state via data attributes for styling:
156
+
157
+ | Attribute | Source |
158
+ | --- | --- |
159
+ | `data-span-id` | `span.id` |
160
+ | `data-span-status` | `span.status` |
161
+ | `data-span-type` | `span.type` |
162
+ | `data-span-depth` | `span.depth` |
163
+ | `data-collapsed` | `span.isCollapsed` |
164
+
165
+ Accepts all standard `<div>` props.
166
+
167
+ ### SpanPrimitive.Indent
168
+
169
+ A `<div>` that adds horizontal padding proportional to span depth.
170
+
171
+ | Prop | Type | Default | Description |
172
+ | --- | --- | --- | --- |
173
+ | `baseIndent` | `number` | `8` | Base padding in pixels. |
174
+ | `indentPerLevel` | `number` | `12` | Additional padding per depth level. |
175
+
176
+ Final `paddingLeft = baseIndent + depth * indentPerLevel`.
177
+
178
+ ### SpanPrimitive.CollapseToggle
179
+
180
+ A `<button>` that toggles the current span's collapsed state. Renders only when the span has children. Stops click propagation so it can be nested inside a clickable row.
181
+
182
+ Exposes `data-collapsed` for styling. Accepts all standard `<button>` props.
183
+
184
+ ### SpanPrimitive.StatusIndicator
185
+
186
+ A `<span>` that exposes `data-span-status` for status-based styling (color, icon swap, etc.). Renders no built-in glyph; you provide the visual.
187
+
188
+ ```tsx
189
+ <SpanPrimitive.StatusIndicator className="size-2 rounded-full data-[span-status=running]:bg-yellow-500 data-[span-status=completed]:bg-green-500 data-[span-status=failed]:bg-red-500 data-[span-status=skipped]:bg-gray-400" />
190
+ ```
191
+
192
+ ### SpanPrimitive.TypeBadge
193
+
194
+ A `<span>` that defaults its children to `span.type` (override by passing custom children). Exposes `data-span-type`.
195
+
196
+ ### SpanPrimitive.Name
197
+
198
+ A `<span>` that defaults its children to `span.name`. Override by passing custom children.
199
+
200
+ ### SpanPrimitive.Children
201
+
202
+ Iterates over visible child spans and renders each.
203
+
204
+ Two usage modes:
205
+
206
+ **Render-prop:**
207
+
208
+ ```tsx
209
+ <SpanPrimitive.Children>
210
+ {({ span }) => <CustomRow span={span} />}
211
+ </SpanPrimitive.Children>
212
+ ```
213
+
214
+ **Component prop (recommended for performance):**
215
+
216
+ ```tsx
217
+ <SpanPrimitive.Children components={{ Span: SpanRow }} />
218
+ ```
219
+
220
+ The `components.Span` form is memoized; pass a stable component reference to avoid re-renders on unrelated state changes.
221
+
222
+ Each child is wrapped in `SpanByIndexProvider` automatically, so primitives inside `SpanRow` read that child's state.
223
+
224
+ ### SpanByIndexProvider
225
+
226
+ Lower-level escape hatch. Selects one span by index and provides its scope to descendants:
227
+
228
+ ```tsx
229
+ <SpanByIndexProvider index={0}>
230
+ <SpanPrimitive.Root>{/* reads span at index 0 */}</SpanPrimitive.Root>
231
+ </SpanByIndexProvider>
232
+ ```
233
+
234
+ Most users do not need to use this directly; `SpanPrimitive.Children` wires it up automatically.
235
+
236
+ ### SpanPrimitive.ChildByIndex
237
+
238
+ Convenience component that pairs `SpanByIndexProvider` with a render component:
239
+
240
+ ```tsx
241
+ <SpanPrimitive.ChildByIndex index={0} components={{ Span: SpanRow }} />
242
+ ```
243
+
244
+ Useful when you want explicit control over which child indices to render (e.g. for virtualization).
245
+
246
+ ## Styling
247
+
248
+ All primitives forward refs and accept standard DOM props (`className`, `style`, etc.). Use the data attributes for state-based styling:
249
+
250
+ ```css
251
+ [data-span-status="running"] {
252
+ /* yellow indicator */
253
+ }
254
+ [data-span-status="failed"] {
255
+ /* red indicator */
256
+ }
257
+ [data-collapsed="true"] svg {
258
+ transform: rotate(0deg);
259
+ }
260
+ [data-collapsed="false"] svg {
261
+ transform: rotate(90deg);
262
+ }
263
+ ```
264
+
265
+ ## Related
266
+
267
+ <Cards>
268
+ <Card
269
+ title="heat-graph"
270
+ description="Activity heatmap primitives in the same Radix-style headless pattern."
271
+ href="/docs/utilities/heat-graph"
272
+ />
273
+ <Card
274
+ title="Primitives overview"
275
+ description="The broader assistant-ui primitive system."
276
+ href="/docs/primitives"
277
+ />
278
+ </Cards>
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  title: tw-shimmer
3
3
  description: Tailwind CSS v4 plugin for shimmer effects.
4
+ platforms: ["react"]
4
5
  ---
5
6
 
6
7
  `tw-shimmer` is a zero-dependency Tailwind CSS v4 plugin that provides polished shimmer animations for both text and skeleton loaders. It uses sine-eased gradients with 17 carefully calculated stops and OKLCH color mixing for smooth, banding-free effects.
@@ -1,7 +1,7 @@
1
1
  import { IS_PREPARE_MODE } from "../constants.js";
2
2
  export const logger = {
3
3
  debug: (message, ...args) => {
4
- if (process.env["DEBUG"]) {
4
+ if (process.env.DEBUG) {
5
5
  console.debug(`[DEBUG] ${message}`, ...args);
6
6
  }
7
7
  },
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACzC,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACzB,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IACD,IAAI,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACxC,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IACD,KAAK,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACzC,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACxC,OAAO,CAAC,IAAI,CAAC,UAAU,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF,CAAC"}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACzC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IACD,IAAI,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACxC,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IACD,KAAK,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACzC,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,EAAE,CAAC,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;QACxC,OAAO,CAAC,IAAI,CAAC,UAAU,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assistant-ui/mcp-docs-server",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "description": "MCP server for assistant-ui documentation and examples",
5
5
  "keywords": [
6
6
  "mcp",
@@ -34,13 +34,13 @@
34
34
  "dependencies": {
35
35
  "@modelcontextprotocol/sdk": "^1.29.0",
36
36
  "gray-matter": "^4.0.3",
37
- "zod": "^4.3.6"
37
+ "zod": "^4.4.3"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^25.6.0",
41
41
  "tsx": "^4.21.0",
42
- "vitest": "^4.1.4",
43
- "@assistant-ui/x-buildutils": "0.0.5"
42
+ "vitest": "^4.1.5",
43
+ "@assistant-ui/x-buildutils": "0.0.7"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public",
@@ -26,7 +26,7 @@ describe("Path Traversal Security", () => {
26
26
 
27
27
  it("should handle multiple paths with one malicious", async () => {
28
28
  const result = await testContext.callTool("assistantUIDocs", {
29
- paths: ["(docs)/index", "../../../../etc/passwd", "(docs)/guides"],
29
+ paths: ["(docs)/index", "../../../../etc/passwd", "guides"],
30
30
  });
31
31
 
32
32
  expect(result.results).toBeDefined();
@@ -2,7 +2,7 @@ import { IS_PREPARE_MODE } from "../constants.js";
2
2
 
3
3
  export const logger = {
4
4
  debug: (message: string, ...args: any[]) => {
5
- if (process.env["DEBUG"]) {
5
+ if (process.env.DEBUG) {
6
6
  console.debug(`[DEBUG] ${message}`, ...args);
7
7
  }
8
8
  },
@@ -1,65 +0,0 @@
1
- ---
2
- title: Message Branching
3
- description: Navigate between different conversation branches when editing or reloading messages.
4
- ---
5
-
6
- import { BranchingSample } from "@/components/docs/samples/branching";
7
-
8
- Switch between different conversation branches.
9
-
10
- <BranchingSample />
11
-
12
- A new branch is created when:
13
-
14
- - a user message is edited
15
- - an assistant message is reloaded
16
-
17
- Branches are automatically tracked by assistant-ui by observing changes to the `messages` array.
18
-
19
- ## Enabling branch support
20
-
21
- You can show a branch picker by using `BranchPickerPrimitive`.
22
-
23
- ```tsx {1, 8, 15-30}
24
- import { BranchPickerPrimitive } from "@assistant-ui/react";
25
-
26
-
27
- const Message = () => {
28
- return (
29
- <MessagePrimitive.Root>
30
- ...
31
- <BranchPicker /> {/* <-- show the branch picker */}
32
- ...
33
- </MessagePrimitive.Root>
34
- );
35
- };
36
-
37
-
38
- const BranchPicker = () => {
39
- return (
40
- <BranchPickerPrimitive.Root hideWhenSingleBranch>
41
- <BranchPickerPrimitive.Previous />
42
- <BranchPickerPrimitive.Number /> / <BranchPickerPrimitive.Count />
43
- <BranchPickerPrimitive.Next />
44
- </BranchPickerPrimitive.Root>
45
- );
46
- };
47
- ```
48
-
49
- ## API
50
-
51
- You can access the current branch state or navigate via the API as well.
52
- These APIs rely on the message scope and may only be called inside a message component.
53
-
54
- ```tsx
55
- import { useAui, useAuiState } from "@assistant-ui/react";
56
-
57
- // read branch state
58
- const { branchNumber, branchCount } = useAuiState((s) => s.message);
59
-
60
- // navigation
61
- const aui = useAui();
62
- aui.message().switchToBranch({ position: "next" });
63
- aui.message().switchToBranch({ position: "previous" });
64
- aui.message().switchToBranch({ branchId: "some-id" });
65
- ```
@@ -1,164 +0,0 @@
1
- ---
2
- title: Chain of Thought
3
- description: Group reasoning and tool calls into a collapsible accordion UI.
4
- ---
5
-
6
- LLMs often produce reasoning steps and tool calls in succession. Chain of Thought lets you visually group these consecutive parts into a single collapsible accordion, giving users a clean "thinking" UI.
7
-
8
- ## Overview
9
-
10
- When a model like OpenAI's `o4-mini` responds, it may emit a sequence of reasoning tokens and tool calls before producing its final text answer. By default, these parts render individually. `ChainOfThoughtPrimitive` groups consecutive reasoning + tool-call parts together and renders them through a single component.
11
-
12
- Key benefits:
13
-
14
- - **Cleaner UI** — Collapse intermediate steps behind a "Thinking" toggle
15
- - **Better context** — Users see that reasoning and tool calls are related
16
- - **Built-in accordion** — Expand/collapse with a single click; collapsed by default
17
-
18
- ## Quick Start
19
-
20
- <Steps>
21
- <Step>
22
-
23
- ### Pass a ChainOfThought component to MessagePrimitive.Parts
24
-
25
- `MessagePrimitive.Parts` accepts a `ChainOfThought` component. When provided, consecutive reasoning and tool-call parts are automatically grouped and rendered through it.
26
-
27
- ```tsx
28
- import {
29
- AuiIf,
30
- ChainOfThoughtPrimitive,
31
- MessagePrimitive,
32
- } from "@assistant-ui/react";
33
- import type { FC } from "react";
34
-
35
- const Reasoning: FC<{ text: string }> = ({ text }) => {
36
- return (
37
- <p className="whitespace-pre-wrap px-4 py-2 text-muted-foreground text-sm italic">
38
- {text}
39
- </p>
40
- );
41
- };
42
-
43
- const ChainOfThought: FC = () => {
44
- return (
45
- <ChainOfThoughtPrimitive.Root className="my-2 rounded-lg border">
46
- <ChainOfThoughtPrimitive.AccordionTrigger className="flex w-full cursor-pointer items-center gap-2 px-4 py-2 font-medium text-sm hover:bg-muted/50">
47
- Thinking
48
- </ChainOfThoughtPrimitive.AccordionTrigger>
49
- <AuiIf condition={(s) => !s.chainOfThought.collapsed}>
50
- <ChainOfThoughtPrimitive.Parts>
51
- {({ part }) => {
52
- if (part.type === "reasoning") return <Reasoning {...part} />;
53
- if (part.type === "tool-call") return <ToolFallback {...part} />;
54
- return null;
55
- }}
56
- </ChainOfThoughtPrimitive.Parts>
57
- </AuiIf>
58
- </ChainOfThoughtPrimitive.Root>
59
- );
60
- };
61
-
62
- const AssistantMessage: FC = () => {
63
- return (
64
- <MessagePrimitive.Root>
65
- <MessagePrimitive.Parts>
66
- {({ part }) => {
67
- if (part.type === "text") return <MarkdownText />;
68
- return null;
69
- }}
70
- </MessagePrimitive.Parts>
71
- </MessagePrimitive.Root>
72
- );
73
- };
74
- ```
75
-
76
- </Step>
77
- <Step>
78
-
79
- ### Use a reasoning model
80
-
81
- Chain of Thought is most useful with models that produce reasoning tokens (e.g. OpenAI `o4-mini`). Here's an example backend route using the Vercel AI SDK:
82
-
83
- ```tsx title="app/api/chat/route.ts"
84
- import { openai } from "@ai-sdk/openai";
85
- import { streamText, convertToModelMessages } from "ai";
86
-
87
- export async function POST(req: Request) {
88
- const { messages } = await req.json();
89
-
90
- const result = streamText({
91
- model: openai("o4-mini"),
92
- messages: await convertToModelMessages(messages),
93
- });
94
-
95
- return result.toUIMessageStreamResponse();
96
- }
97
- ```
98
-
99
- </Step>
100
- </Steps>
101
-
102
- ## API Reference
103
-
104
- ### ChainOfThoughtPrimitive.Root
105
-
106
- Container element for the chain of thought group. Renders a `<div>`.
107
-
108
- ### ChainOfThoughtPrimitive.AccordionTrigger
109
-
110
- A button that toggles the collapsed/expanded state. Collapsed by default.
111
-
112
- ### ChainOfThoughtPrimitive.Parts
113
-
114
- Renders the grouped parts when expanded (nothing when collapsed).
115
-
116
- ```tsx
117
- <AuiIf condition={(s) => !s.chainOfThought.collapsed}>
118
- <ChainOfThoughtPrimitive.Parts>
119
- {({ part }) => {
120
- if (part.type === "reasoning") return <Reasoning {...part} />;
121
- if (part.type === "tool-call") return <ToolFallback {...part} />;
122
- return null;
123
- }}
124
- </ChainOfThoughtPrimitive.Parts>
125
- </AuiIf>
126
- ```
127
-
128
- | Prop | Type | Description |
129
- | --- | --- | --- |
130
- | `components.Reasoning` | `FC<{ text: string }>` | Component to render reasoning parts |
131
- | `components.tools.Fallback` | `ToolCallMessagePartComponent` | Fallback component for tool-call parts |
132
- | `components.Layout` | `ComponentType<PropsWithChildren>` | Wrapper component around each rendered part when expanded |
133
-
134
- ## Reading Collapsed State
135
-
136
- Use `AuiIf` to conditionally render based on the accordion state:
137
-
138
- ```tsx
139
- import { AuiIf, ChainOfThoughtPrimitive } from "@assistant-ui/react";
140
- import { ChevronDownIcon, ChevronRightIcon } from "lucide-react";
141
-
142
- const ChainOfThoughtAccordionTrigger = () => {
143
- return (
144
- <ChainOfThoughtPrimitive.AccordionTrigger className="flex w-full cursor-pointer items-center gap-2 px-4 py-2 text-sm">
145
- <AuiIf condition={(s) => s.chainOfThought.collapsed}>
146
- <ChevronRightIcon className="size-4" />
147
- </AuiIf>
148
- <AuiIf condition={(s) => !s.chainOfThought.collapsed}>
149
- <ChevronDownIcon className="size-4" />
150
- </AuiIf>
151
- Thinking
152
- </ChainOfThoughtPrimitive.AccordionTrigger>
153
- );
154
- };
155
- ```
156
-
157
- ## Full Example
158
-
159
- See the complete [with-chain-of-thought example](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-chain-of-thought) for a working implementation with tool calls and reasoning.
160
-
161
- ## Related Guides
162
-
163
- - [Generative UI](/docs/guides/tool-ui) — Custom UI for tool calls
164
- - [Tools](/docs/guides/tools) — Defining and using tools
@@ -1,66 +0,0 @@
1
- ---
2
- title: Message Editing
3
- description: Allow users to edit their messages with custom editor interfaces.
4
- ---
5
-
6
- Give the user the ability to edit their message.
7
-
8
- ## Enabling edit support
9
-
10
- You can show an editor interface by using `ComposerPrimitive`.
11
-
12
- ```tsx {1-2,11,25,31-52}
13
- import { ComposerPrimitive, useAuiState } from "@assistant-ui/react";
14
- ...
15
-
16
- const Thread = () => {
17
- return (
18
- <ThreadPrimitive.Root>
19
- <ThreadPrimitive.Viewport>
20
- ...
21
- <ThreadPrimitive.Messages>
22
- {({ message }) => {
23
- // Show our new component during edit mode
24
- return <MessageWithEditComposer />;
25
- }}
26
- </ThreadPrimitive.Messages>
27
- </ThreadPrimitive.Viewport>
28
- ...
29
- </ThreadPrimitive.Root>
30
- );
31
- };
32
-
33
- const UserMessage = () => {
34
- return (
35
- <MessagePrimitive.Root>
36
- ...
37
- <ActionBarPrimitive.Root>
38
- ...
39
- <ActionBarPrimitive.Edit /> {/* <-- add a button to enable edit mode */}
40
- </ActionBarPrimitive.Root>
41
- </MessagePrimitive.Root>
42
- );
43
- };
44
-
45
- // define a wrapper component that handles both display and edit mode
46
- const MessageWithEditComposer = () => {
47
- const isEditing = useAuiState((s) => s.composer.isEditing);
48
- if (isEditing) return <EditComposer />;
49
- return <UserMessage />;
50
- };
51
-
52
- // define the edit composer component
53
- const EditComposer = () => {
54
- return (
55
- // you can return a MessagePrimitive including a ComposerPrimitive, or only a ComposerPrimitive
56
- <MessagePrimitive.Root>
57
- ...
58
- <ComposerPrimitive.Root>
59
- <ComposerPrimitive.Input />
60
- <ComposerPrimitive.Cancel />
61
- <ComposerPrimitive.Send />
62
- </ComposerPrimitive.Root>
63
- </MessagePrimitive.Root>
64
- );
65
- };
66
- ```