@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.
- package/.docs/organized/code-examples/with-ag-ui.md +518 -234
- package/.docs/organized/code-examples/{with-ai-sdk-v5.md → with-ai-sdk-v6.md} +476 -189
- package/.docs/organized/code-examples/with-assistant-transport.md +503 -301
- package/.docs/organized/code-examples/with-cloud.md +524 -226
- package/.docs/organized/code-examples/with-custom-thread-list.md +433 -146
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +2241 -0
- package/.docs/organized/code-examples/with-external-store.md +517 -231
- package/.docs/organized/code-examples/with-ffmpeg.md +500 -220
- package/.docs/organized/code-examples/with-langgraph.md +630 -319
- package/.docs/organized/code-examples/with-parent-id-grouping.md +517 -231
- package/.docs/organized/code-examples/with-react-hook-form.md +517 -233
- package/.docs/organized/code-examples/with-react-router.md +2167 -0
- package/.docs/organized/code-examples/{store-example.md → with-store.md} +18 -22
- package/.docs/organized/code-examples/with-tanstack.md +23 -41
- package/.docs/raw/blog/2025-01-31-changelog/index.mdx +0 -2
- package/.docs/raw/docs/{about-assistantui.mdx → (docs)/about-assistantui.mdx} +2 -1
- package/.docs/raw/docs/{architecture.mdx → (docs)/architecture.mdx} +3 -2
- package/.docs/raw/docs/{cli.mdx → (docs)/cli.mdx} +1 -19
- package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-readable.mdx +1 -0
- package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-tool-ui.mdx +2 -1
- package/.docs/raw/docs/{copilots → (docs)/copilots}/make-assistant-tool.mdx +2 -1
- package/.docs/raw/docs/{copilots → (docs)/copilots}/model-context.mdx +1 -0
- package/.docs/raw/docs/{copilots → (docs)/copilots}/motivation.mdx +1 -0
- package/.docs/raw/docs/{copilots → (docs)/copilots}/use-assistant-instructions.mdx +1 -0
- package/.docs/raw/docs/{devtools.mdx → (docs)/devtools.mdx} +4 -4
- package/.docs/raw/docs/{guides/Attachments.mdx → (docs)/guides/attachments.mdx} +4 -5
- package/.docs/raw/docs/{guides/Branching.mdx → (docs)/guides/branching.mdx} +2 -1
- package/.docs/raw/docs/{guides → (docs)/guides}/context-api.mdx +1 -0
- package/.docs/raw/docs/(docs)/guides/dictation.mdx +370 -0
- package/.docs/raw/docs/{guides/Editing.mdx → (docs)/guides/editing.mdx} +1 -0
- package/.docs/raw/docs/{guides/Latex.mdx → (docs)/guides/latex.mdx} +1 -2
- package/.docs/raw/docs/{guides/Speech.mdx → (docs)/guides/speech.mdx} +9 -10
- package/.docs/raw/docs/{guides/ToolUI.mdx → (docs)/guides/tool-ui.mdx} +15 -14
- package/.docs/raw/docs/{guides/Tools.mdx → (docs)/guides/tools.mdx} +10 -7
- package/.docs/raw/docs/{getting-started.mdx → (docs)/index.mdx} +17 -22
- package/.docs/raw/docs/{mcp-docs-server.mdx → (docs)/mcp-docs-server.mdx} +1 -2
- package/.docs/raw/docs/{api-reference/context-providers/AssistantRuntimeProvider.mdx → (reference)/api-reference/context-providers/assistant-runtime-provider.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/context-providers/TextMessagePartProvider.mdx → (reference)/api-reference/context-providers/text-message-part-provider.mdx} +2 -1
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/react-data-stream.mdx +2 -1
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/react-hook-form.mdx +2 -1
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/integrations/vercel-ai-sdk.mdx +2 -2
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/overview.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +327 -0
- package/.docs/raw/docs/{api-reference/primitives/ActionBar.mdx → (reference)/api-reference/primitives/action-bar.mdx} +3 -1
- package/.docs/raw/docs/{api-reference/primitives/AssistantIf.mdx → (reference)/api-reference/primitives/assistant-if.mdx} +2 -2
- package/.docs/raw/docs/{api-reference/primitives/AssistantModal.mdx → (reference)/api-reference/primitives/assistant-modal.mdx} +3 -1
- package/.docs/raw/docs/{api-reference/primitives/Attachment.mdx → (reference)/api-reference/primitives/attachment.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/primitives/BranchPicker.mdx → (reference)/api-reference/primitives/branch-picker.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/Composer.mdx → (reference)/api-reference/primitives/composer.mdx} +101 -2
- package/.docs/raw/docs/{api-reference → (reference)/api-reference}/primitives/composition.mdx +1 -0
- package/.docs/raw/docs/{api-reference/primitives/Error.mdx → (reference)/api-reference/primitives/error.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/MessagePart.mdx → (reference)/api-reference/primitives/message-part.mdx} +2 -2
- package/.docs/raw/docs/{api-reference/primitives/Message.mdx → (reference)/api-reference/primitives/message.mdx} +2 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +221 -0
- package/.docs/raw/docs/{api-reference/primitives/ThreadListItem.mdx → (reference)/api-reference/primitives/thread-list-item.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/ThreadList.mdx → (reference)/api-reference/primitives/thread-list.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/primitives/Thread.mdx → (reference)/api-reference/primitives/thread.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/AssistantRuntime.mdx → (reference)/api-reference/runtimes/assistant-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/AttachmentRuntime.mdx → (reference)/api-reference/runtimes/attachment-runtime.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/runtimes/ComposerRuntime.mdx → (reference)/api-reference/runtimes/composer-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/MessagePartRuntime.mdx → (reference)/api-reference/runtimes/message-part-runtime.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/runtimes/MessageRuntime.mdx → (reference)/api-reference/runtimes/message-runtime.mdx} +3 -2
- package/.docs/raw/docs/{api-reference/runtimes/ThreadListItemRuntime.mdx → (reference)/api-reference/runtimes/thread-list-item-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/ThreadListRuntime.mdx → (reference)/api-reference/runtimes/thread-list-runtime.mdx} +2 -1
- package/.docs/raw/docs/{api-reference/runtimes/ThreadRuntime.mdx → (reference)/api-reference/runtimes/thread-runtime.mdx} +3 -5
- package/.docs/raw/docs/{legacy/styled/AssistantModal.mdx → (reference)/legacy/styled/assistant-modal.mdx} +2 -3
- package/.docs/raw/docs/{legacy/styled/Decomposition.mdx → (reference)/legacy/styled/decomposition.mdx} +1 -0
- package/.docs/raw/docs/{legacy/styled/Markdown.mdx → (reference)/legacy/styled/markdown.mdx} +2 -4
- package/.docs/raw/docs/{legacy/styled/Scrollbar.mdx → (reference)/legacy/styled/scrollbar.mdx} +2 -1
- package/.docs/raw/docs/{legacy/styled/ThreadWidth.mdx → (reference)/legacy/styled/thread-width.mdx} +1 -0
- package/.docs/raw/docs/{legacy/styled/Thread.mdx → (reference)/legacy/styled/thread.mdx} +2 -3
- package/.docs/raw/docs/{migrations → (reference)/migrations}/deprecation-policy.mdx +1 -0
- package/.docs/raw/docs/{migrations → (reference)/migrations}/react-langgraph-v0-7.mdx +1 -2
- package/.docs/raw/docs/{migrations → (reference)/migrations}/v0-11.mdx +1 -0
- package/.docs/raw/docs/{migrations → (reference)/migrations}/v0-12.mdx +1 -0
- package/.docs/raw/docs/{react-compatibility.mdx → (reference)/react-compatibility.mdx} +2 -3
- package/.docs/raw/docs/cloud/authorization.mdx +1 -0
- package/.docs/raw/docs/cloud/overview.mdx +1 -0
- package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +2 -3
- package/.docs/raw/docs/cloud/persistence/langgraph.mdx +5 -7
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +9 -8
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +2 -3
- package/.docs/raw/docs/runtimes/assistant-transport.mdx +7 -6
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +38 -3
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +6 -8
- package/.docs/raw/docs/runtimes/custom/local.mdx +43 -16
- package/.docs/raw/docs/runtimes/data-stream.mdx +32 -4
- package/.docs/raw/docs/runtimes/helicone.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +3 -3
- package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -0
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +2 -1
- package/.docs/raw/docs/runtimes/langserve.mdx +2 -2
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +4 -5
- package/.docs/raw/docs/runtimes/mastra/overview.mdx +1 -0
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +3 -4
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +2 -4
- package/.docs/raw/docs/ui/assistant-modal.mdx +163 -0
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +90 -0
- package/.docs/raw/docs/ui/attachment.mdx +227 -0
- package/.docs/raw/docs/ui/{Markdown.mdx → markdown.mdx} +11 -6
- package/.docs/raw/docs/ui/{Mermaid.mdx → mermaid.mdx} +12 -5
- package/.docs/raw/docs/ui/{PartGrouping.mdx → part-grouping.mdx} +4 -6
- package/.docs/raw/docs/ui/reasoning.mdx +148 -0
- package/.docs/raw/docs/ui/{Scrollbar.mdx → scrollbar.mdx} +9 -7
- package/.docs/raw/docs/ui/sources.mdx +87 -0
- package/.docs/raw/docs/ui/{SyntaxHighlighting.mdx → syntax-highlighting.mdx} +9 -5
- package/.docs/raw/docs/ui/thread-list.mdx +275 -0
- package/.docs/raw/docs/ui/{Thread.mdx → thread.mdx} +5 -6
- package/.docs/raw/docs/ui/tool-fallback.mdx +112 -0
- package/.docs/raw/docs/ui/tool-group.mdx +214 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +14 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -1
- package/dist/index.js.map +1 -0
- package/dist/prepare-docs/code-examples.d.ts +2 -0
- package/dist/prepare-docs/code-examples.d.ts.map +1 -0
- package/dist/prepare-docs/code-examples.js +129 -0
- package/dist/prepare-docs/code-examples.js.map +1 -0
- package/dist/prepare-docs/copy-raw.d.ts +2 -0
- package/dist/prepare-docs/copy-raw.d.ts.map +1 -0
- package/dist/prepare-docs/copy-raw.js +50 -0
- package/dist/prepare-docs/copy-raw.js.map +1 -0
- package/dist/prepare-docs/prepare.d.ts +2 -0
- package/dist/prepare-docs/prepare.d.ts.map +1 -0
- package/dist/prepare-docs/prepare.js +18 -195
- package/dist/prepare-docs/prepare.js.map +1 -0
- package/dist/stdio.d.ts +3 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +4 -5
- package/dist/stdio.js.map +1 -0
- package/dist/tools/docs.d.ts +23 -0
- package/dist/tools/docs.d.ts.map +1 -0
- package/dist/tools/docs.js +168 -0
- package/dist/tools/docs.js.map +1 -0
- package/dist/tools/examples.d.ts +23 -0
- package/dist/tools/examples.d.ts.map +1 -0
- package/dist/tools/examples.js +95 -0
- package/dist/tools/examples.js.map +1 -0
- package/dist/tools/tests/test-setup.d.ts +4 -0
- package/dist/tools/tests/test-setup.d.ts.map +1 -0
- package/dist/tools/tests/test-setup.js +36 -0
- package/dist/tools/tests/test-setup.js.map +1 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +20 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/mcp-format.d.ts +7 -0
- package/dist/utils/mcp-format.d.ts.map +1 -0
- package/dist/utils/mcp-format.js +11 -0
- package/dist/utils/mcp-format.js.map +1 -0
- package/dist/utils/mdx.d.ts +9 -0
- package/dist/utils/mdx.d.ts.map +1 -0
- package/dist/utils/mdx.js +27 -0
- package/dist/utils/mdx.js.map +1 -0
- package/dist/utils/paths.d.ts +8 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +84 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/security.d.ts +2 -0
- package/dist/utils/security.d.ts.map +1 -0
- package/dist/utils/security.js +43 -0
- package/dist/utils/security.js.map +1 -0
- package/package.json +37 -19
- package/src/constants.ts +22 -0
- package/src/index.ts +51 -0
- package/src/prepare-docs/code-examples.ts +158 -0
- package/src/prepare-docs/copy-raw.ts +55 -0
- package/src/prepare-docs/prepare.ts +24 -0
- package/src/stdio.ts +7 -0
- package/src/tools/docs.ts +207 -0
- package/src/tools/examples.ts +107 -0
- package/src/tools/tests/docs.test.ts +124 -0
- package/src/tools/tests/examples.test.ts +94 -0
- package/src/tools/tests/integration.test.ts +46 -0
- package/src/tools/tests/json-parsing.test.ts +23 -0
- package/src/tools/tests/mcp-protocol.test.ts +133 -0
- package/src/tools/tests/path-traversal.test.ts +81 -0
- package/src/tools/tests/test-setup.ts +40 -0
- package/src/utils/logger.ts +20 -0
- package/src/utils/mcp-format.ts +12 -0
- package/src/utils/mdx.ts +39 -0
- package/src/utils/paths.ts +114 -0
- package/src/utils/security.ts +52 -0
- package/src/utils/tests/security.test.ts +119 -0
- package/.docs/raw/docs/index.mdx +0 -7
- package/.docs/raw/docs/ui/AssistantModal.mdx +0 -45
- package/.docs/raw/docs/ui/AssistantSidebar.mdx +0 -41
- package/.docs/raw/docs/ui/Attachment.mdx +0 -84
- package/.docs/raw/docs/ui/Reasoning.mdx +0 -152
- package/.docs/raw/docs/ui/ThreadList.mdx +0 -90
- package/.docs/raw/docs/ui/ToolFallback.mdx +0 -63
- package/.docs/raw/docs/ui/ToolGroup.mdx +0 -96
- package/dist/chunk-M2RKUM66.js +0 -38
- package/dist/chunk-NVNFQ5ZO.js +0 -423
- /package/.docs/raw/docs/{copilots → (docs)/copilots}/assistant-frame.mdx +0 -0
|
@@ -9,43 +9,41 @@
|
|
|
9
9
|
@custom-variant dark (&:is(.dark *));
|
|
10
10
|
|
|
11
11
|
@theme inline {
|
|
12
|
-
--color-background: var(--background);
|
|
13
|
-
--color-foreground: var(--foreground);
|
|
14
|
-
--font-sans: var(--font-geist-sans);
|
|
15
|
-
--font-mono: var(--font-geist-mono);
|
|
16
|
-
--color-sidebar-ring: var(--sidebar-ring);
|
|
17
|
-
--color-sidebar-border: var(--sidebar-border);
|
|
18
|
-
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
19
|
-
--color-sidebar-accent: var(--sidebar-accent);
|
|
20
|
-
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
21
|
-
--color-sidebar-primary: var(--sidebar-primary);
|
|
22
|
-
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
23
|
-
--color-sidebar: var(--sidebar);
|
|
24
|
-
--color-chart-5: var(--chart-5);
|
|
25
|
-
--color-chart-4: var(--chart-4);
|
|
26
|
-
--color-chart-3: var(--chart-3);
|
|
27
|
-
--color-chart-2: var(--chart-2);
|
|
28
|
-
--color-chart-1: var(--chart-1);
|
|
29
|
-
--color-ring: var(--ring);
|
|
30
|
-
--color-input: var(--input);
|
|
31
|
-
--color-border: var(--border);
|
|
32
|
-
--color-destructive: var(--destructive);
|
|
33
|
-
--color-accent-foreground: var(--accent-foreground);
|
|
34
|
-
--color-accent: var(--accent);
|
|
35
|
-
--color-muted-foreground: var(--muted-foreground);
|
|
36
|
-
--color-muted: var(--muted);
|
|
37
|
-
--color-secondary-foreground: var(--secondary-foreground);
|
|
38
|
-
--color-secondary: var(--secondary);
|
|
39
|
-
--color-primary-foreground: var(--primary-foreground);
|
|
40
|
-
--color-primary: var(--primary);
|
|
41
|
-
--color-popover-foreground: var(--popover-foreground);
|
|
42
|
-
--color-popover: var(--popover);
|
|
43
|
-
--color-card-foreground: var(--card-foreground);
|
|
44
|
-
--color-card: var(--card);
|
|
45
12
|
--radius-sm: calc(var(--radius) - 4px);
|
|
46
13
|
--radius-md: calc(var(--radius) - 2px);
|
|
47
14
|
--radius-lg: var(--radius);
|
|
48
15
|
--radius-xl: calc(var(--radius) + 4px);
|
|
16
|
+
--color-background: var(--background);
|
|
17
|
+
--color-foreground: var(--foreground);
|
|
18
|
+
--color-card: var(--card);
|
|
19
|
+
--color-card-foreground: var(--card-foreground);
|
|
20
|
+
--color-popover: var(--popover);
|
|
21
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
22
|
+
--color-primary: var(--primary);
|
|
23
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
24
|
+
--color-secondary: var(--secondary);
|
|
25
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
26
|
+
--color-muted: var(--muted);
|
|
27
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
28
|
+
--color-accent: var(--accent);
|
|
29
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
30
|
+
--color-destructive: var(--destructive);
|
|
31
|
+
--color-border: var(--border);
|
|
32
|
+
--color-input: var(--input);
|
|
33
|
+
--color-ring: var(--ring);
|
|
34
|
+
--color-chart-1: var(--chart-1);
|
|
35
|
+
--color-chart-2: var(--chart-2);
|
|
36
|
+
--color-chart-3: var(--chart-3);
|
|
37
|
+
--color-chart-4: var(--chart-4);
|
|
38
|
+
--color-chart-5: var(--chart-5);
|
|
39
|
+
--color-sidebar: var(--sidebar);
|
|
40
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
41
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
42
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
43
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
44
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
45
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
46
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
49
47
|
}
|
|
50
48
|
|
|
51
49
|
:root {
|
|
@@ -518,7 +516,7 @@ export const ComposerAddAttachment: FC = () => {
|
|
|
518
516
|
side="bottom"
|
|
519
517
|
variant="ghost"
|
|
520
518
|
size="icon"
|
|
521
|
-
className="aui-composer-add-attachment size-
|
|
519
|
+
className="aui-composer-add-attachment size-8.5 rounded-full p-1 font-semibold text-xs hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30"
|
|
522
520
|
aria-label="Add Attachment"
|
|
523
521
|
>
|
|
524
522
|
<PlusIcon className="aui-attachment-add-icon size-5 stroke-[1.5px]" />
|
|
@@ -777,6 +775,7 @@ import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button
|
|
|
777
775
|
import { Button } from "@/components/ui/button";
|
|
778
776
|
import { cn } from "@/lib/utils";
|
|
779
777
|
import {
|
|
778
|
+
ActionBarMorePrimitive,
|
|
780
779
|
ActionBarPrimitive,
|
|
781
780
|
AssistantIf,
|
|
782
781
|
BranchPickerPrimitive,
|
|
@@ -793,6 +792,7 @@ import {
|
|
|
793
792
|
ChevronRightIcon,
|
|
794
793
|
CopyIcon,
|
|
795
794
|
DownloadIcon,
|
|
795
|
+
MoreHorizontalIcon,
|
|
796
796
|
PencilIcon,
|
|
797
797
|
RefreshCwIcon,
|
|
798
798
|
SquareIcon,
|
|
@@ -838,7 +838,7 @@ const ThreadScrollToBottom: FC = () => {
|
|
|
838
838
|
<TooltipIconButton
|
|
839
839
|
tooltip="Scroll to bottom"
|
|
840
840
|
variant="outline"
|
|
841
|
-
className="aui-thread-scroll-to-bottom -top-12
|
|
841
|
+
className="aui-thread-scroll-to-bottom absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible dark:bg-background dark:hover:bg-accent"
|
|
842
842
|
>
|
|
843
843
|
<ArrowDownIcon />
|
|
844
844
|
</TooltipIconButton>
|
|
@@ -1002,7 +1002,7 @@ const AssistantActionBar: FC = () => {
|
|
|
1002
1002
|
hideWhenRunning
|
|
1003
1003
|
autohide="not-last"
|
|
1004
1004
|
autohideFloat="single-branch"
|
|
1005
|
-
className="aui-assistant-action-bar-root
|
|
1005
|
+
className="aui-assistant-action-bar-root col-start-3 row-start-2 -ml-1 flex gap-1 text-muted-foreground data-floating:absolute data-floating:rounded-md data-floating:border data-floating:bg-background data-floating:p-1 data-floating:shadow-sm"
|
|
1006
1006
|
>
|
|
1007
1007
|
<ActionBarPrimitive.Copy asChild>
|
|
1008
1008
|
<TooltipIconButton tooltip="Copy">
|
|
@@ -1014,16 +1014,33 @@ const AssistantActionBar: FC = () => {
|
|
|
1014
1014
|
</AssistantIf>
|
|
1015
1015
|
</TooltipIconButton>
|
|
1016
1016
|
</ActionBarPrimitive.Copy>
|
|
1017
|
-
<ActionBarPrimitive.ExportMarkdown asChild>
|
|
1018
|
-
<TooltipIconButton tooltip="Export as Markdown">
|
|
1019
|
-
<DownloadIcon />
|
|
1020
|
-
</TooltipIconButton>
|
|
1021
|
-
</ActionBarPrimitive.ExportMarkdown>
|
|
1022
1017
|
<ActionBarPrimitive.Reload asChild>
|
|
1023
1018
|
<TooltipIconButton tooltip="Refresh">
|
|
1024
1019
|
<RefreshCwIcon />
|
|
1025
1020
|
</TooltipIconButton>
|
|
1026
1021
|
</ActionBarPrimitive.Reload>
|
|
1022
|
+
<ActionBarMorePrimitive.Root>
|
|
1023
|
+
<ActionBarMorePrimitive.Trigger asChild>
|
|
1024
|
+
<TooltipIconButton
|
|
1025
|
+
tooltip="More"
|
|
1026
|
+
className="data-[state=open]:bg-accent"
|
|
1027
|
+
>
|
|
1028
|
+
<MoreHorizontalIcon />
|
|
1029
|
+
</TooltipIconButton>
|
|
1030
|
+
</ActionBarMorePrimitive.Trigger>
|
|
1031
|
+
<ActionBarMorePrimitive.Content
|
|
1032
|
+
side="bottom"
|
|
1033
|
+
align="start"
|
|
1034
|
+
className="aui-action-bar-more-content z-50 min-w-32 overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md"
|
|
1035
|
+
>
|
|
1036
|
+
<ActionBarPrimitive.ExportMarkdown asChild>
|
|
1037
|
+
<ActionBarMorePrimitive.Item className="aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground">
|
|
1038
|
+
<DownloadIcon className="size-4" />
|
|
1039
|
+
Export as Markdown
|
|
1040
|
+
</ActionBarMorePrimitive.Item>
|
|
1041
|
+
</ActionBarPrimitive.ExportMarkdown>
|
|
1042
|
+
</ActionBarMorePrimitive.Content>
|
|
1043
|
+
</ActionBarMorePrimitive.Root>
|
|
1027
1044
|
</ActionBarPrimitive.Root>
|
|
1028
1045
|
);
|
|
1029
1046
|
};
|
|
@@ -1040,12 +1057,12 @@ const UserMessage: FC = () => {
|
|
|
1040
1057
|
<div className="aui-user-message-content wrap-break-word rounded-2xl bg-muted px-4 py-2.5 text-foreground">
|
|
1041
1058
|
<MessagePrimitive.Parts />
|
|
1042
1059
|
</div>
|
|
1043
|
-
<div className="aui-user-action-bar-wrapper -translate-x-full -translate-y-1/2
|
|
1060
|
+
<div className="aui-user-action-bar-wrapper absolute top-1/2 left-0 -translate-x-full -translate-y-1/2 pr-2">
|
|
1044
1061
|
<UserActionBar />
|
|
1045
1062
|
</div>
|
|
1046
1063
|
</div>
|
|
1047
1064
|
|
|
1048
|
-
<BranchPicker className="aui-user-branch-picker
|
|
1065
|
+
<BranchPicker className="aui-user-branch-picker col-span-full col-start-1 row-start-3 -mr-1 justify-end" />
|
|
1049
1066
|
</MessagePrimitive.Root>
|
|
1050
1067
|
);
|
|
1051
1068
|
};
|
|
@@ -1097,7 +1114,7 @@ const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({
|
|
|
1097
1114
|
<BranchPickerPrimitive.Root
|
|
1098
1115
|
hideWhenSingleBranch
|
|
1099
1116
|
className={cn(
|
|
1100
|
-
"aui-branch-picker-root -
|
|
1117
|
+
"aui-branch-picker-root mr-2 -ml-2 inline-flex items-center text-muted-foreground text-xs",
|
|
1101
1118
|
className,
|
|
1102
1119
|
)}
|
|
1103
1120
|
{...rest}
|
|
@@ -1124,98 +1141,329 @@ const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({
|
|
|
1124
1141
|
## components/assistant-ui/tool-fallback.tsx
|
|
1125
1142
|
|
|
1126
1143
|
```tsx
|
|
1127
|
-
|
|
1144
|
+
"use client";
|
|
1145
|
+
|
|
1146
|
+
import { memo, useCallback, useRef, useState } from "react";
|
|
1128
1147
|
import {
|
|
1148
|
+
AlertCircleIcon,
|
|
1129
1149
|
CheckIcon,
|
|
1130
1150
|
ChevronDownIcon,
|
|
1131
|
-
|
|
1151
|
+
LoaderIcon,
|
|
1132
1152
|
XCircleIcon,
|
|
1133
1153
|
} from "lucide-react";
|
|
1134
|
-
import {
|
|
1135
|
-
|
|
1154
|
+
import {
|
|
1155
|
+
useScrollLock,
|
|
1156
|
+
type ToolCallMessagePartStatus,
|
|
1157
|
+
type ToolCallMessagePartComponent,
|
|
1158
|
+
} from "@assistant-ui/react";
|
|
1159
|
+
import {
|
|
1160
|
+
Collapsible,
|
|
1161
|
+
CollapsibleContent,
|
|
1162
|
+
CollapsibleTrigger,
|
|
1163
|
+
} from "@/components/ui/collapsible";
|
|
1136
1164
|
import { cn } from "@/lib/utils";
|
|
1137
1165
|
|
|
1138
|
-
|
|
1166
|
+
const ANIMATION_DURATION = 200;
|
|
1167
|
+
|
|
1168
|
+
export type ToolFallbackRootProps = Omit<
|
|
1169
|
+
React.ComponentProps<typeof Collapsible>,
|
|
1170
|
+
"open" | "onOpenChange"
|
|
1171
|
+
> & {
|
|
1172
|
+
open?: boolean;
|
|
1173
|
+
onOpenChange?: (open: boolean) => void;
|
|
1174
|
+
defaultOpen?: boolean;
|
|
1175
|
+
};
|
|
1176
|
+
|
|
1177
|
+
function ToolFallbackRoot({
|
|
1178
|
+
className,
|
|
1179
|
+
open: controlledOpen,
|
|
1180
|
+
onOpenChange: controlledOnOpenChange,
|
|
1181
|
+
defaultOpen = false,
|
|
1182
|
+
children,
|
|
1183
|
+
...props
|
|
1184
|
+
}: ToolFallbackRootProps) {
|
|
1185
|
+
const collapsibleRef = useRef<HTMLDivElement>(null);
|
|
1186
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
1187
|
+
const lockScroll = useScrollLock(collapsibleRef, ANIMATION_DURATION);
|
|
1188
|
+
|
|
1189
|
+
const isControlled = controlledOpen !== undefined;
|
|
1190
|
+
const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
|
|
1191
|
+
|
|
1192
|
+
const handleOpenChange = useCallback(
|
|
1193
|
+
(open: boolean) => {
|
|
1194
|
+
if (!open) {
|
|
1195
|
+
lockScroll();
|
|
1196
|
+
}
|
|
1197
|
+
if (!isControlled) {
|
|
1198
|
+
setUncontrolledOpen(open);
|
|
1199
|
+
}
|
|
1200
|
+
controlledOnOpenChange?.(open);
|
|
1201
|
+
},
|
|
1202
|
+
[lockScroll, isControlled, controlledOnOpenChange],
|
|
1203
|
+
);
|
|
1204
|
+
|
|
1205
|
+
return (
|
|
1206
|
+
<Collapsible
|
|
1207
|
+
ref={collapsibleRef}
|
|
1208
|
+
data-slot="tool-fallback-root"
|
|
1209
|
+
open={isOpen}
|
|
1210
|
+
onOpenChange={handleOpenChange}
|
|
1211
|
+
className={cn(
|
|
1212
|
+
"aui-tool-fallback-root group/tool-fallback-root w-full rounded-lg border py-3",
|
|
1213
|
+
className,
|
|
1214
|
+
)}
|
|
1215
|
+
style={
|
|
1216
|
+
{
|
|
1217
|
+
"--animation-duration": `${ANIMATION_DURATION}ms`,
|
|
1218
|
+
} as React.CSSProperties
|
|
1219
|
+
}
|
|
1220
|
+
{...props}
|
|
1221
|
+
>
|
|
1222
|
+
{children}
|
|
1223
|
+
</Collapsible>
|
|
1224
|
+
);
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
type ToolStatus = ToolCallMessagePartStatus["type"];
|
|
1228
|
+
|
|
1229
|
+
const statusIconMap: Record<ToolStatus, React.ElementType> = {
|
|
1230
|
+
running: LoaderIcon,
|
|
1231
|
+
complete: CheckIcon,
|
|
1232
|
+
incomplete: XCircleIcon,
|
|
1233
|
+
"requires-action": AlertCircleIcon,
|
|
1234
|
+
};
|
|
1235
|
+
|
|
1236
|
+
function ToolFallbackTrigger({
|
|
1139
1237
|
toolName,
|
|
1140
|
-
argsText,
|
|
1141
|
-
result,
|
|
1142
1238
|
status,
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1239
|
+
className,
|
|
1240
|
+
...props
|
|
1241
|
+
}: React.ComponentProps<typeof CollapsibleTrigger> & {
|
|
1242
|
+
toolName: string;
|
|
1243
|
+
status?: ToolCallMessagePartStatus;
|
|
1244
|
+
}) {
|
|
1245
|
+
const statusType = status?.type ?? "complete";
|
|
1246
|
+
const isRunning = statusType === "running";
|
|
1146
1247
|
const isCancelled =
|
|
1147
1248
|
status?.type === "incomplete" && status.reason === "cancelled";
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
? status.error
|
|
1152
|
-
: JSON.stringify(status.error)
|
|
1153
|
-
: null;
|
|
1249
|
+
|
|
1250
|
+
const Icon = statusIconMap[statusType];
|
|
1251
|
+
const label = isCancelled ? "Cancelled tool" : "Used tool";
|
|
1154
1252
|
|
|
1155
1253
|
return (
|
|
1156
|
-
<
|
|
1254
|
+
<CollapsibleTrigger
|
|
1255
|
+
data-slot="tool-fallback-trigger"
|
|
1157
1256
|
className={cn(
|
|
1158
|
-
"aui-tool-fallback-
|
|
1159
|
-
|
|
1257
|
+
"aui-tool-fallback-trigger group/trigger flex w-full items-center gap-2 px-4 text-sm transition-colors",
|
|
1258
|
+
className,
|
|
1160
1259
|
)}
|
|
1260
|
+
{...props}
|
|
1161
1261
|
>
|
|
1162
|
-
<
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1262
|
+
<Icon
|
|
1263
|
+
data-slot="tool-fallback-trigger-icon"
|
|
1264
|
+
className={cn(
|
|
1265
|
+
"aui-tool-fallback-trigger-icon size-4 shrink-0",
|
|
1266
|
+
isCancelled && "text-muted-foreground",
|
|
1267
|
+
isRunning && "animate-spin",
|
|
1167
1268
|
)}
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
<div className="aui-tool-fallback-cancelled-root px-4">
|
|
1185
|
-
<p className="aui-tool-fallback-cancelled-header font-semibold text-muted-foreground">
|
|
1186
|
-
Cancelled reason:
|
|
1187
|
-
</p>
|
|
1188
|
-
<p className="aui-tool-fallback-cancelled-reason text-muted-foreground">
|
|
1189
|
-
{cancelledReason}
|
|
1190
|
-
</p>
|
|
1191
|
-
</div>
|
|
1192
|
-
)}
|
|
1193
|
-
<div
|
|
1194
|
-
className={cn(
|
|
1195
|
-
"aui-tool-fallback-args-root px-4",
|
|
1196
|
-
isCancelled && "opacity-60",
|
|
1197
|
-
)}
|
|
1269
|
+
/>
|
|
1270
|
+
<span
|
|
1271
|
+
data-slot="tool-fallback-trigger-label"
|
|
1272
|
+
className={cn(
|
|
1273
|
+
"aui-tool-fallback-trigger-label-wrapper relative inline-block grow text-left leading-none",
|
|
1274
|
+
isCancelled && "text-muted-foreground line-through",
|
|
1275
|
+
)}
|
|
1276
|
+
>
|
|
1277
|
+
<span>
|
|
1278
|
+
{label}: <b>{toolName}</b>
|
|
1279
|
+
</span>
|
|
1280
|
+
{isRunning && (
|
|
1281
|
+
<span
|
|
1282
|
+
aria-hidden
|
|
1283
|
+
data-slot="tool-fallback-trigger-shimmer"
|
|
1284
|
+
className="aui-tool-fallback-trigger-shimmer shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none"
|
|
1198
1285
|
>
|
|
1199
|
-
<
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1286
|
+
{label}: <b>{toolName}</b>
|
|
1287
|
+
</span>
|
|
1288
|
+
)}
|
|
1289
|
+
</span>
|
|
1290
|
+
<ChevronDownIcon
|
|
1291
|
+
data-slot="tool-fallback-trigger-chevron"
|
|
1292
|
+
className={cn(
|
|
1293
|
+
"aui-tool-fallback-trigger-chevron size-4 shrink-0",
|
|
1294
|
+
"transition-transform duration-(--animation-duration) ease-out",
|
|
1295
|
+
"group-data-[state=closed]/trigger:-rotate-90",
|
|
1296
|
+
"group-data-[state=open]/trigger:rotate-0",
|
|
1297
|
+
)}
|
|
1298
|
+
/>
|
|
1299
|
+
</CollapsibleTrigger>
|
|
1300
|
+
);
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
function ToolFallbackContent({
|
|
1304
|
+
className,
|
|
1305
|
+
children,
|
|
1306
|
+
...props
|
|
1307
|
+
}: React.ComponentProps<typeof CollapsibleContent>) {
|
|
1308
|
+
return (
|
|
1309
|
+
<CollapsibleContent
|
|
1310
|
+
data-slot="tool-fallback-content"
|
|
1311
|
+
className={cn(
|
|
1312
|
+
"aui-tool-fallback-content relative overflow-hidden text-sm outline-none",
|
|
1313
|
+
"group/collapsible-content ease-out",
|
|
1314
|
+
"data-[state=closed]:animate-collapsible-up",
|
|
1315
|
+
"data-[state=open]:animate-collapsible-down",
|
|
1316
|
+
"data-[state=closed]:fill-mode-forwards",
|
|
1317
|
+
"data-[state=closed]:pointer-events-none",
|
|
1318
|
+
"data-[state=open]:duration-(--animation-duration)",
|
|
1319
|
+
"data-[state=closed]:duration-(--animation-duration)",
|
|
1320
|
+
className,
|
|
1321
|
+
)}
|
|
1322
|
+
{...props}
|
|
1323
|
+
>
|
|
1324
|
+
<div className="mt-3 flex flex-col gap-2 border-t pt-2">{children}</div>
|
|
1325
|
+
</CollapsibleContent>
|
|
1326
|
+
);
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
function ToolFallbackArgs({
|
|
1330
|
+
argsText,
|
|
1331
|
+
className,
|
|
1332
|
+
...props
|
|
1333
|
+
}: React.ComponentProps<"div"> & {
|
|
1334
|
+
argsText?: string;
|
|
1335
|
+
}) {
|
|
1336
|
+
if (!argsText) return null;
|
|
1337
|
+
|
|
1338
|
+
return (
|
|
1339
|
+
<div
|
|
1340
|
+
data-slot="tool-fallback-args"
|
|
1341
|
+
className={cn("aui-tool-fallback-args px-4", className)}
|
|
1342
|
+
{...props}
|
|
1343
|
+
>
|
|
1344
|
+
<pre className="aui-tool-fallback-args-value whitespace-pre-wrap">
|
|
1345
|
+
{argsText}
|
|
1346
|
+
</pre>
|
|
1347
|
+
</div>
|
|
1348
|
+
);
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
function ToolFallbackResult({
|
|
1352
|
+
result,
|
|
1353
|
+
className,
|
|
1354
|
+
...props
|
|
1355
|
+
}: React.ComponentProps<"div"> & {
|
|
1356
|
+
result?: unknown;
|
|
1357
|
+
}) {
|
|
1358
|
+
if (result === undefined) return null;
|
|
1359
|
+
|
|
1360
|
+
return (
|
|
1361
|
+
<div
|
|
1362
|
+
data-slot="tool-fallback-result"
|
|
1363
|
+
className={cn(
|
|
1364
|
+
"aui-tool-fallback-result border-t border-dashed px-4 pt-2",
|
|
1365
|
+
className,
|
|
1216
1366
|
)}
|
|
1367
|
+
{...props}
|
|
1368
|
+
>
|
|
1369
|
+
<p className="aui-tool-fallback-result-header font-semibold">Result:</p>
|
|
1370
|
+
<pre className="aui-tool-fallback-result-content whitespace-pre-wrap">
|
|
1371
|
+
{typeof result === "string" ? result : JSON.stringify(result, null, 2)}
|
|
1372
|
+
</pre>
|
|
1217
1373
|
</div>
|
|
1218
1374
|
);
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
function ToolFallbackError({
|
|
1378
|
+
status,
|
|
1379
|
+
className,
|
|
1380
|
+
...props
|
|
1381
|
+
}: React.ComponentProps<"div"> & {
|
|
1382
|
+
status?: ToolCallMessagePartStatus;
|
|
1383
|
+
}) {
|
|
1384
|
+
if (status?.type !== "incomplete") return null;
|
|
1385
|
+
|
|
1386
|
+
const error = status.error;
|
|
1387
|
+
const errorText = error
|
|
1388
|
+
? typeof error === "string"
|
|
1389
|
+
? error
|
|
1390
|
+
: JSON.stringify(error)
|
|
1391
|
+
: null;
|
|
1392
|
+
|
|
1393
|
+
if (!errorText) return null;
|
|
1394
|
+
|
|
1395
|
+
const isCancelled = status.reason === "cancelled";
|
|
1396
|
+
const headerText = isCancelled ? "Cancelled reason:" : "Error:";
|
|
1397
|
+
|
|
1398
|
+
return (
|
|
1399
|
+
<div
|
|
1400
|
+
data-slot="tool-fallback-error"
|
|
1401
|
+
className={cn("aui-tool-fallback-error px-4", className)}
|
|
1402
|
+
{...props}
|
|
1403
|
+
>
|
|
1404
|
+
<p className="aui-tool-fallback-error-header font-semibold text-muted-foreground">
|
|
1405
|
+
{headerText}
|
|
1406
|
+
</p>
|
|
1407
|
+
<p className="aui-tool-fallback-error-reason text-muted-foreground">
|
|
1408
|
+
{errorText}
|
|
1409
|
+
</p>
|
|
1410
|
+
</div>
|
|
1411
|
+
);
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
const ToolFallbackImpl: ToolCallMessagePartComponent = ({
|
|
1415
|
+
toolName,
|
|
1416
|
+
argsText,
|
|
1417
|
+
result,
|
|
1418
|
+
status,
|
|
1419
|
+
}) => {
|
|
1420
|
+
const isCancelled =
|
|
1421
|
+
status?.type === "incomplete" && status.reason === "cancelled";
|
|
1422
|
+
|
|
1423
|
+
return (
|
|
1424
|
+
<ToolFallbackRoot
|
|
1425
|
+
className={cn(isCancelled && "border-muted-foreground/30 bg-muted/30")}
|
|
1426
|
+
>
|
|
1427
|
+
<ToolFallbackTrigger toolName={toolName} status={status} />
|
|
1428
|
+
<ToolFallbackContent>
|
|
1429
|
+
<ToolFallbackError status={status} />
|
|
1430
|
+
<ToolFallbackArgs
|
|
1431
|
+
argsText={argsText}
|
|
1432
|
+
className={cn(isCancelled && "opacity-60")}
|
|
1433
|
+
/>
|
|
1434
|
+
{!isCancelled && <ToolFallbackResult result={result} />}
|
|
1435
|
+
</ToolFallbackContent>
|
|
1436
|
+
</ToolFallbackRoot>
|
|
1437
|
+
);
|
|
1438
|
+
};
|
|
1439
|
+
|
|
1440
|
+
const ToolFallback = memo(
|
|
1441
|
+
ToolFallbackImpl,
|
|
1442
|
+
) as unknown as ToolCallMessagePartComponent & {
|
|
1443
|
+
Root: typeof ToolFallbackRoot;
|
|
1444
|
+
Trigger: typeof ToolFallbackTrigger;
|
|
1445
|
+
Content: typeof ToolFallbackContent;
|
|
1446
|
+
Args: typeof ToolFallbackArgs;
|
|
1447
|
+
Result: typeof ToolFallbackResult;
|
|
1448
|
+
Error: typeof ToolFallbackError;
|
|
1449
|
+
};
|
|
1450
|
+
|
|
1451
|
+
ToolFallback.displayName = "ToolFallback";
|
|
1452
|
+
ToolFallback.Root = ToolFallbackRoot;
|
|
1453
|
+
ToolFallback.Trigger = ToolFallbackTrigger;
|
|
1454
|
+
ToolFallback.Content = ToolFallbackContent;
|
|
1455
|
+
ToolFallback.Args = ToolFallbackArgs;
|
|
1456
|
+
ToolFallback.Result = ToolFallbackResult;
|
|
1457
|
+
ToolFallback.Error = ToolFallbackError;
|
|
1458
|
+
|
|
1459
|
+
export {
|
|
1460
|
+
ToolFallback,
|
|
1461
|
+
ToolFallbackRoot,
|
|
1462
|
+
ToolFallbackTrigger,
|
|
1463
|
+
ToolFallbackContent,
|
|
1464
|
+
ToolFallbackArgs,
|
|
1465
|
+
ToolFallbackResult,
|
|
1466
|
+
ToolFallbackError,
|
|
1219
1467
|
};
|
|
1220
1468
|
|
|
1221
1469
|
```
|
|
@@ -1278,47 +1526,50 @@ import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
|
1278
1526
|
|
|
1279
1527
|
import { cn } from "@/lib/utils";
|
|
1280
1528
|
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
)
|
|
1321
|
-
|
|
1529
|
+
function Avatar({
|
|
1530
|
+
className,
|
|
1531
|
+
...props
|
|
1532
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Root>) {
|
|
1533
|
+
return (
|
|
1534
|
+
<AvatarPrimitive.Root
|
|
1535
|
+
data-slot="avatar"
|
|
1536
|
+
className={cn(
|
|
1537
|
+
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
|
|
1538
|
+
className,
|
|
1539
|
+
)}
|
|
1540
|
+
{...props}
|
|
1541
|
+
/>
|
|
1542
|
+
);
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
function AvatarImage({
|
|
1546
|
+
className,
|
|
1547
|
+
...props
|
|
1548
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Image>) {
|
|
1549
|
+
return (
|
|
1550
|
+
<AvatarPrimitive.Image
|
|
1551
|
+
data-slot="avatar-image"
|
|
1552
|
+
className={cn("aspect-square size-full", className)}
|
|
1553
|
+
{...props}
|
|
1554
|
+
/>
|
|
1555
|
+
);
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
function AvatarFallback({
|
|
1559
|
+
className,
|
|
1560
|
+
...props
|
|
1561
|
+
}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
|
|
1562
|
+
return (
|
|
1563
|
+
<AvatarPrimitive.Fallback
|
|
1564
|
+
data-slot="avatar-fallback"
|
|
1565
|
+
className={cn(
|
|
1566
|
+
"flex size-full items-center justify-center rounded-full bg-muted",
|
|
1567
|
+
className,
|
|
1568
|
+
)}
|
|
1569
|
+
{...props}
|
|
1570
|
+
/>
|
|
1571
|
+
);
|
|
1572
|
+
}
|
|
1322
1573
|
|
|
1323
1574
|
export { Avatar, AvatarImage, AvatarFallback };
|
|
1324
1575
|
|
|
@@ -1327,8 +1578,6 @@ export { Avatar, AvatarImage, AvatarFallback };
|
|
|
1327
1578
|
## components/ui/button.tsx
|
|
1328
1579
|
|
|
1329
1580
|
```tsx
|
|
1330
|
-
"use client";
|
|
1331
|
-
|
|
1332
1581
|
import * as React from "react";
|
|
1333
1582
|
import { Slot } from "@radix-ui/react-slot";
|
|
1334
1583
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
@@ -1336,26 +1585,28 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
1336
1585
|
import { cn } from "@/lib/utils";
|
|
1337
1586
|
|
|
1338
1587
|
const buttonVariants = cva(
|
|
1339
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium text-sm transition-
|
|
1588
|
+
"inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium text-sm outline-none transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
1340
1589
|
{
|
|
1341
1590
|
variants: {
|
|
1342
1591
|
variant: {
|
|
1343
|
-
default:
|
|
1344
|
-
"bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
1592
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
1345
1593
|
destructive:
|
|
1346
|
-
"bg-destructive text-destructive
|
|
1594
|
+
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
|
|
1347
1595
|
outline:
|
|
1348
|
-
"border
|
|
1596
|
+
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
|
1349
1597
|
secondary:
|
|
1350
|
-
"bg-secondary text-secondary-foreground
|
|
1351
|
-
ghost:
|
|
1598
|
+
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
1599
|
+
ghost:
|
|
1600
|
+
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
1352
1601
|
link: "text-primary underline-offset-4 hover:underline",
|
|
1353
1602
|
},
|
|
1354
1603
|
size: {
|
|
1355
|
-
default: "h-9 px-4 py-2",
|
|
1356
|
-
sm: "h-8 rounded-md px-3
|
|
1357
|
-
lg: "h-10 rounded-md px-
|
|
1358
|
-
icon: "
|
|
1604
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
1605
|
+
sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
|
|
1606
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
1607
|
+
icon: "size-9",
|
|
1608
|
+
"icon-sm": "size-8",
|
|
1609
|
+
"icon-lg": "size-10",
|
|
1359
1610
|
},
|
|
1360
1611
|
},
|
|
1361
1612
|
defaultVariants: {
|
|
@@ -1365,30 +1616,72 @@ const buttonVariants = cva(
|
|
|
1365
1616
|
},
|
|
1366
1617
|
);
|
|
1367
1618
|
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1619
|
+
function Button({
|
|
1620
|
+
className,
|
|
1621
|
+
variant = "default",
|
|
1622
|
+
size = "default",
|
|
1623
|
+
asChild = false,
|
|
1624
|
+
...props
|
|
1625
|
+
}: React.ComponentProps<"button"> &
|
|
1626
|
+
VariantProps<typeof buttonVariants> & {
|
|
1627
|
+
asChild?: boolean;
|
|
1628
|
+
}) {
|
|
1629
|
+
const Comp = asChild ? Slot : "button";
|
|
1373
1630
|
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
},
|
|
1385
|
-
);
|
|
1386
|
-
Button.displayName = "Button";
|
|
1631
|
+
return (
|
|
1632
|
+
<Comp
|
|
1633
|
+
data-slot="button"
|
|
1634
|
+
data-variant={variant}
|
|
1635
|
+
data-size={size}
|
|
1636
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
1637
|
+
{...props}
|
|
1638
|
+
/>
|
|
1639
|
+
);
|
|
1640
|
+
}
|
|
1387
1641
|
|
|
1388
1642
|
export { Button, buttonVariants };
|
|
1389
1643
|
|
|
1390
1644
|
```
|
|
1391
1645
|
|
|
1646
|
+
## components/ui/collapsible.tsx
|
|
1647
|
+
|
|
1648
|
+
```tsx
|
|
1649
|
+
"use client";
|
|
1650
|
+
|
|
1651
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
1652
|
+
|
|
1653
|
+
function Collapsible({
|
|
1654
|
+
...props
|
|
1655
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
|
1656
|
+
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
function CollapsibleTrigger({
|
|
1660
|
+
...props
|
|
1661
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
|
|
1662
|
+
return (
|
|
1663
|
+
<CollapsiblePrimitive.CollapsibleTrigger
|
|
1664
|
+
data-slot="collapsible-trigger"
|
|
1665
|
+
{...props}
|
|
1666
|
+
/>
|
|
1667
|
+
);
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
function CollapsibleContent({
|
|
1671
|
+
...props
|
|
1672
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
|
|
1673
|
+
return (
|
|
1674
|
+
<CollapsiblePrimitive.CollapsibleContent
|
|
1675
|
+
data-slot="collapsible-content"
|
|
1676
|
+
{...props}
|
|
1677
|
+
/>
|
|
1678
|
+
);
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
1682
|
+
|
|
1683
|
+
```
|
|
1684
|
+
|
|
1392
1685
|
## components/ui/dialog.tsx
|
|
1393
1686
|
|
|
1394
1687
|
```tsx
|
|
@@ -1432,7 +1725,7 @@ function DialogOverlay({
|
|
|
1432
1725
|
<DialogPrimitive.Overlay
|
|
1433
1726
|
data-slot="dialog-overlay"
|
|
1434
1727
|
className={cn(
|
|
1435
|
-
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/
|
|
1728
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
1436
1729
|
className,
|
|
1437
1730
|
)}
|
|
1438
1731
|
{...props}
|
|
@@ -1443,24 +1736,32 @@ function DialogOverlay({
|
|
|
1443
1736
|
function DialogContent({
|
|
1444
1737
|
className,
|
|
1445
1738
|
children,
|
|
1739
|
+
showCloseButton = true,
|
|
1446
1740
|
...props
|
|
1447
|
-
}: React.ComponentProps<typeof DialogPrimitive.Content>
|
|
1741
|
+
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
1742
|
+
showCloseButton?: boolean;
|
|
1743
|
+
}) {
|
|
1448
1744
|
return (
|
|
1449
1745
|
<DialogPortal data-slot="dialog-portal">
|
|
1450
1746
|
<DialogOverlay />
|
|
1451
1747
|
<DialogPrimitive.Content
|
|
1452
1748
|
data-slot="dialog-content"
|
|
1453
1749
|
className={cn(
|
|
1454
|
-
"data-[state=closed]:fade-out-0 data-[state=
|
|
1750
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg outline-none duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in sm:max-w-lg",
|
|
1455
1751
|
className,
|
|
1456
1752
|
)}
|
|
1457
1753
|
{...props}
|
|
1458
1754
|
>
|
|
1459
1755
|
{children}
|
|
1460
|
-
|
|
1461
|
-
<
|
|
1462
|
-
|
|
1463
|
-
|
|
1756
|
+
{showCloseButton && (
|
|
1757
|
+
<DialogPrimitive.Close
|
|
1758
|
+
data-slot="dialog-close"
|
|
1759
|
+
className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
1760
|
+
>
|
|
1761
|
+
<XIcon />
|
|
1762
|
+
<span className="sr-only">Close</span>
|
|
1763
|
+
</DialogPrimitive.Close>
|
|
1764
|
+
)}
|
|
1464
1765
|
</DialogPrimitive.Content>
|
|
1465
1766
|
</DialogPortal>
|
|
1466
1767
|
);
|
|
@@ -1581,13 +1882,13 @@ function TooltipContent({
|
|
|
1581
1882
|
data-slot="tooltip-content"
|
|
1582
1883
|
sideOffset={sideOffset}
|
|
1583
1884
|
className={cn(
|
|
1584
|
-
"fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-
|
|
1885
|
+
"fade-in-0 zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in text-balance rounded-md bg-foreground px-3 py-1.5 text-background text-xs data-[state=closed]:animate-out",
|
|
1585
1886
|
className,
|
|
1586
1887
|
)}
|
|
1587
1888
|
{...props}
|
|
1588
1889
|
>
|
|
1589
1890
|
{children}
|
|
1590
|
-
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-
|
|
1891
|
+
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
|
|
1591
1892
|
</TooltipPrimitive.Content>
|
|
1592
1893
|
</TooltipPrimitive.Portal>
|
|
1593
1894
|
);
|
|
@@ -1627,42 +1928,44 @@ export default nextConfig;
|
|
|
1627
1928
|
```json
|
|
1628
1929
|
{
|
|
1629
1930
|
"name": "with-ag-ui",
|
|
1630
|
-
"version": "0.
|
|
1931
|
+
"version": "0.0.0",
|
|
1631
1932
|
"private": true,
|
|
1933
|
+
"type": "module",
|
|
1632
1934
|
"scripts": {
|
|
1633
|
-
"dev": "next dev
|
|
1935
|
+
"dev": "next dev",
|
|
1634
1936
|
"build": "next build",
|
|
1635
1937
|
"start": "next start"
|
|
1636
1938
|
},
|
|
1637
1939
|
"dependencies": {
|
|
1638
|
-
"@
|
|
1940
|
+
"@ag-ui/client": "^0.0.43",
|
|
1639
1941
|
"@assistant-ui/react": "workspace:*",
|
|
1640
|
-
"@assistant-ui/react-markdown": "workspace:*",
|
|
1641
1942
|
"@assistant-ui/react-ag-ui": "workspace:*",
|
|
1642
|
-
"@
|
|
1943
|
+
"@assistant-ui/react-markdown": "workspace:*",
|
|
1643
1944
|
"@radix-ui/react-avatar": "^1.1.11",
|
|
1945
|
+
"@radix-ui/react-collapsible": "^1.1.12",
|
|
1644
1946
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
1645
1947
|
"@radix-ui/react-slot": "^1.2.4",
|
|
1646
1948
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
1647
1949
|
"class-variance-authority": "^0.7.1",
|
|
1648
1950
|
"clsx": "^2.1.1",
|
|
1649
|
-
"lucide-react": "^0.
|
|
1650
|
-
"next": "16.
|
|
1651
|
-
"react": "19.2.3",
|
|
1652
|
-
"react-dom": "19.2.3",
|
|
1951
|
+
"lucide-react": "^0.562.0",
|
|
1952
|
+
"next": "^16.1.4",
|
|
1953
|
+
"react": "^19.2.3",
|
|
1954
|
+
"react-dom": "^19.2.3",
|
|
1653
1955
|
"remark-gfm": "^4.0.1",
|
|
1654
1956
|
"tailwind-merge": "^3.4.0",
|
|
1655
|
-
"
|
|
1656
|
-
"zustand": "^5.0.9"
|
|
1957
|
+
"zustand": "^5.0.10"
|
|
1657
1958
|
},
|
|
1658
1959
|
"devDependencies": {
|
|
1659
1960
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
1660
|
-
"@
|
|
1661
|
-
"@types/
|
|
1662
|
-
"@types/react
|
|
1663
|
-
"
|
|
1961
|
+
"@tailwindcss/postcss": "^4.1.18",
|
|
1962
|
+
"@types/node": "^25.0.9",
|
|
1963
|
+
"@types/react": "^19.2.9",
|
|
1964
|
+
"@types/react-dom": "^19.2.3",
|
|
1965
|
+
"postcss": "^8.5.6",
|
|
1664
1966
|
"tailwindcss": "^4.1.18",
|
|
1665
|
-
"
|
|
1967
|
+
"tw-animate-css": "^1.4.0",
|
|
1968
|
+
"typescript": "^5.9.3"
|
|
1666
1969
|
}
|
|
1667
1970
|
}
|
|
1668
1971
|
|
|
@@ -1672,30 +1975,11 @@ export default nextConfig;
|
|
|
1672
1975
|
|
|
1673
1976
|
```json
|
|
1674
1977
|
{
|
|
1675
|
-
"extends": "@assistant-ui/x-buildutils/ts/
|
|
1978
|
+
"extends": "@assistant-ui/x-buildutils/ts/next",
|
|
1676
1979
|
"compilerOptions": {
|
|
1677
|
-
"
|
|
1678
|
-
"module": "ESNext",
|
|
1679
|
-
"incremental": true,
|
|
1680
|
-
"plugins": [
|
|
1681
|
-
{
|
|
1682
|
-
"name": "next"
|
|
1683
|
-
}
|
|
1684
|
-
],
|
|
1685
|
-
"allowJs": true,
|
|
1686
|
-
"strictNullChecks": true,
|
|
1687
|
-
"jsx": "preserve",
|
|
1688
|
-
"paths": {
|
|
1689
|
-
"@/*": ["./*"],
|
|
1690
|
-
"@assistant-ui/react-ag-ui": ["../../packages/react-ag-ui/src"],
|
|
1691
|
-
"@assistant-ui/*": ["../../packages/*/src"],
|
|
1692
|
-
"@assistant-ui/react/*": ["../../packages/react/src/*"],
|
|
1693
|
-
"@assistant-ui/tap/*": ["../../packages/tap/src/*"],
|
|
1694
|
-
"assistant-stream": ["../../packages/assistant-stream/src"],
|
|
1695
|
-
"assistant-stream/*": ["../../packages/assistant-stream/src/*"]
|
|
1696
|
-
}
|
|
1980
|
+
"paths": { "@/*": ["./*"] }
|
|
1697
1981
|
},
|
|
1698
|
-
"include": ["
|
|
1982
|
+
"include": ["**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
1699
1983
|
"exclude": ["node_modules"]
|
|
1700
1984
|
}
|
|
1701
1985
|
|