Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

feat: improve UI loading size

Gus7baa4f63bd9e
diff --git a/src/web/src/app/globals.css b/src/web/src/app/globals.css
index f5963943f..eb874bd08 100644
--- a/src/web/src/app/globals.css
+++ b/src/web/src/app/globals.css
@@ -13,7 +13,7 @@
--font-sans: var(--font-dm-sans);
--font-mono: var(--font-dm-mono);
--font-heading: var(--font-dm-sans);
- --font-display: var(--font-bricolage);
+ --font-display: var(--font-dm-sans);
--font-news: var(--font-literata);
--font-brand: var(--font-caveat);
--color-sidebar-ring: var(--sidebar-ring);
diff --git a/src/web/src/app/layout.tsx b/src/web/src/app/layout.tsx
index fddeb9cb4..555277fd1 100644
--- a/src/web/src/app/layout.tsx
+++ b/src/web/src/app/layout.tsx
@@ -3,7 +3,6 @@ import {
DM_Sans,
DM_Mono,
Caveat,
- Bricolage_Grotesque,
VT323,
Literata,
} from "next/font/google";
@@ -31,12 +30,6 @@ const caveat = Caveat({
weight: ["700"],
});
-const bricolage = Bricolage_Grotesque({
- variable: "--font-bricolage",
- subsets: ["latin"],
- weight: ["300", "400", "500", "600", "700", "800"],
-});
-
const vt323 = VT323({
variable: "--font-vt323",
subsets: ["latin"],
@@ -119,7 +112,7 @@ export default function RootLayout({
return (
<html
lang="en"
- className={`${dmSans.variable} ${dmMono.variable} ${caveat.variable} ${bricolage.variable} ${vt323.variable} ${literata.variable} h-full antialiased`}
+ className={`${dmSans.variable} ${dmMono.variable} ${caveat.variable} ${vt323.variable} ${literata.variable} h-full antialiased`}
suppressHydrationWarning
>
<head>
diff --git a/src/web/src/app/page.tsx b/src/web/src/app/page.tsx
index 0b7a20e6d..585484254 100644
--- a/src/web/src/app/page.tsx
+++ b/src/web/src/app/page.tsx
@@ -1,8 +1,12 @@
import type { Metadata } from "next";
+import dynamic from "next/dynamic";
import { getSession } from "@/lib/session";
-import { HomePage } from "@/components/home/home-page";
import { WorkspaceRedirect } from "@/components/workspace-redirect";
+const HomePage = dynamic(() => import("@/components/home/home-page").then(m => ({ default: m.HomePage })), {
+ ssr: true,
+});
+
export const metadata: Metadata = {
title: "Alook — Your Personal Company",
description:
diff --git a/src/web/src/components/agent-chat/agent-chat-view.tsx b/src/web/src/components/agent-chat/agent-chat-view.tsx
index 349e326cb..8d5c4fc95 100644
--- a/src/web/src/components/agent-chat/agent-chat-view.tsx
+++ b/src/web/src/components/agent-chat/agent-chat-view.tsx
@@ -35,7 +35,7 @@ import { toast } from "sonner";
import { cn } from "@/lib/utils";
import { Skeleton } from "@/components/ui/skeleton";
import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
-import { ArrowUp, BedDouble, Box, Calendar, CircleDot, FileText, Loader2, Mail, MessageSquareQuote, Mic, Paperclip, Square, X } from "lucide-react";
+import { ArrowUp, BedDouble, Box, FileText, Loader2, Mail, MessageSquareQuote, Mic, Paperclip, Square, X } from "lucide-react";
import { useSpeechRecognition } from "@/hooks/use-speech-recognition";
import { useMentionPopup } from "@/hooks/use-mention-popup";
import { MentionPopup } from "@/components/agent-chat/mention-popup";
@@ -43,9 +43,8 @@ import { highlightMentions } from "@/lib/highlight-mentions";
import { ArtifactSheet, formatSize } from "@/components/agent-chat/artifact-sheet";
import { EmailEventSheet } from "@/components/agent-chat/email-event-sheet";
import { isPreviewable, getArtifactUrl } from "@/components/artifact-content-renderer";
-import { Streamdown } from "streamdown";
import { FollowUpBuffer } from "@/components/agent-chat/follow-up-buffer";
-import { HistoricalTaskSteps } from "@/components/agent-chat/historical-task-steps";
+import { MessageItem } from "@/components/agent-chat/message-list";
import { AgentPreviewCard } from "@/components/agent-preview-card";
import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popover";
@@ -98,14 +97,6 @@ export function getEventIconType(content: string, conversationType?: string | nu
return "calendar";
}
-function EventMessageIcon({ content, conversationType }: { content: string; conversationType?: string | null }) {
- const iconType = getEventIconType(content, conversationType);
- const className = "h-4 w-4 mt-0.5 shrink-0";
-
- if (iconType === "issue") return <CircleDot className={className} />;
- if (iconType === "email") return <Mail className={className} />;
- return <Calendar className={className} />;
-}
/** Sort messages by (created_at, id) ascending — guarantees chronological order. */
export function sortMessages(msgs: Message[]): Message[] {
@@ -265,63 +256,6 @@ function ArtifactCard({ artifact, onClick }: { artifact: Artifact; onClick: (a:
);
}
-function AttachmentChips({
- attachmentIds,
- artifacts,
- onArtifactClick,
-}: {
- attachmentIds: string[];
- artifacts: Artifact[];
- onArtifactClick: (a: Artifact) => void;
-}) {
- const matched = attachmentIds
- .map((id) => artifacts.find((a) => a.id === id))
- .filter((a): a is Artifact => !!a);
-
- if (matched.length === 0) return null;
-
- return (
- <div className="flex flex-wrap gap-1.5 mt-1.5">
- {matched.map((a) => (
- <button
- key={a.id}
- type="button"
- onClick={(e) => { e.stopPropagation(); onArtifactClick(a); }}
- className="inline-flex items-center gap-1 rounded-md bg-primary-foreground/10 border border-primary-foreground/20 px-2 py-0.5 text-xs text-primary-foreground/80 hover:bg-primary-foreground/20 transition-colors cursor-pointer"
- >
- <FileText className="size-3 shrink-0" />
- <span className="truncate max-w-37.5">{a.filename}</span>
- </button>
- ))}
- </div>
- );
-}
-
-function PendingFileChips({
- pendingFiles,
- messageId,
-}: {
- pendingFiles: Map<string, File[]>;
- messageId: string;
-}) {
- const files = pendingFiles.get(messageId);
- if (!files || files.length === 0) return null;
-
- return (
- <div className="flex flex-wrap gap-1.5 mt-1.5">
- {files.map((f, i) => (
- <span
- key={i}
- className="inline-flex items-center gap-1 rounded-md bg-primary-foreground/10 border border-primary-foreground/20 px-2 py-0.5 text-xs text-primary-foreground/80"
- >
- <FileText className="size-3 shrink-0" />
- <span className="truncate max-w-37.5">{f.name}</span>
- </span>
- ))}
- </div>
- );
-}
-
export function AgentChatView() {
const params = useParams();
const searchParams = useSearchParams();
@@ -1446,88 +1380,29 @@ export function AgentChatView() {
}
const msg = item.data;
- const hasTaskStream =
- activeTask &&
- msg.role === "assistant" &&
- msg.task_id === activeTask.id &&
- taskMessages.length > 0;
-
- const historicalStepCount =
- !hasTaskStream &&
- targetConvId &&
- msg.role === "assistant" &&
- msg.task_id &&
- stepCounts[msg.task_id] > 0
- ? stepCounts[msg.task_id]
- : 0;
-
return (
- <React.Fragment key={msg.id}>
- {hasTaskStream && (
- <TaskStream
- task={activeTask}
- messages={taskMessages}
- connectionLost={connectionLost}
- onRetry={handleRetryTask}
- />
- )}
- {historicalStepCount > 0 && msg.task_id && (
- <HistoricalTaskSteps
- taskId={msg.task_id}
- stepCount={historicalStepCount}
- workspaceId={workspaceId}
- />
- )}
- {msg.role === "user" ? (() => {
- const isLastUser = messages.length > 0 && messages[messages.length - 1].id === msg.id;
- const awaitingRun = isLastUser && !!activeTask && activeTask.status !== "running" && !["completed", "failed", "cancelled", "superseded"].includes(activeTask.status);
- return (
- <div className="flex justify-end" {...(msg.task_id ? { "data-task-id": msg.task_id } : {})}>
- <div className={cn(
- "max-w-[80%] rounded-lg px-4 py-2 bg-primary text-primary-foreground text-base relative",
- )}>
- {awaitingRun && (
- <div className="absolute inset-0 rounded-lg animate-pulse pointer-events-none" style={{ boxShadow: "0 0 0 2px var(--bubble-glow)" }} />
- )}
- <div className="markdown markdown-user">
- <Streamdown controls={{ code: { copy: true, download: false }, table: { copy: false, download: false, fullscreen: false } }} linkSafety={{ enabled: false }} allowedTags={MENTION_ALLOWED_TAGS} literalTagContent={MENTION_LITERAL_TAGS} components={MENTION_COMPONENTS}>{highlightMentions(msg.content, agents)}</Streamdown>
- </div>
- {msg.attachment_ids && msg.attachment_ids.length > 0 && (
- <AttachmentChips attachmentIds={msg.attachment_ids} artifacts={artifacts} onArtifactClick={handleArtifactClick} />
- )}
- {!msg.attachment_ids && (
- <PendingFileChips pendingFiles={pendingFilesByMessage} messageId={msg.id} />
- )}
- </div>
- </div>
- );
- })() : msg.role === "event" ? (() => {
- const eventEmailId = msg.metadata?.emailId as string | undefined;
- return (
- <div className="flex justify-start" {...(msg.task_id ? { "data-task-id": msg.task_id } : {})}>
- <div
- className={cn(
- "w-full rounded-md border bg-muted/50 text-muted-foreground text-sm px-3 py-2 flex items-start gap-2",
- eventEmailId && "cursor-pointer hover:bg-muted transition-colors"
- )}
- onClick={eventEmailId ? () => {
- setSelectedEmailId(eventEmailId);
- setEmailSheetOpen(true);
- } : undefined}
- >
- <EventMessageIcon content={msg.content} conversationType={conversation?.type} />
- <span>{msg.content}</span>
- </div>
- </div>
- );
- })() : !hasTaskStream ? (
- <div className="flex justify-start" data-quote-source {...(msg.task_id ? { "data-task-id": msg.task_id } : {})}>
- <div className="markdown max-w-full min-w-0 px-1 py-1 text-base text-foreground">
- <Streamdown controls={{ code: { copy: true, download: false }, table: { copy: true, download: false, fullscreen: true } }} linkSafety={{ enabled: false }} allowedTags={MENTION_ALLOWED_TAGS} literalTagContent={MENTION_LITERAL_TAGS} components={MENTION_COMPONENTS}>{highlightMentions(msg.content, agents)}</Streamdown>
- </div>
- </div>
- ) : null}
- </React.Fragment>
+ <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}
+ />
);
})}
diff --git a/src/web/src/components/agent-chat/message-list.tsx b/src/web/src/components/agent-chat/message-list.tsx
new file mode 100644
index 000000000..580c24ef9
--- /dev/null
+++ b/src/web/src/components/agent-chat/message-list.tsx
@@ -0,0 +1,198 @@
+import React, { memo } from "react";
+import type { Agent, Artifact, Message, TaskApi as Task, TaskMessage } from "@alook/shared";
+import type { Conversation } from "@alook/shared";
+import { cn } from "@/lib/utils";
+import { Streamdown } from "streamdown";
+import { highlightMentions } from "@/lib/highlight-mentions";
+import { TaskStream } from "@/components/task-stream";
+import { HistoricalTaskSteps } from "@/components/agent-chat/historical-task-steps";
+import { FileText, Calendar, CircleDot, Mail } from "lucide-react";
+import { formatSize } from "@/components/agent-chat/artifact-sheet";
+import { getEventIconType } from "@/components/agent-chat/agent-chat-view";
+
+const MENTION_ALLOWED_TAGS = { mention: ["data-agent-id"] };
+const MENTION_LITERAL_TAGS = ["mention"];
+
+export interface MessageItemProps {
+ msg: Message;
+ agents: Agent[];
+ artifacts: Artifact[];
+ activeTask: Task | null;
+ taskMessages: TaskMessage[];
+ connectionLost: boolean;
+ isLastMessage: boolean;
+ stepCount: number;
+ targetConvId: string | null;
+ workspaceId: string;
+ conversationType?: string | null;
+ pendingFilesByMessage: Map<string, File[]>;
+ onArtifactClick: (a: Artifact) => void;
+ onEmailClick: (emailId: string) => void;
+ onRetry?: () => void;
+ mentionComponents: Record<string, React.ComponentType<Record<string, unknown> & { children?: React.ReactNode }>>;
+}
+
+function EventMessageIcon({ content, conversationType }: { content: string; conversationType?: string | null }) {
+ const iconType = getEventIconType(content, conversationType);
+ const className = "h-4 w-4 mt-0.5 shrink-0";
+
+ if (iconType === "issue") return <CircleDot className={className} />;
+ if (iconType === "email") return <Mail className={className} />;
+ return <Calendar className={className} />;
+}
+
+function AttachmentChips({
+ attachmentIds,
+ artifacts,
+ onArtifactClick,
+}: {
+ attachmentIds: string[];
+ artifacts: Artifact[];
+ onArtifactClick: (a: Artifact) => void;
+}) {
+ const matched = attachmentIds
+ .map((id) => artifacts.find((a) => a.id === id))
+ .filter((a): a is Artifact => !!a);
+
+ if (matched.length === 0) return null;
+
+ return (
+ <div className="flex flex-wrap gap-1.5 mt-1.5">
+ {matched.map((a) => (
+ <button
+ key={a.id}
+ type="button"
+ onClick={(e) => { e.stopPropagation(); onArtifactClick(a); }}
+ className="inline-flex items-center gap-1 rounded-md bg-primary-foreground/10 border border-primary-foreground/20 px-2 py-0.5 text-xs text-primary-foreground/80 hover:bg-primary-foreground/20 transition-colors cursor-pointer"
+ >
+ <FileText className="size-3 shrink-0" />
+ <span className="truncate max-w-37.5">{a.filename}</span>
+ </button>
+ ))}
+ </div>
+ );
+}
+
+function PendingFileChips({
+ pendingFiles,
+ messageId,
+}: {
+ pendingFiles: Map<string, File[]>;
+ messageId: string;
+}) {
+ const files = pendingFiles.get(messageId);
+ if (!files || files.length === 0) return null;
+
+ return (
+ <div className="flex flex-wrap gap-1.5 mt-1.5">
+ {files.map((f, i) => (
+ <span
+ key={i}
+ className="inline-flex items-center gap-1 rounded-md bg-primary-foreground/10 border border-primary-foreground/20 px-2 py-0.5 text-xs text-primary-foreground/80"
+ >
+ <FileText className="size-3 shrink-0" />
+ <span className="truncate max-w-37.5">{f.name}</span>
+ </span>
+ ))}
+ </div>
+ );
+}
+
+export const MessageItem = memo(function MessageItem({
+ msg,
+ agents,
+ artifacts,
+ activeTask,
+ taskMessages,
+ connectionLost,
+ isLastMessage,
+ stepCount,
+ targetConvId,
+ workspaceId,
+ conversationType,
+ pendingFilesByMessage,
+ onArtifactClick,
+ onEmailClick,
+ onRetry,
+ mentionComponents,
+}: MessageItemProps) {
+ const hasTaskStream =
+ activeTask &&
+ msg.role === "assistant" &&
+ msg.task_id === activeTask.id &&
+ taskMessages.length > 0;
+
+ const historicalStepCount =
+ !hasTaskStream &&
+ targetConvId &&
+ msg.role === "assistant" &&
+ msg.task_id &&
+ stepCount > 0
+ ? stepCount
+ : 0;
+
+ return (
+ <React.Fragment>
+ {hasTaskStream && (
+ <TaskStream
+ task={activeTask}
+ messages={taskMessages}
+ connectionLost={connectionLost}
+ onRetry={onRetry}
+ />
+ )}
+ {historicalStepCount > 0 && msg.task_id && (
+ <HistoricalTaskSteps
+ taskId={msg.task_id}
+ stepCount={historicalStepCount}
+ workspaceId={workspaceId}
+ />
+ )}
+ {msg.role === "user" ? (() => {
+ const awaitingRun = isLastMessage && !!activeTask && activeTask.status !== "running" && !["completed", "failed", "cancelled", "superseded"].includes(activeTask.status);
+ return (
+ <div className="flex justify-end" {...(msg.task_id ? { "data-task-id": msg.task_id } : {})}>
+ <div className={cn(
+ "max-w-[80%] rounded-lg px-4 py-2 bg-primary text-primary-foreground text-base relative",
+ )}>
+ {awaitingRun && (
+ <div className="absolute inset-0 rounded-lg animate-pulse pointer-events-none" style={{ boxShadow: "0 0 0 2px var(--bubble-glow)" }} />
+ )}
+ <div className="markdown markdown-user">
+ <Streamdown controls={{ code: { copy: true, download: false }, table: { copy: false, download: false, fullscreen: false } }} linkSafety={{ enabled: false }} allowedTags={MENTION_ALLOWED_TAGS} literalTagContent={MENTION_LITERAL_TAGS} components={mentionComponents}>{highlightMentions(msg.content, agents)}</Streamdown>
+ </div>
+ {msg.attachment_ids && msg.attachment_ids.length > 0 && (
+ <AttachmentChips attachmentIds={msg.attachment_ids} artifacts={artifacts} onArtifactClick={onArtifactClick} />
+ )}
+ {!msg.attachment_ids && (
+ <PendingFileChips pendingFiles={pendingFilesByMessage} messageId={msg.id} />
+ )}
+ </div>
+ </div>
+ );
+ })() : msg.role === "event" ? (() => {
+ const eventEmailId = msg.metadata?.emailId as string | undefined;
+ return (
+ <div className="flex justify-start" {...(msg.task_id ? { "data-task-id": msg.task_id } : {})}>
+ <div
+ className={cn(
+ "w-full rounded-md border bg-muted/50 text-muted-foreground text-sm px-3 py-2 flex items-start gap-2",
+ eventEmailId && "cursor-pointer hover:bg-muted transition-colors"
+ )}
+ onClick={eventEmailId ? () => onEmailClick(eventEmailId) : undefined}
+ >
+ <EventMessageIcon content={msg.content} conversationType={conversationType} />
+ <span>{msg.content}</span>
+ </div>
+ </div>
+ );
+ })() : !hasTaskStream ? (
+ <div className="flex justify-start" data-quote-source {...(msg.task_id ? { "data-task-id": msg.task_id } : {})}>
+ <div className="markdown max-w-full min-w-0 px-1 py-1 text-base text-foreground">
+ <Streamdown controls={{ code: { copy: true, download: false }, table: { copy: true, download: false, fullscreen: true } }} linkSafety={{ enabled: false }} allowedTags={MENTION_ALLOWED_TAGS} literalTagContent={MENTION_LITERAL_TAGS} components={mentionComponents}>{highlightMentions(msg.content, agents)}</Streamdown>
+ </div>
+ </div>
+ ) : null}
+ </React.Fragment>
+ );
+});
diff --git a/src/web/src/components/gradient-background.test.ts b/src/web/src/components/gradient-background.test.ts
index f2cdc6c3c..4069e03bc 100644
--- a/src/web/src/components/gradient-background.test.ts
+++ b/src/web/src/components/gradient-background.test.ts
@@ -4,11 +4,10 @@ import { describe, expect, it } from "vitest";
import { GradientBackground } from "./gradient-background";
describe("GradientBackground", () => {
- it("limits the noise overlay to dark mode", () => {
+ it("renders a light-mode background with dark transparent override", () => {
const markup = renderToStaticMarkup(createElement(GradientBackground));
- expect(markup).toContain("hidden");
- expect(markup).toContain("dark:block");
- expect(markup).toContain("dark:mix-blend-overlay");
+ expect(markup).toContain("bg-[oklch(0.93_0.015_80)]");
+ expect(markup).toContain("dark:bg-transparent");
});
});
diff --git a/src/web/src/components/gradient-background.tsx b/src/web/src/components/gradient-background.tsx
index ebf37ff34..bb476c0c4 100644
--- a/src/web/src/components/gradient-background.tsx
+++ b/src/web/src/components/gradient-background.tsx
@@ -1,27 +1,8 @@
-"use client";
-
-import { useId } from "react";
-
export function GradientBackground() {
- const filterId = useId();
-
return (
<div
aria-hidden
className="pointer-events-none fixed inset-0 -z-10 overflow-hidden bg-[oklch(0.93_0.015_80)] dark:bg-transparent"
- >
- {/* Noise texture overlay */}
- <svg className="absolute inset-0 hidden w-full h-full opacity-[0.25] mix-blend-multiply pointer-events-none dark:block dark:mix-blend-overlay">
- <filter id={filterId}>
- <feTurbulence type="fractalNoise" baseFrequency="0.75" numOctaves="4" stitchTiles="stitch" />
- <feComponentTransfer>
- <feFuncR type="linear" slope="0.5" intercept="0" />
- <feFuncG type="linear" slope="0.5" intercept="0" />
- <feFuncB type="linear" slope="0.5" intercept="0" />
- </feComponentTransfer>
- </filter>
- <rect width="100%" height="100%" filter={`url(#${filterId})`} />
- </svg>
- </div>
+ />
);
}
diff --git a/src/web/src/components/workspace-shell.tsx b/src/web/src/components/workspace-shell.tsx
index bbda8db3f..4e7a92697 100644
--- a/src/web/src/components/workspace-shell.tsx
+++ b/src/web/src/components/workspace-shell.tsx
@@ -47,7 +47,7 @@ export function WorkspaceShell({ children }: { children: ReactNode }) {
<div className="flex h-dvh overflow-hidden relative">
<GradientBackground />
<AppSidebar />
- <div className="flex-1 flex flex-col min-w-0 pt-1 pr-2 pb-2">
+ <div className="flex-1 flex flex-col min-w-0 pt-2 pr-2 pb-2">
<main className="flex-1 min-h-0 rounded-xl bg-card/80 backdrop-blur-xl shadow-lg ring-1 ring-border/40 overflow-hidden flex flex-col">
{children}
</main>