@assistant-ui/mcp-docs-server 0.1.9 → 0.1.10

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.
@@ -1,160 +0,0 @@
1
- ---
2
- title: Migration to v0.8
3
- ---
4
-
5
- ## Styled Components moved to @assistant-ui/react-ui
6
-
7
- All styled components (Thread, ThreadList, AssistantModal, makeMarkdownText, etc.) have been moved to a new package, `@assistant-ui/react-ui`.
8
-
9
- To migrate, use the migration codemod:
10
-
11
- ```sh
12
- # IMPORTANT: make sure to commit all changes to git / creating a backup before running the codemod
13
- npx assistant-ui upgrade
14
- ```
15
-
16
- ## Vercel AI SDK RSC requires additional setup
17
-
18
- Built-in RSC support in assistant-ui has been removed, so an additional setup step is required.
19
- The RSC runtime now requires additional setup to display React Server Components.
20
-
21
- ```ts
22
- import { RSCDisplay } from "@assistant-ui/react-ai-sdk";
23
-
24
- // if you are using the default Thread component
25
- // add RSCDisplay to assistantMessage.components.Text
26
- <Thread assistantMessage={{ components: { Text: RSCDisplay } }} />
27
-
28
-
29
- // if you are using unstyled primitives, update MyThread.tsx
30
- <MessagePrimitive.Parts components={{ Text: RSCDisplay }} />
31
- ```
32
-
33
- ## Migrate away from UIMessagePart
34
-
35
- For instructions on migrating for Vercel AI SDK RSC, see section above.
36
- This migration guide is for users of `useExternalStoreRuntime`.
37
-
38
- ### Recommended Approach: Use ToolUI
39
-
40
- First, reconsider your approach.
41
-
42
- Creating UI components in the `convertMessage` callback is considered an anti-pattern.
43
- The recommended alternative approach is to pass tool-call message parts, and use `makeAssistantToolUI` to map these tool calls to UI components.
44
-
45
- This ensures that the data layer is separate and decoupled from the UI layer.
46
-
47
- #### Example
48
-
49
- Consider the following example, where you are using a UIMessagePart to show a loading indicator.
50
-
51
- ```ts title="bad.ts"
52
- // THIS IS BAD
53
- const convertMessage = (message: MyMessage): ThreadMessageLike => {
54
- if (message.isLoading) {
55
- return { content: [{ type: "ui", display:< MyLoader /> }] };
56
- }
57
- // ...
58
- };
59
- ```
60
-
61
- ```ts title="good.ts"
62
- const convertMessage = (message: MyMessage): ThreadMessageLike => {
63
- if (message.isLoading) {
64
- return { content: [] };
65
- }
66
- // ...
67
- };
68
-
69
- // use the empty message part to show the loading indicator
70
- <Thread assistantMessage={{ components: { Empty: MyLoader } }} />;
71
- ```
72
-
73
- (if you are using unstyled primitives, update MyThread.tsx, and pass the component to MessagePrimitive.Parts)
74
-
75
- #### Example 2
76
-
77
- Consider the following example, where you are displaying a custom chart based on data received from an external source.
78
-
79
- ```ts title="bad.ts"
80
- // THIS IS BAD
81
- const convertMessage = (message: MyMessage): ThreadMessageLike => {
82
- return { content: [{ type: "ui", display: <MyChart data={message.chartData} /> }] };
83
- };
84
- ```
85
-
86
- ```ts title="good.ts"
87
- const convertMessage = (message: MyMessage): ThreadMessageLike => {
88
- return {
89
- content: [
90
- {
91
- type: "tool-call",
92
- toolName: "chart",
93
- args: message.chartData,
94
- },
95
- ],
96
- };
97
- };
98
-
99
- const ChartToolUI = makeAssistantToolUI({
100
- toolName: "chart",
101
- render: ({ args }) => <MyChart data={args} />,
102
- });
103
-
104
- // use tool UI to display the chart
105
- <Thread tools={[ChartToolUI]} />;
106
- ```
107
-
108
- (if you are using unstyled primitives, render the `<ChartToolUI />` component anywhere inside your AssistantRuntimeProvider)
109
-
110
- ### Fallback Approach: Override MessagePartText
111
-
112
- However, sometimes you receive UI components from an external source.
113
-
114
- The example below assumes that your custom `MyMessage` type has a `display` field.
115
-
116
- First, we define a dummy `UI_PLACEHOLDER` message part, which we will replace with the UI component later:
117
-
118
- ```ts
119
- const UI_PLACEHOLDER = Object.freeze({
120
- type: "text",
121
- text: "UI content placeholder",
122
- });
123
- const convertMessage = (message: MyMessage): ThreadMessageLike => ({
124
- content: [
125
- // other message parts,
126
- UI_PLACEHOLDER,
127
- ],
128
- });
129
- ```
130
-
131
- Then, we define a custom `TextMessagePartComponent`:
132
-
133
- ```tsx
134
- const MyText: TextMessagePartComponent = () => {
135
- const isUIPlaceholder = useMessagePart((p) => p === UI_PLACEHOLDER);
136
-
137
- // this assumes that you have a `display` field on your original message objects before conversion.
138
- const ui = useMessage((m) =>
139
- isUIPlaceholder ? getExternalStoreMessage(m).display : undefined,
140
- );
141
- if (ui) {
142
- return ui;
143
- }
144
-
145
- return <MarkdownText />; // your default text component
146
- };
147
- ```
148
-
149
- We pass this component to our Thread:
150
-
151
- ```tsx
152
- <Thread
153
- assistantMessage={{ components: { Text: MyText } }}
154
- userMessage={{ components: { Text: MyText } }}
155
- />
156
- ```
157
-
158
- (if you are using unstyled primitives, update MyThread.tsx, and pass the component to MessagePrimitive.Parts)
159
-
160
- Now, the `UI_PLACEHOLDER` message part is replaced with the UI component we defined earlier.
@@ -1,75 +0,0 @@
1
- ---
2
- title: Migration to v0.9
3
- ---
4
-
5
- ## Edge Runtime moved to @assistant-ui/react-edge
6
-
7
- The edge runtime, as well as the `CoreMessage` type, moved to `@assistant-ui/react-edge`.
8
-
9
- The following components and types have been moved to `@assistant-ui/react-edge`:
10
-
11
- - Edge Runtime
12
-
13
- - `useEdgeRuntime`
14
- - `EdgeRuntimeOptions`
15
- - `EdgeModelAdapter`
16
- - `EdgeChatAdapter`
17
- - `EdgeRuntimeRequestOptions`
18
- - `createEdgeRuntimeAPI`
19
- - `getEdgeRuntimeResponse`
20
-
21
- - Core Types
22
- - `CoreMessage`
23
- - `CoreUserMessage`
24
- - `CoreAssistantMessage`
25
- - `CoreSystemMessage`
26
- - `CoreUserMessagePart`
27
- - `CoreAssistantMessagePart`
28
- - `CoreToolCallMessagePart`
29
- - Core message converters
30
- - `fromCoreMessages`
31
- - `fromCoreMessage`
32
- - `toCoreMessages`
33
- - `toCoreMessage`
34
-
35
- To migrate, use the migration codemod:
36
-
37
- ```sh
38
- # IMPORTANT: make sure to commit all changes to git / creating a backup before running the codemod
39
- npx assistant-ui upgrade
40
- ```
41
-
42
- ## Language Model converters and useDangerousInBrowserRuntime moved to @assistant-ui/react-ai-sdk
43
-
44
- The following methods have been moved to `@assistant-ui/react-ai-sdk`:
45
-
46
- - Language Model converters
47
- - `toLanguageModelMessages`
48
- - `toLanguageModelTools`
49
- - `fromLanguageModelMessages`
50
- - `fromLanguageModelTools`
51
- - Dangerous in Browser Runtime
52
- - `useDangerousInBrowserRuntime`
53
-
54
- To migrate, use the migration codemod:
55
-
56
- ```sh
57
- # IMPORTANT: make sure to commit all changes to git / creating a backup before running the codemod
58
- npx assistant-ui upgrade
59
- ```
60
-
61
- ## LangGraph `unstable_allowImageAttachments` removed
62
-
63
- The `unstable_allowImageAttachments` option has been removed. Use the `adapters` option instead.
64
-
65
- ```ts
66
- useLangGraphRuntime({
67
- adapters: {
68
- attachments: new SimpleImageAttachmentAdapter(),
69
- },
70
- });
71
- ```
72
-
73
- ## Markdown `components.by_language` removed
74
-
75
- The `components.by_language` option has been removed. Use the `componentsByLanguage` option instead.
@@ -1,197 +0,0 @@
1
- ---
2
- title: Thread
3
- ---
4
-
5
- A conversation between a user and an assistant.
6
-
7
- import { ParametersTable } from "@/components/docs";
8
-
9
- ## Anatomy
10
-
11
- ```tsx
12
- import { ThreadPrimitive } from "@assistant-ui/react";
13
-
14
- const Thread = () => (
15
- <ThreadPrimitive.Root>
16
- <ThreadPrimitive.Viewport>
17
- <ThreadPrimitive.Empty>...</ThreadPrimitive.Empty>
18
- <ThreadPrimitive.Messages components={...} />
19
- </ThreadPrimitive.Viewport>
20
- <Composer />
21
- </ThreadPrimitive.Root>
22
- );
23
- ```
24
-
25
- ## API Reference
26
-
27
- ### Root
28
-
29
- Contains all parts of the thread.
30
-
31
- This primitive renders a `<div>` element unless `asChild` is set.
32
-
33
- <ParametersTable
34
- type="ThreadPrimitiveRootProps"
35
- parameters={[
36
- {
37
- name: "asChild",
38
- },
39
- ]}
40
- />
41
-
42
- ### Viewport
43
-
44
- The scrollable area containing all messages. Anchors scroll to the bottom as new messages are added.
45
-
46
- This primitive renders a `<div>` element unless `asChild` is set.
47
-
48
- <ParametersTable
49
- type="ThreadPrimitiveViewportProps"
50
- parameters={[
51
- {
52
- name: "asChild",
53
- },
54
- {
55
- name: "autoScroll",
56
- type: "boolean",
57
- default: "true",
58
- description:
59
- "Whether to automatically scroll to the bottom of the viewport when new messages are added while the viewport is was previously scrolled to the bottom.",
60
- },
61
- ]}
62
- />
63
-
64
- ### Messages
65
-
66
- Renders all messages. This primitive renders a separate component for each message.
67
-
68
- <ParametersTable
69
- type="ThreadPrimitiveMessagesProps"
70
- parameters={[
71
- {
72
- name: "components",
73
- type: "MessageComponents",
74
- description: "The component to render for each message.",
75
- children: [
76
- {
77
- type: "MessageComponents",
78
- parameters: [
79
- {
80
- name: "Message",
81
- type: "ComponentType",
82
- description: "The component to render for each message.",
83
- },
84
- {
85
- name: "UserMessage",
86
- type: "ComponentType",
87
- description: "The component to render for user messages.",
88
- },
89
- {
90
- name: "EditComposer",
91
- type: "ComponentType",
92
- description:
93
- "The component to render for user messages that are being edited.",
94
- },
95
- {
96
- name: "AssistantMessage",
97
- type: "ComponentType",
98
- description: "The component to render for assistant messages.",
99
- },
100
- ],
101
- },
102
- ],
103
- },
104
- ]}
105
- />
106
-
107
- ### Empty
108
-
109
- Renders children only when there are no messages.
110
-
111
- ### ScrollToBottom
112
-
113
- A button to scroll the viewport to the bottom. Disabled when the viewport is already at bottom.
114
-
115
- This primitive renders a `<button>` element unless `asChild` is set.
116
-
117
- <ParametersTable
118
- type="ThreadPrimitiveScrollToBottomProps"
119
- parameters={[
120
- {
121
- name: "asChild",
122
- },
123
- ]}
124
- />
125
-
126
- ### `ThreadPrimitive.Suggestion`
127
-
128
- Shows a suggestion to the user. When the user clicks on the suggestion, the composer's value is set to the suggestion's prompt.
129
-
130
- This primitive renders a `<button>` element unless `asChild` is set.
131
-
132
- ```tsx
133
- import { ThreadPrimitive } from "@assistant-ui/react";
134
-
135
- const Suggestion = () => {
136
- return (
137
- <ThreadPrimitive.Suggestion
138
- prompt="I need help with product search"
139
- method="replace"
140
- autoSend
141
- />
142
- );
143
- };
144
- ```
145
-
146
- <ParametersTable
147
- type="ThreadPrimitiveSuggestionProps"
148
- parameters={[
149
- {
150
- name: "prompt",
151
- type: "string",
152
- description: "The suggestion's prompt.",
153
- },
154
- {
155
- name: "method",
156
- type: "'replace'",
157
- description:
158
- "How does the suggestion interact with the composer's existing value.",
159
- },
160
- {
161
- name: "autoSend",
162
- type: "boolean",
163
- description:
164
- "Whether to automatically send the suggestion when the user clicks on it.",
165
- default: "false",
166
- },
167
- ]}
168
- />
169
-
170
- ### If
171
-
172
- Renders children if a condition is met.
173
-
174
- <ParametersTable
175
- type="ThreadPrimitiveIfProps"
176
- parameters={[
177
- {
178
- name: "empty",
179
- type: "boolean | undefined",
180
- description: "Render children if the thread is empty.",
181
- },
182
- {
183
- name: "running",
184
- type: "boolean | undefined",
185
- description: "Render children if the thread is running.",
186
- },
187
- ]}
188
- />
189
-
190
- ```tsx
191
- <Thread.If empty>
192
- {/* equivalent to <Thread.Empty> */}
193
- </Thread.If>
194
- <Thread.If empty={false}>
195
- {/* rendered if thread is not empty */}
196
- </Thread.If>
197
- ```