Agent List

Agents as conversations, each with its face, when it spoke and its status in two lines, plus pinned faces for a phone.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/agent-list

Usage

import { AgentList, AgentRow } from "./ui/uicontext/components/kit/AgentList.ts"import { formatStamp } from "./ui/uicontext/components/domain/Time.ts"import type { Persona } from "./ui/uicontext/components/kit/Persona.ts"
interface Agent { readonly id: string; readonly name: string; readonly persona: Persona; readonly status: string; readonly at: string; readonly unread: boolean }// each row links to its conversation; the time reads "7:34 PM", "Yesterday" or "Tuesday"export const Agents = <M>(h: Html.H<M>, agents: ReadonlyArray<Agent>, open: string, now: string) =>	AgentList(h, {		label: "Agents",		children: agents.map((agent) => AgentRow(h, {			key: agent.id, href: `/agents/${agent.id}`, name: agent.name, persona: agent.persona,			stamp: formatStamp(agent.at, now), preview: agent.status, unread: agent.unread, current: agent.id === open,		})),	})

Examples

A phone's home

The agents opened most sit above the list as big faces, three across; more scroll sideways.

Hard data

A long name and role, an unbroken address, emoji, other scripts, a big count and no status at all, in a 280px column.

API reference

AgentRowView function

Options

AgentRow options
NameTypeDefaultDescription
keyrequiredstring—Names the row in its list
namerequiredstring——
personarequiredPersona——
state"idle" | "thinking" | "working" | "waiting" | "blocked" | "done"idleWhat it's doing, shown on its face; idle by default
activitystring—What it's doing right now, shown when the pointer rests on the row: "Reading Priya's reply"
rolestring—A short role beside the name: "SEO content"
stampstring—When it last spoke, already formatted: "7:34 PM", "Yesterday" (see formatStamp)
previewstring—Its latest status, as a result and what's next: "Inbox at 3. Two need replies."
lines1 | 22Lines of preview before it's cut; 2 by default
unreadboolean——
starredboolean——
currentboolean—The open conversation
hrefstring—A link to its conversation; or onSelect for a list that isn't routed
onSelectMessage——
styleStyle——

AgentListView function

Options

AgentList options
NameTypeDescription
labelrequiredstring—
childrenrequiredView.Children—

AgentGroupView function

Options

AgentGroup options
NameTypeDescription
keyrequiredstring—
labelrequiredstring—
childrenrequiredView.Children—

PinnedAgentsView function

Options

PinnedAgents options
NameTypeDescription
labelstring—
agentsrequiredPinnedAgent[]—

Source