Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed app/src/components/assistant-ui/elements/tool-fallback.tsx,app/src/components/a

Steven Enamakel3e7fa3893e13
diff --git a/app/src/components/assistant-ui/elements/day-separator.tsx b/app/src/components/assistant-ui/elements/day-separator.tsx
new file mode 100644
index 0000000000..0daf5695c3
--- /dev/null
+++ b/app/src/components/assistant-ui/elements/day-separator.tsx
@@ -0,0 +1,73 @@
+'use client';
+
+/**
+ * Vendored from the assistant-ui `elements-day-separator` registry item
+ * (https://r.assistant-ui.com/styles/base-nova/elements-day-separator.json).
+ * Changes from upstream:
+ * - `cn` import path (`@/components/assistant-ui/lib/utils`).
+ */
+import { cn } from '@/components/assistant-ui/lib/utils';
+import type { ComponentProps } from 'react';
+
+import { mono } from './surfaces';
+
+export interface DatedMessage {
+ id: string;
+ day: string;
+ time: string;
+ role: 'user' | 'assistant';
+ text: string;
+}
+
+export function DaySeparator({
+ messages,
+ className,
+ ...props
+}: Omit<ComponentProps<'div'>, 'children' | 'messages'> & {
+ messages: readonly DatedMessage[];
+}) {
+ let lastDay = '';
+
+ return (
+ <div data-slot="day-separator" className={cn('flex w-full max-w-sm flex-col gap-2', className)} {...props}>
+ {messages.map((message) => {
+ const newDay = message.day !== lastDay;
+ lastDay = message.day;
+
+ return (
+ <div key={message.id} className="flex flex-col gap-2">
+ {newDay && (
+ <div className="flex items-center gap-2.5 py-1">
+ <span className="bg-foreground/[0.08] h-px flex-1" />
+ <span className={cn(mono, 'text-foreground/30')}>{message.day}</span>
+ <span className="bg-foreground/[0.08] h-px flex-1" />
+ </div>
+ )}
+ <div
+ className={cn(
+ 'group flex items-baseline gap-2',
+ message.role === 'user' && 'flex-row-reverse'
+ )}>
+ <span
+ className={cn(
+ 'max-w-[80%] text-[13.5px] leading-relaxed break-words',
+ message.role === 'user'
+ ? 'bg-foreground/[0.05] rounded-2xl px-3.5 py-2'
+ : 'text-foreground/75'
+ )}>
+ {message.text}
+ </span>
+ <span
+ className={cn(
+ mono,
+ 'text-foreground/0 group-hover:text-foreground/30 shrink-0 tabular-nums transition-colors'
+ )}>
+ {message.time}
+ </span>
+ </div>
+ </div>
+ );
+ })}
+ </div>
+ );
+}
diff --git a/app/src/components/assistant-ui/elements/tool-fallback.tsx b/app/src/components/assistant-ui/elements/tool-fallback.tsx
index dcacc9c7bb..9264418d26 100644
--- a/app/src/components/assistant-ui/elements/tool-fallback.tsx
+++ b/app/src/components/assistant-ui/elements/tool-fallback.tsx
@@ -1,5 +1,30 @@
'use client';
+/**
+ * assistant-ui's tool-fallback element: the default renderer for any tool
+ * call the toolkit does not register its own element for, plus the shared
+ * approval bar every gated call renders while it waits on the user.
+ *
+ * Vendored from the assistant-ui `tool-fallback` registry item
+ * (https://r.assistant-ui.com/styles/base-nova/tool-fallback.json —
+ * `elements/tool-fallback.aui.tsx` upstream). Changes from upstream:
+ * - `cn` import path and Radix collapsible from `../ui/collapsible`.
+ * - `formatUnknownValue` handles `Error` values and an unserializable
+ * fallback the same way upstream does, but the cancelled-call result stays
+ * hidden (`!isCancelled && <ToolFallbackResult .../>`) rather than always
+ * rendered — a cancelled call's stale result would otherwise read as a
+ * real one.
+ * - **Not ported (blocked on a dependency bump, not a design choice):**
+ * upstream's free-text answer path (`Textarea`, `toolApprovalAcceptsText`,
+ * the `isQuestion`/`dismiss`/`promptText` branches) and the voice-session
+ * lock (`useAuiState(s => s.thread.voice)`) all read fields — `approval.
+ * display`, `approval.prompt`, `approval.dismissible`, a `text` member on
+ * `ToolApprovalResponse`, `thread.voice` — that do not exist on the
+ * `@assistant-ui/react` 0.15.16 / `@assistant-ui/core` 0.3.15 types pinned
+ * here (`toolApprovalAcceptsText` is not exported at all). Adding them
+ * needs the version bump the ground rules reserve for WS-A; until then the
+ * options/confirm decision bar below is the full approval surface.
+ */
import { cn } from '@/components/assistant-ui/lib/utils';
import { Button } from '@/components/assistant-ui/ui/button';
import {
@@ -218,6 +243,25 @@ function ToolFallbackArgs({
);
}
+const formatUnknownValue = (value: unknown, space?: number): string => {
+ if (typeof value === 'string') return value;
+
+ try {
+ if (value instanceof Error) return String(value);
+
+ const json = JSON.stringify(value, null, space);
+ if (json !== undefined) return json;
+ } catch {
+ // fall through to the String() fallback below
+ }
+
+ try {
+ return String(value);
+ } catch {
+ return '[Unserializable value]';
+ }
+};
+
function ToolFallbackResult({
result,
className,