@assistant-ui/mcp-docs-server 0.1.34 → 0.1.36
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.
- package/.docs/organized/code-examples/waterfall.md +4 -4
- package/.docs/organized/code-examples/with-a2a.md +5 -5
- package/.docs/organized/code-examples/with-ag-ui.md +6 -6
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +7 -7
- package/.docs/organized/code-examples/with-artifacts.md +7 -7
- package/.docs/organized/code-examples/with-assistant-transport.md +73 -57
- package/.docs/organized/code-examples/with-browser-extension.md +7 -7
- package/.docs/organized/code-examples/with-chain-of-thought.md +44 -93
- package/.docs/organized/code-examples/with-cloud-standalone.md +7 -7
- package/.docs/organized/code-examples/with-cloud.md +7 -7
- package/.docs/organized/code-examples/with-custom-thread-list.md +7 -7
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +9 -9
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +9 -9
- package/.docs/organized/code-examples/with-eve.md +343 -0
- package/.docs/organized/code-examples/with-expo.md +943 -940
- package/.docs/organized/code-examples/with-external-store.md +5 -5
- package/.docs/organized/code-examples/with-ffmpeg.md +8 -11
- package/.docs/organized/code-examples/with-generative-ui.md +33 -309
- package/.docs/organized/code-examples/with-google-adk.md +5 -5
- package/.docs/organized/code-examples/with-heat-graph.md +4 -4
- package/.docs/organized/code-examples/with-image-generation.md +7 -7
- package/.docs/organized/code-examples/with-interactables.md +169 -341
- package/.docs/organized/code-examples/with-langchain.md +7 -7
- package/.docs/organized/code-examples/with-langgraph.md +23 -160
- package/.docs/organized/code-examples/with-livekit.md +10 -10
- package/.docs/organized/code-examples/with-mcp.md +7 -7
- package/.docs/organized/code-examples/with-opencode.md +106 -580
- package/.docs/organized/code-examples/with-pi.md +2046 -0
- package/.docs/organized/code-examples/with-react-hook-form.md +16 -9
- package/.docs/organized/code-examples/with-react-ink-web.md +691 -0
- package/.docs/organized/code-examples/with-react-ink.md +29 -17
- package/.docs/organized/code-examples/with-react-router.md +12 -12
- package/.docs/organized/code-examples/with-resumable-stream.md +8 -8
- package/.docs/organized/code-examples/with-store.md +14 -10
- package/.docs/organized/code-examples/with-tanstack.md +21 -7
- package/.docs/organized/code-examples/with-tap-runtime.md +5 -5
- package/.docs/organized/code-examples/with-virtualized-thread.md +676 -0
- package/.docs/raw/docs/(docs)/architecture.mdx +13 -12
- package/.docs/raw/docs/(docs)/cli.mdx +4 -2
- package/.docs/raw/docs/(docs)/devtools.mdx +25 -2
- package/.docs/raw/docs/(docs)/index.mdx +5 -2
- package/.docs/raw/docs/(docs)/installation.mdx +5 -2
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +16 -16
- package/.docs/raw/docs/(reference)/api-reference/hooks/composer-triggers.mdx +73 -42
- package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +3 -20
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +234 -123
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +51 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +4 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +70 -38
- package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +30 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +7 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +26 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/chain-of-thought.mdx +15 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +103 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +16 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +56 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/queue-item.mdx +12 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/selection-toolbar.mdx +12 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +14 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +57 -1
- package/.docs/raw/docs/(reference)/api-reference/tools/index.mdx +6 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/interactables-legacy.mdx +55 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/interactables.mdx +151 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +17 -38
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +20 -27
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +40 -25
- package/.docs/raw/docs/guides/chain-of-thought.mdx +1 -1
- package/.docs/raw/docs/guides/headless-composer-input.mdx +113 -0
- package/.docs/raw/docs/guides/index.mdx +3 -0
- package/.docs/raw/docs/guides/input-history.mdx +55 -0
- package/.docs/raw/docs/guides/latex.mdx +28 -22
- package/.docs/raw/docs/guides/mentions.mdx +32 -7
- package/.docs/raw/docs/guides/slash-commands.mdx +3 -6
- package/.docs/raw/docs/guides/speech.mdx +5 -7
- package/.docs/raw/docs/guides/virtualization.mdx +133 -0
- package/.docs/raw/docs/guides/voice.mdx +3 -2
- package/.docs/raw/docs/ink/hooks.mdx +2 -2
- package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +4 -12
- package/.docs/raw/docs/integrations/auth/better-auth.mdx +7 -10
- package/.docs/raw/docs/integrations/auth/clerk.mdx +3 -9
- package/.docs/raw/docs/integrations/auth/next-auth.mdx +3 -8
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +8 -5
- package/.docs/raw/docs/integrations/index.mdx +5 -12
- package/.docs/raw/docs/integrations/observability/helicone.mdx +3 -4
- package/.docs/raw/docs/integrations/observability/langfuse.mdx +3 -5
- package/.docs/raw/docs/integrations/observability/langsmith.mdx +3 -2
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +4 -3
- package/.docs/raw/docs/primitives/composer.mdx +8 -0
- package/.docs/raw/docs/primitives/thread.mdx +24 -0
- package/.docs/raw/docs/react-native/hooks.mdx +1 -1
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +22 -3
- package/.docs/raw/docs/runtimes/concepts/stability.mdx +1 -1
- package/.docs/raw/docs/runtimes/custom/data-stream.mdx +1 -1
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +54 -0
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +108 -4
- package/.docs/raw/docs/runtimes/eve/overview.mdx +100 -0
- package/.docs/raw/docs/runtimes/eve/quickstart.mdx +143 -0
- package/.docs/raw/docs/runtimes/langchain.mdx +386 -18
- package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +1 -1
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +1 -1
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +12 -6
- package/.docs/raw/docs/tools/defining-tools.mdx +4 -0
- package/.docs/raw/docs/tools/interactables-legacy.mdx +410 -0
- package/.docs/raw/docs/tools/interactables.mdx +892 -223
- package/.docs/raw/docs/tools/mcp.mdx +4 -4
- package/.docs/raw/docs/tools/multi-agent.mdx +5 -0
- package/.docs/raw/docs/tools/tool-ui.mdx +37 -1
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +2 -0
- package/.docs/raw/docs/ui/dot-matrix.mdx +133 -0
- package/.docs/raw/docs/ui/file.mdx +1 -1
- package/.docs/raw/docs/ui/model-selector.mdx +219 -52
- package/.docs/raw/docs/ui/number-roll.mdx +154 -0
- package/.docs/raw/docs/ui/part-grouping.mdx +38 -0
- package/.docs/raw/docs/ui/reasoning.mdx +3 -3
- package/.docs/raw/docs/ui/streamdown.mdx +2 -0
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -1
- package/.docs/raw/docs/ui/thread.mdx +52 -0
- package/.docs/raw/docs/ui/tool-fallback.mdx +2 -2
- package/.docs/raw/docs/utilities/react-o11y.mdx +92 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +14 -6
- package/src/tools/tests/mcp-protocol.test.ts +9 -0
|
@@ -3,7 +3,7 @@ title: ThreadPrimitive
|
|
|
3
3
|
description: Thread primitives for rendering chat transcripts, message lists, viewport state, suggestions, and composers in assistant-ui.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { ThreadPrimitiveIfProps, ThreadPrimitiveMessageByIndexProps, ThreadPrimitiveMessagesProps, ThreadPrimitiveRootProps, ThreadPrimitiveScrollToBottomProps, ThreadPrimitiveSuggestionByIndexProps, ThreadPrimitiveSuggestionProps, ThreadPrimitiveSuggestionsProps, ThreadPrimitiveViewportFooterProps, ThreadPrimitiveViewportProps, ThreadPrimitiveViewportProviderProps } from "@/generated/typeDocs";
|
|
6
|
+
import { ThreadPrimitiveIfProps, ThreadPrimitiveMessageByIndexProps, ThreadPrimitiveMessagesProps, ThreadPrimitiveRootProps, ThreadPrimitiveScrollToBottomProps, ThreadPrimitiveSuggestionByIndexProps, ThreadPrimitiveSuggestionProps, ThreadPrimitiveSuggestionsProps, ThreadPrimitiveUnstable_MessageByIdProps, ThreadPrimitiveViewportFooterProps, ThreadPrimitiveViewportProps, ThreadPrimitiveViewportProviderProps } from "@/generated/typeDocs";
|
|
7
7
|
import { ThreadPrimitive as ThreadPrimitiveDocs } from "@/generated/primitiveDocs";
|
|
8
8
|
|
|
9
9
|
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
@@ -51,6 +51,16 @@ const Thread = () => (
|
|
|
51
51
|
<p>This primitive renders a <code>{`<${ThreadPrimitiveDocs.Root?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
52
52
|
)}
|
|
53
53
|
|
|
54
|
+
```tsx
|
|
55
|
+
<ThreadPrimitive.Root>
|
|
56
|
+
<ThreadPrimitive.Viewport>
|
|
57
|
+
<ThreadPrimitive.Messages>
|
|
58
|
+
{() => <MyMessage />}
|
|
59
|
+
</ThreadPrimitive.Messages>
|
|
60
|
+
</ThreadPrimitive.Viewport>
|
|
61
|
+
</ThreadPrimitive.Root>
|
|
62
|
+
```
|
|
63
|
+
|
|
54
64
|
<ParametersTable {...ThreadPrimitiveRootProps} />
|
|
55
65
|
|
|
56
66
|
### Empty
|
|
@@ -101,6 +111,14 @@ const Thread = () => (
|
|
|
101
111
|
<p>This primitive renders a <code>{`<${ThreadPrimitiveDocs.Viewport?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
102
112
|
)}
|
|
103
113
|
|
|
114
|
+
```tsx
|
|
115
|
+
<ThreadPrimitive.Viewport turnAnchor="top">
|
|
116
|
+
<ThreadPrimitive.Messages>
|
|
117
|
+
{() => <MyMessage />}
|
|
118
|
+
</ThreadPrimitive.Messages>
|
|
119
|
+
</ThreadPrimitive.Viewport>
|
|
120
|
+
```
|
|
121
|
+
|
|
104
122
|
<ParametersTable {...ThreadPrimitiveViewportProps} />
|
|
105
123
|
|
|
106
124
|
### ViewportProvider
|
|
@@ -133,6 +151,17 @@ const Thread = () => (
|
|
|
133
151
|
<p>This primitive renders a <code>{`<${ThreadPrimitiveDocs.ViewportFooter?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
134
152
|
)}
|
|
135
153
|
|
|
154
|
+
```tsx
|
|
155
|
+
<ThreadPrimitive.Viewport>
|
|
156
|
+
<ThreadPrimitive.Messages>
|
|
157
|
+
{() => <MyMessage />}
|
|
158
|
+
</ThreadPrimitive.Messages>
|
|
159
|
+
<ThreadPrimitive.ViewportFooter className="sticky bottom-0">
|
|
160
|
+
<Composer />
|
|
161
|
+
</ThreadPrimitive.ViewportFooter>
|
|
162
|
+
</ThreadPrimitive.Viewport>
|
|
163
|
+
```
|
|
164
|
+
|
|
136
165
|
<ParametersTable {...ThreadPrimitiveViewportFooterProps} />
|
|
137
166
|
|
|
138
167
|
### Messages
|
|
@@ -167,6 +196,33 @@ const Thread = () => (
|
|
|
167
196
|
|
|
168
197
|
<ParametersTable {...ThreadPrimitiveMessageByIndexProps} />
|
|
169
198
|
|
|
199
|
+
### Unstable_MessageById
|
|
200
|
+
|
|
201
|
+
{ThreadPrimitiveDocs.Unstable_MessageById?.deprecated && (
|
|
202
|
+
<Callout type="tip">
|
|
203
|
+
<strong>Experimental.</strong> {ThreadPrimitiveDocs.Unstable_MessageById.deprecated}
|
|
204
|
+
</Callout>
|
|
205
|
+
)}
|
|
206
|
+
|
|
207
|
+
{ThreadPrimitiveDocs.Unstable_MessageById?.description}
|
|
208
|
+
|
|
209
|
+
{ThreadPrimitiveDocs.Unstable_MessageById?.element && (
|
|
210
|
+
<p>This primitive renders a <code>{`<${ThreadPrimitiveDocs.Unstable_MessageById?.element}>`}</code> element unless <code>asChild</code> is set.</p>
|
|
211
|
+
)}
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
const messageIds = unstable_useThreadMessageIds();
|
|
215
|
+
return messageIds.map((messageId) => (
|
|
216
|
+
<ThreadPrimitive.Unstable_MessageById
|
|
217
|
+
key={messageId}
|
|
218
|
+
messageId={messageId}
|
|
219
|
+
components={MESSAGE_COMPONENTS}
|
|
220
|
+
/>
|
|
221
|
+
));
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
<ParametersTable {...ThreadPrimitiveUnstable_MessageByIdProps} />
|
|
225
|
+
|
|
170
226
|
### ScrollToBottom
|
|
171
227
|
|
|
172
228
|
{ThreadPrimitiveDocs.ScrollToBottom?.deprecated && (
|
|
@@ -36,4 +36,10 @@ Toolkits are the current registration API. Tool **rendering** and **status** are
|
|
|
36
36
|
<Card title={"Tool Status"} href={"/docs/api-reference/tools/status"}>
|
|
37
37
|
{"Read tool arguments, execution status, and result state inside assistant-ui tool UI components."}
|
|
38
38
|
</Card>
|
|
39
|
+
<Card title={"Interactables"} href={"/docs/api-reference/tools/interactables"}>
|
|
40
|
+
{"Unstable interactables APIs for model-editable app and message state, including hooks, resources, toolkit helpers, and snapshot utilities."}
|
|
41
|
+
</Card>
|
|
42
|
+
<Card title={"Interactables (legacy)"} href={"/docs/api-reference/tools/interactables-legacy"}>
|
|
43
|
+
{"Deprecated legacy interactables APIs for registering model-editable components with per-instance update tools."}
|
|
44
|
+
</Card>
|
|
39
45
|
</Cards>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Interactables (legacy)
|
|
3
|
+
description: Deprecated legacy interactables APIs for registering model-editable components with per-instance update tools.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { Interactables, useAssistantInteractable, useInteractableState } from "@/generated/typeDocs";
|
|
7
|
+
|
|
8
|
+
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
|
+
{/* Do not edit manually. */}
|
|
10
|
+
|
|
11
|
+
{/* api-reference:start */}
|
|
12
|
+
{/* AUTO-GENERATED by scripts/generate-api-reference.mts */}
|
|
13
|
+
{/* Do not edit this block manually. */}
|
|
14
|
+
|
|
15
|
+
## API Reference
|
|
16
|
+
|
|
17
|
+
### Interactables
|
|
18
|
+
|
|
19
|
+
<Callout type="warn">
|
|
20
|
+
<strong>Deprecated.</strong> Since 2026-06-14 — migrate to the Unstable / Experimental API.
|
|
21
|
+
Scheduled for removal on/after 2026-09-14. See
|
|
22
|
+
[Interactables migration guide](https://www.assistant-ui.com/docs/tools/interactables#migrating-from-the-previous-api).
|
|
23
|
+
</Callout>
|
|
24
|
+
|
|
25
|
+
<ParametersTable {...Interactables} />
|
|
26
|
+
|
|
27
|
+
### useAssistantInteractable
|
|
28
|
+
|
|
29
|
+
<Callout type="warn">
|
|
30
|
+
<strong>Deprecated.</strong> Since 2026-06-14 — migrate to the Unstable / Experimental API.
|
|
31
|
+
Scheduled for removal on/after 2026-09-14. See
|
|
32
|
+
[Interactables migration guide](https://www.assistant-ui.com/docs/tools/interactables#migrating-from-the-previous-api).
|
|
33
|
+
</Callout>
|
|
34
|
+
|
|
35
|
+
Registers an interactable with the AI assistant.
|
|
36
|
+
|
|
37
|
+
This hook handles registration only. To read and write the interactable's
|
|
38
|
+
state, use [useInteractableState](/docs/api-reference/tools/interactables-legacy#useinteractablestate) with the returned id.
|
|
39
|
+
|
|
40
|
+
<ParametersTable {...useAssistantInteractable} />
|
|
41
|
+
|
|
42
|
+
### useInteractableState
|
|
43
|
+
|
|
44
|
+
<Callout type="warn">
|
|
45
|
+
<strong>Deprecated.</strong> Since 2026-06-14 — migrate to the Unstable / Experimental API.
|
|
46
|
+
Scheduled for removal on/after 2026-09-14. See
|
|
47
|
+
[Interactables migration guide](https://www.assistant-ui.com/docs/tools/interactables#migrating-from-the-previous-api).
|
|
48
|
+
</Callout>
|
|
49
|
+
|
|
50
|
+
Reads and writes the state of a registered interactable.
|
|
51
|
+
|
|
52
|
+
Pair with [useAssistantInteractable](/docs/api-reference/tools/interactables-legacy#useassistantinteractable) which handles registration.
|
|
53
|
+
|
|
54
|
+
<ParametersTable {...useInteractableState} />
|
|
55
|
+
{/* api-reference:end */}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Interactables
|
|
3
|
+
description: Unstable interactables APIs for model-editable app and message state, including hooks, resources, toolkit helpers, and snapshot utilities.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { unstable_formatInteractableSnapshot, unstable_getInteractableSnapshots, unstable_getInteractableVersions, unstable_useInteractable, unstable_useInteractableState, unstable_useInteractableVersions } from "@/generated/typeDocs";
|
|
7
|
+
|
|
8
|
+
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
|
+
{/* Do not edit manually. */}
|
|
10
|
+
|
|
11
|
+
{/* api-reference:start */}
|
|
12
|
+
{/* AUTO-GENERATED by scripts/generate-api-reference.mts */}
|
|
13
|
+
{/* Do not edit this block manually. */}
|
|
14
|
+
|
|
15
|
+
## API Reference
|
|
16
|
+
|
|
17
|
+
### unstable_Interactables
|
|
18
|
+
|
|
19
|
+
<Callout type="tip">
|
|
20
|
+
<strong>Experimental.</strong> Unstable / Experimental (not actually removed).
|
|
21
|
+
</Callout>
|
|
22
|
+
|
|
23
|
+
Registers the unstable interactables store scope.
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const unstable_Interactables: Resource<ClientOutput<"unstable_interactables">, [(Unstable_InteractablesConfig | undefined)?]>;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### unstable_useInteractable
|
|
30
|
+
|
|
31
|
+
<Callout type="tip">
|
|
32
|
+
<strong>Experimental.</strong> Unstable / Experimental (not actually removed).
|
|
33
|
+
</Callout>
|
|
34
|
+
|
|
35
|
+
Registers an interactable with the AI assistant and returns its live state,
|
|
36
|
+
like `useState` that the model can also read and update.
|
|
37
|
+
|
|
38
|
+
Call this once per place that shows the interactable. Other components can
|
|
39
|
+
read and write the same instance by passing its `id` to
|
|
40
|
+
`unstable_useInteractableState`.
|
|
41
|
+
|
|
42
|
+
For tool-created interactables rendered inside tool-call message parts,
|
|
43
|
+
`version` carries this message's version of the instance — its state as of
|
|
44
|
+
that point in the conversation, whether it is the most recent tool-driven
|
|
45
|
+
version, and a `restore()` back to it. Whether older messages render frozen history or stay
|
|
46
|
+
live-editable is the component's choice. Inside an `update_{name}` part the
|
|
47
|
+
instance `id` is inferred from the call, so the same component works at the
|
|
48
|
+
creating call and at update calls.
|
|
49
|
+
|
|
50
|
+
<ParametersTable {...unstable_useInteractable} />
|
|
51
|
+
|
|
52
|
+
### unstable_useInteractableState
|
|
53
|
+
|
|
54
|
+
<Callout type="tip">
|
|
55
|
+
<strong>Experimental.</strong> Unstable / Experimental (not actually removed).
|
|
56
|
+
</Callout>
|
|
57
|
+
|
|
58
|
+
Reads and writes the state of an interactable registered elsewhere, by id.
|
|
59
|
+
|
|
60
|
+
Use this from secondary readers (children, siblings); the owning component
|
|
61
|
+
registers with `unstable_useInteractable`, which returns state directly. Returns
|
|
62
|
+
`undefined` until the owning interactable is registered.
|
|
63
|
+
|
|
64
|
+
<ParametersTable {...unstable_useInteractableState} />
|
|
65
|
+
|
|
66
|
+
### unstable_useInteractableVersions
|
|
67
|
+
|
|
68
|
+
<Callout type="tip">
|
|
69
|
+
<strong>Experimental.</strong> Unstable / Experimental (not actually removed).
|
|
70
|
+
</Callout>
|
|
71
|
+
|
|
72
|
+
Every version of a tool-created interactable recorded in the current
|
|
73
|
+
thread, oldest first: the creating tool call, each user edit, and each
|
|
74
|
+
`update_*` call. Each entry carries the full state as of that version and a
|
|
75
|
+
`restore()` that sets the live instance back to it — enough for a version
|
|
76
|
+
picker like an artifact's history dropdown.
|
|
77
|
+
|
|
78
|
+
<ParametersTable {...unstable_useInteractableVersions} />
|
|
79
|
+
|
|
80
|
+
### unstable_interactableTool
|
|
81
|
+
|
|
82
|
+
<Callout type="tip">
|
|
83
|
+
<strong>Experimental.</strong> Unstable / Experimental (not actually removed).
|
|
84
|
+
</Callout>
|
|
85
|
+
|
|
86
|
+
Defines a tool that creates a thread-scoped interactable from its arguments,
|
|
87
|
+
for assignment to a toolkit entry — the entry key is the interactable name:
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
notepad: unstable_interactableTool({
|
|
91
|
+
description: "A notepad the user can read and edit.",
|
|
92
|
+
stateSchema: notepadSchema,
|
|
93
|
+
render: (props) => <Notepad {...props} />,
|
|
94
|
+
}),
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
`render` shows at the creating call and — installed automatically — at every
|
|
98
|
+
`update_{name}` call, with streaming previews, instance-id wiring, and
|
|
99
|
+
registration handled. It receives the live `state`/`setState` plus this
|
|
100
|
+
message's `version`; whether older messages render frozen history or stay
|
|
101
|
+
live-editable is the render function's choice.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
const unstable_interactableTool: <TSchema extends Unstable_InteractableStateSchema>(config: Unstable_InteractableToolConfig<TSchema>) => ToolDefinition<Record<string, unknown>, { success: true; }>;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### unstable_getInteractableSnapshots
|
|
108
|
+
|
|
109
|
+
<Callout type="tip">
|
|
110
|
+
<strong>Experimental.</strong> Unstable / Experimental (not actually removed).
|
|
111
|
+
</Callout>
|
|
112
|
+
|
|
113
|
+
Reads the interactable snapshots stamped on a message's
|
|
114
|
+
`metadata.custom.interactables`, or `undefined` if none. This is the read
|
|
115
|
+
half of the snapshot channel — integrations use it to surface interactable
|
|
116
|
+
state to the model (see `unstable_injectInteractableContext` in
|
|
117
|
+
`@assistant-ui/react-ai-sdk` for the AI SDK implementation).
|
|
118
|
+
|
|
119
|
+
<ParametersTable {...unstable_getInteractableSnapshots} />
|
|
120
|
+
|
|
121
|
+
### unstable_formatInteractableSnapshot
|
|
122
|
+
|
|
123
|
+
<Callout type="tip">
|
|
124
|
+
<strong>Experimental.</strong> Unstable / Experimental (not actually removed).
|
|
125
|
+
</Callout>
|
|
126
|
+
|
|
127
|
+
Canonical model-facing wording for one snapshot entry.
|
|
128
|
+
|
|
129
|
+
<ParametersTable {...unstable_formatInteractableSnapshot} />
|
|
130
|
+
|
|
131
|
+
### unstable_getInteractableVersions
|
|
132
|
+
|
|
133
|
+
<Callout type="tip">
|
|
134
|
+
<strong>Experimental.</strong> Unstable / Experimental (not actually removed).
|
|
135
|
+
</Callout>
|
|
136
|
+
|
|
137
|
+
Every version of interactable `id` recorded in the thread, oldest first,
|
|
138
|
+
folded chronologically:
|
|
139
|
+
|
|
140
|
+
- the tool call whose `toolCallId` equals `id` seeds the baseline with its
|
|
141
|
+
args (`origin: "create"`) — the `id: toolCallId` convention for
|
|
142
|
+
tool-created interactables,
|
|
143
|
+
- a snapshot stamped on a user message is a `"user-edit"` version (a full
|
|
144
|
+
snapshot replaces the state; a partial one shallow-merges),
|
|
145
|
+
- each accepted `update_*` call shallow-merges an `"update"` version.
|
|
146
|
+
|
|
147
|
+
The last entry is the state the model knows. Partial snapshots and update
|
|
148
|
+
calls with no baseline to merge into are skipped.
|
|
149
|
+
|
|
150
|
+
<ParametersTable {...unstable_getInteractableVersions} />
|
|
151
|
+
{/* api-reference:end */}
|
|
@@ -3,7 +3,7 @@ title: Tool Rendering
|
|
|
3
3
|
description: Register React renderers for assistant-ui tool calls, tool results, and model data parts.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { McpAppRenderer, McpAppsRemoteHost, getMcpAppFromToolPart, useAssistantDataUI, useAssistantToolUI } from "@/generated/typeDocs";
|
|
6
|
+
import { DataRenderers, McpAppRenderer, McpAppsRemoteHost, getMcpAppFromToolPart, useAssistantDataUI, useAssistantToolUI } from "@/generated/typeDocs";
|
|
7
7
|
|
|
8
8
|
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
9
|
{/* Do not edit manually. */}
|
|
@@ -16,15 +16,7 @@ import { McpAppRenderer, McpAppsRemoteHost, getMcpAppFromToolPart, useAssistantD
|
|
|
16
16
|
|
|
17
17
|
### DataRenderers
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Data renderers are looked up by the part's `name` field. Use this resource
|
|
22
|
-
directly for a renderer scope, or prefer [useAssistantDataUI](/docs/api-reference/tools/rendering#useassistantdataui) /
|
|
23
|
-
[makeAssistantDataUI](/docs/api-reference/tools/rendering#makeassistantdataui) when registering from React components.
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
const DataRenderers: () => ResourceElement<ClientOutput<"dataRenderers">, undefined>;
|
|
27
|
-
```
|
|
19
|
+
<ParametersTable {...DataRenderers} />
|
|
28
20
|
|
|
29
21
|
### getMcpAppFromToolPart
|
|
30
22
|
|
|
@@ -52,6 +44,21 @@ type AssistantDataUIProps = {
|
|
|
52
44
|
const makeAssistantDataUI: <T = any>(dataUI: AssistantDataUIProps<T>) => AssistantDataUI;
|
|
53
45
|
```
|
|
54
46
|
|
|
47
|
+
### McpAppRenderer
|
|
48
|
+
|
|
49
|
+
<ParametersTable {...McpAppRenderer} />
|
|
50
|
+
|
|
51
|
+
### McpAppsRemoteHost
|
|
52
|
+
|
|
53
|
+
<ParametersTable {...McpAppsRemoteHost} />
|
|
54
|
+
|
|
55
|
+
### useAssistantDataUI
|
|
56
|
+
|
|
57
|
+
Registers a renderer for named `data` message parts while the component is
|
|
58
|
+
mounted.
|
|
59
|
+
|
|
60
|
+
<ParametersTable {...useAssistantDataUI} />
|
|
61
|
+
|
|
55
62
|
### makeAssistantToolUI
|
|
56
63
|
|
|
57
64
|
<Callout type="warn">
|
|
@@ -82,34 +89,6 @@ type AssistantToolUIProps = {
|
|
|
82
89
|
const makeAssistantToolUI: <TArgs, TResult>(tool: AssistantToolUIProps<TArgs, TResult>) => AssistantToolUI;
|
|
83
90
|
```
|
|
84
91
|
|
|
85
|
-
### McpAppRenderer
|
|
86
|
-
|
|
87
|
-
Creates a tool-call renderer for MCP Apps embedded in assistant messages.
|
|
88
|
-
|
|
89
|
-
Compose this into the `Tools` resource through its `mcpApp` option. When a
|
|
90
|
-
tool-call part carries `mcp.app` metadata for a `ui://` resource, the
|
|
91
|
-
renderer loads that resource from the configured host and displays it in a
|
|
92
|
-
sandboxed frame.
|
|
93
|
-
|
|
94
|
-
<ParametersTable {...McpAppRenderer} />
|
|
95
|
-
|
|
96
|
-
### McpAppsRemoteHost
|
|
97
|
-
|
|
98
|
-
Creates the default HTTP host for MCP App widgets.
|
|
99
|
-
|
|
100
|
-
The host POSTs widget requests to the configured route as `{ method,
|
|
101
|
-
params }`, using the method names expected by the assistant-ui MCP Apps
|
|
102
|
-
guide.
|
|
103
|
-
|
|
104
|
-
<ParametersTable {...McpAppsRemoteHost} />
|
|
105
|
-
|
|
106
|
-
### useAssistantDataUI
|
|
107
|
-
|
|
108
|
-
Registers a renderer for named `data` message parts while the component is
|
|
109
|
-
mounted.
|
|
110
|
-
|
|
111
|
-
<ParametersTable {...useAssistantDataUI} />
|
|
112
|
-
|
|
113
92
|
### useAssistantToolUI
|
|
114
93
|
|
|
115
94
|
<Callout type="warn">
|
|
@@ -39,4 +39,26 @@ function WeatherToolUI({
|
|
|
39
39
|
```ts
|
|
40
40
|
const useToolArgsStatus: <TArgs extends Record<string, unknown> = Record<string, unknown>>() => ToolArgsStatus<TArgs>;
|
|
41
41
|
```
|
|
42
|
+
|
|
43
|
+
### useToolCallElapsed
|
|
44
|
+
|
|
45
|
+
Hook that returns the elapsed wall-clock time of the current tool call in
|
|
46
|
+
milliseconds, ticking once per second while the call runs.
|
|
47
|
+
|
|
48
|
+
Reads `part.timing`. Returns `undefined` when the part is not a tool call,
|
|
49
|
+
carries no timing, ended without a recorded completion (the duration is
|
|
50
|
+
unknown), or when no message part scope is available (so kit components
|
|
51
|
+
stay renderable standalone, e.g. in docs previews).
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
function ToolDuration() {
|
|
55
|
+
const elapsedMs = useToolCallElapsed();
|
|
56
|
+
if (elapsedMs === undefined) return null;
|
|
57
|
+
return <span>{(elapsedMs / 1000).toFixed(1)}s</span>;
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
const useToolCallElapsed: () => number;
|
|
63
|
+
```
|
|
42
64
|
{/* api-reference:end */}
|
|
@@ -80,13 +80,6 @@ type Toolkit = Record<string, ToolDefinition<any, any>>;
|
|
|
80
80
|
|
|
81
81
|
### Tools
|
|
82
82
|
|
|
83
|
-
Registers tools with model context and installs tool-call renderers.
|
|
84
|
-
|
|
85
|
-
Mount this resource near an assistant subtree when you want to expose a
|
|
86
|
-
group of tools declaratively. Tool definitions are registered with model
|
|
87
|
-
context, while each tool renderer is registered with the tools scope for
|
|
88
|
-
message rendering.
|
|
89
|
-
|
|
90
83
|
<ParametersTable {...Tools} />
|
|
91
84
|
|
|
92
85
|
### defineMcpToolkit
|
|
@@ -122,26 +115,6 @@ client build.
|
|
|
122
115
|
function externalTool(): never;
|
|
123
116
|
```
|
|
124
117
|
|
|
125
|
-
### hitl
|
|
126
|
-
|
|
127
|
-
<Callout type="warn">
|
|
128
|
-
<strong>Deprecated.</strong> Use [humanTool](/docs/api-reference/tools/toolkits#humantool).
|
|
129
|
-
</Callout>
|
|
130
|
-
|
|
131
|
-
```ts
|
|
132
|
-
const hitl: typeof humanTool;
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### hitlTool
|
|
136
|
-
|
|
137
|
-
<Callout type="warn">
|
|
138
|
-
<strong>Deprecated.</strong> Use [humanTool](/docs/api-reference/tools/toolkits#humantool).
|
|
139
|
-
</Callout>
|
|
140
|
-
|
|
141
|
-
```ts
|
|
142
|
-
const hitlTool: typeof humanTool;
|
|
143
|
-
```
|
|
144
|
-
|
|
145
118
|
### humanTool
|
|
146
119
|
|
|
147
120
|
Marks a tool as **human-in-the-loop**: the agent pauses and the UI (`render`)
|
|
@@ -179,4 +152,24 @@ supplied by `useAuiToolOverrides(...)`.
|
|
|
179
152
|
```ts
|
|
180
153
|
function stubTool(): never;
|
|
181
154
|
```
|
|
155
|
+
|
|
156
|
+
### hitl
|
|
157
|
+
|
|
158
|
+
<Callout type="warn">
|
|
159
|
+
<strong>Deprecated.</strong> Use [humanTool](/docs/api-reference/tools/toolkits#humantool).
|
|
160
|
+
</Callout>
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
const hitl: typeof humanTool;
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### hitlTool
|
|
167
|
+
|
|
168
|
+
<Callout type="warn">
|
|
169
|
+
<strong>Deprecated.</strong> Use [humanTool](/docs/api-reference/tools/toolkits#humantool).
|
|
170
|
+
</Callout>
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
const hitlTool: typeof humanTool;
|
|
174
|
+
```
|
|
182
175
|
{/* api-reference:end */}
|
|
@@ -3,7 +3,7 @@ title: Utilities
|
|
|
3
3
|
description: Miscellaneous @assistant-ui/react utilities for custom rendering, composition, and advanced assistant UI behavior.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { AssistantCloud, ChainOfThoughtClient, DevToolsHooks, InMemoryThreadList, SingleThreadList } from "@/generated/typeDocs";
|
|
6
|
+
import { AssistantCloud, ChainOfThoughtClient, DevToolsHooks, InMemoryThreadList, SingleThreadList, Suggestions, useSmooth } from "@/generated/typeDocs";
|
|
7
7
|
|
|
8
8
|
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
9
|
{/* Do not edit manually. */}
|
|
@@ -36,36 +36,13 @@ const createMessageQueue: (driver: MessageQueueDriver) => MessageQueueController
|
|
|
36
36
|
|
|
37
37
|
<ParametersTable {...InMemoryThreadList} />
|
|
38
38
|
|
|
39
|
-
### Interactables
|
|
40
|
-
|
|
41
|
-
```ts
|
|
42
|
-
const Interactables: () => ResourceElement<ClientOutput<"interactables">, undefined>;
|
|
43
|
-
```
|
|
44
|
-
|
|
45
39
|
### SingleThreadList
|
|
46
40
|
|
|
47
|
-
A minimal threads scope that wraps a single thread.
|
|
48
|
-
Automatically provided by ExternalThread when no threads scope exists.
|
|
49
|
-
Mounts the provided thread resource element.
|
|
50
|
-
|
|
51
41
|
<ParametersTable {...SingleThreadList} />
|
|
52
42
|
|
|
53
43
|
### Suggestions
|
|
54
44
|
|
|
55
|
-
|
|
56
|
-
const Suggestions: {
|
|
57
|
-
(): ResourceElement<
|
|
58
|
-
ClientOutput<"suggestions">,
|
|
59
|
-
undefined
|
|
60
|
-
>;
|
|
61
|
-
(
|
|
62
|
-
suggestions: SuggestionConfig[],
|
|
63
|
-
): ResourceElement<
|
|
64
|
-
ClientOutput<"suggestions">,
|
|
65
|
-
SuggestionConfig[]
|
|
66
|
-
>;
|
|
67
|
-
};
|
|
68
|
-
```
|
|
45
|
+
<ParametersTable {...Suggestions} />
|
|
69
46
|
|
|
70
47
|
### unstable_defaultDirectiveFormatter
|
|
71
48
|
|
|
@@ -76,4 +53,42 @@ When `id` equals `label`, the `{name=…}` attribute is omitted for brevity.
|
|
|
76
53
|
```ts
|
|
77
54
|
const unstable_defaultDirectiveFormatter: Unstable_DirectiveFormatter;
|
|
78
55
|
```
|
|
56
|
+
|
|
57
|
+
### useSmooth
|
|
58
|
+
|
|
59
|
+
Animates streamed message part text with a typewriter-style reveal.
|
|
60
|
+
|
|
61
|
+
Takes the current part state and a `smooth` argument: `false` disables,
|
|
62
|
+
`true` uses the default rate, and a SmoothOptions object tunes
|
|
63
|
+
the reveal. Returns the part state with `text` replaced by the revealed
|
|
64
|
+
prefix and `status` reporting `running` until the reveal catches up.
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
const { text, status } = useSmooth(useMessagePartText(), {
|
|
68
|
+
drainMs: 500,
|
|
69
|
+
maxCharsPerFrame: 30,
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
<ParametersTable {...useSmooth} />
|
|
74
|
+
|
|
75
|
+
### fromThreadMessageLike
|
|
76
|
+
|
|
77
|
+
<Callout type="tip">
|
|
78
|
+
<strong>Experimental.</strong> This API is experimental and may change without notice.
|
|
79
|
+
</Callout>
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
const fromThreadMessageLike: (like: ThreadMessageLike, fallbackId: string, fallbackStatus: MessageStatus) => ThreadMessage;
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### generateId
|
|
86
|
+
|
|
87
|
+
<Callout type="tip">
|
|
88
|
+
<strong>Experimental.</strong> This API is experimental and may change without notice.
|
|
89
|
+
</Callout>
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
const generateId: (size?: number) => string;
|
|
93
|
+
```
|
|
79
94
|
{/* api-reference:end */}
|
|
@@ -60,7 +60,7 @@ const AssistantMessage: FC = () => {
|
|
|
60
60
|
case "group-reasoning": {
|
|
61
61
|
const running = part.status.type === "running";
|
|
62
62
|
return (
|
|
63
|
-
<ReasoningRoot
|
|
63
|
+
<ReasoningRoot streaming={running}>
|
|
64
64
|
<ReasoningTrigger active={running} />
|
|
65
65
|
<ReasoningContent aria-busy={running}>
|
|
66
66
|
<ReasoningText>{children}</ReasoningText>
|