@assistant-ui/mcp-docs-server 0.1.34 → 0.1.35

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 (64) hide show
  1. package/.docs/organized/code-examples/waterfall.md +4 -4
  2. package/.docs/organized/code-examples/with-a2a.md +5 -5
  3. package/.docs/organized/code-examples/with-ag-ui.md +6 -6
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +7 -7
  5. package/.docs/organized/code-examples/with-artifacts.md +7 -7
  6. package/.docs/organized/code-examples/with-assistant-transport.md +5 -5
  7. package/.docs/organized/code-examples/with-browser-extension.md +5 -5
  8. package/.docs/organized/code-examples/with-chain-of-thought.md +8 -8
  9. package/.docs/organized/code-examples/with-cloud-standalone.md +7 -7
  10. package/.docs/organized/code-examples/with-cloud.md +7 -7
  11. package/.docs/organized/code-examples/with-custom-thread-list.md +7 -7
  12. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +9 -9
  13. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +9 -9
  14. package/.docs/organized/code-examples/with-expo.md +43 -17
  15. package/.docs/organized/code-examples/with-external-store.md +5 -5
  16. package/.docs/organized/code-examples/with-ffmpeg.md +7 -7
  17. package/.docs/organized/code-examples/with-generative-ui.md +32 -308
  18. package/.docs/organized/code-examples/with-google-adk.md +5 -5
  19. package/.docs/organized/code-examples/with-heat-graph.md +4 -4
  20. package/.docs/organized/code-examples/with-image-generation.md +7 -7
  21. package/.docs/organized/code-examples/with-interactables.md +7 -7
  22. package/.docs/organized/code-examples/with-langchain.md +7 -7
  23. package/.docs/organized/code-examples/with-langgraph.md +6 -6
  24. package/.docs/organized/code-examples/with-livekit.md +9 -9
  25. package/.docs/organized/code-examples/with-mcp.md +7 -7
  26. package/.docs/organized/code-examples/with-opencode.md +106 -580
  27. package/.docs/organized/code-examples/with-pi.md +2044 -0
  28. package/.docs/organized/code-examples/with-react-hook-form.md +8 -8
  29. package/.docs/organized/code-examples/with-react-ink-web.md +691 -0
  30. package/.docs/organized/code-examples/with-react-ink.md +28 -16
  31. package/.docs/organized/code-examples/with-react-router.md +5 -5
  32. package/.docs/organized/code-examples/with-resumable-stream.md +8 -8
  33. package/.docs/organized/code-examples/with-store.md +14 -10
  34. package/.docs/organized/code-examples/with-tanstack.md +18 -4
  35. package/.docs/organized/code-examples/with-tap-runtime.md +5 -5
  36. package/.docs/organized/code-examples/with-virtualized-thread.md +656 -0
  37. package/.docs/raw/docs/(docs)/architecture.mdx +13 -12
  38. package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +44 -1
  39. package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +1 -1
  40. package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +2 -23
  41. package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +22 -0
  42. package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +0 -7
  43. package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +20 -21
  44. package/.docs/raw/docs/guides/chain-of-thought.mdx +1 -1
  45. package/.docs/raw/docs/guides/index.mdx +3 -0
  46. package/.docs/raw/docs/guides/input-history.mdx +55 -0
  47. package/.docs/raw/docs/guides/virtualization.mdx +63 -0
  48. package/.docs/raw/docs/ink/hooks.mdx +2 -2
  49. package/.docs/raw/docs/react-native/hooks.mdx +1 -1
  50. package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +1 -3
  51. package/.docs/raw/docs/runtimes/concepts/stability.mdx +1 -1
  52. package/.docs/raw/docs/runtimes/custom/data-stream.mdx +1 -1
  53. package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +108 -4
  54. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +6 -6
  55. package/.docs/raw/docs/tools/tool-ui.mdx +37 -1
  56. package/.docs/raw/docs/ui/dot-matrix.mdx +133 -0
  57. package/.docs/raw/docs/ui/model-selector.mdx +219 -52
  58. package/.docs/raw/docs/ui/number-roll.mdx +154 -0
  59. package/.docs/raw/docs/ui/reasoning.mdx +3 -3
  60. package/.docs/raw/docs/ui/streamdown.mdx +2 -0
  61. package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -1
  62. package/.docs/raw/docs/ui/thread.mdx +52 -0
  63. package/.docs/raw/docs/ui/tool-fallback.mdx +2 -2
  64. package/package.json +3 -3
@@ -0,0 +1,154 @@
1
+ ---
2
+ title: Number Roll
3
+ description: Animated number that rolls digits odometer-style when the value changes.
4
+ platforms: ["react"]
5
+ ---
6
+
7
+ import { PreviewCode } from "@/components/docs/preview-code.server";
8
+ import {
9
+ NumberRollSample,
10
+ NumberRollCompactSample,
11
+ NumberRollFormatSample,
12
+ NumberRollLiveSample,
13
+ } from "@/components/docs/samples/number-roll";
14
+
15
+ <Callout>
16
+ This is a **standalone component** that does not depend on the assistant-ui runtime. Use it anywhere in your application.
17
+ </Callout>
18
+
19
+ <NumberRollSample />
20
+
21
+ ## Installation
22
+
23
+ <InstallCommand shadcn={["number-roll"]} />
24
+
25
+ This adds a `/components/assistant-ui/number-roll.tsx` file to your project, which you can adjust as needed. The component has no dependencies beyond React.
26
+
27
+ ## Usage
28
+
29
+ ```tsx
30
+ import { NumberRoll } from "@/components/assistant-ui/number-roll";
31
+
32
+ export function TokenCounter({ count }: { count: number }) {
33
+ return <NumberRoll value={count} format={{ notation: "compact" }} />;
34
+ }
35
+ ```
36
+
37
+ When `value` changes, each digit rolls in place to its new value. Formatting is handled by `Intl.NumberFormat`, so structural changes animate too: when `700` becomes `1.1K` with compact notation, the surviving ones digit rolls from 0 to 1 while the leading `70` slides out and the decimal point, fraction digit, and `K` suffix slide in.
38
+
39
+ ## Examples
40
+
41
+ ### Compact Notation
42
+
43
+ Pass any `Intl.NumberFormatOptions` via the `format` prop. Crossing a compact-notation threshold animates the formatting change instead of remounting the whole string.
44
+
45
+ <PreviewCode file="components/docs/samples/number-roll" name="NumberRollCompactSample">
46
+ <NumberRollCompactSample />
47
+ </PreviewCode>
48
+
49
+ ### Formats and Locales
50
+
51
+ Currencies, percentages, suffixes, and non-English locales all work through the same `Intl.NumberFormat` pipeline. Compact thresholds and suffixes are locale-dependent (`1.2万` in `zh-CN`), so never hardcode them.
52
+
53
+ <PreviewCode file="components/docs/samples/number-roll" name="NumberRollFormatSample">
54
+ <NumberRollFormatSample />
55
+ </PreviewCode>
56
+
57
+ ### Live Counter
58
+
59
+ Rapid successive updates retarget the in-flight roll smoothly, which makes the component suitable for streaming token counts and other live metrics.
60
+
61
+ <PreviewCode file="components/docs/samples/number-roll" name="NumberRollLiveSample">
62
+ <NumberRollLiveSample />
63
+ </PreviewCode>
64
+
65
+ ## How It Works
66
+
67
+ The value is formatted with `Intl.NumberFormat.formatToParts` and split into keyed parts. Integer digits are keyed by place value counted from the right, so when `999` becomes `1,000` the existing columns keep their identity and roll in place while only the new leading digit and separator enter. Symbols (decimal point, group separators, currency signs, compact suffixes) cross-fade and collapse via animated `grid-template-columns`.
68
+
69
+ Each digit renders a strip of 0 to 9 and animates a registered CSS custom property; CSS `mod()` math wraps the strip into an endless ribbon, so rolling from 9 to 0 continues in the trend direction instead of spinning backwards. There is no JavaScript animation loop and no animation library dependency.
70
+
71
+ In browsers without CSS `mod()` support, and during server rendering, the component renders the plain formatted string. With `prefers-reduced-motion`, values swap instantly without rolling. When server rendering, pass an explicit `locales`: the server's default locale can differ from the visitor's browser locale, and a mismatched formatted string causes a React hydration error. Locales whose default numbering system is non-Latin (such as `ar-EG`) cross-fade their digits as symbols instead of rolling.
72
+
73
+ The formatted value is exposed to screen readers as plain text while the animated digits are `aria-hidden`. Value changes are not announced automatically; wrap the component in an `aria-live` region if you need announcements.
74
+
75
+ ## API Reference
76
+
77
+ ### NumberRoll
78
+
79
+ <ParametersTable
80
+ type="NumberRollProps"
81
+ parameters={[
82
+ {
83
+ name: "value",
84
+ type: "number",
85
+ required: true,
86
+ description: "The number to display.",
87
+ },
88
+ {
89
+ name: "format",
90
+ type: "Intl.NumberFormatOptions",
91
+ description:
92
+ "Number formatting options, e.g. `{ notation: \"compact\" }` or `{ style: \"currency\", currency: \"USD\" }`.",
93
+ },
94
+ {
95
+ name: "locales",
96
+ type: "Intl.LocalesArgument",
97
+ description:
98
+ "Locale(s) passed to `Intl.NumberFormat`. Pass an explicit value in server-rendered apps so the server and client format identically.",
99
+ },
100
+ {
101
+ name: "prefix",
102
+ type: "string",
103
+ description: "Static text rendered before the number.",
104
+ },
105
+ {
106
+ name: "suffix",
107
+ type: "string",
108
+ description: "Static text rendered after the number.",
109
+ },
110
+ {
111
+ name: "trend",
112
+ type: '"auto" | "up" | "down"',
113
+ default: '"auto"',
114
+ description:
115
+ "Roll direction. `auto` follows the sign of the value change; `up` and `down` force a direction, wrapping digits through 9/0 as needed.",
116
+ },
117
+ {
118
+ name: "duration",
119
+ type: "number",
120
+ default: "500",
121
+ description:
122
+ "Digit roll duration in milliseconds. Enter/exit fades run at 60% of this value.",
123
+ },
124
+ {
125
+ name: "className",
126
+ type: "string",
127
+ description: "Additional CSS classes.",
128
+ },
129
+ ]}
130
+ />
131
+
132
+ ### Styling
133
+
134
+ The root applies `tabular-nums` so digits keep a constant width while rolling; the font you use must provide tabular figures for the layout to stay stable. Size and color are inherited from the surrounding text, so style it like any span:
135
+
136
+ ```tsx
137
+ <NumberRoll value={value} className="text-4xl font-semibold" />
138
+ ```
139
+
140
+ Change the animation speed via the `duration` prop; it drives both the CSS timing and the cleanup that unmounts exited characters, so overriding the duration variable in CSS alone would remove them mid-fade. The fade and easing variables are safe to override via the `style` prop (the defaults are set as inline styles, so plain `className` overrides do not apply):
141
+
142
+ | Variable | Default | Description |
143
+ |----------|---------|-------------|
144
+ | `--aui-number-roll-duration` | `500ms` (from the `duration` prop) | Digit roll duration. |
145
+ | `--aui-number-roll-fade` | 60% of the duration | Enter/exit fade and width-collapse duration. |
146
+ | `--aui-number-roll-ease` | `cubic-bezier(0.23, 1, 0.32, 1)` | Digit roll easing. |
147
+
148
+ Parts are targetable via data attributes: `[data-slot="number-roll"]`, `[data-slot="number-roll-part"]`, `[data-slot="number-roll-digit"]`, and `[data-slot="number-roll-symbol"]`.
149
+
150
+ ## Related Components
151
+
152
+ - [Context Display](/docs/ui/context-display) - Live token usage ring and bar
153
+ - [Message Timing](/docs/ui/message-timing) - Streaming stats badge
154
+ - [Badge](/docs/ui/badge) - Small status and metadata labels
@@ -28,7 +28,7 @@ Previously, reasoning parts were rendered via `components.Reasoning` and grouped
28
28
 
29
29
  Render reasoning parts through `MessagePrimitive.GroupedParts`. Group consecutive reasoning parts with `"group-reasoning"`, then compose `ReasoningRoot`, `ReasoningTrigger`, `ReasoningContent`, and `ReasoningText` around the grouped children.
30
30
 
31
- While reasoning is streaming, `part.status.type === "running"`. Pass that to `defaultOpen` so the accordion auto-opens during streaming and lets the user collapse it once the model moves on.
31
+ While reasoning is streaming, `part.status.type === "running"`. Pass that to `streaming` so the accordion auto-opens during streaming with a bottom-pinned live preview of the newest tokens, auto-collapses when the model moves on, and permanently defers to the first manual toggle. When `streaming` is provided it supersedes `defaultOpen`.
32
32
 
33
33
  ```tsx title="/app/components/assistant-ui/thread.tsx"
34
34
  import { MessagePrimitive, groupPartByType } from "@assistant-ui/react";
@@ -56,7 +56,7 @@ const AssistantMessage: FC = () => {
56
56
  case "group-reasoning": { // [!code ++]
57
57
  const running = part.status.type === "running"; // [!code ++]
58
58
  return ( // [!code ++]
59
- <ReasoningRoot defaultOpen={running}> // [!code ++]
59
+ <ReasoningRoot streaming={running}> // [!code ++]
60
60
  <ReasoningTrigger active={running} /> // [!code ++]
61
61
  <ReasoningContent aria-busy={running}> // [!code ++]
62
62
  <ReasoningText>{children}</ReasoningText> // [!code ++]
@@ -139,7 +139,7 @@ const ReasoningGroupImpl: ReasoningGroupComponent = ({
139
139
  });
140
140
 
141
141
  return (
142
- <ReasoningRoot defaultOpen={isReasoningStreaming}>
142
+ <ReasoningRoot streaming={isReasoningStreaming}>
143
143
  <ReasoningTrigger active={isReasoningStreaming} />
144
144
  <ReasoningContent aria-busy={isReasoningStreaming}>
145
145
  <ReasoningText>{children}</ReasoningText>
@@ -119,6 +119,8 @@ const StreamdownText = () => (
119
119
  | `components` | `object` | - | Custom components including `SyntaxHighlighter` and `CodeHeader` |
120
120
  | `componentsByLanguage` | `object` | - | Language-specific component overrides |
121
121
  | `preprocess` | `(text: string) => string` | - | Text preprocessing function |
122
+ | `defer` | `boolean` | `false` | Defer markdown parsing to a lower priority via `useDeferredValue` so typing and scrolling stay responsive during streaming |
123
+ | `smooth` | `boolean \| SmoothOptions` | `false` | Typewriter-style reveal via `useSmooth`; the caret and controls stay active until the reveal catches up. Prefer the native `animated` prop for entrance animations |
122
124
  | `controls` | `boolean \| object` | `true` | Enable/disable UI controls for code blocks and tables |
123
125
  | `caret` | `"block" \| "circle"` | - | Streaming caret style |
124
126
  | `mermaid` | `MermaidOptions` | - | Mermaid diagram configuration |
@@ -29,7 +29,7 @@ import { SyntaxHighlightingSample } from "@/components/docs/samples/syntax-highl
29
29
 
30
30
  This adds a `/components/assistant-ui/shiki-highlighter.tsx` file to your project and
31
31
  installs the `react-shiki` dependency. The highlighter can be customized by editing
32
- the config in the `shiki-highlighter.tsx` file.
32
+ the config in the `shiki-highlighter.tsx` file. While a message part is still streaming, the component renders the plain code without tokenization and highlights once the part settles, so streaming stays cheap.
33
33
 
34
34
  </Step>
35
35
  <Step>
@@ -133,6 +133,58 @@ const SuggestionItem = () => (
133
133
  );
134
134
  ```
135
135
 
136
+ ## Component Overrides
137
+
138
+ `Thread` accepts an optional `components` prop that swaps parts of the rendering without editing the copied file. All slots are optional; omitted slots keep the built-in rendering.
139
+
140
+ ```tsx
141
+ import { Thread, type ThreadComponents } from "@/components/assistant-ui/thread";
142
+
143
+ const THREAD_COMPONENTS: ThreadComponents = {
144
+ ToolFallback: MyToolFallback,
145
+ ToolGroup: MyToolGroup,
146
+ };
147
+
148
+ export default function Chat() {
149
+ return <Thread components={THREAD_COMPONENTS} />;
150
+ }
151
+ ```
152
+
153
+ <ParametersTable
154
+ type="ThreadComponents"
155
+ parameters={[
156
+ {
157
+ name: "AssistantMessage",
158
+ type: "ComponentType",
159
+ description: "Replaces the entire assistant message, including the action bar and branch picker.",
160
+ },
161
+ {
162
+ name: "Welcome",
163
+ type: "ComponentType",
164
+ description: "Replaces the welcome screen shown for a new chat.",
165
+ },
166
+ {
167
+ name: "ToolFallback",
168
+ type: "ToolCallMessagePartComponent",
169
+ description: "Renders tool calls that have no tool UI registered by name. Registered tool UIs take precedence over this slot.",
170
+ },
171
+ {
172
+ name: "ToolGroup",
173
+ type: "ComponentType<PropsWithChildren<{ group: ThreadGroupPart }>>",
174
+ description: "Wraps runs of consecutive tool calls. Receives the group part (`indices`, `status`) and the rendered children.",
175
+ },
176
+ {
177
+ name: "ReasoningGroup",
178
+ type: "ComponentType<PropsWithChildren<{ group: ThreadGroupPart }>>",
179
+ description: "Wraps runs of consecutive reasoning parts. Receives the group part and the rendered children.",
180
+ },
181
+ ]}
182
+ />
183
+
184
+ Define the `components` object once at module scope (or memoize it) so message subtrees do not re-render whenever the parent re-renders.
185
+
186
+ For per-tool UI, prefer registering a renderer by tool name over overriding `ToolFallback`: put `render` on the matching toolkit entry (see [Tool UI](/docs/tools/tool-ui)). `data` message parts render through renderers registered with `useAssistantDataUI`; parts without a registered renderer are not displayed.
187
+
136
188
  ## API Reference
137
189
 
138
190
  The following primitives are used within the Thread component and can be customized in your `/components/assistant-ui/thread.tsx` file.
@@ -74,7 +74,7 @@ Shows a muted appearance when a tool call was cancelled.
74
74
 
75
75
  ### Approval State
76
76
 
77
- Shows the default Allow / Deny buttons rendered when a tool call enters `requires-action`. The block auto-expands so the decision is visible without a click. Edit your project's copy of `tool-fallback.tsx` to add trust escalation, edit-args, custom labels, or analytics hooks — the shadcn philosophy is you own the file.
77
+ Shows the default Allow / Deny buttons rendered when a tool call enters `requires-action`. A tool call whose approval gate is already decided renders no buttons. The block auto-expands so the decision is visible without a click. Edit your project's copy of `tool-fallback.tsx` to add trust escalation, edit-args, custom labels, or analytics hooks — the shadcn philosophy is you own the file.
78
78
 
79
79
  <ToolFallbackRequiresActionSample />
80
80
 
@@ -90,7 +90,7 @@ All sub-components are exported for custom layouts:
90
90
  | `ToolFallback.Args` | Displays tool arguments |
91
91
  | `ToolFallback.Result` | Displays tool execution result |
92
92
  | `ToolFallback.Error` | Displays error or cancellation messages |
93
- | `ToolFallback.Approval` | Renders Allow / Deny buttons for `requires-action` tools; wires `resume` / `addResult` / `respondToApproval` |
93
+ | `ToolFallback.Approval` | Renders Allow / Deny buttons for `requires-action` tools until a decision is recorded; wires `resume` / `addResult` / `respondToApproval` |
94
94
 
95
95
  ```tsx
96
96
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assistant-ui/mcp-docs-server",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
4
4
  "description": "MCP server for assistant-ui documentation and examples",
5
5
  "keywords": [
6
6
  "mcp",
@@ -37,10 +37,10 @@
37
37
  "zod": "^4.4.3"
38
38
  },
39
39
  "devDependencies": {
40
- "@types/node": "^25.9.2",
40
+ "@types/node": "^25.9.3",
41
41
  "tsx": "^4.22.4",
42
42
  "vitest": "^4.1.8",
43
- "@assistant-ui/x-buildutils": "0.0.12"
43
+ "@assistant-ui/x-buildutils": "0.0.14"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public",