From 7b610a4013f372eed7b1f262a1073c6d8a714100 Mon Sep 17 00:00:00 2001 From: devv-eve Date: Thu, 2 Apr 2026 22:59:36 -0700 Subject: [PATCH] feat(agents): hide archived agents from default list (#373) * feat(agents): hide archived agents from default list Archived agents are now filtered out of the default agent list view. A toggle button (archive icon) appears when archived agents exist, allowing users to switch between viewing active and archived agents. The @mention suggestion list already filters out archived agents. Co-Authored-By: Claude Opus 4.6 (1M context) * fix(agents): show "No active agents" when all agents are archived When there are archived agents but no active ones, the empty state now shows "No active agents" instead of "No agents yet" to avoid confusion. Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Devv Co-authored-by: Claude Opus 4.6 (1M context) --- apps/web/app/(dashboard)/agents/page.tsx | 71 ++++++++++++++++-------- 1 file changed, 48 insertions(+), 23 deletions(-) diff --git a/apps/web/app/(dashboard)/agents/page.tsx b/apps/web/app/(dashboard)/agents/page.tsx index 478edd46..b0113772 100644 --- a/apps/web/app/(dashboard)/agents/page.tsx +++ b/apps/web/app/(dashboard)/agents/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState, useEffect, useRef } from "react"; +import { useState, useEffect, useRef, useMemo } from "react"; import { useDefaultLayout } from "react-resizable-panels"; import { Bot, @@ -29,6 +29,7 @@ import { Lock, Settings, Camera, + Archive, } from "lucide-react"; import type { Agent, @@ -1546,6 +1547,7 @@ export default function AgentsPage() { const agents = useWorkspaceStore((s) => s.agents); const refreshAgents = useWorkspaceStore((s) => s.refreshAgents); const [selectedId, setSelectedId] = useState(""); + const [showArchived, setShowArchived] = useState(false); const [showCreate, setShowCreate] = useState(false); const runtimes = useRuntimeStore((s) => s.runtimes); const fetchRuntimes = useRuntimeStore((s) => s.fetchRuntimes); @@ -1557,12 +1559,19 @@ export default function AgentsPage() { if (workspace) fetchRuntimes(); }, [workspace, fetchRuntimes]); - // Select first agent on initial load + const filteredAgents = useMemo( + () => showArchived ? agents.filter((a) => !!a.archived_at) : agents.filter((a) => !a.archived_at), + [agents, showArchived], + ); + + const archivedCount = useMemo(() => agents.filter((a) => !!a.archived_at).length, [agents]); + + // Select first agent on initial load or when filter changes useEffect(() => { - if (agents.length > 0 && !selectedId) { - setSelectedId(agents[0]!.id); + if (filteredAgents.length > 0 && !filteredAgents.some((a) => a.id === selectedId)) { + setSelectedId(filteredAgents[0]!.id); } - }, [agents, selectedId]); + }, [filteredAgents, selectedId]); const handleCreate = async (data: CreateAgentRequest) => { const agent = await api.createAgent(data); @@ -1655,30 +1664,46 @@ export default function AgentsPage() {

Agents

- +
+ {archivedCount > 0 && ( + + )} + +
- {agents.length === 0 ? ( + {filteredAgents.length === 0 ? (
-

No agents yet

- +

+ {showArchived ? "No archived agents" : archivedCount > 0 ? "No active agents" : "No agents yet"} +

+ {!showArchived && ( + + )}
) : (
- {agents.map((agent) => ( + {filteredAgents.map((agent) => (