@assistant-ui/mcp-docs-server 0.1.31 → 0.1.33
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 +23 -25
- package/.docs/organized/code-examples/with-a2a.md +28 -28
- package/.docs/organized/code-examples/with-ag-ui.md +35 -30
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +16 -14
- package/.docs/organized/code-examples/with-artifacts.md +44 -38
- package/.docs/organized/code-examples/with-assistant-transport.md +68 -56
- package/.docs/organized/code-examples/with-browser-extension.md +357 -0
- package/.docs/organized/code-examples/with-chain-of-thought.md +425 -90
- package/.docs/organized/code-examples/with-cloud-standalone.md +30 -29
- package/.docs/organized/code-examples/with-cloud.md +16 -14
- package/.docs/organized/code-examples/with-custom-thread-list.md +19 -17
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +29 -26
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +20 -18
- package/.docs/organized/code-examples/with-expo.md +37 -31
- package/.docs/organized/code-examples/with-external-store.md +13 -11
- package/.docs/organized/code-examples/with-ffmpeg.md +327 -290
- package/.docs/organized/code-examples/with-generative-ui.md +1195 -194
- package/.docs/organized/code-examples/with-google-adk.md +13 -11
- package/.docs/organized/code-examples/with-heat-graph.md +16 -14
- package/.docs/organized/code-examples/with-image-generation.md +456 -0
- package/.docs/organized/code-examples/with-interactables.md +322 -244
- package/.docs/organized/code-examples/with-langchain.md +18 -16
- package/.docs/organized/code-examples/with-langgraph.md +95 -88
- package/.docs/organized/code-examples/with-livekit.md +30 -27
- package/.docs/organized/code-examples/with-mcp.md +754 -0
- package/.docs/organized/code-examples/with-opencode.md +70 -70
- package/.docs/organized/code-examples/with-react-hook-form.md +24 -22
- package/.docs/organized/code-examples/with-react-ink.md +4 -4
- package/.docs/organized/code-examples/with-react-router.md +20 -18
- package/.docs/organized/code-examples/with-resumable-stream.md +661 -0
- package/.docs/organized/code-examples/with-store.md +22 -20
- package/.docs/organized/code-examples/with-tanstack.md +18 -19
- package/.docs/organized/code-examples/with-tap-runtime.md +31 -28
- package/.docs/raw/docs/(docs)/architecture.mdx +43 -2
- package/.docs/raw/docs/(docs)/cli.mdx +2 -2
- package/.docs/raw/docs/(docs)/copilots/model-context.mdx +34 -26
- package/.docs/raw/docs/(docs)/copilots/motivation.mdx +32 -26
- package/.docs/raw/docs/(docs)/index.mdx +2 -2
- package/.docs/raw/docs/(docs)/installation.mdx +2 -2
- package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +26 -24
- package/.docs/raw/docs/(reference)/api-reference/adapters/feedback.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +20 -12
- package/.docs/raw/docs/(reference)/api-reference/adapters/model.mdx +44 -0
- package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +41 -16
- package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +12 -23
- package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +37 -8
- package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +11 -9
- package/.docs/raw/docs/(reference)/api-reference/context-providers/scoped-providers.mdx +64 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +52 -0
- package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +46 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/index.mdx +18 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/rendering.mdx +33 -0
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/spec.mdx +45 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/composer-triggers.mdx +98 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +18 -13
- package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +31 -52
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +640 -0
- package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +15 -28
- package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +64 -18
- package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +434 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/cloud-ai-sdk.mdx +24 -0
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +11 -12
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +109 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +58 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/model-context/registry.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +109 -132
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +78 -221
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +127 -242
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +39 -20
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +66 -87
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +50 -58
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +80 -48
- package/.docs/raw/docs/(reference)/api-reference/primitives/chain-of-thought.mdx +67 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +323 -461
- package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +36 -43
- package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +29 -24
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +63 -245
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +202 -588
- package/.docs/raw/docs/(reference)/api-reference/primitives/queue-item.mdx +65 -0
- package/.docs/raw/docs/(reference)/api-reference/primitives/selection-toolbar.mdx +35 -22
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +57 -140
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +70 -161
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +84 -108
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +77 -96
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +173 -349
- package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +9 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +10 -21
- package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +15 -70
- package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +18 -13
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +25 -28
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +11 -63
- package/.docs/raw/docs/(reference)/api-reference/runtimes/queue-state.mdx +20 -0
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +11 -48
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +10 -47
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +18 -30
- package/.docs/raw/docs/(reference)/api-reference/tools/component-tools.mdx +85 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/index.mdx +39 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +127 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +42 -0
- package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +91 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/assistant-transport.mdx +48 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +62 -0
- package/.docs/raw/docs/(reference)/api-reference/transport/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/utilities/index.mdx +19 -0
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +143 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/index.mdx +22 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +54 -0
- package/.docs/raw/docs/(reference)/api-reference/voice/speech-dictation.mdx +36 -0
- package/.docs/raw/docs/cloud/ai-sdk.mdx +1 -3
- package/.docs/raw/docs/cloud/index.mdx +2 -2
- package/.docs/raw/docs/guides/attachments.mdx +4 -4
- package/.docs/raw/docs/guides/branching.mdx +1 -1
- package/.docs/raw/docs/guides/chain-of-thought.mdx +12 -14
- package/.docs/raw/docs/guides/context-api.mdx +6 -5
- package/.docs/raw/docs/guides/dictation.mdx +2 -2
- package/.docs/raw/docs/guides/editing.mdx +1 -1
- package/.docs/raw/docs/guides/image-generation.mdx +74 -0
- package/.docs/raw/docs/guides/index.mdx +5 -14
- package/.docs/raw/docs/guides/latex.mdx +2 -2
- package/.docs/raw/docs/guides/mentions.mdx +6 -6
- package/.docs/raw/docs/guides/message-timing.mdx +38 -5
- package/.docs/raw/docs/guides/quoting.mdx +1 -1
- package/.docs/raw/docs/guides/resumable-stream-deployment.mdx +212 -0
- package/.docs/raw/docs/guides/resumable-stream-stores.mdx +152 -0
- package/.docs/raw/docs/guides/resumable-streams.mdx +210 -0
- package/.docs/raw/docs/guides/slash-commands.mdx +2 -2
- package/.docs/raw/docs/guides/speech.mdx +2 -2
- package/.docs/raw/docs/guides/suggestions.mdx +89 -5
- package/.docs/raw/docs/guides/voice.mdx +2 -2
- package/.docs/raw/docs/ink/adapters.mdx +37 -1
- package/.docs/raw/docs/ink/custom-backend.mdx +59 -8
- package/.docs/raw/docs/ink/hooks.mdx +98 -85
- package/.docs/raw/docs/ink/index.mdx +10 -11
- package/.docs/raw/docs/ink/migration.mdx +1 -1
- package/.docs/raw/docs/ink/primitives.mdx +350 -9
- package/.docs/raw/docs/integrations/auth/better-auth.mdx +1 -1
- package/.docs/raw/docs/integrations/auth/clerk.mdx +1 -1
- package/.docs/raw/docs/integrations/auth/next-auth.mdx +1 -1
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +3 -3
- package/.docs/raw/docs/integrations/frameworks/cloudflare-agents/overview.mdx +282 -0
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +2 -2
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +1 -1
- package/.docs/raw/docs/integrations/gateways/index.mdx +9 -4
- package/.docs/raw/docs/integrations/index.mdx +17 -5
- package/.docs/raw/docs/integrations/observability/langfuse.mdx +8 -1
- package/.docs/raw/docs/integrations/observability/langsmith.mdx +8 -4
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +17 -2
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +226 -0
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +10 -16
- package/.docs/raw/docs/primitives/composer.mdx +53 -0
- package/.docs/raw/docs/primitives/index.mdx +2 -2
- package/.docs/raw/docs/primitives/message.mdx +9 -10
- package/.docs/raw/docs/primitives/suggestion.mdx +9 -0
- package/.docs/raw/docs/react-native/hooks.mdx +57 -82
- package/.docs/raw/docs/react-native/index.mdx +4 -4
- package/.docs/raw/docs/react-native/migration.mdx +1 -1
- package/.docs/raw/docs/react-native/primitives.mdx +2 -2
- package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +7 -4
- package/.docs/raw/docs/runtimes/a2a/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +32 -1
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +7 -2
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +1 -1
- package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +129 -1
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +7 -1
- package/.docs/raw/docs/runtimes/custom/data-stream.mdx +27 -2
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +9 -1
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +18 -7
- package/.docs/raw/docs/runtimes/custom/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +108 -38
- package/.docs/raw/docs/runtimes/google-adk/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/langchain.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +1 -1
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +64 -50
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +98 -86
- package/.docs/raw/docs/runtimes/opencode/overview.mdx +2 -2
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +1 -1
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +12 -5
- package/.docs/raw/docs/tools/backend.mdx +136 -0
- package/.docs/raw/docs/tools/defining-tools.mdx +413 -0
- package/.docs/raw/docs/tools/dynamic-tools.mdx +110 -0
- package/.docs/raw/docs/tools/generative-ui.mdx +214 -0
- package/.docs/raw/docs/tools/index.mdx +76 -0
- package/.docs/raw/docs/{guides → tools}/interactables.mdx +3 -3
- package/.docs/raw/docs/tools/mcp-apps.mdx +231 -0
- package/.docs/raw/docs/{integrations/tools → tools}/mcp.mdx +77 -50
- package/.docs/raw/docs/{guides → tools}/multi-agent.mdx +19 -21
- package/.docs/raw/docs/tools/tool-ui.mdx +967 -0
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +337 -0
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +11 -1
- package/.docs/raw/docs/ui/directive-text.mdx +3 -3
- package/.docs/raw/docs/ui/mcp-config.mdx +102 -0
- package/.docs/raw/docs/ui/model-selector.mdx +8 -8
- package/.docs/raw/docs/ui/part-grouping.mdx +84 -50
- package/.docs/raw/docs/ui/reasoning.mdx +4 -5
- package/.docs/raw/docs/ui/sources.mdx +17 -0
- package/.docs/raw/docs/ui/streamdown.mdx +34 -2
- package/.docs/raw/docs/ui/thread-list.mdx +2 -2
- package/.docs/raw/docs/ui/thread.mdx +2 -2
- package/.docs/raw/docs/ui/tool-group.mdx +5 -6
- package/.docs/raw/docs/utilities/heat-graph.mdx +1 -1
- package/README.md +14 -72
- package/dist/constants.d.ts +12 -9
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +13 -9
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -24
- package/dist/index.js.map +1 -1
- package/dist/prepare-docs/code-examples.d.ts +4 -1
- package/dist/prepare-docs/code-examples.d.ts.map +1 -1
- package/dist/prepare-docs/code-examples.js +109 -121
- package/dist/prepare-docs/code-examples.js.map +1 -1
- package/dist/prepare-docs/copy-raw.d.ts +4 -1
- package/dist/prepare-docs/copy-raw.d.ts.map +1 -1
- package/dist/prepare-docs/copy-raw.js +45 -42
- package/dist/prepare-docs/copy-raw.js.map +1 -1
- package/dist/prepare-docs/prepare.d.ts +1 -2
- package/dist/prepare-docs/prepare.js +17 -17
- package/dist/prepare-docs/prepare.js.map +1 -1
- package/dist/stdio.d.ts +1 -3
- package/dist/stdio.js +6 -3
- package/dist/stdio.js.map +1 -1
- package/dist/tools/docs.d.ts +20 -15
- package/dist/tools/docs.d.ts.map +1 -1
- package/dist/tools/docs.js +140 -161
- package/dist/tools/docs.js.map +1 -1
- package/dist/tools/examples.d.ts +20 -15
- package/dist/tools/examples.d.ts.map +1 -1
- package/dist/tools/examples.js +74 -86
- package/dist/tools/examples.js.map +1 -1
- package/dist/tools/tests/test-setup.d.ts +5 -2
- package/dist/tools/tests/test-setup.d.ts.map +1 -1
- package/dist/tools/tests/test-setup.js +21 -28
- package/dist/tools/tests/test-setup.js.map +1 -1
- package/dist/utils/logger.d.ts +8 -5
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +17 -17
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/mcp-format.d.ts +8 -5
- package/dist/utils/mcp-format.d.ts.map +1 -1
- package/dist/utils/mcp-format.js +9 -9
- package/dist/utils/mcp-format.js.map +1 -1
- package/dist/utils/mdx.d.ts +8 -6
- package/dist/utils/mdx.d.ts.map +1 -1
- package/dist/utils/mdx.js +22 -22
- package/dist/utils/mdx.js.map +1 -1
- package/dist/utils/paths.d.ts +9 -6
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +66 -76
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/security.d.ts +4 -1
- package/dist/utils/security.d.ts.map +1 -1
- package/dist/utils/security.js +19 -40
- package/dist/utils/security.js.map +1 -1
- package/package.json +5 -5
- package/.docs/organized/code-examples/with-parent-id-grouping.md +0 -596
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +0 -151
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +0 -230
- package/.docs/raw/docs/(reference)/api-reference/adapters/feedback-speech.mdx +0 -41
- package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +0 -40
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +0 -260
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +0 -103
- package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +0 -254
- package/.docs/raw/docs/guides/tool-ui.mdx +0 -858
- package/.docs/raw/docs/guides/tools.mdx +0 -675
- package/dist/prepare-docs/prepare.d.ts.map +0 -1
- package/dist/stdio.d.ts.map +0 -1
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/deprecation-policy.mdx +0 -0
- /package/.docs/raw/docs/{(reference) → migrations}/react-compatibility.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/react-langgraph-v0-7.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-11.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-12.mdx +0 -0
- /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-14.mdx +0 -0
|
@@ -1,87 +1,32 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: ComposerRuntime
|
|
3
|
-
description:
|
|
3
|
+
description: ComposerRuntime state and actions for controlling assistant-ui composer text, attachments, submission, cancellation, and pending input.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { ComposerRuntime, ComposerState, EditComposerRuntime, EditComposerState } from "@/generated/typeDocs";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
|
+
{/* Do not edit manually. */}
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
{/* api-reference:start */}
|
|
12
|
+
{/* AUTO-GENERATED by scripts/generate-api-reference.mts */}
|
|
13
|
+
{/* Do not edit this block manually. */}
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
## API Reference
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
// Example
|
|
16
|
-
import { useAui } from "@assistant-ui/react";
|
|
17
|
-
|
|
18
|
-
const aui = useAui();
|
|
19
|
-
|
|
20
|
-
// set the text
|
|
21
|
-
aui.composer().setText("Hello from the composer");
|
|
22
|
-
|
|
23
|
-
// send whatever is in the composer
|
|
24
|
-
aui.composer().send();
|
|
25
|
-
|
|
26
|
-
// get the current text in the composer state
|
|
27
|
-
const composerState = aui.composer().getState();
|
|
28
|
-
const currentText = composerState.text;
|
|
29
|
-
|
|
30
|
-
```
|
|
17
|
+
### ComposerRuntime
|
|
31
18
|
|
|
32
19
|
<ParametersTable {...ComposerRuntime} />
|
|
33
20
|
|
|
21
|
+
### ComposerState
|
|
34
22
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Access the thread’s new message composer state:
|
|
38
|
-
|
|
39
|
-
```tsx
|
|
40
|
-
import { useAuiState, useAui } from "@assistant-ui/react";
|
|
41
|
-
|
|
42
|
-
const text = useAuiState((s) => s.composer.text);
|
|
43
|
-
const isEmpty = useAuiState((s) => s.composer.isEmpty);
|
|
44
|
-
|
|
45
|
-
// For actions, use useAui
|
|
46
|
-
const aui = useAui();
|
|
47
|
-
|
|
48
|
-
// set the text
|
|
49
|
-
aui.composer().setText("Hello from the thread composer");
|
|
50
|
-
|
|
51
|
-
// send whatever is in the thread composer
|
|
52
|
-
aui.composer().send();
|
|
53
|
-
|
|
54
|
-
```
|
|
23
|
+
<ParametersTable {...ComposerState} />
|
|
55
24
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
### `useAui` (Edit Composer Actions)
|
|
60
|
-
|
|
61
|
-
Access edit composer actions via `useAui` from within a message component:
|
|
62
|
-
|
|
63
|
-
```tsx
|
|
64
|
-
import { useAui } from "@assistant-ui/react";
|
|
65
|
-
|
|
66
|
-
const aui = useAui();
|
|
67
|
-
|
|
68
|
-
// Begin editing the current message (populates the composer with its content)
|
|
69
|
-
aui.message().composer().beginEdit();
|
|
70
|
-
|
|
71
|
-
// Update the text and send the edit
|
|
72
|
-
aui.message().composer().setText("Updated message text");
|
|
73
|
-
aui.message().composer().send();
|
|
74
|
-
|
|
75
|
-
// Cancel editing without saving
|
|
76
|
-
aui.message().composer().cancel();
|
|
77
|
-
```
|
|
25
|
+
### EditComposerRuntime
|
|
78
26
|
|
|
79
27
|
<ParametersTable {...EditComposerRuntime} />
|
|
80
28
|
|
|
81
|
-
###
|
|
82
|
-
|
|
83
|
-
The state of the thread composer which is the composer the user can interact with at the bottom.
|
|
84
|
-
|
|
85
|
-
<ParametersTable {...ThreadComposerState} />
|
|
86
|
-
|
|
29
|
+
### EditComposerState
|
|
87
30
|
|
|
31
|
+
<ParametersTable {...EditComposerState} />
|
|
32
|
+
{/* api-reference:end */}
|
|
@@ -1,38 +1,43 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
description: Runtime
|
|
2
|
+
title: Runtime State API Reference
|
|
3
|
+
description: Runtime state and actions exposed through useAui and useAuiState, covering AssistantRuntime, ThreadRuntime, ThreadListRuntime, ComposerRuntime, MessageRuntime, and attachment APIs for controlling assistant-ui chat.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
{/* AUTO-GENERATED by scripts/generate-api-reference
|
|
7
|
-
{/*
|
|
6
|
+
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
7
|
+
{/* The page list is generated from exported APIs; edit only the manual prose slot. */}
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
{/* api-manual:start */}
|
|
10
|
+
Runtime state is the typed control surface behind assistant-ui. These pages document the actions and state objects available through `useAui`, `useAuiState`, and scoped runtimes.
|
|
11
|
+
{/* api-manual:end */}
|
|
10
12
|
|
|
11
13
|
## Pages
|
|
12
14
|
|
|
13
15
|
<Cards>
|
|
14
16
|
<Card title={"AssistantRuntime"} href={"/docs/api-reference/runtimes/assistant-runtime"}>
|
|
15
|
-
{"
|
|
17
|
+
{"Top-level assistant-ui runtime actions and state for tools, threads, composers, messages, and assistant behavior."}
|
|
16
18
|
</Card>
|
|
17
19
|
<Card title={"AttachmentRuntime"} href={"/docs/api-reference/runtimes/attachment-runtime"}>
|
|
18
|
-
{"
|
|
20
|
+
{"AttachmentRuntime state and actions for reading attachment data and controlling files inside assistant-ui messages and composers."}
|
|
19
21
|
</Card>
|
|
20
22
|
<Card title={"ComposerRuntime"} href={"/docs/api-reference/runtimes/composer-runtime"}>
|
|
21
|
-
{"
|
|
23
|
+
{"ComposerRuntime state and actions for controlling assistant-ui composer text, attachments, submission, cancellation, and pending input."}
|
|
22
24
|
</Card>
|
|
23
25
|
<Card title={"MessagePartRuntime"} href={"/docs/api-reference/runtimes/message-part-runtime"}>
|
|
24
|
-
{"
|
|
26
|
+
{"MessagePartRuntime state and helpers for inspecting assistant-ui text, tool calls, data parts, reasoning, and custom message content."}
|
|
25
27
|
</Card>
|
|
26
28
|
<Card title={"MessageRuntime"} href={"/docs/api-reference/runtimes/message-runtime"}>
|
|
27
|
-
{"
|
|
29
|
+
{"MessageRuntime state and actions for editing, reloading, copying, rating, speaking, and branching assistant-ui messages."}
|
|
30
|
+
</Card>
|
|
31
|
+
<Card title={"QueueItemState"} href={"/docs/api-reference/runtimes/queue-state"}>
|
|
32
|
+
{"State shape for queued assistant-ui thread operations and pending runtime work."}
|
|
28
33
|
</Card>
|
|
29
34
|
<Card title={"ThreadListItemRuntime"} href={"/docs/api-reference/runtimes/thread-list-item-runtime"}>
|
|
30
|
-
{"
|
|
35
|
+
{"ThreadListItemRuntime state and actions for selecting, archiving, unarchiving, deleting, and renaming assistant-ui conversations."}
|
|
31
36
|
</Card>
|
|
32
37
|
<Card title={"ThreadListRuntime"} href={"/docs/api-reference/runtimes/thread-list-runtime"}>
|
|
33
|
-
{"
|
|
38
|
+
{"ThreadListRuntime state and actions for managing remote assistant-ui conversations, active thread selection, and new thread creation."}
|
|
34
39
|
</Card>
|
|
35
40
|
<Card title={"ThreadRuntime"} href={"/docs/api-reference/runtimes/thread-runtime"}>
|
|
36
|
-
{"
|
|
41
|
+
{"ThreadRuntime state and actions for controlling assistant-ui messages, composers, suggestions, model context, and the full thread lifecycle."}
|
|
37
42
|
</Card>
|
|
38
43
|
</Cards>
|
|
@@ -1,46 +1,43 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: MessagePartRuntime
|
|
3
|
-
description:
|
|
3
|
+
description: MessagePartRuntime state and helpers for inspecting assistant-ui text, tool calls, data parts, reasoning, and custom message content.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { MessagePartRuntime,
|
|
6
|
+
import { EnrichedPartState, MessagePartRuntime, MessagePartState, PartState } from "@/generated/typeDocs";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
|
+
{/* Do not edit manually. */}
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
{/* api-reference:start */}
|
|
12
|
+
{/* AUTO-GENERATED by scripts/generate-api-reference.mts */}
|
|
13
|
+
{/* Do not edit this block manually. */}
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
import { useAui } from "@assistant-ui/react";
|
|
15
|
+
## API Reference
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
### EnrichedPartState
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
aui.part().addToolResult({ result: "Tool output" });
|
|
19
|
+
Enriched part state passed to children render functions.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
```
|
|
21
|
+
For tool-call parts, adds `toolUI`, `addResult`, and `resume`.
|
|
22
|
+
For data parts, adds `dataRendererUI`.
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
The render function is also invoked once with a synthetic empty text part
|
|
25
|
+
(`{ type: "text", text: "", status: { type: "running" } }`) when the
|
|
26
|
+
assistant message has no parts yet but is in the running state, so a
|
|
27
|
+
loading indicator can render. Differentiate this from a real empty text
|
|
28
|
+
via `part.status?.type === "running" && part.text === ""`.
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
<ParametersTable {...EnrichedPartState} />
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
import { useAuiState } from "@assistant-ui/react";
|
|
32
|
+
### MessagePartRuntime
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
const type = useAuiState((s) => s.part.type);
|
|
35
|
-
```
|
|
34
|
+
<ParametersTable {...MessagePartRuntime} />
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
### MessagePartState
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
import { useAui } from "@assistant-ui/react";
|
|
38
|
+
<ParametersTable {...MessagePartState} />
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
const partState = aui.part().getState();
|
|
44
|
-
```
|
|
40
|
+
### PartState
|
|
45
41
|
|
|
46
|
-
<ParametersTable {...
|
|
42
|
+
<ParametersTable {...PartState} />
|
|
43
|
+
{/* api-reference:end */}
|
|
@@ -1,76 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: MessageRuntime
|
|
3
|
-
description:
|
|
3
|
+
description: MessageRuntime state and actions for editing, reloading, copying, rating, speaking, and branching assistant-ui messages.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
MessageRuntime,
|
|
8
|
-
MessageState,
|
|
9
|
-
ComposerState,
|
|
10
|
-
} from "@/generated/typeDocs";
|
|
6
|
+
import { MessageRuntime, MessageState } from "@/generated/typeDocs";
|
|
11
7
|
|
|
12
|
-
|
|
8
|
+
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
|
+
{/* Do not edit manually. */}
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
{/* api-reference:start */}
|
|
12
|
+
{/* AUTO-GENERATED by scripts/generate-api-reference.mts */}
|
|
13
|
+
{/* Do not edit this block manually. */}
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
import { useAui } from "@assistant-ui/react";
|
|
15
|
+
## API Reference
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// Reload an assistant message (regenerate the response)
|
|
22
|
-
aui.message().reload();
|
|
23
|
-
|
|
24
|
-
// Switch to the previous or next branch
|
|
25
|
-
aui.message().switchToBranch({ position: "previous" });
|
|
26
|
-
aui.message().switchToBranch({ position: "next" });
|
|
27
|
-
|
|
28
|
-
// Submit feedback on a message
|
|
29
|
-
aui.message().submitFeedback({ type: "positive" });
|
|
30
|
-
aui.message().submitFeedback({ type: "negative" });
|
|
31
|
-
|
|
32
|
-
// Get the plain-text content of the message
|
|
33
|
-
const text = aui.message().getCopyText();
|
|
34
|
-
|
|
35
|
-
// Access a message part by index or tool call ID
|
|
36
|
-
aui.message().part({ index: 0 });
|
|
37
|
-
aui.message().part({ toolCallId: "call_123" });
|
|
38
|
-
|
|
39
|
-
// Access an attachment by index
|
|
40
|
-
aui.message().attachment({ index: 0 });
|
|
41
|
-
|
|
42
|
-
// Access the edit composer for this message
|
|
43
|
-
aui.message().composer();
|
|
44
|
-
|
|
45
|
-
// Get a snapshot of the full message state
|
|
46
|
-
const state = aui.message().getState();
|
|
47
|
-
```
|
|
17
|
+
### MessageRuntime
|
|
48
18
|
|
|
49
19
|
<ParametersTable {...MessageRuntime} />
|
|
50
20
|
|
|
51
|
-
###
|
|
52
|
-
|
|
53
|
-
Access message state reactively:
|
|
54
|
-
|
|
55
|
-
```tsx
|
|
56
|
-
import { useAuiState } from "@assistant-ui/react";
|
|
57
|
-
|
|
58
|
-
const role = useAuiState((s) => s.message.role);
|
|
59
|
-
const content = useAuiState((s) => s.message.content);
|
|
60
|
-
const isLast = useAuiState((s) => s.message.isLast);
|
|
61
|
-
```
|
|
21
|
+
### MessageState
|
|
62
22
|
|
|
63
23
|
<ParametersTable {...MessageState} />
|
|
64
|
-
|
|
65
|
-
### `useAuiState` (Edit Composer)
|
|
66
|
-
|
|
67
|
-
Access the edit composer state (used when editing a message):
|
|
68
|
-
|
|
69
|
-
```tsx
|
|
70
|
-
import { useAuiState } from "@assistant-ui/react";
|
|
71
|
-
|
|
72
|
-
const editText = useAuiState((s) => s.message.composer.text);
|
|
73
|
-
const isEditing = useAuiState((s) => s.message.composer.isEditing);
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
<ParametersTable {...ComposerState} />
|
|
24
|
+
{/* api-reference:end */}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: QueueItemState
|
|
3
|
+
description: State shape for queued assistant-ui thread operations and pending runtime work.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { QueueItemState } 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
|
+
### QueueItemState
|
|
18
|
+
|
|
19
|
+
<ParametersTable {...QueueItemState} />
|
|
20
|
+
{/* api-reference:end */}
|
|
@@ -1,61 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: ThreadListItemRuntime
|
|
3
|
-
description:
|
|
3
|
+
description: ThreadListItemRuntime state and actions for selecting, archiving, unarchiving, deleting, and renaming assistant-ui conversations.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
ThreadListItemRuntime,
|
|
8
|
-
ThreadListItemState,
|
|
9
|
-
} from "@/generated/typeDocs";
|
|
6
|
+
import { ThreadListItemRuntime, ThreadListItemState } from "@/generated/typeDocs";
|
|
10
7
|
|
|
11
|
-
|
|
8
|
+
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
|
+
{/* Do not edit manually. */}
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
{/* api-reference:start */}
|
|
12
|
+
{/* AUTO-GENERATED by scripts/generate-api-reference.mts */}
|
|
13
|
+
{/* Do not edit this block manually. */}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
import { useAui } from "@assistant-ui/react";
|
|
15
|
+
## API Reference
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// Navigation
|
|
21
|
-
await aui.threadListItem().switchTo();
|
|
22
|
-
|
|
23
|
-
// Rename
|
|
24
|
-
await aui.threadListItem().rename("New Title");
|
|
25
|
-
|
|
26
|
-
// Archive / unarchive
|
|
27
|
-
await aui.threadListItem().archive();
|
|
28
|
-
await aui.threadListItem().unarchive();
|
|
29
|
-
|
|
30
|
-
// Delete
|
|
31
|
-
await aui.threadListItem().delete();
|
|
32
|
-
|
|
33
|
-
// Initialize a new thread (returns remoteId and externalId)
|
|
34
|
-
const { remoteId, externalId } = await aui.threadListItem().initialize();
|
|
35
|
-
|
|
36
|
-
// Auto-generate a title from thread content
|
|
37
|
-
await aui.threadListItem().generateTitle();
|
|
38
|
-
|
|
39
|
-
// Detach the thread list item from its thread
|
|
40
|
-
aui.threadListItem().detach();
|
|
41
|
-
|
|
42
|
-
// Get current state
|
|
43
|
-
const state = aui.threadListItem().getState();
|
|
44
|
-
const { id, title, status } = state;
|
|
45
|
-
```
|
|
17
|
+
### ThreadListItemRuntime
|
|
46
18
|
|
|
47
19
|
<ParametersTable {...ThreadListItemRuntime} />
|
|
48
20
|
|
|
49
|
-
###
|
|
50
|
-
|
|
51
|
-
Access the state for a specific thread list item:
|
|
52
|
-
|
|
53
|
-
```tsx
|
|
54
|
-
import { useAuiState } from "@assistant-ui/react";
|
|
55
|
-
|
|
56
|
-
const title = useAuiState((s) => s.threadListItem.title);
|
|
57
|
-
const status = useAuiState((s) => s.threadListItem.status);
|
|
58
|
-
const id = useAuiState((s) => s.threadListItem.id);
|
|
59
|
-
```
|
|
21
|
+
### ThreadListItemState
|
|
60
22
|
|
|
61
23
|
<ParametersTable {...ThreadListItemState} />
|
|
24
|
+
{/* api-reference:end */}
|
|
@@ -1,61 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: ThreadListRuntime
|
|
3
|
-
description:
|
|
3
|
+
description: ThreadListRuntime state and actions for managing remote assistant-ui conversations, active thread selection, and new thread creation.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
import { ThreadListRuntime, ThreadListState } from "@/generated/typeDocs";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
|
+
{/* Do not edit manually. */}
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
{/* api-reference:start */}
|
|
12
|
+
{/* AUTO-GENERATED by scripts/generate-api-reference.mts */}
|
|
13
|
+
{/* Do not edit this block manually. */}
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
import { useAui } from "@assistant-ui/react";
|
|
15
|
+
## API Reference
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// Switch threads
|
|
18
|
-
await aui.threads().switchToNewThread();
|
|
19
|
-
await aui.threads().switchToThread(threadId);
|
|
20
|
-
|
|
21
|
-
// Re-fetch the thread list from the remote adapter
|
|
22
|
-
// (e.g. after async auth completes)
|
|
23
|
-
await aui.threads().reload();
|
|
24
|
-
|
|
25
|
-
// Append the next page of threads when the adapter returned a `nextCursor`
|
|
26
|
-
await aui.threads().loadMore();
|
|
27
|
-
|
|
28
|
-
// Access the main thread runtime
|
|
29
|
-
const mainThread = aui.threads().main;
|
|
30
|
-
|
|
31
|
-
// Access a thread by ID
|
|
32
|
-
const thread = aui.threads().getById(threadId);
|
|
33
|
-
|
|
34
|
-
// Access thread list items
|
|
35
|
-
const mainItem = aui.threads().mainItem;
|
|
36
|
-
const itemByIndex = aui.threads().getItemByIndex(0);
|
|
37
|
-
const itemById = aui.threads().getItemById(threadId);
|
|
38
|
-
const archivedItem = aui.threads().getArchivedItemByIndex(0);
|
|
39
|
-
|
|
40
|
-
// Get current state
|
|
41
|
-
const state = aui.threads().getState();
|
|
42
|
-
const threadIds = state.threadIds;
|
|
43
|
-
const archivedThreadIds = state.archivedThreadIds;
|
|
44
|
-
```
|
|
17
|
+
### ThreadListRuntime
|
|
45
18
|
|
|
46
19
|
<ParametersTable {...ThreadListRuntime} />
|
|
47
20
|
|
|
48
|
-
###
|
|
49
|
-
|
|
50
|
-
Access thread list state reactively:
|
|
51
|
-
|
|
52
|
-
```tsx
|
|
53
|
-
import { useAuiState } from "@assistant-ui/react";
|
|
54
|
-
|
|
55
|
-
const threads = useAuiState((s) => s.threads.threadIds);
|
|
56
|
-
const isLoading = useAuiState((s) => s.threads.isLoading);
|
|
57
|
-
const hasMore = useAuiState((s) => s.threads.hasMore);
|
|
58
|
-
const isLoadingMore = useAuiState((s) => s.threads.isLoadingMore);
|
|
59
|
-
```
|
|
21
|
+
### ThreadListState
|
|
60
22
|
|
|
61
23
|
<ParametersTable {...ThreadListState} />
|
|
24
|
+
{/* api-reference:end */}
|
|
@@ -1,48 +1,36 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: ThreadRuntime
|
|
3
|
-
description:
|
|
3
|
+
description: ThreadRuntime state and actions for controlling assistant-ui messages, composers, suggestions, model context, and the full thread lifecycle.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
import { ThreadRuntime, ThreadState } from "@/generated/typeDocs";
|
|
7
|
-
import { ThreadViewportState } from "@/components/docs/parameters-table.context";
|
|
6
|
+
import { ThreadComposerRuntime, ThreadComposerState, ThreadRuntime, ThreadState, ThreadViewportState } from "@/generated/typeDocs";
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
|
+
{/* Do not edit manually. */}
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
{/* api-reference:start */}
|
|
12
|
+
{/* AUTO-GENERATED by scripts/generate-api-reference.mts */}
|
|
13
|
+
{/* Do not edit this block manually. */}
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
import { useAui } from "@assistant-ui/react";
|
|
15
|
+
## API Reference
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
aui.thread().cancelRun();
|
|
18
|
-
aui.thread().append({ role: "user", content: [{ type: "text", text: "Hello" }] });
|
|
19
|
-
```
|
|
17
|
+
### ThreadComposerRuntime
|
|
20
18
|
|
|
21
|
-
<ParametersTable {...
|
|
22
|
-
|
|
23
|
-
### `useAuiState` (Thread State)
|
|
24
|
-
|
|
25
|
-
Access the thread state reactively:
|
|
19
|
+
<ParametersTable {...ThreadComposerRuntime} />
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
import { useAuiState } from "@assistant-ui/react";
|
|
21
|
+
### ThreadComposerState
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
const isLoading = useAuiState((s) => s.thread.isLoading);
|
|
32
|
-
const messages = useAuiState((s) => s.thread.messages);
|
|
33
|
-
```
|
|
23
|
+
<ParametersTable {...ThreadComposerState} />
|
|
34
24
|
|
|
35
|
-
|
|
25
|
+
### ThreadRuntime
|
|
36
26
|
|
|
37
|
-
|
|
27
|
+
<ParametersTable {...ThreadRuntime} />
|
|
38
28
|
|
|
39
|
-
|
|
29
|
+
### ThreadState
|
|
40
30
|
|
|
41
|
-
|
|
42
|
-
import { useThreadViewport } from "@assistant-ui/react";
|
|
31
|
+
<ParametersTable {...ThreadState} />
|
|
43
32
|
|
|
44
|
-
|
|
45
|
-
const isAtBottom = useThreadViewport((m) => m.isAtBottom);
|
|
46
|
-
```
|
|
33
|
+
### ThreadViewportState
|
|
47
34
|
|
|
48
35
|
<ParametersTable {...ThreadViewportState} />
|
|
36
|
+
{/* api-reference:end */}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Component Tools
|
|
3
|
+
description: Register assistant tools from mounted React components, scoped to the lifetime of part of the UI tree.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import { useAssistantTool } from "@/generated/typeDocs";
|
|
7
|
+
|
|
8
|
+
{/* AUTO-GENERATED PAGE by scripts/generate-api-reference.mts */}
|
|
9
|
+
{/* Do not edit manually. */}
|
|
10
|
+
|
|
11
|
+
{/* api-manual:start */}
|
|
12
|
+
<Callout type="warn">
|
|
13
|
+
`makeAssistantTool` and `useAssistantTool` are **deprecated** compatibility
|
|
14
|
+
APIs, documented here for reference only. New code should define a toolkit —
|
|
15
|
+
see [Defining Tools](/docs/tools/defining-tools) and [Migrating Tools to
|
|
16
|
+
Toolkits](/docs/migrations/toolkit-tools).
|
|
17
|
+
</Callout>
|
|
18
|
+
{/* api-manual:end */}
|
|
19
|
+
|
|
20
|
+
{/* api-reference:start */}
|
|
21
|
+
{/* AUTO-GENERATED by scripts/generate-api-reference.mts */}
|
|
22
|
+
{/* Do not edit this block manually. */}
|
|
23
|
+
|
|
24
|
+
## API Reference
|
|
25
|
+
|
|
26
|
+
### makeAssistantTool
|
|
27
|
+
|
|
28
|
+
<Callout type="warn">
|
|
29
|
+
<strong>Deprecated.</strong> Use a toolkit with `Tools({ toolkit })` and register it via
|
|
30
|
+
`useAui({ tools: Tools({ toolkit }) })` instead. See
|
|
31
|
+
https://assistant-ui.com/docs/migrations/toolkit-tools.
|
|
32
|
+
</Callout>
|
|
33
|
+
|
|
34
|
+
Creates a React component that registers an assistant tool when rendered.
|
|
35
|
+
|
|
36
|
+
Use this when exporting reusable tool modules that can be included in JSX
|
|
37
|
+
rather than calling [useAssistantTool](/docs/api-reference/tools/component-tools#useassistanttool) directly.
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
type AssistantToolProps = CoreAssistantToolProps<TArgs, TResult> & {
|
|
41
|
+
/** Component used to render calls to this tool in assistant messages. */
|
|
42
|
+
render?: ToolCallMessagePartComponent<TArgs, TResult> | undefined;
|
|
43
|
+
/** Lightweight text rendered while a tool call is running or complete. */
|
|
44
|
+
renderText?: ToolCallText<TArgs, TResult> | undefined;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const makeAssistantTool: <TArgs extends Record<string, unknown>, TResult>(tool: AssistantToolProps<TArgs, TResult>) => AssistantTool;
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### useAssistantTool
|
|
51
|
+
|
|
52
|
+
<Callout type="warn">
|
|
53
|
+
<strong>Deprecated.</strong> Use a toolkit with `Tools({ toolkit })` and register it via
|
|
54
|
+
`useAui({ tools: Tools({ toolkit }) })` instead. See
|
|
55
|
+
https://assistant-ui.com/docs/migrations/toolkit-tools.
|
|
56
|
+
</Callout>
|
|
57
|
+
|
|
58
|
+
Registers a tool with the assistant model context while the component is
|
|
59
|
+
mounted.
|
|
60
|
+
|
|
61
|
+
If `render` is provided, it is also installed as the renderer for matching
|
|
62
|
+
tool-call message parts. The registration is removed automatically when the
|
|
63
|
+
component unmounts or the tool definition changes.
|
|
64
|
+
|
|
65
|
+
Pass a referentially stable tool object, such as one declared at module
|
|
66
|
+
scope or memoized with `useMemo`, to avoid re-registering on every render.
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
const weatherTool = {
|
|
70
|
+
toolName: "get_weather",
|
|
71
|
+
type: "frontend",
|
|
72
|
+
description: "Get the weather for a city.",
|
|
73
|
+
parameters: weatherSchema,
|
|
74
|
+
execute: async ({ city }: { city: string }) => fetchWeather(city),
|
|
75
|
+
render: WeatherToolUI,
|
|
76
|
+
} satisfies AssistantToolProps<{ city: string }, Weather>;
|
|
77
|
+
|
|
78
|
+
function WeatherToolRegistration() {
|
|
79
|
+
useAssistantTool(weatherTool);
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
<ParametersTable {...useAssistantTool} />
|
|
85
|
+
{/* api-reference:end */}
|