@assistant-ui/mcp-docs-server 0.1.18 → 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 +375 -85
- package/.docs/organized/code-examples/{with-ai-sdk-v5.md → with-ai-sdk-v6.md} +386 -94
- package/.docs/organized/code-examples/with-assistant-transport.md +374 -84
- package/.docs/organized/code-examples/with-cloud.md +405 -100
- package/.docs/organized/code-examples/with-custom-thread-list.md +412 -105
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +2241 -0
- package/.docs/organized/code-examples/with-external-store.md +374 -83
- package/.docs/organized/code-examples/with-ffmpeg.md +377 -87
- package/.docs/organized/code-examples/with-langgraph.md +403 -98
- package/.docs/organized/code-examples/with-parent-id-grouping.md +374 -83
- package/.docs/organized/code-examples/with-react-hook-form.md +379 -89
- package/.docs/organized/code-examples/with-react-router.md +2167 -0
- package/.docs/organized/code-examples/with-store.md +5 -5
- package/.docs/organized/code-examples/with-tanstack.md +10 -10
- 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 +2 -3
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +6 -8
- package/.docs/raw/docs/runtimes/custom/local.mdx +12 -8
- 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 -1
- 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/tools/docs.js +1 -1
- package/dist/tools/examples.js +1 -1
- package/dist/tools/examples.js.map +1 -1
- package/package.json +5 -5
- package/src/tools/docs.ts +1 -1
- package/src/tools/examples.ts +1 -1
- package/src/tools/tests/docs.test.ts +18 -16
- package/src/tools/tests/examples.test.ts +5 -5
- package/src/tools/tests/path-traversal.test.ts +3 -3
- package/src/utils/tests/security.test.ts +3 -3
- 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/.docs/raw/docs/{copilots → (docs)/copilots}/assistant-frame.mdx +0 -0
|
@@ -14,7 +14,7 @@ export async function POST(req: Request) {
|
|
|
14
14
|
|
|
15
15
|
const result = streamText({
|
|
16
16
|
model: openai("gpt-4o"),
|
|
17
|
-
messages: convertToModelMessages(messages),
|
|
17
|
+
messages: await convertToModelMessages(messages),
|
|
18
18
|
system,
|
|
19
19
|
tools: {
|
|
20
20
|
...frontendTools(tools),
|
|
@@ -567,7 +567,7 @@ export const ComposerAddAttachment: FC = () => {
|
|
|
567
567
|
side="bottom"
|
|
568
568
|
variant="ghost"
|
|
569
569
|
size="icon"
|
|
570
|
-
className="aui-composer-add-attachment size-
|
|
570
|
+
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"
|
|
571
571
|
aria-label="Add Attachment"
|
|
572
572
|
>
|
|
573
573
|
<PlusIcon className="aui-attachment-add-icon size-5 stroke-[1.5px]" />
|
|
@@ -826,6 +826,7 @@ import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button
|
|
|
826
826
|
import { Button } from "@/components/ui/button";
|
|
827
827
|
import { cn } from "@/lib/utils";
|
|
828
828
|
import {
|
|
829
|
+
ActionBarMorePrimitive,
|
|
829
830
|
ActionBarPrimitive,
|
|
830
831
|
AssistantIf,
|
|
831
832
|
BranchPickerPrimitive,
|
|
@@ -842,6 +843,7 @@ import {
|
|
|
842
843
|
ChevronRightIcon,
|
|
843
844
|
CopyIcon,
|
|
844
845
|
DownloadIcon,
|
|
846
|
+
MoreHorizontalIcon,
|
|
845
847
|
PencilIcon,
|
|
846
848
|
RefreshCwIcon,
|
|
847
849
|
SquareIcon,
|
|
@@ -1063,16 +1065,33 @@ const AssistantActionBar: FC = () => {
|
|
|
1063
1065
|
</AssistantIf>
|
|
1064
1066
|
</TooltipIconButton>
|
|
1065
1067
|
</ActionBarPrimitive.Copy>
|
|
1066
|
-
<ActionBarPrimitive.ExportMarkdown asChild>
|
|
1067
|
-
<TooltipIconButton tooltip="Export as Markdown">
|
|
1068
|
-
<DownloadIcon />
|
|
1069
|
-
</TooltipIconButton>
|
|
1070
|
-
</ActionBarPrimitive.ExportMarkdown>
|
|
1071
1068
|
<ActionBarPrimitive.Reload asChild>
|
|
1072
1069
|
<TooltipIconButton tooltip="Refresh">
|
|
1073
1070
|
<RefreshCwIcon />
|
|
1074
1071
|
</TooltipIconButton>
|
|
1075
1072
|
</ActionBarPrimitive.Reload>
|
|
1073
|
+
<ActionBarMorePrimitive.Root>
|
|
1074
|
+
<ActionBarMorePrimitive.Trigger asChild>
|
|
1075
|
+
<TooltipIconButton
|
|
1076
|
+
tooltip="More"
|
|
1077
|
+
className="data-[state=open]:bg-accent"
|
|
1078
|
+
>
|
|
1079
|
+
<MoreHorizontalIcon />
|
|
1080
|
+
</TooltipIconButton>
|
|
1081
|
+
</ActionBarMorePrimitive.Trigger>
|
|
1082
|
+
<ActionBarMorePrimitive.Content
|
|
1083
|
+
side="bottom"
|
|
1084
|
+
align="start"
|
|
1085
|
+
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"
|
|
1086
|
+
>
|
|
1087
|
+
<ActionBarPrimitive.ExportMarkdown asChild>
|
|
1088
|
+
<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">
|
|
1089
|
+
<DownloadIcon className="size-4" />
|
|
1090
|
+
Export as Markdown
|
|
1091
|
+
</ActionBarMorePrimitive.Item>
|
|
1092
|
+
</ActionBarPrimitive.ExportMarkdown>
|
|
1093
|
+
</ActionBarMorePrimitive.Content>
|
|
1094
|
+
</ActionBarMorePrimitive.Root>
|
|
1076
1095
|
</ActionBarPrimitive.Root>
|
|
1077
1096
|
);
|
|
1078
1097
|
};
|
|
@@ -1173,98 +1192,329 @@ const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({
|
|
|
1173
1192
|
## components/assistant-ui/tool-fallback.tsx
|
|
1174
1193
|
|
|
1175
1194
|
```tsx
|
|
1176
|
-
|
|
1195
|
+
"use client";
|
|
1196
|
+
|
|
1197
|
+
import { memo, useCallback, useRef, useState } from "react";
|
|
1177
1198
|
import {
|
|
1199
|
+
AlertCircleIcon,
|
|
1178
1200
|
CheckIcon,
|
|
1179
1201
|
ChevronDownIcon,
|
|
1180
|
-
|
|
1202
|
+
LoaderIcon,
|
|
1181
1203
|
XCircleIcon,
|
|
1182
1204
|
} from "lucide-react";
|
|
1183
|
-
import {
|
|
1184
|
-
|
|
1205
|
+
import {
|
|
1206
|
+
useScrollLock,
|
|
1207
|
+
type ToolCallMessagePartStatus,
|
|
1208
|
+
type ToolCallMessagePartComponent,
|
|
1209
|
+
} from "@assistant-ui/react";
|
|
1210
|
+
import {
|
|
1211
|
+
Collapsible,
|
|
1212
|
+
CollapsibleContent,
|
|
1213
|
+
CollapsibleTrigger,
|
|
1214
|
+
} from "@/components/ui/collapsible";
|
|
1185
1215
|
import { cn } from "@/lib/utils";
|
|
1186
1216
|
|
|
1187
|
-
|
|
1217
|
+
const ANIMATION_DURATION = 200;
|
|
1218
|
+
|
|
1219
|
+
export type ToolFallbackRootProps = Omit<
|
|
1220
|
+
React.ComponentProps<typeof Collapsible>,
|
|
1221
|
+
"open" | "onOpenChange"
|
|
1222
|
+
> & {
|
|
1223
|
+
open?: boolean;
|
|
1224
|
+
onOpenChange?: (open: boolean) => void;
|
|
1225
|
+
defaultOpen?: boolean;
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1228
|
+
function ToolFallbackRoot({
|
|
1229
|
+
className,
|
|
1230
|
+
open: controlledOpen,
|
|
1231
|
+
onOpenChange: controlledOnOpenChange,
|
|
1232
|
+
defaultOpen = false,
|
|
1233
|
+
children,
|
|
1234
|
+
...props
|
|
1235
|
+
}: ToolFallbackRootProps) {
|
|
1236
|
+
const collapsibleRef = useRef<HTMLDivElement>(null);
|
|
1237
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
1238
|
+
const lockScroll = useScrollLock(collapsibleRef, ANIMATION_DURATION);
|
|
1239
|
+
|
|
1240
|
+
const isControlled = controlledOpen !== undefined;
|
|
1241
|
+
const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
|
|
1242
|
+
|
|
1243
|
+
const handleOpenChange = useCallback(
|
|
1244
|
+
(open: boolean) => {
|
|
1245
|
+
if (!open) {
|
|
1246
|
+
lockScroll();
|
|
1247
|
+
}
|
|
1248
|
+
if (!isControlled) {
|
|
1249
|
+
setUncontrolledOpen(open);
|
|
1250
|
+
}
|
|
1251
|
+
controlledOnOpenChange?.(open);
|
|
1252
|
+
},
|
|
1253
|
+
[lockScroll, isControlled, controlledOnOpenChange],
|
|
1254
|
+
);
|
|
1255
|
+
|
|
1256
|
+
return (
|
|
1257
|
+
<Collapsible
|
|
1258
|
+
ref={collapsibleRef}
|
|
1259
|
+
data-slot="tool-fallback-root"
|
|
1260
|
+
open={isOpen}
|
|
1261
|
+
onOpenChange={handleOpenChange}
|
|
1262
|
+
className={cn(
|
|
1263
|
+
"aui-tool-fallback-root group/tool-fallback-root w-full rounded-lg border py-3",
|
|
1264
|
+
className,
|
|
1265
|
+
)}
|
|
1266
|
+
style={
|
|
1267
|
+
{
|
|
1268
|
+
"--animation-duration": `${ANIMATION_DURATION}ms`,
|
|
1269
|
+
} as React.CSSProperties
|
|
1270
|
+
}
|
|
1271
|
+
{...props}
|
|
1272
|
+
>
|
|
1273
|
+
{children}
|
|
1274
|
+
</Collapsible>
|
|
1275
|
+
);
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
type ToolStatus = ToolCallMessagePartStatus["type"];
|
|
1279
|
+
|
|
1280
|
+
const statusIconMap: Record<ToolStatus, React.ElementType> = {
|
|
1281
|
+
running: LoaderIcon,
|
|
1282
|
+
complete: CheckIcon,
|
|
1283
|
+
incomplete: XCircleIcon,
|
|
1284
|
+
"requires-action": AlertCircleIcon,
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
function ToolFallbackTrigger({
|
|
1188
1288
|
toolName,
|
|
1189
|
-
argsText,
|
|
1190
|
-
result,
|
|
1191
1289
|
status,
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1290
|
+
className,
|
|
1291
|
+
...props
|
|
1292
|
+
}: React.ComponentProps<typeof CollapsibleTrigger> & {
|
|
1293
|
+
toolName: string;
|
|
1294
|
+
status?: ToolCallMessagePartStatus;
|
|
1295
|
+
}) {
|
|
1296
|
+
const statusType = status?.type ?? "complete";
|
|
1297
|
+
const isRunning = statusType === "running";
|
|
1195
1298
|
const isCancelled =
|
|
1196
1299
|
status?.type === "incomplete" && status.reason === "cancelled";
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
? status.error
|
|
1201
|
-
: JSON.stringify(status.error)
|
|
1202
|
-
: null;
|
|
1300
|
+
|
|
1301
|
+
const Icon = statusIconMap[statusType];
|
|
1302
|
+
const label = isCancelled ? "Cancelled tool" : "Used tool";
|
|
1203
1303
|
|
|
1204
1304
|
return (
|
|
1205
|
-
<
|
|
1305
|
+
<CollapsibleTrigger
|
|
1306
|
+
data-slot="tool-fallback-trigger"
|
|
1206
1307
|
className={cn(
|
|
1207
|
-
"aui-tool-fallback-
|
|
1208
|
-
|
|
1308
|
+
"aui-tool-fallback-trigger group/trigger flex w-full items-center gap-2 px-4 text-sm transition-colors",
|
|
1309
|
+
className,
|
|
1209
1310
|
)}
|
|
1311
|
+
{...props}
|
|
1210
1312
|
>
|
|
1211
|
-
<
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1313
|
+
<Icon
|
|
1314
|
+
data-slot="tool-fallback-trigger-icon"
|
|
1315
|
+
className={cn(
|
|
1316
|
+
"aui-tool-fallback-trigger-icon size-4 shrink-0",
|
|
1317
|
+
isCancelled && "text-muted-foreground",
|
|
1318
|
+
isRunning && "animate-spin",
|
|
1216
1319
|
)}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
<div className="aui-tool-fallback-cancelled-root px-4">
|
|
1234
|
-
<p className="aui-tool-fallback-cancelled-header font-semibold text-muted-foreground">
|
|
1235
|
-
Cancelled reason:
|
|
1236
|
-
</p>
|
|
1237
|
-
<p className="aui-tool-fallback-cancelled-reason text-muted-foreground">
|
|
1238
|
-
{cancelledReason}
|
|
1239
|
-
</p>
|
|
1240
|
-
</div>
|
|
1241
|
-
)}
|
|
1242
|
-
<div
|
|
1243
|
-
className={cn(
|
|
1244
|
-
"aui-tool-fallback-args-root px-4",
|
|
1245
|
-
isCancelled && "opacity-60",
|
|
1246
|
-
)}
|
|
1320
|
+
/>
|
|
1321
|
+
<span
|
|
1322
|
+
data-slot="tool-fallback-trigger-label"
|
|
1323
|
+
className={cn(
|
|
1324
|
+
"aui-tool-fallback-trigger-label-wrapper relative inline-block grow text-left leading-none",
|
|
1325
|
+
isCancelled && "text-muted-foreground line-through",
|
|
1326
|
+
)}
|
|
1327
|
+
>
|
|
1328
|
+
<span>
|
|
1329
|
+
{label}: <b>{toolName}</b>
|
|
1330
|
+
</span>
|
|
1331
|
+
{isRunning && (
|
|
1332
|
+
<span
|
|
1333
|
+
aria-hidden
|
|
1334
|
+
data-slot="tool-fallback-trigger-shimmer"
|
|
1335
|
+
className="aui-tool-fallback-trigger-shimmer shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none"
|
|
1247
1336
|
>
|
|
1248
|
-
<
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1337
|
+
{label}: <b>{toolName}</b>
|
|
1338
|
+
</span>
|
|
1339
|
+
)}
|
|
1340
|
+
</span>
|
|
1341
|
+
<ChevronDownIcon
|
|
1342
|
+
data-slot="tool-fallback-trigger-chevron"
|
|
1343
|
+
className={cn(
|
|
1344
|
+
"aui-tool-fallback-trigger-chevron size-4 shrink-0",
|
|
1345
|
+
"transition-transform duration-(--animation-duration) ease-out",
|
|
1346
|
+
"group-data-[state=closed]/trigger:-rotate-90",
|
|
1347
|
+
"group-data-[state=open]/trigger:rotate-0",
|
|
1348
|
+
)}
|
|
1349
|
+
/>
|
|
1350
|
+
</CollapsibleTrigger>
|
|
1351
|
+
);
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
function ToolFallbackContent({
|
|
1355
|
+
className,
|
|
1356
|
+
children,
|
|
1357
|
+
...props
|
|
1358
|
+
}: React.ComponentProps<typeof CollapsibleContent>) {
|
|
1359
|
+
return (
|
|
1360
|
+
<CollapsibleContent
|
|
1361
|
+
data-slot="tool-fallback-content"
|
|
1362
|
+
className={cn(
|
|
1363
|
+
"aui-tool-fallback-content relative overflow-hidden text-sm outline-none",
|
|
1364
|
+
"group/collapsible-content ease-out",
|
|
1365
|
+
"data-[state=closed]:animate-collapsible-up",
|
|
1366
|
+
"data-[state=open]:animate-collapsible-down",
|
|
1367
|
+
"data-[state=closed]:fill-mode-forwards",
|
|
1368
|
+
"data-[state=closed]:pointer-events-none",
|
|
1369
|
+
"data-[state=open]:duration-(--animation-duration)",
|
|
1370
|
+
"data-[state=closed]:duration-(--animation-duration)",
|
|
1371
|
+
className,
|
|
1372
|
+
)}
|
|
1373
|
+
{...props}
|
|
1374
|
+
>
|
|
1375
|
+
<div className="mt-3 flex flex-col gap-2 border-t pt-2">{children}</div>
|
|
1376
|
+
</CollapsibleContent>
|
|
1377
|
+
);
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
function ToolFallbackArgs({
|
|
1381
|
+
argsText,
|
|
1382
|
+
className,
|
|
1383
|
+
...props
|
|
1384
|
+
}: React.ComponentProps<"div"> & {
|
|
1385
|
+
argsText?: string;
|
|
1386
|
+
}) {
|
|
1387
|
+
if (!argsText) return null;
|
|
1388
|
+
|
|
1389
|
+
return (
|
|
1390
|
+
<div
|
|
1391
|
+
data-slot="tool-fallback-args"
|
|
1392
|
+
className={cn("aui-tool-fallback-args px-4", className)}
|
|
1393
|
+
{...props}
|
|
1394
|
+
>
|
|
1395
|
+
<pre className="aui-tool-fallback-args-value whitespace-pre-wrap">
|
|
1396
|
+
{argsText}
|
|
1397
|
+
</pre>
|
|
1398
|
+
</div>
|
|
1399
|
+
);
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
function ToolFallbackResult({
|
|
1403
|
+
result,
|
|
1404
|
+
className,
|
|
1405
|
+
...props
|
|
1406
|
+
}: React.ComponentProps<"div"> & {
|
|
1407
|
+
result?: unknown;
|
|
1408
|
+
}) {
|
|
1409
|
+
if (result === undefined) return null;
|
|
1410
|
+
|
|
1411
|
+
return (
|
|
1412
|
+
<div
|
|
1413
|
+
data-slot="tool-fallback-result"
|
|
1414
|
+
className={cn(
|
|
1415
|
+
"aui-tool-fallback-result border-t border-dashed px-4 pt-2",
|
|
1416
|
+
className,
|
|
1265
1417
|
)}
|
|
1418
|
+
{...props}
|
|
1419
|
+
>
|
|
1420
|
+
<p className="aui-tool-fallback-result-header font-semibold">Result:</p>
|
|
1421
|
+
<pre className="aui-tool-fallback-result-content whitespace-pre-wrap">
|
|
1422
|
+
{typeof result === "string" ? result : JSON.stringify(result, null, 2)}
|
|
1423
|
+
</pre>
|
|
1424
|
+
</div>
|
|
1425
|
+
);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
function ToolFallbackError({
|
|
1429
|
+
status,
|
|
1430
|
+
className,
|
|
1431
|
+
...props
|
|
1432
|
+
}: React.ComponentProps<"div"> & {
|
|
1433
|
+
status?: ToolCallMessagePartStatus;
|
|
1434
|
+
}) {
|
|
1435
|
+
if (status?.type !== "incomplete") return null;
|
|
1436
|
+
|
|
1437
|
+
const error = status.error;
|
|
1438
|
+
const errorText = error
|
|
1439
|
+
? typeof error === "string"
|
|
1440
|
+
? error
|
|
1441
|
+
: JSON.stringify(error)
|
|
1442
|
+
: null;
|
|
1443
|
+
|
|
1444
|
+
if (!errorText) return null;
|
|
1445
|
+
|
|
1446
|
+
const isCancelled = status.reason === "cancelled";
|
|
1447
|
+
const headerText = isCancelled ? "Cancelled reason:" : "Error:";
|
|
1448
|
+
|
|
1449
|
+
return (
|
|
1450
|
+
<div
|
|
1451
|
+
data-slot="tool-fallback-error"
|
|
1452
|
+
className={cn("aui-tool-fallback-error px-4", className)}
|
|
1453
|
+
{...props}
|
|
1454
|
+
>
|
|
1455
|
+
<p className="aui-tool-fallback-error-header font-semibold text-muted-foreground">
|
|
1456
|
+
{headerText}
|
|
1457
|
+
</p>
|
|
1458
|
+
<p className="aui-tool-fallback-error-reason text-muted-foreground">
|
|
1459
|
+
{errorText}
|
|
1460
|
+
</p>
|
|
1266
1461
|
</div>
|
|
1267
1462
|
);
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
const ToolFallbackImpl: ToolCallMessagePartComponent = ({
|
|
1466
|
+
toolName,
|
|
1467
|
+
argsText,
|
|
1468
|
+
result,
|
|
1469
|
+
status,
|
|
1470
|
+
}) => {
|
|
1471
|
+
const isCancelled =
|
|
1472
|
+
status?.type === "incomplete" && status.reason === "cancelled";
|
|
1473
|
+
|
|
1474
|
+
return (
|
|
1475
|
+
<ToolFallbackRoot
|
|
1476
|
+
className={cn(isCancelled && "border-muted-foreground/30 bg-muted/30")}
|
|
1477
|
+
>
|
|
1478
|
+
<ToolFallbackTrigger toolName={toolName} status={status} />
|
|
1479
|
+
<ToolFallbackContent>
|
|
1480
|
+
<ToolFallbackError status={status} />
|
|
1481
|
+
<ToolFallbackArgs
|
|
1482
|
+
argsText={argsText}
|
|
1483
|
+
className={cn(isCancelled && "opacity-60")}
|
|
1484
|
+
/>
|
|
1485
|
+
{!isCancelled && <ToolFallbackResult result={result} />}
|
|
1486
|
+
</ToolFallbackContent>
|
|
1487
|
+
</ToolFallbackRoot>
|
|
1488
|
+
);
|
|
1489
|
+
};
|
|
1490
|
+
|
|
1491
|
+
const ToolFallback = memo(
|
|
1492
|
+
ToolFallbackImpl,
|
|
1493
|
+
) as unknown as ToolCallMessagePartComponent & {
|
|
1494
|
+
Root: typeof ToolFallbackRoot;
|
|
1495
|
+
Trigger: typeof ToolFallbackTrigger;
|
|
1496
|
+
Content: typeof ToolFallbackContent;
|
|
1497
|
+
Args: typeof ToolFallbackArgs;
|
|
1498
|
+
Result: typeof ToolFallbackResult;
|
|
1499
|
+
Error: typeof ToolFallbackError;
|
|
1500
|
+
};
|
|
1501
|
+
|
|
1502
|
+
ToolFallback.displayName = "ToolFallback";
|
|
1503
|
+
ToolFallback.Root = ToolFallbackRoot;
|
|
1504
|
+
ToolFallback.Trigger = ToolFallbackTrigger;
|
|
1505
|
+
ToolFallback.Content = ToolFallbackContent;
|
|
1506
|
+
ToolFallback.Args = ToolFallbackArgs;
|
|
1507
|
+
ToolFallback.Result = ToolFallbackResult;
|
|
1508
|
+
ToolFallback.Error = ToolFallbackError;
|
|
1509
|
+
|
|
1510
|
+
export {
|
|
1511
|
+
ToolFallback,
|
|
1512
|
+
ToolFallbackRoot,
|
|
1513
|
+
ToolFallbackTrigger,
|
|
1514
|
+
ToolFallbackContent,
|
|
1515
|
+
ToolFallbackArgs,
|
|
1516
|
+
ToolFallbackResult,
|
|
1517
|
+
ToolFallbackError,
|
|
1268
1518
|
};
|
|
1269
1519
|
|
|
1270
1520
|
```
|
|
@@ -1593,6 +1843,45 @@ export { Button, buttonVariants };
|
|
|
1593
1843
|
|
|
1594
1844
|
```
|
|
1595
1845
|
|
|
1846
|
+
## components/ui/collapsible.tsx
|
|
1847
|
+
|
|
1848
|
+
```tsx
|
|
1849
|
+
"use client";
|
|
1850
|
+
|
|
1851
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
1852
|
+
|
|
1853
|
+
function Collapsible({
|
|
1854
|
+
...props
|
|
1855
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
|
1856
|
+
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
function CollapsibleTrigger({
|
|
1860
|
+
...props
|
|
1861
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
|
|
1862
|
+
return (
|
|
1863
|
+
<CollapsiblePrimitive.CollapsibleTrigger
|
|
1864
|
+
data-slot="collapsible-trigger"
|
|
1865
|
+
{...props}
|
|
1866
|
+
/>
|
|
1867
|
+
);
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
function CollapsibleContent({
|
|
1871
|
+
...props
|
|
1872
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
|
|
1873
|
+
return (
|
|
1874
|
+
<CollapsiblePrimitive.CollapsibleContent
|
|
1875
|
+
data-slot="collapsible-content"
|
|
1876
|
+
{...props}
|
|
1877
|
+
/>
|
|
1878
|
+
);
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
1882
|
+
|
|
1883
|
+
```
|
|
1884
|
+
|
|
1596
1885
|
## components/ui/dialog.tsx
|
|
1597
1886
|
|
|
1598
1887
|
```tsx
|
|
@@ -2231,37 +2520,38 @@ export default nextConfig;
|
|
|
2231
2520
|
"start": "next start"
|
|
2232
2521
|
},
|
|
2233
2522
|
"dependencies": {
|
|
2234
|
-
"@ai-sdk/openai": "^
|
|
2523
|
+
"@ai-sdk/openai": "^3.0.13",
|
|
2235
2524
|
"@assistant-ui/react": "workspace:*",
|
|
2236
2525
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
2237
2526
|
"@assistant-ui/react-hook-form": "workspace:*",
|
|
2238
2527
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
2239
2528
|
"@hookform/resolvers": "^5.2.2",
|
|
2240
2529
|
"@radix-ui/react-avatar": "^1.1.11",
|
|
2530
|
+
"@radix-ui/react-collapsible": "^1.1.12",
|
|
2241
2531
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
2242
2532
|
"@radix-ui/react-label": "^2.1.8",
|
|
2243
2533
|
"@radix-ui/react-slot": "^1.2.4",
|
|
2244
2534
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
2245
2535
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
2246
|
-
"ai": "^
|
|
2536
|
+
"ai": "^6.0.42",
|
|
2247
2537
|
"class-variance-authority": "^0.7.1",
|
|
2248
2538
|
"clsx": "^2.1.1",
|
|
2249
2539
|
"lucide-react": "^0.562.0",
|
|
2250
|
-
"next": "16.1.
|
|
2251
|
-
"react": "19.2.3",
|
|
2252
|
-
"react-dom": "19.2.3",
|
|
2253
|
-
"react-hook-form": "^7.
|
|
2254
|
-
"react-resizable-panels": "^4.
|
|
2540
|
+
"next": "^16.1.4",
|
|
2541
|
+
"react": "^19.2.3",
|
|
2542
|
+
"react-dom": "^19.2.3",
|
|
2543
|
+
"react-hook-form": "^7.71.1",
|
|
2544
|
+
"react-resizable-panels": "^4.4.1",
|
|
2255
2545
|
"remark-gfm": "^4.0.1",
|
|
2256
2546
|
"tailwind-merge": "^3.4.0",
|
|
2257
|
-
"zod": "^4.
|
|
2258
|
-
"zustand": "^5.0.
|
|
2547
|
+
"zod": "^4.3.5",
|
|
2548
|
+
"zustand": "^5.0.10"
|
|
2259
2549
|
},
|
|
2260
2550
|
"devDependencies": {
|
|
2261
2551
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
2262
2552
|
"@tailwindcss/postcss": "^4.1.18",
|
|
2263
|
-
"@types/node": "^25.0.
|
|
2264
|
-
"@types/react": "^19.2.
|
|
2553
|
+
"@types/node": "^25.0.9",
|
|
2554
|
+
"@types/react": "^19.2.9",
|
|
2265
2555
|
"@types/react-dom": "^19.2.3",
|
|
2266
2556
|
"postcss": "^8.5.6",
|
|
2267
2557
|
"tailwindcss": "^4.1.18",
|