Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
feat: add scroll-to-bottom button, rename inbox to unread, resize avatar parts
Gus4f421b103baa
diff --git a/src/web/src/app/(app)/w/[slug]/agents/[id]/activity/page.tsx b/src/web/src/app/(app)/w/[slug]/agents/[id]/activity/page.tsxindex bbfdbe38e..b00de039b 100644--- a/src/web/src/app/(app)/w/[slug]/agents/[id]/activity/page.tsx+++ b/src/web/src/app/(app)/w/[slug]/agents/[id]/activity/page.tsx@@ -22,6 +22,7 @@ import {RotateCw,Loader2,} from "lucide-react";+import { ScrollToBottomButton } from "@/components/ui/scroll-to-bottom-button";const ACTIVITY_LIMIT = 30;@@ -339,47 +340,50 @@ export default function AgentActivityPage() {</div>{/* Scroll container */}- <div- ref={scrollRef}- className="flex-1 overflow-y-auto thin-scrollbar"- onScroll={handleScroll}- >- {loading ? (- <div className="flex flex-col">- <SkeletonRow promptWidth="40%" />- <SkeletonRow promptWidth="55%" />- <SkeletonRow promptWidth="48%" />- </div>- ) : tasks.length === 0 ? (- <div className="flex flex-col items-center justify-center h-full animate-[fade-up_400ms_ease-out_both]">- <History className="size-8 text-muted-foreground mb-3" />- <p className="text-sm text-muted-foreground">No activity yet</p>- {(statusFilter || typeFilter) && (- <p className="text-xs text-muted-foreground/60 mt-1">- Try changing your filters- </p>- )}- </div>- ) : (- <div className="flex flex-col animate-[fade-up_400ms_ease-out_both]">- {loadingMore && (- <>- <SkeletonRow promptWidth="48%" />- <SkeletonRow promptWidth="40%" />- </>- )}- {tasks.map((task) => (- <ActivityRow- key={task.id}- task={task}- slug={slug}- agentId={agentId}- workspaceId={workspaceId}- onRetry={loadInitial}- />- ))}- </div>- )}+ <div className="relative flex-1 min-h-0">+ <div+ ref={scrollRef}+ className="h-full overflow-y-auto thin-scrollbar"+ onScroll={handleScroll}+ >+ {loading ? (+ <div className="flex flex-col">+ <SkeletonRow promptWidth="40%" />+ <SkeletonRow promptWidth="55%" />+ <SkeletonRow promptWidth="48%" />+ </div>+ ) : tasks.length === 0 ? (+ <div className="flex flex-col items-center justify-center h-full animate-[fade-up_400ms_ease-out_both]">+ <History className="size-8 text-muted-foreground mb-3" />+ <p className="text-sm text-muted-foreground">No activity yet</p>+ {(statusFilter || typeFilter) && (+ <p className="text-xs text-muted-foreground/60 mt-1">+ Try changing your filters+ </p>+ )}+ </div>+ ) : (+ <div className="flex flex-col animate-[fade-up_400ms_ease-out_both]">+ {loadingMore && (+ <>+ <SkeletonRow promptWidth="48%" />+ <SkeletonRow promptWidth="40%" />+ </>+ )}+ {tasks.map((task) => (+ <ActivityRow+ key={task.id}+ task={task}+ slug={slug}+ agentId={agentId}+ workspaceId={workspaceId}+ onRetry={loadInitial}+ />+ ))}+ </div>+ )}+ </div>+ <ScrollToBottomButton scrollRef={scrollRef} /></div></>);diff --git a/src/web/src/app/(app)/w/[slug]/inbox/page.tsx b/src/web/src/app/(app)/w/[slug]/unread/page.tsxsimilarity index 99%rename from src/web/src/app/(app)/w/[slug]/inbox/page.tsxrename to src/web/src/app/(app)/w/[slug]/unread/page.tsxindex 7185dae7e..68d4ce009 100644--- a/src/web/src/app/(app)/w/[slug]/inbox/page.tsx+++ b/src/web/src/app/(app)/w/[slug]/unread/page.tsx@@ -202,7 +202,7 @@ export default function InboxPage() {<div className="flex flex-col h-full"><div className="flex items-center justify-between border-b border-border/50 px-3 md:px-5 py-2.5 gap-3"><div className="flex items-center gap-3 min-w-0">- <h1 className="text-sm font-medium">Inbox</h1>+ <h1 className="text-sm font-medium">Unread</h1><p className="text-xs text-muted-foreground hidden md:block">Unread responses from your agents.</p>diff --git a/src/web/src/components/agent-chat/agent-chat-view.tsx b/src/web/src/components/agent-chat/agent-chat-view.tsxindex a67a88c75..f42481ced 100644--- a/src/web/src/components/agent-chat/agent-chat-view.tsx+++ b/src/web/src/components/agent-chat/agent-chat-view.tsx@@ -44,6 +44,7 @@ import { ArtifactSheet, formatSize } from "@/components/agent-chat/artifact-sheeimport { EmailEventSheet } from "@/components/agent-chat/email-event-sheet";import { isPreviewable, getArtifactUrl } from "@/components/artifact-content-renderer";import { FollowUpBuffer } from "@/components/agent-chat/follow-up-buffer";+import { ScrollToBottomButton } from "@/components/ui/scroll-to-bottom-button";import { MessageItem } from "@/components/agent-chat/message-list";import { AgentPreviewCard } from "@/components/agent-preview-card";import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popover";@@ -1335,117 +1336,120 @@ export function AgentChatView() {</button>)}{/* Messages */}- <div- className="flex-1 overflow-y-auto overflow-x-hidden px-3 md:px-5 thin-scrollbar"- ref={scrollRef}- onScroll={handleScroll}- onClick={(e) => {- const btn = (e.target as HTMLElement).closest(- '[data-streamdown="code-block-actions"] button'- );- if (btn) toast.success("Copied to clipboard");- }}- >- <div className="mx-auto max-w-2xl py-6 space-y-4">- {canLoadMore && !loadingMore && (- <div className="flex justify-center py-2">- <button- onClick={() => loadOlderMessages()}- className="text-xs text-muted-foreground hover:text-foreground transition-colors"- >- Load earlier messages- </button>- </div>- )}- {loadingMore && (- <div className="flex justify-center py-2">- <Loader2 className="size-4 animate-spin text-muted-foreground" />- </div>- )}+ <div className="relative flex-1 min-h-0">+ <div+ className="h-full overflow-y-auto overflow-x-hidden px-3 md:px-5 thin-scrollbar"+ ref={scrollRef}+ onScroll={handleScroll}+ onClick={(e) => {+ const btn = (e.target as HTMLElement).closest(+ '[data-streamdown="code-block-actions"] button'+ );+ if (btn) toast.success("Copied to clipboard");+ }}+ >+ <div className="mx-auto max-w-2xl py-6 space-y-4">+ {canLoadMore && !loadingMore && (+ <div className="flex justify-center py-2">+ <button+ onClick={() => loadOlderMessages()}+ className="text-xs text-muted-foreground hover:text-foreground transition-colors"+ >+ Load earlier messages+ </button>+ </div>+ )}+ {loadingMore && (+ <div className="flex justify-center py-2">+ <Loader2 className="size-4 animate-spin text-muted-foreground" />+ </div>+ )}- {messages.length === 0 && !activeTask && (() => {- const agent = agents.find(a => a.id === agentId);- const isNewAgent = agent?.created_at && (renderNow - new Date(agent.created_at).getTime() < 5 * 60 * 1000);- const hasEmailTask = (activeTaskCounts[agentId] ?? 0) > 0;+ {messages.length === 0 && !activeTask && (() => {+ const agent = agents.find(a => a.id === agentId);+ const isNewAgent = agent?.created_at && (renderNow - new Date(agent.created_at).getTime() < 5 * 60 * 1000);+ const hasEmailTask = (activeTaskCounts[agentId] ?? 0) > 0;++ if (isNewAgent && hasEmailTask && activeChannel === "default") {+ return (+ <div className="flex flex-col items-center justify-center py-20 gap-3 animate-[fade-up_400ms_ease-out_both]">+ <div className="relative animate-bounce">+ <Mail className="size-8 text-primary" />+ <span className="absolute -top-1 -right-1 flex size-3">+ <span className="animate-ping absolute inline-flex size-full rounded-full bg-primary/60" />+ <span className="relative inline-flex size-3 rounded-full bg-primary" />+ </span>+ </div>+ <p className="text-sm text-muted-foreground text-center max-w-xs">+ Your agent is sending you a welcome email.+ </p>+ <p className="text-xs text-muted-foreground/60 text-center max-w-xs">+ Wait for the email task in the top-left to complete, then check your inbox. Or send a message below to start chatting.+ </p>+ </div>+ );+ }- if (isNewAgent && hasEmailTask && activeChannel === "default") {return (- <div className="flex flex-col items-center justify-center py-20 gap-3 animate-[fade-up_400ms_ease-out_both]">- <div className="relative animate-bounce">- <Mail className="size-8 text-primary" />- <span className="absolute -top-1 -right-1 flex size-3">- <span className="animate-ping absolute inline-flex size-full rounded-full bg-primary/60" />- <span className="relative inline-flex size-3 rounded-full bg-primary" />- </span>- </div>- <p className="text-sm text-muted-foreground text-center max-w-xs">- Your agent is sending you a welcome email.- </p>- <p className="text-xs text-muted-foreground/60 text-center max-w-xs">- Wait for the email task in the top-left to complete, then check your inbox. Or send a message below to start chatting.- </p>- </div>+ <p className="text-center text-muted-foreground py-20 text-sm">+ Send a message to start chatting with the agent.+ </p>);- }+ })()}- return (- <p className="text-center text-muted-foreground py-20 text-sm">- Send a message to start chatting with the agent.- </p>- );- })()}+ {timeline.map((item) => {+ if (item.kind === "nap") {+ return <NapSeparator key={item.data.id} agentName={agentName} />;+ }- {timeline.map((item) => {- if (item.kind === "nap") {- return <NapSeparator key={item.data.id} agentName={agentName} />;- }+ if (item.kind === "artifact") {+ return (+ <ArtifactCard+ key={`artifact-${item.data.id}`}+ artifact={item.data}+ onClick={handleArtifactClick}+ />+ );+ }- if (item.kind === "artifact") {+ const msg = item.data;return (- <ArtifactCard- key={`artifact-${item.data.id}`}- artifact={item.data}- onClick={handleArtifactClick}+ <MessageItem+ key={msg.id}+ msg={msg}+ agents={agents}+ artifacts={artifacts}+ activeTask={activeTask}+ taskMessages={taskMessages}+ connectionLost={connectionLost}+ isLastMessage={messages.length > 0 && messages[messages.length - 1].id === msg.id}+ stepCount={msg.task_id ? (stepCounts[msg.task_id] ?? 0) : 0}+ targetConvId={targetConvId}+ workspaceId={workspaceId}+ conversationType={conversation?.type}+ pendingFilesByMessage={pendingFilesByMessage}+ onArtifactClick={handleArtifactClick}+ onEmailClick={(emailId) => {+ setSelectedEmailId(emailId);+ setEmailSheetOpen(true);+ }}+ onRetry={handleRetryTask}+ mentionComponents={MENTION_COMPONENTS}/>);- }+ })}- const msg = item.data;- return (- <MessageItem- key={msg.id}- msg={msg}- agents={agents}- artifacts={artifacts}- activeTask={activeTask}- taskMessages={taskMessages}+ {/* Show trace while task is in progress (no assistant message yet) */}+ {activeTask && !["completed", "failed", "cancelled", "superseded"].includes(activeTask.status) && (+ <TaskStream+ task={activeTask}+ messages={taskMessages}connectionLost={connectionLost}- isLastMessage={messages.length > 0 && messages[messages.length - 1].id === msg.id}- stepCount={msg.task_id ? (stepCounts[msg.task_id] ?? 0) : 0}- targetConvId={targetConvId}- workspaceId={workspaceId}- conversationType={conversation?.type}- pendingFilesByMessage={pendingFilesByMessage}- onArtifactClick={handleArtifactClick}- onEmailClick={(emailId) => {- setSelectedEmailId(emailId);- setEmailSheetOpen(true);- }}- onRetry={handleRetryTask}- mentionComponents={MENTION_COMPONENTS}/>- );- })}-- {/* Show trace while task is in progress (no assistant message yet) */}- {activeTask && !["completed", "failed", "cancelled", "superseded"].includes(activeTask.status) && (- <TaskStream- task={activeTask}- messages={taskMessages}- connectionLost={connectionLost}- />- )}+ )}+ </div></div>+ <ScrollToBottomButton scrollRef={scrollRef} /></div>{/* Follow-up buffer indicator */}diff --git a/src/web/src/components/app-sidebar.tsx b/src/web/src/components/app-sidebar.tsxindex dab10008c..90a83ea1a 100644--- a/src/web/src/components/app-sidebar.tsx+++ b/src/web/src/components/app-sidebar.tsx@@ -176,7 +176,7 @@ export function AppSidebar({ onNavigate }: { onNavigate?: () => void } = {}) {const isHome = pathname === `${prefix}/home`;const isRuntimes = pathname === `${prefix}/runtimes`;const isCalendar = pathname === `${prefix}/calendar`;- const isInbox = pathname.startsWith(`${prefix}/inbox`);+ const isInbox = pathname.startsWith(`${prefix}/unread`);const isIssues = pathname.startsWith(`${prefix}/issues`);const isSettings = pathname === `${prefix}/settings`;const isCreateAgent = pathname === `${prefix}/agents/new`;@@ -268,7 +268,7 @@ export function AppSidebar({ onNavigate }: { onNavigate?: () => void } = {}) {<TooltipTrigger render={<buttontype="button"- onClick={() => { router.push(`${prefix}/inbox`); onNavigate?.(); }}+ onClick={() => { router.push(`${prefix}/unread`); onNavigate?.(); }}className={cn("relative flex items-center justify-center size-10 rounded-xl transition-colors duration-200 cursor-pointer","text-muted-foreground hover:text-foreground hover:bg-accent",@@ -283,7 +283,7 @@ export function AppSidebar({ onNavigate }: { onNavigate?: () => void } = {}) {</span>)}</TooltipTrigger>- <TooltipContent side="right">Inbox</TooltipContent>+ <TooltipContent side="right">Unread</TooltipContent></Tooltip><Tooltip>diff --git a/src/web/src/components/avatar/avatar-parts.tsx b/src/web/src/components/avatar/avatar-parts.tsxindex 1c2232357..cf45d8911 100644--- a/src/web/src/components/avatar/avatar-parts.tsx+++ b/src/web/src/components/avatar/avatar-parts.tsx@@ -121,36 +121,36 @@ export interface NoseDef {export const Noses: Record<string, NoseDef> = {dot: {name: "Dot",- render: (c = DEFAULT_FACE_COLOR) => <circle cx="0" cy="0" r="3" fill={c} />,+ render: (c = DEFAULT_FACE_COLOR) => <circle cx="0" cy="0" r="4.5" fill={c} />,},dash: {name: "Dash",- render: (c = DEFAULT_FACE_COLOR) => <line x1="-7" y1="0" x2="7" y2="0" stroke={c} strokeWidth="4" strokeLinecap="round" />,+ render: (c = DEFAULT_FACE_COLOR) => <line x1="-10" y1="0" x2="10" y2="0" stroke={c} strokeWidth="5" strokeLinecap="round" />,},hookL: {name: "Hook",- render: (c = DEFAULT_FACE_COLOR) => <path d="M-8 0 Q-4 5 0 1 Q4 5 8 0" fill="none" stroke={c} strokeWidth="3.5" strokeLinecap="round" strokeLinejoin="round" />,+ render: (c = DEFAULT_FACE_COLOR) => <path d="M-11 0 Q-5.5 7 0 1.5 Q5.5 7 11 0" fill="none" stroke={c} strokeWidth="4.5" strokeLinecap="round" strokeLinejoin="round" />,},smile: {name: "Smile",- render: (c = DEFAULT_FACE_COLOR) => <path d="M-8 0 Q0 8 8 0" fill="none" stroke={c} strokeWidth="4" strokeLinecap="round" />,+ render: (c = DEFAULT_FACE_COLOR) => <path d="M-11 0 Q0 11 11 0" fill="none" stroke={c} strokeWidth="5" strokeLinecap="round" />,},caret: {name: "Caret",render: (c = DEFAULT_FACE_COLOR) => (<g>- <path d="M-7 0 Q0 6 7 0" fill="none" stroke={c} strokeWidth="3.5" strokeLinecap="round" />- <ellipse cx="2" cy="5" rx="3" ry="3.5" fill="#f472b6" />+ <path d="M-10 0 Q0 8 10 0" fill="none" stroke={c} strokeWidth="4.5" strokeLinecap="round" />+ <ellipse cx="3" cy="6" rx="4" ry="4.5" fill="#f472b6" /></g>),},arrow: {name: "Arrow",- render: (c = DEFAULT_FACE_COLOR) => <ellipse cx="0" cy="0" rx="4.5" ry="5.5" fill={c} />,+ render: (c = DEFAULT_FACE_COLOR) => <ellipse cx="0" cy="0" rx="6" ry="7.5" fill={c} />,},oh: {name: "o",- render: (c = DEFAULT_FACE_COLOR) => <ellipse cx="0" cy="0" rx="5" ry="5.5" fill="none" stroke={c} strokeWidth="3.5" />,+ render: (c = DEFAULT_FACE_COLOR) => <ellipse cx="0" cy="0" rx="7" ry="7.5" fill="none" stroke={c} strokeWidth="4.5" />,},};@@ -179,47 +179,47 @@ const eye = (l: (c: string) => ReactNode, r?: (c: string) => ReactNode) => {export const Eyes: Record<string, EyeDef> = {dots: {name: "Dots",- render: eye((c) => <circle cx="0" cy="0" r="5" fill={c} />),+ render: eye((c) => <circle cx="0" cy="0" r="7" fill={c} />),},big: {name: "Big",render: eye((c) => (<g>- <circle cx="0" cy="0" r="7.5" fill={c} />- <circle cx="2" cy="-2" r="2.5" fill="rgba(255,255,255,0.9)" />+ <circle cx="0" cy="0" r="10" fill={c} />+ <circle cx="2.5" cy="-3" r="3.5" fill="rgba(255,255,255,0.9)" /></g>)),},rings: {name: "Rings",- render: eye((c) => <ellipse cx="0" cy="0" rx="6" ry="7" fill="none" stroke={c} strokeWidth="3.5" />),+ render: eye((c) => <ellipse cx="0" cy="0" rx="8.5" ry="9.5" fill="none" stroke={c} strokeWidth="4.5" />),},arches: {name: "Arches",- render: eye((c) => <path d="M-7 2 Q0 -6 7 2" fill="none" stroke={c} strokeWidth="4" strokeLinecap="round" />),+ render: eye((c) => <path d="M-10 2 Q0 -9 10 2" fill="none" stroke={c} strokeWidth="5" strokeLinecap="round" />),},lines: {name: "Lines",- render: eye((c) => <path d="M-7 0 Q0 -4 7 0" fill="none" stroke={c} strokeWidth="4" strokeLinecap="round" />),+ render: eye((c) => <path d="M-10 0 Q0 -6 10 0" fill="none" stroke={c} strokeWidth="5" strokeLinecap="round" />),},happy: {name: "Happy",- render: eye((c) => <path d="M-7 4 Q0 -8 7 4" fill="none" stroke={c} strokeWidth="4" strokeLinecap="round" />),+ render: eye((c) => <path d="M-10 5 Q0 -11 10 5" fill="none" stroke={c} strokeWidth="5" strokeLinecap="round" />),},sleepy: {name: "Sleepy",- render: eye((c) => <path d="M-7 -2 Q0 6 7 -2" fill="none" stroke={c} strokeWidth="4" strokeLinecap="round" />),+ render: eye((c) => <path d="M-10 -2 Q0 8 10 -2" fill="none" stroke={c} strokeWidth="5" strokeLinecap="round" />),},shy: {name: "Shy",- render: eye((c) => <ellipse cx="0" cy="0" rx="6" ry="7" fill={c} />),+ render: eye((c) => <ellipse cx="0" cy="0" rx="8.5" ry="9.5" fill={c} />),},wink: {name: "Wink",render: (dx: number, c = DEFAULT_FACE_COLOR) => (<g>- <g transform={`translate(${-dx}, 0)`}><circle cx="0" cy="0" r="5" fill={c} /></g>- <g transform={`translate(${dx}, 0)`}><path d="M-7 2 Q0 -6 7 2" fill="none" stroke={c} strokeWidth="4" strokeLinecap="round" /></g>+ <g transform={`translate(${-dx}, 0)`}><circle cx="0" cy="0" r="7" fill={c} /></g>+ <g transform={`translate(${dx}, 0)`}><path d="M-10 2 Q0 -9 10 2" fill="none" stroke={c} strokeWidth="5" strokeLinecap="round" /></g></g>),},@@ -302,8 +302,8 @@ export function AvatarRenderer({ config, size = 200, className }: AvatarRendererconst faceColor = bgEntry.faceColor;const { cx, cy, w } = sh.face;- const eyeDx = Math.max(11, w * 0.22);- const eyeY = cy - Math.max(10, w * 0.14);+ const eyeDx = Math.max(13, w * 0.24);+ const eyeY = cy - Math.max(12, w * 0.16);return (<svg@@ -332,7 +332,7 @@ export function AvatarRenderer({ config, size = 200, className }: AvatarRenderer<g transform="translate(100,100) scale(0.8) translate(-100,-100)"><g data-avatar-shape="" filter={`url(#sh-${uid})`}>{sh.render()}</g>{ey && <g transform={`translate(${cx}, ${eyeY})`}><g data-avatar-eyes="">{ey.render(eyeDx, faceColor)}</g></g>}- {no && <g transform={`translate(${cx}, ${cy + 5})`}><g data-avatar-nose="">{no.render(faceColor)}</g></g>}+ {no && <g transform={`translate(${cx}, ${cy + 7})`}><g data-avatar-nose="">{no.render(faceColor)}</g></g>}</g></svg>);diff --git a/src/web/src/components/ui/scroll-to-bottom-button.tsx b/src/web/src/components/ui/scroll-to-bottom-button.tsxnew file mode 100644index 000000000..2993d6731--- /dev/null+++ b/src/web/src/components/ui/scroll-to-bottom-button.tsx@@ -0,0 +1,73 @@+"use client";++import { useState, useEffect, useCallback, type RefObject } from "react";+import { Button } from "@/components/ui/button";+import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";+import { ArrowDown } from "lucide-react";+import { cn } from "@/lib/utils";++interface ScrollToBottomButtonProps {+ scrollRef: RefObject<HTMLDivElement | null>;+ threshold?: number;+}++export function ScrollToBottomButton({ scrollRef, threshold = 100 }: ScrollToBottomButtonProps) {+ const [showButton, setShowButton] = useState(false);++ const check = useCallback(() => {+ const el = scrollRef.current;+ if (!el) return;+ const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < threshold;+ const hasOverflow = el.scrollHeight > el.clientHeight;+ setShowButton(hasOverflow && !atBottom);+ }, [scrollRef, threshold]);++ useEffect(() => {+ const el = scrollRef.current;+ if (!el) return;++ el.addEventListener("scroll", check, { passive: true });+ check();++ const ro = new ResizeObserver(check);+ ro.observe(el);++ return () => {+ el.removeEventListener("scroll", check);+ ro.disconnect();+ };+ }, [scrollRef, check]);++ const handleClick = () => {+ const el = scrollRef.current;+ if (!el) return;+ el.scrollTo({ top: el.scrollHeight, behavior: "smooth" });+ };++ return (+ <div+ className={cn(+ "absolute bottom-1 left-1/2 -translate-x-1/2 z-10 transition-all duration-200 ease-out",+ showButton+ ? "opacity-100 translate-y-0"+ : "opacity-0 translate-y-2 pointer-events-none"+ )}+ >+ <Tooltip>+ <TooltipTrigger+ render={+ <Button+ variant="ghost"+ size="icon-sm"+ onClick={handleClick}+ className="rounded-full bg-background/80 backdrop-blur-sm border shadow-sm hover:bg-background"+ />+ }+ >+ <ArrowDown />+ </TooltipTrigger>+ <TooltipContent side="top">Scroll to bottom</TooltipContent>+ </Tooltip>+ </div>+ );+}