@assistant-ui/mcp-docs-server 0.1.17 → 0.1.19

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 (202) hide show
  1. package/.docs/organized/code-examples/with-ag-ui.md +518 -234
  2. package/.docs/organized/code-examples/{with-ai-sdk-v5.md → with-ai-sdk-v6.md} +476 -189
  3. package/.docs/organized/code-examples/with-assistant-transport.md +503 -301
  4. package/.docs/organized/code-examples/with-cloud.md +524 -226
  5. package/.docs/organized/code-examples/with-custom-thread-list.md +433 -146
  6. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +2241 -0
  7. package/.docs/organized/code-examples/with-external-store.md +517 -231
  8. package/.docs/organized/code-examples/with-ffmpeg.md +500 -220
  9. package/.docs/organized/code-examples/with-langgraph.md +630 -319
  10. package/.docs/organized/code-examples/with-parent-id-grouping.md +517 -231
  11. package/.docs/organized/code-examples/with-react-hook-form.md +517 -233
  12. package/.docs/organized/code-examples/with-react-router.md +2167 -0
  13. package/.docs/organized/code-examples/{store-example.md → with-store.md} +18 -22
  14. package/.docs/organized/code-examples/with-tanstack.md +23 -41
  15. package/.docs/raw/blog/2025-01-31-changelog/index.mdx +0 -2
  16. package/.docs/raw/docs/{about-assistantui.mdx → (docs)/about-assistantui.mdx} +2 -1
  17. package/.docs/raw/docs/{architecture.mdx → (docs)/architecture.mdx} +3 -2
  18. package/.docs/raw/docs/{cli.mdx → (docs)/cli.mdx} +1 -19
  19. package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-readable.mdx +1 -0
  20. package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-tool-ui.mdx +2 -1
  21. package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-tool.mdx +2 -1
  22. package/.docs/raw/docs/{copilots → (docs)/copilots}/model-context.mdx +1 -0
  23. package/.docs/raw/docs/{copilots → (docs)/copilots}/motivation.mdx +1 -0
  24. package/.docs/raw/docs/{copilots → (docs)/copilots}/use-assistant-instructions.mdx +1 -0
  25. package/.docs/raw/docs/{devtools.mdx → (docs)/devtools.mdx} +4 -4
  26. package/.docs/raw/docs/{guides/Attachments.mdx → (docs)/guides/attachments.mdx} +4 -5
  27. package/.docs/raw/docs/{guides/Branching.mdx → (docs)/guides/branching.mdx} +2 -1
  28. package/.docs/raw/docs/{guides → (docs)/guides}/context-api.mdx +1 -0
  29. package/.docs/raw/docs/(docs)/guides/dictation.mdx +370 -0
  30. package/.docs/raw/docs/{guides/Editing.mdx → (docs)/guides/editing.mdx} +1 -0
  31. package/.docs/raw/docs/{guides/Latex.mdx → (docs)/guides/latex.mdx} +1 -2
  32. package/.docs/raw/docs/{guides/Speech.mdx → (docs)/guides/speech.mdx} +9 -10
  33. package/.docs/raw/docs/{guides/ToolUI.mdx → (docs)/guides/tool-ui.mdx} +15 -14
  34. package/.docs/raw/docs/{guides/Tools.mdx → (docs)/guides/tools.mdx} +10 -7
  35. package/.docs/raw/docs/{getting-started.mdx → (docs)/index.mdx} +17 -22
  36. package/.docs/raw/docs/{mcp-docs-server.mdx → (docs)/mcp-docs-server.mdx} +1 -2
  37. package/.docs/raw/docs/{api-reference/context-providers/AssistantRuntimeProvider.mdx → (reference)/api-reference/context-providers/assistant-runtime-provider.mdx} +2 -1
  38. package/.docs/raw/docs/{api-reference/context-providers/TextMessagePartProvider.mdx → (reference)/api-reference/context-providers/text-message-part-provider.mdx} +2 -1
  39. package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/react-data-stream.mdx +2 -1
  40. package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/react-hook-form.mdx +2 -1
  41. package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/vercel-ai-sdk.mdx +2 -2
  42. package/.docs/raw/docs/{api-reference → (reference)/api-reference}/overview.mdx +1 -1
  43. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +327 -0
  44. package/.docs/raw/docs/{api-reference/primitives/ActionBar.mdx → (reference)/api-reference/primitives/action-bar.mdx} +3 -1
  45. package/.docs/raw/docs/{api-reference/primitives/AssistantIf.mdx → (reference)/api-reference/primitives/assistant-if.mdx} +2 -2
  46. package/.docs/raw/docs/{api-reference/primitives/AssistantModal.mdx → (reference)/api-reference/primitives/assistant-modal.mdx} +3 -1
  47. package/.docs/raw/docs/{api-reference/primitives/Attachment.mdx → (reference)/api-reference/primitives/attachment.mdx} +3 -2
  48. package/.docs/raw/docs/{api-reference/primitives/BranchPicker.mdx → (reference)/api-reference/primitives/branch-picker.mdx} +2 -1
  49. package/.docs/raw/docs/{api-reference/primitives/Composer.mdx → (reference)/api-reference/primitives/composer.mdx} +101 -2
  50. package/.docs/raw/docs/{api-reference → (reference)/api-reference}/primitives/composition.mdx +1 -0
  51. package/.docs/raw/docs/{api-reference/primitives/Error.mdx → (reference)/api-reference/primitives/error.mdx} +2 -1
  52. package/.docs/raw/docs/{api-reference/primitives/MessagePart.mdx → (reference)/api-reference/primitives/message-part.mdx} +2 -2
  53. package/.docs/raw/docs/{api-reference/primitives/Message.mdx → (reference)/api-reference/primitives/message.mdx} +2 -1
  54. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +221 -0
  55. package/.docs/raw/docs/{api-reference/primitives/ThreadListItem.mdx → (reference)/api-reference/primitives/thread-list-item.mdx} +2 -1
  56. package/.docs/raw/docs/{api-reference/primitives/ThreadList.mdx → (reference)/api-reference/primitives/thread-list.mdx} +2 -1
  57. package/.docs/raw/docs/{api-reference/primitives/Thread.mdx → (reference)/api-reference/primitives/thread.mdx} +2 -1
  58. package/.docs/raw/docs/{api-reference/runtimes/AssistantRuntime.mdx → (reference)/api-reference/runtimes/assistant-runtime.mdx} +2 -1
  59. package/.docs/raw/docs/{api-reference/runtimes/AttachmentRuntime.mdx → (reference)/api-reference/runtimes/attachment-runtime.mdx} +3 -2
  60. package/.docs/raw/docs/{api-reference/runtimes/ComposerRuntime.mdx → (reference)/api-reference/runtimes/composer-runtime.mdx} +2 -1
  61. package/.docs/raw/docs/{api-reference/runtimes/MessagePartRuntime.mdx → (reference)/api-reference/runtimes/message-part-runtime.mdx} +3 -2
  62. package/.docs/raw/docs/{api-reference/runtimes/MessageRuntime.mdx → (reference)/api-reference/runtimes/message-runtime.mdx} +3 -2
  63. package/.docs/raw/docs/{api-reference/runtimes/ThreadListItemRuntime.mdx → (reference)/api-reference/runtimes/thread-list-item-runtime.mdx} +2 -1
  64. package/.docs/raw/docs/{api-reference/runtimes/ThreadListRuntime.mdx → (reference)/api-reference/runtimes/thread-list-runtime.mdx} +2 -1
  65. package/.docs/raw/docs/{api-reference/runtimes/ThreadRuntime.mdx → (reference)/api-reference/runtimes/thread-runtime.mdx} +3 -5
  66. package/.docs/raw/docs/{legacy/styled/AssistantModal.mdx → (reference)/legacy/styled/assistant-modal.mdx} +2 -3
  67. package/.docs/raw/docs/{legacy/styled/Decomposition.mdx → (reference)/legacy/styled/decomposition.mdx} +1 -0
  68. package/.docs/raw/docs/{legacy/styled/Markdown.mdx → (reference)/legacy/styled/markdown.mdx} +2 -4
  69. package/.docs/raw/docs/{legacy/styled/Scrollbar.mdx → (reference)/legacy/styled/scrollbar.mdx} +2 -1
  70. package/.docs/raw/docs/{legacy/styled/ThreadWidth.mdx → (reference)/legacy/styled/thread-width.mdx} +1 -0
  71. package/.docs/raw/docs/{legacy/styled/Thread.mdx → (reference)/legacy/styled/thread.mdx} +2 -3
  72. package/.docs/raw/docs/{migrations → (reference)/migrations}/deprecation-policy.mdx +1 -0
  73. package/.docs/raw/docs/{migrations → (reference)/migrations}/react-langgraph-v0-7.mdx +1 -2
  74. package/.docs/raw/docs/{migrations → (reference)/migrations}/v0-11.mdx +1 -0
  75. package/.docs/raw/docs/{migrations → (reference)/migrations}/v0-12.mdx +1 -0
  76. package/.docs/raw/docs/{react-compatibility.mdx → (reference)/react-compatibility.mdx} +2 -3
  77. package/.docs/raw/docs/cloud/authorization.mdx +1 -0
  78. package/.docs/raw/docs/cloud/overview.mdx +1 -0
  79. package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +2 -3
  80. package/.docs/raw/docs/cloud/persistence/langgraph.mdx +5 -7
  81. package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +9 -8
  82. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +2 -3
  83. package/.docs/raw/docs/runtimes/assistant-transport.mdx +7 -6
  84. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +38 -3
  85. package/.docs/raw/docs/runtimes/custom/external-store.mdx +6 -8
  86. package/.docs/raw/docs/runtimes/custom/local.mdx +43 -16
  87. package/.docs/raw/docs/runtimes/data-stream.mdx +32 -4
  88. package/.docs/raw/docs/runtimes/helicone.mdx +1 -0
  89. package/.docs/raw/docs/runtimes/langgraph/index.mdx +3 -3
  90. package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +1 -0
  91. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +1 -0
  92. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +1 -0
  93. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -0
  94. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +2 -1
  95. package/.docs/raw/docs/runtimes/langserve.mdx +2 -2
  96. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +4 -5
  97. package/.docs/raw/docs/runtimes/mastra/overview.mdx +1 -0
  98. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +3 -4
  99. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +2 -4
  100. package/.docs/raw/docs/ui/assistant-modal.mdx +163 -0
  101. package/.docs/raw/docs/ui/assistant-sidebar.mdx +90 -0
  102. package/.docs/raw/docs/ui/attachment.mdx +227 -0
  103. package/.docs/raw/docs/ui/{Markdown.mdx → markdown.mdx} +11 -6
  104. package/.docs/raw/docs/ui/{Mermaid.mdx → mermaid.mdx} +12 -5
  105. package/.docs/raw/docs/ui/{PartGrouping.mdx → part-grouping.mdx} +4 -6
  106. package/.docs/raw/docs/ui/reasoning.mdx +148 -0
  107. package/.docs/raw/docs/ui/{Scrollbar.mdx → scrollbar.mdx} +9 -7
  108. package/.docs/raw/docs/ui/sources.mdx +87 -0
  109. package/.docs/raw/docs/ui/{SyntaxHighlighting.mdx → syntax-highlighting.mdx} +9 -5
  110. package/.docs/raw/docs/ui/thread-list.mdx +275 -0
  111. package/.docs/raw/docs/ui/{Thread.mdx → thread.mdx} +5 -6
  112. package/.docs/raw/docs/ui/tool-fallback.mdx +112 -0
  113. package/.docs/raw/docs/ui/tool-group.mdx +214 -0
  114. package/dist/constants.d.ts +10 -0
  115. package/dist/constants.d.ts.map +1 -0
  116. package/dist/constants.js +14 -0
  117. package/dist/constants.js.map +1 -0
  118. package/dist/index.d.ts +4 -0
  119. package/dist/index.d.ts.map +1 -0
  120. package/dist/index.js +33 -1
  121. package/dist/index.js.map +1 -0
  122. package/dist/prepare-docs/code-examples.d.ts +2 -0
  123. package/dist/prepare-docs/code-examples.d.ts.map +1 -0
  124. package/dist/prepare-docs/code-examples.js +129 -0
  125. package/dist/prepare-docs/code-examples.js.map +1 -0
  126. package/dist/prepare-docs/copy-raw.d.ts +2 -0
  127. package/dist/prepare-docs/copy-raw.d.ts.map +1 -0
  128. package/dist/prepare-docs/copy-raw.js +50 -0
  129. package/dist/prepare-docs/copy-raw.js.map +1 -0
  130. package/dist/prepare-docs/prepare.d.ts +2 -0
  131. package/dist/prepare-docs/prepare.d.ts.map +1 -0
  132. package/dist/prepare-docs/prepare.js +18 -195
  133. package/dist/prepare-docs/prepare.js.map +1 -0
  134. package/dist/stdio.d.ts +3 -0
  135. package/dist/stdio.d.ts.map +1 -0
  136. package/dist/stdio.js +4 -5
  137. package/dist/stdio.js.map +1 -0
  138. package/dist/tools/docs.d.ts +23 -0
  139. package/dist/tools/docs.d.ts.map +1 -0
  140. package/dist/tools/docs.js +168 -0
  141. package/dist/tools/docs.js.map +1 -0
  142. package/dist/tools/examples.d.ts +23 -0
  143. package/dist/tools/examples.d.ts.map +1 -0
  144. package/dist/tools/examples.js +95 -0
  145. package/dist/tools/examples.js.map +1 -0
  146. package/dist/tools/tests/test-setup.d.ts +4 -0
  147. package/dist/tools/tests/test-setup.d.ts.map +1 -0
  148. package/dist/tools/tests/test-setup.js +36 -0
  149. package/dist/tools/tests/test-setup.js.map +1 -0
  150. package/dist/utils/logger.d.ts +7 -0
  151. package/dist/utils/logger.d.ts.map +1 -0
  152. package/dist/utils/logger.js +20 -0
  153. package/dist/utils/logger.js.map +1 -0
  154. package/dist/utils/mcp-format.d.ts +7 -0
  155. package/dist/utils/mcp-format.d.ts.map +1 -0
  156. package/dist/utils/mcp-format.js +11 -0
  157. package/dist/utils/mcp-format.js.map +1 -0
  158. package/dist/utils/mdx.d.ts +9 -0
  159. package/dist/utils/mdx.d.ts.map +1 -0
  160. package/dist/utils/mdx.js +27 -0
  161. package/dist/utils/mdx.js.map +1 -0
  162. package/dist/utils/paths.d.ts +8 -0
  163. package/dist/utils/paths.d.ts.map +1 -0
  164. package/dist/utils/paths.js +84 -0
  165. package/dist/utils/paths.js.map +1 -0
  166. package/dist/utils/security.d.ts +2 -0
  167. package/dist/utils/security.d.ts.map +1 -0
  168. package/dist/utils/security.js +43 -0
  169. package/dist/utils/security.js.map +1 -0
  170. package/package.json +37 -19
  171. package/src/constants.ts +22 -0
  172. package/src/index.ts +51 -0
  173. package/src/prepare-docs/code-examples.ts +158 -0
  174. package/src/prepare-docs/copy-raw.ts +55 -0
  175. package/src/prepare-docs/prepare.ts +24 -0
  176. package/src/stdio.ts +7 -0
  177. package/src/tools/docs.ts +207 -0
  178. package/src/tools/examples.ts +107 -0
  179. package/src/tools/tests/docs.test.ts +124 -0
  180. package/src/tools/tests/examples.test.ts +94 -0
  181. package/src/tools/tests/integration.test.ts +46 -0
  182. package/src/tools/tests/json-parsing.test.ts +23 -0
  183. package/src/tools/tests/mcp-protocol.test.ts +133 -0
  184. package/src/tools/tests/path-traversal.test.ts +81 -0
  185. package/src/tools/tests/test-setup.ts +40 -0
  186. package/src/utils/logger.ts +20 -0
  187. package/src/utils/mcp-format.ts +12 -0
  188. package/src/utils/mdx.ts +39 -0
  189. package/src/utils/paths.ts +114 -0
  190. package/src/utils/security.ts +52 -0
  191. package/src/utils/tests/security.test.ts +119 -0
  192. package/.docs/raw/docs/index.mdx +0 -7
  193. package/.docs/raw/docs/ui/AssistantModal.mdx +0 -45
  194. package/.docs/raw/docs/ui/AssistantSidebar.mdx +0 -41
  195. package/.docs/raw/docs/ui/Attachment.mdx +0 -84
  196. package/.docs/raw/docs/ui/Reasoning.mdx +0 -152
  197. package/.docs/raw/docs/ui/ThreadList.mdx +0 -90
  198. package/.docs/raw/docs/ui/ToolFallback.mdx +0 -63
  199. package/.docs/raw/docs/ui/ToolGroup.mdx +0 -96
  200. package/dist/chunk-M2RKUM66.js +0 -38
  201. package/dist/chunk-NVNFQ5ZO.js +0 -423
  202. /package/.docs/raw/docs/{copilots → (docs)/copilots}/assistant-frame.mdx +0 -0
@@ -1,90 +0,0 @@
1
- ---
2
- title: ThreadList
3
- ---
4
-
5
- import { Steps, Step } from "fumadocs-ui/components/steps";
6
- import { Callout } from "fumadocs-ui/components/callout";
7
- import { Tabs, Tab } from "fumadocs-ui/components/tabs";
8
- import { InstallCommand } from "@/components/docs/install-command";
9
- import { ThreadListSample } from "@/components/samples/threadlist-sample";
10
-
11
- ## Overview
12
-
13
- The ThreadList component lets the user switch between threads.
14
-
15
- <ThreadListSample />
16
-
17
- <Callout>
18
- This demo uses **ThreadListSidebar**, which includes `thread-list` as a dependency and provides a complete sidebar layout. For custom implementations, you can use `thread-list` directly.
19
- </Callout>
20
-
21
- ## Getting Started
22
-
23
- <Steps>
24
- <Step>
25
-
26
- ### Add the component
27
-
28
- Use `threadlist-sidebar` for a complete sidebar layout or `thread-list` for custom layouts.
29
-
30
- #### ThreadListSidebar
31
-
32
- <InstallCommand shadcn={["threadlist-sidebar"]} />
33
-
34
- #### ThreadList
35
-
36
- <InstallCommand shadcn={["thread-list"]} />
37
-
38
- </Step>
39
- <Step>
40
-
41
- ### Use in your application
42
-
43
- <Tabs items={["With Sidebar", "Without Sidebar"]}>
44
- <Tab value="With Sidebar">
45
- ```tsx title="/app/assistant.tsx"
46
- import { Thread } from "@/components/assistant-ui/thread";
47
- import { ThreadListSidebar } from "@/components/assistant-ui/threadlist-sidebar";
48
- import {
49
- SidebarProvider,
50
- SidebarInset,
51
- SidebarTrigger
52
- } from "@/components/ui/sidebar";
53
-
54
- export default function Assistant() {
55
- return (
56
- <SidebarProvider>
57
- <div className="flex h-dvh w-full">
58
- <ThreadListSidebar />
59
- <SidebarInset>
60
- {/* Add sidebar trigger, location can be customized */}
61
- <SidebarTrigger className="absolute top-4 left-4" />
62
- <Thread />
63
- </SidebarInset>
64
- </div>
65
- </SidebarProvider>
66
- );
67
- }
68
- ```
69
- </Tab>
70
- <Tab value="Without Sidebar">
71
- ```tsx title="/app/assistant.tsx"
72
- import { Thread } from "@/components/assistant-ui/thread";
73
- import { ThreadList } from "@/components/assistant-ui/thread-list";
74
-
75
- export default function Assistant() {
76
- return (
77
- <div className="grid h-full grid-cols-[200px_1fr]">
78
- <ThreadList />
79
- <Thread />
80
- </div>
81
- );
82
- }
83
- ```
84
- </Tab>
85
- </Tabs>
86
-
87
- </Step>
88
- </Steps>
89
-
90
-
@@ -1,63 +0,0 @@
1
- ---
2
- title: ToolFallback
3
- ---
4
-
5
- import { Steps, Step } from "fumadocs-ui/components/steps";
6
- import { InstallCommand } from "@/components/docs/install-command";
7
-
8
- ## Overview
9
-
10
- The ToolFallback component displays a default ToolUI for tools that do not have a dedicated ToolUI.
11
-
12
- ## Getting Started
13
-
14
- <Steps>
15
- <Step>
16
-
17
- ### Add `tool-fallback`
18
-
19
- <InstallCommand shadcn={["tool-fallback"]} />
20
-
21
- This adds a `/components/assistant-ui/tool-fallback.tsx` file to your project, which you can adjust as needed.
22
-
23
- </Step>
24
- <Step>
25
-
26
- ### Use it in your application
27
-
28
- Pass the `ToolFallback` component to the `MessagePrimitive.Parts` component
29
-
30
- ```tsx twoslash title="/components/assistant-ui/thread.tsx" {1,11}
31
- // @filename: /components/assistant-ui/tool-fallback.tsx
32
- import { FC } from "react";
33
- export const ToolFallback: FC = () => null;
34
-
35
- // @filename: ./thread.tsx
36
- import { FC } from "react";
37
- import { MessagePrimitive } from "@assistant-ui/react";
38
- import { Avatar, AvatarFallback } from "@/components/ui/avatar";
39
-
40
- const AssistantActionBar: FC = () => null;
41
- const BranchPicker: FC<{ className?: string }> = () => null;
42
-
43
- // ---cut---
44
- import { ToolFallback } from "@/components/assistant-ui/tool-fallback";
45
-
46
- const AssistantMessage: FC = () => {
47
- return (
48
- <MessagePrimitive.Root className="...">
49
- <div className="...">
50
- <MessagePrimitive.Parts
51
- components={{ tools: { Fallback: ToolFallback } }}
52
- />
53
- </div>
54
- <AssistantActionBar />
55
-
56
- <BranchPicker className="..." />
57
- </MessagePrimitive.Root>
58
- );
59
- };
60
- ```
61
-
62
- </Step>
63
- </Steps>
@@ -1,96 +0,0 @@
1
- ---
2
- title: ToolGroup
3
- ---
4
-
5
- import { Steps, Step } from "fumadocs-ui/components/steps";
6
-
7
- ## Overview
8
-
9
- The ToolGroup component wraps consecutive tool-call message parts, enabling you to create custom presentations for grouped tool calls such as collapsible sections and custom styling.
10
-
11
- ### Use it in your application
12
-
13
- Pass the `ToolGroup` component to the `MessagePrimitive.Parts` component
14
-
15
- ```tsx twoslash title="/components/assistant-ui/thread.tsx"
16
- import { FC, PropsWithChildren } from "react";
17
- import { MessagePrimitive } from "@assistant-ui/react";
18
-
19
- const AssistantActionBar: FC = () => null;
20
- const BranchPicker: FC<{ className?: string }> = () => null;
21
-
22
- // ---cut---
23
- const ToolGroup: FC<
24
- PropsWithChildren<{ startIndex: number; endIndex: number }>
25
- > = ({ startIndex, endIndex, children }) => {
26
- const toolCount = endIndex - startIndex + 1;
27
-
28
- return (
29
- <details className="my-2">
30
- <summary className="cursor-pointer font-medium">
31
- {toolCount} tool {toolCount === 1 ? "call" : "calls"}
32
- </summary>
33
- <div className="space-y-2 pl-4">{children}</div>
34
- </details>
35
- );
36
- };
37
-
38
- const AssistantMessage: FC = () => {
39
- return (
40
- <MessagePrimitive.Root className="...">
41
- <div className="...">
42
- <MessagePrimitive.Parts components={{ ToolGroup }} />
43
- </div>
44
- <AssistantActionBar />
45
-
46
- <BranchPicker className="..." />
47
- </MessagePrimitive.Root>
48
- );
49
- };
50
- ```
51
-
52
- ## Props
53
-
54
- The ToolGroup component receives the following props:
55
-
56
- - `startIndex`: The index of the first tool call in the group
57
- - `endIndex`: The index of the last tool call in the group
58
- - `children`: The rendered tool call components
59
-
60
- ## Examples
61
-
62
- ### Collapsible Tool Group
63
-
64
- ```tsx
65
- const ToolGroup: FC<
66
- PropsWithChildren<{ startIndex: number; endIndex: number }>
67
- > = ({ startIndex, endIndex, children }) => {
68
- const toolCount = endIndex - startIndex + 1;
69
-
70
- return (
71
- <details className="my-2">
72
- <summary className="cursor-pointer font-medium">
73
- {toolCount} tool {toolCount === 1 ? "call" : "calls"}
74
- </summary>
75
- <div className="space-y-2 pl-4">{children}</div>
76
- </details>
77
- );
78
- };
79
- ```
80
-
81
- ### Styled Tool Group with Header
82
-
83
- ```tsx
84
- const ToolGroup: FC<
85
- PropsWithChildren<{ startIndex: number; endIndex: number }>
86
- > = ({ startIndex, endIndex, children }) => {
87
- return (
88
- <div className="bg-muted/50 my-2 rounded-lg border p-4">
89
- <div className="text-muted-foreground mb-2 text-sm">
90
- Tool execution #{startIndex + 1}-{endIndex + 1}
91
- </div>
92
- <div className="space-y-2">{children}</div>
93
- </div>
94
- );
95
- };
96
- ```
@@ -1,38 +0,0 @@
1
- import { fileURLToPath } from 'url';
2
- import { dirname, join } from 'path';
3
-
4
- // src/constants.ts
5
- var __dirname$1 = dirname(fileURLToPath(import.meta.url));
6
- var ROOT_DIR = join(__dirname$1, "../../../");
7
- var PACKAGE_DIR = join(__dirname$1, "../");
8
- var EXAMPLES_PATH = join(ROOT_DIR, "examples");
9
- var DOCS_BASE = join(PACKAGE_DIR, ".docs");
10
- var DOCS_PATH = join(DOCS_BASE, "raw/docs");
11
- join(DOCS_BASE, "raw/blog");
12
- var CODE_EXAMPLES_PATH = join(DOCS_BASE, "organized/code-examples");
13
- var MDX_EXTENSION = ".mdx";
14
- var MD_EXTENSION = ".md";
15
- var MAX_FILE_SIZE = 10 * 1024 * 1024;
16
- var IS_PREPARE_MODE = process.env.PREPARE === "true";
17
-
18
- // src/utils/logger.ts
19
- var logger = {
20
- debug: (message, ...args) => {
21
- if (process.env.DEBUG) {
22
- console.debug(`[DEBUG] ${message}`, ...args);
23
- }
24
- },
25
- info: (message, ...args) => {
26
- if (process.env.PREPARE === "true") {
27
- console.log(`[INFO] ${message}`, ...args);
28
- }
29
- },
30
- error: (message, ...args) => {
31
- console.error(`[ERROR] ${message}`, ...args);
32
- },
33
- warn: (message, ...args) => {
34
- console.warn(`[WARN] ${message}`, ...args);
35
- }
36
- };
37
-
38
- export { CODE_EXAMPLES_PATH, DOCS_PATH, EXAMPLES_PATH, IS_PREPARE_MODE, MAX_FILE_SIZE, MDX_EXTENSION, MD_EXTENSION, ROOT_DIR, logger };