Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

feat: add channel support to traces, sidebar home button, and UI polish

Gusd92949574de6
diff --git a/src/cli/daemon/execenv/__tests__/index.test.ts b/src/cli/daemon/execenv/__tests__/index.test.ts
index c0a578fec..e8073c454 100644
--- a/src/cli/daemon/execenv/__tests__/index.test.ts
+++ b/src/cli/daemon/execenv/__tests__/index.test.ts
@@ -16,7 +16,11 @@ function makeTask(overrides: Partial<Task> = {}): Task {
prompt: "do something",
status: "running",
priority: 0,
+ type: "user_dm_message",
createdAt: "2026-01-01T00:00:00Z",
+ traceId: null,
+ parentTaskId: null,
+ channel: null,
agent: { name: "test-agent", instructions: "Be helpful." },
...overrides,
};
@@ -104,6 +108,7 @@ describe("prepare", () => {
ALOOK_TASK_ID: "t1",
ALOOK_CONVERSATION_ID: "c1",
ALOOK_TRACE_ID: "",
+ ALOOK_CHANNEL: "default",
ALOOK_HEALTH_PORT: expect.any(String),
});
});
diff --git a/src/cli/daemon/execenv/index.ts b/src/cli/daemon/execenv/index.ts
index 6bc28a090..6f466a441 100644
--- a/src/cli/daemon/execenv/index.ts
+++ b/src/cli/daemon/execenv/index.ts
@@ -32,6 +32,7 @@ export function prepare(
ALOOK_TASK_ID: task.id,
ALOOK_CONVERSATION_ID: task.conversationId,
ALOOK_TRACE_ID: task.traceId ?? "",
+ ALOOK_CHANNEL: task.channel ?? "default",
ALOOK_HEALTH_PORT: process.env.ALOOK_HEALTH_PORT || "19514",
};
diff --git a/src/cli/daemon/types.ts b/src/cli/daemon/types.ts
index 0841feeb5..3b7d7f5c8 100644
--- a/src/cli/daemon/types.ts
+++ b/src/cli/daemon/types.ts
@@ -22,6 +22,7 @@ export interface Task {
createdAt: string;
traceId: string | null;
parentTaskId: string | null;
+ channel: string | null;
}
export interface Attachment {
@@ -156,5 +157,6 @@ export function fromApiTask(api: import("@alook/shared").TaskApi): Task {
createdAt: api.created_at,
traceId: api.trace_id ?? null,
parentTaskId: api.parent_task_id ?? null,
+ channel: api.channel ?? null,
};
}
diff --git a/src/shared/src/db/queries/task.ts b/src/shared/src/db/queries/task.ts
index 91feefb55..106d1c73d 100644
--- a/src/shared/src/db/queries/task.ts
+++ b/src/shared/src/db/queries/task.ts
@@ -1,5 +1,6 @@
-import { eq, and, desc, asc, inArray, notInArray, ne, count, lt, or, sql } from "drizzle-orm";
-import { agentTaskQueue, taskMessage } from "../schema";
+import { eq, and, desc, asc, inArray, notInArray, ne, count, lt, or, sql, exists } from "drizzle-orm";
+import { alias } from "drizzle-orm/sqlite-core";
+import { agentTaskQueue, taskMessage, conversation } from "../schema";
import type { Database } from "../index";
import { ClaimedTaskRowSchema } from "../../schemas";
import { TASK_TYPES } from "../../constants";
@@ -653,7 +654,7 @@ export async function listTaskHistory(
export async function listTraces(
db: Database,
workspaceId: string,
- opts?: { status?: string; limit?: number; before?: string }
+ opts?: { status?: string; limit?: number; before?: string; multiAgent?: boolean; agentId?: string; channel?: string }
) {
const limit = opts?.limit ?? 30;
// When filtering by computed status, overfetch roots to compensate
@@ -668,6 +669,28 @@ export async function listTraces(
if (opts?.before) {
conditions.push(lt(agentTaskQueue.createdAt, opts.before));
}
+ if (opts?.agentId) {
+ conditions.push(eq(agentTaskQueue.agentId, opts.agentId));
+ }
+ if (opts?.channel) {
+ conditions.push(eq(conversation.channel, opts.channel));
+ }
+ if (opts?.multiAgent) {
+ const helperTask = alias(agentTaskQueue, "helper_task");
+ conditions.push(
+ exists(
+ db.select()
+ .from(helperTask)
+ .where(
+ and(
+ eq(helperTask.traceId, agentTaskQueue.traceId),
+ ne(helperTask.agentId, agentTaskQueue.agentId),
+ ne(helperTask.type, TASK_TYPES.KILL_TASK),
+ )
+ )
+ )
+ );
+ }
const rootTasks = await db
.select({
@@ -676,8 +699,10 @@ export async function listTraces(
agentId: agentTaskQueue.agentId,
prompt: agentTaskQueue.prompt,
createdAt: agentTaskQueue.createdAt,
+ channel: conversation.channel,
})
.from(agentTaskQueue)
+ .leftJoin(conversation, eq(agentTaskQueue.conversationId, conversation.id))
.where(and(...conditions))
.orderBy(desc(agentTaskQueue.createdAt))
.limit(rootFetchLimit + 1);
@@ -721,6 +746,7 @@ export async function listTraces(
taskCount: number;
startedAt: string;
completedAt: string | null;
+ channel: string;
}[] = [];
for (const root of roots) {
@@ -750,6 +776,7 @@ export async function listTraces(
taskCount: tasks.length,
startedAt: root.createdAt,
completedAt,
+ channel: root.channel ?? "default",
});
}
diff --git a/src/shared/src/schemas.ts b/src/shared/src/schemas.ts
index 4c144939a..00dc32f9a 100644
--- a/src/shared/src/schemas.ts
+++ b/src/shared/src/schemas.ts
@@ -90,6 +90,7 @@ export const TaskApiBaseSchema = z.object({
context: z.unknown().nullable().optional(),
trace_id: z.string().nullable().optional(),
parent_task_id: z.string().nullable().optional(),
+ channel: z.string().nullable().optional(),
});
export type TaskApiBase = z.infer<typeof TaskApiBaseSchema>;
diff --git a/src/web/src/app/(app)/w/[slug]/traces/[traceId]/page.tsx b/src/web/src/app/(app)/w/[slug]/traces/[traceId]/page.tsx
index e0008e986..950357a37 100644
--- a/src/web/src/app/(app)/w/[slug]/traces/[traceId]/page.tsx
+++ b/src/web/src/app/(app)/w/[slug]/traces/[traceId]/page.tsx
@@ -165,13 +165,17 @@ export default function TraceDetailPage() {
const traceId = params.traceId as string;
const [tasks, setTasks] = useState<TraceTask[]>([]);
+ const [channel, setChannel] = useState("default");
const [loading, setLoading] = useState(true);
useEffect(() => {
setLoading(true);
getTrace(traceId, workspaceId)
- .then((data) => setTasks(data.tasks))
- .catch(() => {})
+ .then((data) => {
+ setTasks(data.tasks);
+ setChannel(data.channel);
+ })
+ .catch(() => { })
.finally(() => setLoading(false));
}, [traceId, workspaceId]);
@@ -186,8 +190,8 @@ export default function TraceDetailPage() {
className="flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors"
>
<ArrowLeft className="size-3.5" />
- Traces
</Link>
+ <span className="text-xs text-muted-foreground">#{channel}</span>
</div>
<div className="flex-1 overflow-y-auto thin-scrollbar">
diff --git a/src/web/src/app/(app)/w/[slug]/traces/page.tsx b/src/web/src/app/(app)/w/[slug]/traces/page.tsx
index 8b085f426..70d396a43 100644
--- a/src/web/src/app/(app)/w/[slug]/traces/page.tsx
+++ b/src/web/src/app/(app)/w/[slug]/traces/page.tsx
@@ -4,7 +4,9 @@ import { useState, useEffect, useCallback, useRef } from "react";
import { useRouter, useSearchParams } from "next/navigation";
import Link from "next/link";
import { useWorkspace } from "@/contexts/workspace-context";
-import { listTraces, type TraceListItem } from "@/lib/api";
+import { useChannel } from "@/contexts/channel-context";
+import { listTraces, listAgents, type TraceListItem } from "@/lib/api";
+import type { Agent } from "@alook/shared";
import { Skeleton } from "@/components/ui/skeleton";
import {
Select,
@@ -108,6 +110,8 @@ function TraceRow({ trace, slug }: { trace: TraceListItem; slug: string }) {
<span className="text-muted-foreground/40">&middot;</span>
</>
)}
+ <span className="text-xs text-muted-foreground">#{trace.channel}</span>
+ <span className="text-muted-foreground/40">&middot;</span>
<StatusDot status={trace.status} />
<span className="text-xs text-muted-foreground">{statusLabel}</span>
{duration && (
@@ -155,16 +159,24 @@ export default function TracesPage() {
const router = useRouter();
const searchParams = useSearchParams();
const { slug, workspaceId } = useWorkspace();
+ const { channels } = useChannel();
const [traces, setTraces] = useState<TraceListItem[]>([]);
const [loading, setLoading] = useState(true);
const [hasMore, setHasMore] = useState(false);
const [loadingMore, setLoadingMore] = useState(false);
+ const [agents, setAgents] = useState<Agent[]>([]);
const scrollRef = useRef<HTMLDivElement>(null);
const isFetchingRef = useRef(false);
const statusFilter = searchParams.get("status") ?? "";
+ const agentFilter = searchParams.get("agentId") ?? "";
+ const channelFilter = searchParams.get("channel") ?? "";
+
+ useEffect(() => {
+ listAgents(workspaceId).then(setAgents).catch(() => {});
+ }, [workspaceId]);
const loadInitial = useCallback(async () => {
setLoading(true);
@@ -172,6 +184,9 @@ export default function TracesPage() {
const result = await listTraces(workspaceId, {
limit: TRACE_LIMIT,
status: statusFilter || undefined,
+ multiAgent: true,
+ agentId: agentFilter || undefined,
+ channel: channelFilter || undefined,
});
const seen = new Set<string>();
const deduped = result.traces.filter((t) => {
@@ -186,7 +201,7 @@ export default function TracesPage() {
} finally {
setLoading(false);
}
- }, [workspaceId, statusFilter]);
+ }, [workspaceId, statusFilter, agentFilter, channelFilter]);
useEffect(() => {
loadInitial();
@@ -202,6 +217,9 @@ export default function TracesPage() {
limit: TRACE_LIMIT,
before: oldest.started_at,
status: statusFilter || undefined,
+ multiAgent: true,
+ agentId: agentFilter || undefined,
+ channel: channelFilter || undefined,
});
if (result.traces.length === 0) {
setHasMore(false);
@@ -217,7 +235,7 @@ export default function TracesPage() {
isFetchingRef.current = false;
setLoadingMore(false);
}
- }, [workspaceId, traces, hasMore, statusFilter]);
+ }, [workspaceId, traces, hasMore, statusFilter, agentFilter, channelFilter]);
const handleScroll = useCallback(() => {
const el = scrollRef.current;
@@ -229,12 +247,12 @@ export default function TracesPage() {
}, [loadOlderTraces, loadingMore, hasMore]);
const updateFilter = useCallback(
- (value: string) => {
+ (key: string, value: string) => {
const newParams = new URLSearchParams(searchParams.toString());
if (value) {
- newParams.set("status", value);
+ newParams.set(key, value);
} else {
- newParams.delete("status");
+ newParams.delete(key);
}
const pathname = `/w/${slug}/traces`;
const qs = newParams.toString();
@@ -246,7 +264,7 @@ export default function TracesPage() {
return (
<div className="flex flex-col h-full">
<div className="sticky top-0 z-10 flex items-center gap-2 px-4 py-2.5">
- <Select value={statusFilter} onValueChange={(v) => updateFilter(v ?? "")}>
+ <Select value={statusFilter} onValueChange={(v) => updateFilter("status", v ?? "")}>
<SelectTrigger className="w-35 border-none bg-transparent shadow-none text-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors">
<SelectValue placeholder="Status: All" />
</SelectTrigger>
@@ -259,6 +277,37 @@ export default function TracesPage() {
</SelectPopup>
</Select>
+ <Select value={agentFilter} onValueChange={(v) => updateFilter("agentId", v ?? "")}>
+ <SelectTrigger className="w-40 border-none bg-transparent shadow-none text-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors">
+ {agentFilter ? agents.find((a) => a.id === agentFilter)?.name ?? agentFilter : "Agent: All"}
+ </SelectTrigger>
+ <SelectPopup>
+ <SelectItem value="">Agent: All</SelectItem>
+ {agents.map((a) => (
+ <SelectItem key={a.id} value={a.id}>
+ <span className="flex items-center gap-1.5">
+ <AgentAvatar name={a.name} avatarUrl={a.avatar_url} />
+ {a.name}
+ </span>
+ </SelectItem>
+ ))}
+ </SelectPopup>
+ </Select>
+
+ <Select value={channelFilter} onValueChange={(v) => updateFilter("channel", v ?? "")}>
+ <SelectTrigger className="w-40 border-none bg-transparent shadow-none text-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors">
+ <SelectValue placeholder="Channel: All" />
+ </SelectTrigger>
+ <SelectPopup>
+ <SelectItem value="">Channel: All</SelectItem>
+ {channels.map((ch) => (
+ <SelectItem key={ch.id} value={ch.name}>
+ #{ch.name}
+ </SelectItem>
+ ))}
+ </SelectPopup>
+ </Select>
+
<button
type="button"
onClick={loadInitial}
@@ -269,6 +318,8 @@ export default function TracesPage() {
</button>
</div>
+ <p className="px-4 pb-1 text-xs text-muted-foreground/50">Showing tasks that involve multiple agents</p>
+
<div
ref={scrollRef}
className="flex-1 overflow-y-auto thin-scrollbar"
@@ -283,8 +334,11 @@ export default function TracesPage() {
) : traces.length === 0 ? (
<div className="flex flex-col items-center justify-center h-full animate-[fade-up_400ms_ease-out_both]">
<GitBranch className="size-8 text-muted-foreground mb-3" />
- <p className="text-sm text-muted-foreground">No traces yet</p>
- {statusFilter && (
+ <p className="text-sm text-muted-foreground">No threads yet</p>
+ <p className="text-xs text-muted-foreground/60 mt-1">
+ Only tasks involving multiple agents appear here.
+ </p>
+ {(statusFilter || agentFilter || channelFilter) && (
<p className="text-xs text-muted-foreground/60 mt-1">
Try changing your filter
</p>
diff --git a/src/web/src/app/api/daemon/tasks/poll/route.ts b/src/web/src/app/api/daemon/tasks/poll/route.ts
index d747556ca..d2b406b9e 100644
--- a/src/web/src/app/api/daemon/tasks/poll/route.ts
+++ b/src/web/src/app/api/daemon/tasks/poll/route.ts
@@ -79,6 +79,7 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {
// Per-request caches: avoid duplicate DB reads when multiple tasks share the same owner/user
const memberCache = new Map<string, { globalInstruction: string } | null>();
const userCache = new Map<string, { name: string; email: string } | null>();
+ const convoCache = new Map<string, Awaited<ReturnType<typeof queries.conversation.getConversation>> | null>();
for (const task of claimed) {
if (task.type === "kill_task") {
tasks.push({ ...taskToResponse(task), agent: null, sender: null });
@@ -121,23 +122,27 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {
ownerName = userCache.get(agent.ownerId)?.name ?? null;
}
- // Resolve sender identity for DM tasks only
+ // Fetch conversation for channel (all task types) and sender (DM only)
+ let convo = convoCache.get(task.conversationId) ?? null;
+ if (task.conversationId && !convoCache.has(task.conversationId)) {
+ convo = await queries.conversation.getConversation(db, task.conversationId, task.workspaceId);
+ convoCache.set(task.conversationId, convo);
+ }
+ const taskChannel = convo?.channel ?? "default";
+
let sender: { name: string; email: string; is_owner: boolean } | null = null;
- if (task.type === "user_dm_message" && task.conversationId) {
- const convo = await queries.conversation.getConversation(db, task.conversationId, task.workspaceId);
- if (convo?.userId) {
- if (!userCache.has(convo.userId)) {
- const u = await queries.user.getUser(db, convo.userId);
- userCache.set(convo.userId, u ? { name: u.name, email: u.email } : null);
- }
- const cachedUser = userCache.get(convo.userId);
- if (cachedUser) {
- sender = {
- name: cachedUser.name,
- email: cachedUser.email,
- is_owner: convo.userId === agent?.ownerId,
- };
- }
+ if (task.type === "user_dm_message" && convo?.userId) {
+ if (!userCache.has(convo.userId)) {
+ const u = await queries.user.getUser(db, convo.userId);
+ userCache.set(convo.userId, u ? { name: u.name, email: u.email } : null);
+ }
+ const cachedUser = userCache.get(convo.userId);
+ if (cachedUser) {
+ sender = {
+ name: cachedUser.name,
+ email: cachedUser.email,
+ is_owner: convo.userId === agent?.ownerId,
+ };
}
}
@@ -157,6 +162,7 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {
tasks.push({
...taskToResponse(task),
+ channel: taskChannel,
sender,
agent: agent
? {
diff --git a/src/web/src/app/api/email/notify/route.ts b/src/web/src/app/api/email/notify/route.ts
index 5f6b81bd0..6300603b8 100644
--- a/src/web/src/app/api/email/notify/route.ts
+++ b/src/web/src/app/api/email/notify/route.ts
@@ -70,12 +70,21 @@ export async function POST(req: NextRequest) {
}
}
} else {
+ let inheritedChannel: string | undefined;
+ if (body.sourceTaskId) {
+ const parentTask = await queries.task.getTask(db, body.sourceTaskId, body.workspaceId);
+ if (parentTask) {
+ const parentConv = await queries.conversation.getConversation(db, parentTask.conversationId, body.workspaceId);
+ if (parentConv) inheritedChannel = parentConv.channel;
+ }
+ }
const conv = await queries.conversation.createConversation(db, {
workspaceId: agent.workspaceId,
agentId: agent.id,
userId: agent.ownerId,
title: `Email: ${body.subject}`.slice(0, 50),
type: TASK_TYPES.EMAIL_NOTIFICATION,
+ ...(inheritedChannel && inheritedChannel !== "default" ? { channel: inheritedChannel } : {}),
})
conversationId = conv.id;
diff --git a/src/web/src/app/api/traces/[traceId]/route.ts b/src/web/src/app/api/traces/[traceId]/route.ts
index acc1b19b1..0fa3813d1 100644
--- a/src/web/src/app/api/traces/[traceId]/route.ts
+++ b/src/web/src/app/api/traces/[traceId]/route.ts
@@ -21,6 +21,13 @@ export const GET = withAuth(async (req: NextRequest, ctx) => {
const tasks = await queries.task.getTraceTree(db, traceId, ws.workspaceId);
if (tasks.length === 0) return writeError("trace not found", 404);
+ const rootTask = tasks.find(t => !t.parentTaskId);
+ let channel = "default";
+ if (rootTask) {
+ const conv = await queries.conversation.getConversation(db, rootTask.conversationId, ws.workspaceId);
+ if (conv) channel = conv.channel;
+ }
+
const agents = await queries.agent.listAgents(db, ws.workspaceId, ctx.userId);
const agentMap = new Map(agents.map(a => [a.id, { name: a.name, email_handle: a.emailHandle, avatarUrl: a.avatarUrl }]));
@@ -37,5 +44,5 @@ export const GET = withAuth(async (req: NextRequest, ctx) => {
completed_at: t.completedAt,
}));
- return writeJSON({ trace_id: traceId, tasks: traceTasks });
+ return writeJSON({ trace_id: traceId, channel, tasks: traceTasks });
});
diff --git a/src/web/src/app/api/traces/route.ts b/src/web/src/app/api/traces/route.ts
index fb1f07641..479be7ac3 100644
--- a/src/web/src/app/api/traces/route.ts
+++ b/src/web/src/app/api/traces/route.ts
@@ -19,7 +19,10 @@ export const GET = withAuth(async (req: NextRequest, ctx) => {
const limitParam = req.nextUrl.searchParams.get("limit");
const limit = limitParam ? Math.min(Math.max(parseInt(limitParam, 10) || 30, 1), 100) : undefined;
- const result = await queries.task.listTraces(db, ws.workspaceId, { status, limit, before });
+ const multiAgent = req.nextUrl.searchParams.get("multiAgent") === "true";
+ const agentId = req.nextUrl.searchParams.get("agentId") ?? undefined;
+ const channel = req.nextUrl.searchParams.get("channel") ?? undefined;
+ const result = await queries.task.listTraces(db, ws.workspaceId, { status, limit, before, multiAgent, agentId, channel });
const agents = await queries.agent.listAgents(db, ws.workspaceId, ctx.userId);
const agentMap = new Map(agents.map(a => [a.id, { name: a.name, avatarUrl: a.avatarUrl }]));
@@ -34,6 +37,7 @@ export const GET = withAuth(async (req: NextRequest, ctx) => {
task_count: t.taskCount,
started_at: t.startedAt,
completed_at: t.completedAt,
+ channel: t.channel,
}));
return writeJSON({ traces, has_more: result.hasMore });
diff --git a/src/web/src/app/globals.css b/src/web/src/app/globals.css
index 451e65da9..f239a3e98 100644
--- a/src/web/src/app/globals.css
+++ b/src/web/src/app/globals.css
@@ -841,7 +841,8 @@
.markdown h2 { font-size: 1.125em; line-height: 1.25; margin-top: 1.35em; }
.markdown h3 { font-size: 1em; line-height: 1.3; margin-top: 1.25em; }
.markdown h4 { font-size: 1em; line-height: 1.3; margin-top: 1.15em; }
-.markdown p {
+.markdown p,
+.markdown [data-md-p] {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
@@ -1322,7 +1323,20 @@
animation: avatar-nod 500ms ease-in-out infinite;
}
+/* ── Sidebar easter egg: logo click → agents pop ── */
+@keyframes sidebar-agent-pop {
+ 0% { transform: scale(1) translateY(0) rotate(0); }
+ 25% { transform: scale(1.15) translateY(-6px) rotate(-5deg); }
+ 50% { transform: scale(0.92) translateY(1px) rotate(3deg); }
+ 75% { transform: scale(1.05) translateY(-2px) rotate(-1deg); }
+ 100% { transform: scale(1) translateY(0) rotate(0); }
+}
+.sidebar-agent-pop {
+ animation: sidebar-agent-pop 500ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
+}
+
@media (prefers-reduced-motion: reduce) {
+ .sidebar-agent-pop { animation: none !important; }
.avatar-anim-shape-bounce [data-avatar-shape],
.avatar-anim-head-tilt [data-avatar-shape],
.avatar-anim-head-tilt [data-avatar-eyes],
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 94a599914..29bbf9035 100644
--- a/src/web/src/components/agent-chat/agent-chat-view.tsx
+++ b/src/web/src/components/agent-chat/agent-chat-view.tsx
@@ -73,7 +73,10 @@ function MentionHighlight(props: Record<string, unknown> & { children?: React.Re
}
return <span className="mention-highlight">{children}</span>;
}
-const MENTION_COMPONENTS = { mention: MentionHighlight };
+const MENTION_COMPONENTS: Record<string, React.ComponentType<Record<string, unknown> & { children?: React.ReactNode }>> = {
+ mention: MentionHighlight,
+ p: ({ children, node: _node, ...rest }: Record<string, unknown> & { children?: React.ReactNode }) => <div data-md-p="" {...rest}>{children}</div>,
+};
/** Sort messages by (created_at, id) ascending — guarantees chronological order. */
export function sortMessages(msgs: Message[]): Message[] {
diff --git a/src/web/src/components/app-sidebar.tsx b/src/web/src/components/app-sidebar.tsx
index f000448e5..f1efa1588 100644
--- a/src/web/src/components/app-sidebar.tsx
+++ b/src/web/src/components/app-sidebar.tsx
@@ -1,13 +1,13 @@
"use client";
-import { useState } from "react";
+import { useState, useCallback, useRef, useEffect } from "react";
import { useRouter, usePathname, useSearchParams } from "next/navigation";
import { useAgentContext } from "@/contexts/agent-context";
import { useWorkspace } from "@/contexts/workspace-context";
import type { Agent } from "@alook/shared";
import { Logo } from "@/components/logo";
import { cn } from "@/lib/utils";
-import { Monitor, SunMoon, Plus, CalendarDays, GitBranch, Settings, PinIcon, PinOffIcon, ArrowLeftRight } from "lucide-react";
+import { Monitor, SunMoon, Plus, CalendarDays, GitBranch, Settings, PinIcon, PinOffIcon, ArrowLeftRight, Home } from "lucide-react";
import { Skeleton } from "@/components/ui/skeleton";
import { Tooltip, TooltipTrigger, TooltipContent } from "@/components/ui/tooltip";
import { useTheme } from "next-themes";
@@ -190,34 +190,77 @@ export function AppSidebar({ onNavigate }: { onNavigate?: () => void } = {}) {
const hasOnlineRuntime = runtimes.some((r) => r.status === "online");
- const renderAgentButton = (agent: typeof agents[number]) => (
- <AgentSidebarButton
- key={agent.id}
- agent={agent}
- isActive={activeAgentId === agent.id}
- isPinned={pins.has(agent.id)}
- isOnline={hasOnlineRuntime}
- taskCount={taskCounts[agent.id] ?? 0}
- onClick={() => handleAgentClick(agent.id)}
- onPin={() => handlePinAgent(agent.id)}
- onUnpin={() => handleUnpinAgent(agent.id)}
- />
+ const [wiggling, setWiggling] = useState(false);
+ const wiggleRef = useRef(false);
+ const wiggleTimerRef = useRef<ReturnType<typeof setTimeout>>(null);
+
+ useEffect(() => {
+ return () => {
+ if (wiggleTimerRef.current) clearTimeout(wiggleTimerRef.current);
+ };
+ }, []);
+
+ const triggerWiggle = useCallback(() => {
+ if (wiggleRef.current) return;
+ wiggleRef.current = true;
+ setWiggling(true);
+ const count = pinned.length + unpinned.length;
+ const total = Math.max(0, count - 1) * 60 + 550;
+ wiggleTimerRef.current = setTimeout(() => {
+ wiggleRef.current = false;
+ setWiggling(false);
+ }, total);
+ }, [pinned.length, unpinned.length]);
+
+ const renderAgentButton = (agent: typeof agents[number], animIndex: number) => (
+ <div
+ className={cn(wiggling && "sidebar-agent-pop")}
+ style={wiggling ? { animationDelay: `${animIndex * 60}ms` } : undefined}
+ >
+ <AgentSidebarButton
+ agent={agent}
+ isActive={activeAgentId === agent.id}
+ isPinned={pins.has(agent.id)}
+ isOnline={hasOnlineRuntime}
+ taskCount={taskCounts[agent.id] ?? 0}
+ onClick={() => handleAgentClick(agent.id)}
+ onPin={() => handlePinAgent(agent.id)}
+ onUnpin={() => handleUnpinAgent(agent.id)}
+ />
+ </div>
);
return (
<nav className="flex h-full w-14 flex-col items-center pt-1 pb-2 gap-0.5">
- {/* Top — logo as Home link */}
+ {/* Top — logo (easter egg: click to wake agents) */}
<div className="pb-1.5 mb-1">
<div
- className="flex shrink-0 items-center justify-center size-8 cursor-pointer [&>button]:pointer-events-none"
- onClick={() => { router.push(`${prefix}/home`); onNavigate?.(); }}
+ className="flex shrink-0 items-center justify-center size-8 [&>button]:pointer-events-none cursor-pointer active:scale-90 transition-transform"
+ onClick={triggerWiggle}
>
<Logo size="sm" iconOnly />
</div>
</div>
- {/* Threads */}
- <div className="pb-1.5 border-b border-border/50 mb-1">
+ {/* Home & Threads */}
+ <div className="flex flex-col items-center gap-1.5 pb-1.5 border-b border-border/50 mb-1">
+ <Tooltip>
+ <TooltipTrigger render={
+ <button
+ type="button"
+ onClick={() => { router.push(`${prefix}/home`); onNavigate?.(); }}
+ className={cn(
+ "flex items-center justify-center size-10 rounded-xl transition-colors duration-200 cursor-pointer",
+ "text-muted-foreground hover:text-foreground hover:bg-accent",
+ isHome && "bg-accent text-foreground"
+ )}
+ />
+ }>
+ <Home className="size-4" />
+ </TooltipTrigger>
+ <TooltipContent side="right">Home</TooltipContent>
+ </Tooltip>
+
<Tooltip>
<TooltipTrigger render={
<button
@@ -225,8 +268,8 @@ export function AppSidebar({ onNavigate }: { onNavigate?: () => void } = {}) {
onClick={() => { router.push(`${prefix}/traces`); onNavigate?.(); }}
className={cn(
"flex items-center justify-center size-10 rounded-xl transition-colors duration-200 cursor-pointer",
- "bg-primary text-primary-foreground hover:bg-primary/80",
- isTraces && "ring-2 ring-primary/50"
+ "text-muted-foreground hover:text-foreground hover:bg-accent",
+ isTraces && "bg-accent text-foreground"
)}
/>
}>
@@ -244,9 +287,9 @@ export function AppSidebar({ onNavigate }: { onNavigate?: () => void } = {}) {
<>
<DndContext sensors={sensors} collisionDetection={closestCenter} modifiers={[restrictToVerticalAxis]} onDragEnd={handleDragEnd}>
<SortableContext items={pinned.map((a) => a.id)} strategy={verticalListSortingStrategy}>
- {pinned.map((agent) => (
+ {pinned.map((agent, i) => (
<SortableAgentButton key={agent.id} id={agent.id}>
- {renderAgentButton(agent)}
+ {renderAgentButton(agent, i)}
</SortableAgentButton>
))}
</SortableContext>
@@ -256,9 +299,9 @@ export function AppSidebar({ onNavigate }: { onNavigate?: () => void } = {}) {
)}
<DndContext sensors={sensors} collisionDetection={closestCenter} modifiers={[restrictToVerticalAxis]} onDragEnd={handleUnpinnedDragEnd}>
<SortableContext items={unpinned.map((a) => a.id)} strategy={verticalListSortingStrategy}>
- {unpinned.map((agent) => (
+ {unpinned.map((agent, i) => (
<SortableAgentButton key={agent.id} id={agent.id}>
- {renderAgentButton(agent)}
+ {renderAgentButton(agent, pinned.length + i)}
</SortableAgentButton>
))}
</SortableContext>
diff --git a/src/web/src/components/mobile-top-bar.tsx b/src/web/src/components/mobile-top-bar.tsx
index a115982c3..6eab97e46 100644
--- a/src/web/src/components/mobile-top-bar.tsx
+++ b/src/web/src/components/mobile-top-bar.tsx
@@ -1,7 +1,7 @@
"use client";
import { useRouter, usePathname } from "next/navigation";
-import { GitBranch } from "lucide-react";
+import { GitBranch, Home } from "lucide-react";
import { useSidebarTrigger } from "@/components/workspace-shell";
import { useAgentContext } from "@/contexts/agent-context";
import { useWorkspace } from "@/contexts/workspace-context";
@@ -17,6 +17,7 @@ export function MobileTopBar() {
const { slug } = useWorkspace();
const { agents, pins, unpinnedOrder, runtimes, loading } = useAgentContext();
+ const isHomeActive = pathname === `/w/${slug}/home`;
const isTracesActive = pathname.includes("/traces");
const activeAgentMatch = pathname.match(/^\/w\/[^/]+\/agents\/([^/]+)/);
const activeAgentId = activeAgentMatch?.[1] ?? null;
@@ -58,6 +59,19 @@ export function MobileTopBar() {
</div>
)}
+ <button
+ onClick={() => router.push(`/w/${slug}/home`)}
+ aria-label="Home"
+ className={cn(
+ "shrink-0 p-1 rounded-md transition-colors",
+ isHomeActive
+ ? "text-foreground bg-muted"
+ : "text-muted-foreground hover:text-foreground"
+ )}
+ >
+ <Home className="size-4" />
+ </button>
+
<button
onClick={() => router.push(`/w/${slug}/traces`)}
aria-label="Traces"
diff --git a/src/web/src/lib/api.ts b/src/web/src/lib/api.ts
index 0b0ceee44..d21c9ae97 100644
--- a/src/web/src/lib/api.ts
+++ b/src/web/src/lib/api.ts
@@ -908,6 +908,7 @@ export interface TraceListItem {
task_count: number;
started_at: string;
completed_at: string | null;
+ channel: string;
}
export interface TraceTask {
@@ -925,18 +926,21 @@ export interface TraceTask {
export const listTraces = (
workspaceId: string,
- opts?: { status?: string; limit?: number; before?: string }
+ opts?: { status?: string; limit?: number; before?: string; multiAgent?: boolean; agentId?: string; channel?: string }
) => {
const extra: Record<string, string> = {};
if (opts?.limit) extra.limit = String(opts.limit);
if (opts?.before) extra.before = opts.before;
if (opts?.status) extra.status = opts.status;
+ if (opts?.multiAgent) extra.multiAgent = "true";
+ if (opts?.agentId) extra.agentId = opts.agentId;
+ if (opts?.channel) extra.channel = opts.channel;
return apiFetch<{ traces: TraceListItem[]; has_more: boolean }>(
`/api/traces${wsQuery(workspaceId, extra)}`
);
};
export const getTrace = (traceId: string, workspaceId: string) =>
- apiFetch<{ trace_id: string; tasks: TraceTask[] }>(
+ apiFetch<{ trace_id: string; channel: string; tasks: TraceTask[] }>(
`/api/traces/${traceId}${wsQuery(workspaceId)}`
);