@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),
|
|
@@ -703,7 +703,7 @@ export const ComposerAddAttachment: FC = () => {
|
|
|
703
703
|
side="bottom"
|
|
704
704
|
variant="ghost"
|
|
705
705
|
size="icon"
|
|
706
|
-
className="aui-composer-add-attachment size-
|
|
706
|
+
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"
|
|
707
707
|
aria-label="Add Attachment"
|
|
708
708
|
>
|
|
709
709
|
<PlusIcon className="aui-attachment-add-icon size-5 stroke-[1.5px]" />
|
|
@@ -962,6 +962,7 @@ import { TooltipIconButton } from "@/components/assistant-ui/tooltip-icon-button
|
|
|
962
962
|
import { Button } from "@/components/ui/button";
|
|
963
963
|
import { cn } from "@/lib/utils";
|
|
964
964
|
import {
|
|
965
|
+
ActionBarMorePrimitive,
|
|
965
966
|
ActionBarPrimitive,
|
|
966
967
|
AssistantIf,
|
|
967
968
|
BranchPickerPrimitive,
|
|
@@ -978,6 +979,7 @@ import {
|
|
|
978
979
|
ChevronRightIcon,
|
|
979
980
|
CopyIcon,
|
|
980
981
|
DownloadIcon,
|
|
982
|
+
MoreHorizontalIcon,
|
|
981
983
|
PencilIcon,
|
|
982
984
|
RefreshCwIcon,
|
|
983
985
|
SquareIcon,
|
|
@@ -1199,16 +1201,33 @@ const AssistantActionBar: FC = () => {
|
|
|
1199
1201
|
</AssistantIf>
|
|
1200
1202
|
</TooltipIconButton>
|
|
1201
1203
|
</ActionBarPrimitive.Copy>
|
|
1202
|
-
<ActionBarPrimitive.ExportMarkdown asChild>
|
|
1203
|
-
<TooltipIconButton tooltip="Export as Markdown">
|
|
1204
|
-
<DownloadIcon />
|
|
1205
|
-
</TooltipIconButton>
|
|
1206
|
-
</ActionBarPrimitive.ExportMarkdown>
|
|
1207
1204
|
<ActionBarPrimitive.Reload asChild>
|
|
1208
1205
|
<TooltipIconButton tooltip="Refresh">
|
|
1209
1206
|
<RefreshCwIcon />
|
|
1210
1207
|
</TooltipIconButton>
|
|
1211
1208
|
</ActionBarPrimitive.Reload>
|
|
1209
|
+
<ActionBarMorePrimitive.Root>
|
|
1210
|
+
<ActionBarMorePrimitive.Trigger asChild>
|
|
1211
|
+
<TooltipIconButton
|
|
1212
|
+
tooltip="More"
|
|
1213
|
+
className="data-[state=open]:bg-accent"
|
|
1214
|
+
>
|
|
1215
|
+
<MoreHorizontalIcon />
|
|
1216
|
+
</TooltipIconButton>
|
|
1217
|
+
</ActionBarMorePrimitive.Trigger>
|
|
1218
|
+
<ActionBarMorePrimitive.Content
|
|
1219
|
+
side="bottom"
|
|
1220
|
+
align="start"
|
|
1221
|
+
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"
|
|
1222
|
+
>
|
|
1223
|
+
<ActionBarPrimitive.ExportMarkdown asChild>
|
|
1224
|
+
<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">
|
|
1225
|
+
<DownloadIcon className="size-4" />
|
|
1226
|
+
Export as Markdown
|
|
1227
|
+
</ActionBarMorePrimitive.Item>
|
|
1228
|
+
</ActionBarPrimitive.ExportMarkdown>
|
|
1229
|
+
</ActionBarMorePrimitive.Content>
|
|
1230
|
+
</ActionBarMorePrimitive.Root>
|
|
1212
1231
|
</ActionBarPrimitive.Root>
|
|
1213
1232
|
);
|
|
1214
1233
|
};
|
|
@@ -1309,98 +1328,329 @@ const BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({
|
|
|
1309
1328
|
## components/assistant-ui/tool-fallback.tsx
|
|
1310
1329
|
|
|
1311
1330
|
```tsx
|
|
1312
|
-
|
|
1331
|
+
"use client";
|
|
1332
|
+
|
|
1333
|
+
import { memo, useCallback, useRef, useState } from "react";
|
|
1313
1334
|
import {
|
|
1335
|
+
AlertCircleIcon,
|
|
1314
1336
|
CheckIcon,
|
|
1315
1337
|
ChevronDownIcon,
|
|
1316
|
-
|
|
1338
|
+
LoaderIcon,
|
|
1317
1339
|
XCircleIcon,
|
|
1318
1340
|
} from "lucide-react";
|
|
1319
|
-
import {
|
|
1320
|
-
|
|
1341
|
+
import {
|
|
1342
|
+
useScrollLock,
|
|
1343
|
+
type ToolCallMessagePartStatus,
|
|
1344
|
+
type ToolCallMessagePartComponent,
|
|
1345
|
+
} from "@assistant-ui/react";
|
|
1346
|
+
import {
|
|
1347
|
+
Collapsible,
|
|
1348
|
+
CollapsibleContent,
|
|
1349
|
+
CollapsibleTrigger,
|
|
1350
|
+
} from "@/components/ui/collapsible";
|
|
1321
1351
|
import { cn } from "@/lib/utils";
|
|
1322
1352
|
|
|
1323
|
-
|
|
1353
|
+
const ANIMATION_DURATION = 200;
|
|
1354
|
+
|
|
1355
|
+
export type ToolFallbackRootProps = Omit<
|
|
1356
|
+
React.ComponentProps<typeof Collapsible>,
|
|
1357
|
+
"open" | "onOpenChange"
|
|
1358
|
+
> & {
|
|
1359
|
+
open?: boolean;
|
|
1360
|
+
onOpenChange?: (open: boolean) => void;
|
|
1361
|
+
defaultOpen?: boolean;
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
function ToolFallbackRoot({
|
|
1365
|
+
className,
|
|
1366
|
+
open: controlledOpen,
|
|
1367
|
+
onOpenChange: controlledOnOpenChange,
|
|
1368
|
+
defaultOpen = false,
|
|
1369
|
+
children,
|
|
1370
|
+
...props
|
|
1371
|
+
}: ToolFallbackRootProps) {
|
|
1372
|
+
const collapsibleRef = useRef<HTMLDivElement>(null);
|
|
1373
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
1374
|
+
const lockScroll = useScrollLock(collapsibleRef, ANIMATION_DURATION);
|
|
1375
|
+
|
|
1376
|
+
const isControlled = controlledOpen !== undefined;
|
|
1377
|
+
const isOpen = isControlled ? controlledOpen : uncontrolledOpen;
|
|
1378
|
+
|
|
1379
|
+
const handleOpenChange = useCallback(
|
|
1380
|
+
(open: boolean) => {
|
|
1381
|
+
if (!open) {
|
|
1382
|
+
lockScroll();
|
|
1383
|
+
}
|
|
1384
|
+
if (!isControlled) {
|
|
1385
|
+
setUncontrolledOpen(open);
|
|
1386
|
+
}
|
|
1387
|
+
controlledOnOpenChange?.(open);
|
|
1388
|
+
},
|
|
1389
|
+
[lockScroll, isControlled, controlledOnOpenChange],
|
|
1390
|
+
);
|
|
1391
|
+
|
|
1392
|
+
return (
|
|
1393
|
+
<Collapsible
|
|
1394
|
+
ref={collapsibleRef}
|
|
1395
|
+
data-slot="tool-fallback-root"
|
|
1396
|
+
open={isOpen}
|
|
1397
|
+
onOpenChange={handleOpenChange}
|
|
1398
|
+
className={cn(
|
|
1399
|
+
"aui-tool-fallback-root group/tool-fallback-root w-full rounded-lg border py-3",
|
|
1400
|
+
className,
|
|
1401
|
+
)}
|
|
1402
|
+
style={
|
|
1403
|
+
{
|
|
1404
|
+
"--animation-duration": `${ANIMATION_DURATION}ms`,
|
|
1405
|
+
} as React.CSSProperties
|
|
1406
|
+
}
|
|
1407
|
+
{...props}
|
|
1408
|
+
>
|
|
1409
|
+
{children}
|
|
1410
|
+
</Collapsible>
|
|
1411
|
+
);
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
type ToolStatus = ToolCallMessagePartStatus["type"];
|
|
1415
|
+
|
|
1416
|
+
const statusIconMap: Record<ToolStatus, React.ElementType> = {
|
|
1417
|
+
running: LoaderIcon,
|
|
1418
|
+
complete: CheckIcon,
|
|
1419
|
+
incomplete: XCircleIcon,
|
|
1420
|
+
"requires-action": AlertCircleIcon,
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1423
|
+
function ToolFallbackTrigger({
|
|
1324
1424
|
toolName,
|
|
1325
|
-
argsText,
|
|
1326
|
-
result,
|
|
1327
1425
|
status,
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1426
|
+
className,
|
|
1427
|
+
...props
|
|
1428
|
+
}: React.ComponentProps<typeof CollapsibleTrigger> & {
|
|
1429
|
+
toolName: string;
|
|
1430
|
+
status?: ToolCallMessagePartStatus;
|
|
1431
|
+
}) {
|
|
1432
|
+
const statusType = status?.type ?? "complete";
|
|
1433
|
+
const isRunning = statusType === "running";
|
|
1331
1434
|
const isCancelled =
|
|
1332
1435
|
status?.type === "incomplete" && status.reason === "cancelled";
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
? status.error
|
|
1337
|
-
: JSON.stringify(status.error)
|
|
1338
|
-
: null;
|
|
1436
|
+
|
|
1437
|
+
const Icon = statusIconMap[statusType];
|
|
1438
|
+
const label = isCancelled ? "Cancelled tool" : "Used tool";
|
|
1339
1439
|
|
|
1340
1440
|
return (
|
|
1341
|
-
<
|
|
1441
|
+
<CollapsibleTrigger
|
|
1442
|
+
data-slot="tool-fallback-trigger"
|
|
1342
1443
|
className={cn(
|
|
1343
|
-
"aui-tool-fallback-
|
|
1344
|
-
|
|
1444
|
+
"aui-tool-fallback-trigger group/trigger flex w-full items-center gap-2 px-4 text-sm transition-colors",
|
|
1445
|
+
className,
|
|
1345
1446
|
)}
|
|
1447
|
+
{...props}
|
|
1346
1448
|
>
|
|
1347
|
-
<
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1449
|
+
<Icon
|
|
1450
|
+
data-slot="tool-fallback-trigger-icon"
|
|
1451
|
+
className={cn(
|
|
1452
|
+
"aui-tool-fallback-trigger-icon size-4 shrink-0",
|
|
1453
|
+
isCancelled && "text-muted-foreground",
|
|
1454
|
+
isRunning && "animate-spin",
|
|
1352
1455
|
)}
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
<div className="aui-tool-fallback-cancelled-root px-4">
|
|
1370
|
-
<p className="aui-tool-fallback-cancelled-header font-semibold text-muted-foreground">
|
|
1371
|
-
Cancelled reason:
|
|
1372
|
-
</p>
|
|
1373
|
-
<p className="aui-tool-fallback-cancelled-reason text-muted-foreground">
|
|
1374
|
-
{cancelledReason}
|
|
1375
|
-
</p>
|
|
1376
|
-
</div>
|
|
1377
|
-
)}
|
|
1378
|
-
<div
|
|
1379
|
-
className={cn(
|
|
1380
|
-
"aui-tool-fallback-args-root px-4",
|
|
1381
|
-
isCancelled && "opacity-60",
|
|
1382
|
-
)}
|
|
1456
|
+
/>
|
|
1457
|
+
<span
|
|
1458
|
+
data-slot="tool-fallback-trigger-label"
|
|
1459
|
+
className={cn(
|
|
1460
|
+
"aui-tool-fallback-trigger-label-wrapper relative inline-block grow text-left leading-none",
|
|
1461
|
+
isCancelled && "text-muted-foreground line-through",
|
|
1462
|
+
)}
|
|
1463
|
+
>
|
|
1464
|
+
<span>
|
|
1465
|
+
{label}: <b>{toolName}</b>
|
|
1466
|
+
</span>
|
|
1467
|
+
{isRunning && (
|
|
1468
|
+
<span
|
|
1469
|
+
aria-hidden
|
|
1470
|
+
data-slot="tool-fallback-trigger-shimmer"
|
|
1471
|
+
className="aui-tool-fallback-trigger-shimmer shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none"
|
|
1383
1472
|
>
|
|
1384
|
-
<
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1473
|
+
{label}: <b>{toolName}</b>
|
|
1474
|
+
</span>
|
|
1475
|
+
)}
|
|
1476
|
+
</span>
|
|
1477
|
+
<ChevronDownIcon
|
|
1478
|
+
data-slot="tool-fallback-trigger-chevron"
|
|
1479
|
+
className={cn(
|
|
1480
|
+
"aui-tool-fallback-trigger-chevron size-4 shrink-0",
|
|
1481
|
+
"transition-transform duration-(--animation-duration) ease-out",
|
|
1482
|
+
"group-data-[state=closed]/trigger:-rotate-90",
|
|
1483
|
+
"group-data-[state=open]/trigger:rotate-0",
|
|
1484
|
+
)}
|
|
1485
|
+
/>
|
|
1486
|
+
</CollapsibleTrigger>
|
|
1487
|
+
);
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
function ToolFallbackContent({
|
|
1491
|
+
className,
|
|
1492
|
+
children,
|
|
1493
|
+
...props
|
|
1494
|
+
}: React.ComponentProps<typeof CollapsibleContent>) {
|
|
1495
|
+
return (
|
|
1496
|
+
<CollapsibleContent
|
|
1497
|
+
data-slot="tool-fallback-content"
|
|
1498
|
+
className={cn(
|
|
1499
|
+
"aui-tool-fallback-content relative overflow-hidden text-sm outline-none",
|
|
1500
|
+
"group/collapsible-content ease-out",
|
|
1501
|
+
"data-[state=closed]:animate-collapsible-up",
|
|
1502
|
+
"data-[state=open]:animate-collapsible-down",
|
|
1503
|
+
"data-[state=closed]:fill-mode-forwards",
|
|
1504
|
+
"data-[state=closed]:pointer-events-none",
|
|
1505
|
+
"data-[state=open]:duration-(--animation-duration)",
|
|
1506
|
+
"data-[state=closed]:duration-(--animation-duration)",
|
|
1507
|
+
className,
|
|
1508
|
+
)}
|
|
1509
|
+
{...props}
|
|
1510
|
+
>
|
|
1511
|
+
<div className="mt-3 flex flex-col gap-2 border-t pt-2">{children}</div>
|
|
1512
|
+
</CollapsibleContent>
|
|
1513
|
+
);
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
function ToolFallbackArgs({
|
|
1517
|
+
argsText,
|
|
1518
|
+
className,
|
|
1519
|
+
...props
|
|
1520
|
+
}: React.ComponentProps<"div"> & {
|
|
1521
|
+
argsText?: string;
|
|
1522
|
+
}) {
|
|
1523
|
+
if (!argsText) return null;
|
|
1524
|
+
|
|
1525
|
+
return (
|
|
1526
|
+
<div
|
|
1527
|
+
data-slot="tool-fallback-args"
|
|
1528
|
+
className={cn("aui-tool-fallback-args px-4", className)}
|
|
1529
|
+
{...props}
|
|
1530
|
+
>
|
|
1531
|
+
<pre className="aui-tool-fallback-args-value whitespace-pre-wrap">
|
|
1532
|
+
{argsText}
|
|
1533
|
+
</pre>
|
|
1534
|
+
</div>
|
|
1535
|
+
);
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
function ToolFallbackResult({
|
|
1539
|
+
result,
|
|
1540
|
+
className,
|
|
1541
|
+
...props
|
|
1542
|
+
}: React.ComponentProps<"div"> & {
|
|
1543
|
+
result?: unknown;
|
|
1544
|
+
}) {
|
|
1545
|
+
if (result === undefined) return null;
|
|
1546
|
+
|
|
1547
|
+
return (
|
|
1548
|
+
<div
|
|
1549
|
+
data-slot="tool-fallback-result"
|
|
1550
|
+
className={cn(
|
|
1551
|
+
"aui-tool-fallback-result border-t border-dashed px-4 pt-2",
|
|
1552
|
+
className,
|
|
1401
1553
|
)}
|
|
1554
|
+
{...props}
|
|
1555
|
+
>
|
|
1556
|
+
<p className="aui-tool-fallback-result-header font-semibold">Result:</p>
|
|
1557
|
+
<pre className="aui-tool-fallback-result-content whitespace-pre-wrap">
|
|
1558
|
+
{typeof result === "string" ? result : JSON.stringify(result, null, 2)}
|
|
1559
|
+
</pre>
|
|
1402
1560
|
</div>
|
|
1403
1561
|
);
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
function ToolFallbackError({
|
|
1565
|
+
status,
|
|
1566
|
+
className,
|
|
1567
|
+
...props
|
|
1568
|
+
}: React.ComponentProps<"div"> & {
|
|
1569
|
+
status?: ToolCallMessagePartStatus;
|
|
1570
|
+
}) {
|
|
1571
|
+
if (status?.type !== "incomplete") return null;
|
|
1572
|
+
|
|
1573
|
+
const error = status.error;
|
|
1574
|
+
const errorText = error
|
|
1575
|
+
? typeof error === "string"
|
|
1576
|
+
? error
|
|
1577
|
+
: JSON.stringify(error)
|
|
1578
|
+
: null;
|
|
1579
|
+
|
|
1580
|
+
if (!errorText) return null;
|
|
1581
|
+
|
|
1582
|
+
const isCancelled = status.reason === "cancelled";
|
|
1583
|
+
const headerText = isCancelled ? "Cancelled reason:" : "Error:";
|
|
1584
|
+
|
|
1585
|
+
return (
|
|
1586
|
+
<div
|
|
1587
|
+
data-slot="tool-fallback-error"
|
|
1588
|
+
className={cn("aui-tool-fallback-error px-4", className)}
|
|
1589
|
+
{...props}
|
|
1590
|
+
>
|
|
1591
|
+
<p className="aui-tool-fallback-error-header font-semibold text-muted-foreground">
|
|
1592
|
+
{headerText}
|
|
1593
|
+
</p>
|
|
1594
|
+
<p className="aui-tool-fallback-error-reason text-muted-foreground">
|
|
1595
|
+
{errorText}
|
|
1596
|
+
</p>
|
|
1597
|
+
</div>
|
|
1598
|
+
);
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
const ToolFallbackImpl: ToolCallMessagePartComponent = ({
|
|
1602
|
+
toolName,
|
|
1603
|
+
argsText,
|
|
1604
|
+
result,
|
|
1605
|
+
status,
|
|
1606
|
+
}) => {
|
|
1607
|
+
const isCancelled =
|
|
1608
|
+
status?.type === "incomplete" && status.reason === "cancelled";
|
|
1609
|
+
|
|
1610
|
+
return (
|
|
1611
|
+
<ToolFallbackRoot
|
|
1612
|
+
className={cn(isCancelled && "border-muted-foreground/30 bg-muted/30")}
|
|
1613
|
+
>
|
|
1614
|
+
<ToolFallbackTrigger toolName={toolName} status={status} />
|
|
1615
|
+
<ToolFallbackContent>
|
|
1616
|
+
<ToolFallbackError status={status} />
|
|
1617
|
+
<ToolFallbackArgs
|
|
1618
|
+
argsText={argsText}
|
|
1619
|
+
className={cn(isCancelled && "opacity-60")}
|
|
1620
|
+
/>
|
|
1621
|
+
{!isCancelled && <ToolFallbackResult result={result} />}
|
|
1622
|
+
</ToolFallbackContent>
|
|
1623
|
+
</ToolFallbackRoot>
|
|
1624
|
+
);
|
|
1625
|
+
};
|
|
1626
|
+
|
|
1627
|
+
const ToolFallback = memo(
|
|
1628
|
+
ToolFallbackImpl,
|
|
1629
|
+
) as unknown as ToolCallMessagePartComponent & {
|
|
1630
|
+
Root: typeof ToolFallbackRoot;
|
|
1631
|
+
Trigger: typeof ToolFallbackTrigger;
|
|
1632
|
+
Content: typeof ToolFallbackContent;
|
|
1633
|
+
Args: typeof ToolFallbackArgs;
|
|
1634
|
+
Result: typeof ToolFallbackResult;
|
|
1635
|
+
Error: typeof ToolFallbackError;
|
|
1636
|
+
};
|
|
1637
|
+
|
|
1638
|
+
ToolFallback.displayName = "ToolFallback";
|
|
1639
|
+
ToolFallback.Root = ToolFallbackRoot;
|
|
1640
|
+
ToolFallback.Trigger = ToolFallbackTrigger;
|
|
1641
|
+
ToolFallback.Content = ToolFallbackContent;
|
|
1642
|
+
ToolFallback.Args = ToolFallbackArgs;
|
|
1643
|
+
ToolFallback.Result = ToolFallbackResult;
|
|
1644
|
+
ToolFallback.Error = ToolFallbackError;
|
|
1645
|
+
|
|
1646
|
+
export {
|
|
1647
|
+
ToolFallback,
|
|
1648
|
+
ToolFallbackRoot,
|
|
1649
|
+
ToolFallbackTrigger,
|
|
1650
|
+
ToolFallbackContent,
|
|
1651
|
+
ToolFallbackArgs,
|
|
1652
|
+
ToolFallbackResult,
|
|
1653
|
+
ToolFallbackError,
|
|
1404
1654
|
};
|
|
1405
1655
|
|
|
1406
1656
|
```
|
|
@@ -1580,6 +1830,45 @@ export { Button, buttonVariants };
|
|
|
1580
1830
|
|
|
1581
1831
|
```
|
|
1582
1832
|
|
|
1833
|
+
## components/ui/collapsible.tsx
|
|
1834
|
+
|
|
1835
|
+
```tsx
|
|
1836
|
+
"use client";
|
|
1837
|
+
|
|
1838
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
1839
|
+
|
|
1840
|
+
function Collapsible({
|
|
1841
|
+
...props
|
|
1842
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
|
1843
|
+
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
function CollapsibleTrigger({
|
|
1847
|
+
...props
|
|
1848
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
|
|
1849
|
+
return (
|
|
1850
|
+
<CollapsiblePrimitive.CollapsibleTrigger
|
|
1851
|
+
data-slot="collapsible-trigger"
|
|
1852
|
+
{...props}
|
|
1853
|
+
/>
|
|
1854
|
+
);
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
function CollapsibleContent({
|
|
1858
|
+
...props
|
|
1859
|
+
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
|
|
1860
|
+
return (
|
|
1861
|
+
<CollapsiblePrimitive.CollapsibleContent
|
|
1862
|
+
data-slot="collapsible-content"
|
|
1863
|
+
{...props}
|
|
1864
|
+
/>
|
|
1865
|
+
);
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
1869
|
+
|
|
1870
|
+
```
|
|
1871
|
+
|
|
1583
1872
|
## components/ui/dialog.tsx
|
|
1584
1873
|
|
|
1585
1874
|
```tsx
|
|
@@ -1835,33 +2124,34 @@ export default nextConfig;
|
|
|
1835
2124
|
"start": "next start"
|
|
1836
2125
|
},
|
|
1837
2126
|
"dependencies": {
|
|
1838
|
-
"@ai-sdk/openai": "^
|
|
2127
|
+
"@ai-sdk/openai": "^3.0.13",
|
|
1839
2128
|
"@assistant-ui/react": "workspace:*",
|
|
1840
2129
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
1841
2130
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
1842
2131
|
"@ffmpeg/ffmpeg": "^0.12.15",
|
|
1843
2132
|
"@ffmpeg/util": "^0.12.2",
|
|
1844
2133
|
"@radix-ui/react-avatar": "^1.1.11",
|
|
2134
|
+
"@radix-ui/react-collapsible": "^1.1.12",
|
|
1845
2135
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
1846
2136
|
"@radix-ui/react-slot": "^1.2.4",
|
|
1847
2137
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
1848
|
-
"ai": "^
|
|
2138
|
+
"ai": "^6.0.42",
|
|
1849
2139
|
"class-variance-authority": "^0.7.1",
|
|
1850
2140
|
"clsx": "^2.1.1",
|
|
1851
2141
|
"lucide-react": "^0.562.0",
|
|
1852
|
-
"next": "16.1.
|
|
1853
|
-
"react": "19.2.3",
|
|
1854
|
-
"react-dom": "19.2.3",
|
|
2142
|
+
"next": "^16.1.4",
|
|
2143
|
+
"react": "^19.2.3",
|
|
2144
|
+
"react-dom": "^19.2.3",
|
|
1855
2145
|
"remark-gfm": "^4.0.1",
|
|
1856
2146
|
"tailwind-merge": "^3.4.0",
|
|
1857
|
-
"zod": "^4.
|
|
1858
|
-
"zustand": "^5.0.
|
|
2147
|
+
"zod": "^4.3.5",
|
|
2148
|
+
"zustand": "^5.0.10"
|
|
1859
2149
|
},
|
|
1860
2150
|
"devDependencies": {
|
|
1861
2151
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
1862
2152
|
"@tailwindcss/postcss": "^4.1.18",
|
|
1863
|
-
"@types/node": "^25.0.
|
|
1864
|
-
"@types/react": "^19.2.
|
|
2153
|
+
"@types/node": "^25.0.9",
|
|
2154
|
+
"@types/react": "^19.2.9",
|
|
1865
2155
|
"@types/react-dom": "^19.2.3",
|
|
1866
2156
|
"postcss": "^8.5.6",
|
|
1867
2157
|
"tailwindcss": "^4.1.18",
|