Merge pull request #263 from mvanhorn/feat/180-agent-role-labels
feat(ui): show human-readable role labels in agent list and properties
This commit is contained in:
@@ -48,6 +48,20 @@ export const AGENT_ROLES = [
|
|||||||
] as const;
|
] as const;
|
||||||
export type AgentRole = (typeof AGENT_ROLES)[number];
|
export type AgentRole = (typeof AGENT_ROLES)[number];
|
||||||
|
|
||||||
|
export const AGENT_ROLE_LABELS: Record<AgentRole, string> = {
|
||||||
|
ceo: "CEO",
|
||||||
|
cto: "CTO",
|
||||||
|
cmo: "CMO",
|
||||||
|
cfo: "CFO",
|
||||||
|
engineer: "Engineer",
|
||||||
|
designer: "Designer",
|
||||||
|
pm: "PM",
|
||||||
|
qa: "QA",
|
||||||
|
devops: "DevOps",
|
||||||
|
researcher: "Researcher",
|
||||||
|
general: "General",
|
||||||
|
};
|
||||||
|
|
||||||
export const AGENT_ICON_NAMES = [
|
export const AGENT_ICON_NAMES = [
|
||||||
"bot",
|
"bot",
|
||||||
"cpu",
|
"cpu",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export {
|
|||||||
AGENT_STATUSES,
|
AGENT_STATUSES,
|
||||||
AGENT_ADAPTER_TYPES,
|
AGENT_ADAPTER_TYPES,
|
||||||
AGENT_ROLES,
|
AGENT_ROLES,
|
||||||
|
AGENT_ROLE_LABELS,
|
||||||
AGENT_ICON_NAMES,
|
AGENT_ICON_NAMES,
|
||||||
ISSUE_STATUSES,
|
ISSUE_STATUSES,
|
||||||
ISSUE_PRIORITIES,
|
ISSUE_PRIORITIES,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { Link } from "@/lib/router";
|
import { Link } from "@/lib/router";
|
||||||
import type { Agent, AgentRuntimeState } from "@paperclipai/shared";
|
import { AGENT_ROLE_LABELS, type Agent, type AgentRuntimeState } from "@paperclipai/shared";
|
||||||
import { agentsApi } from "../api/agents";
|
import { agentsApi } from "../api/agents";
|
||||||
import { useCompany } from "../context/CompanyContext";
|
import { useCompany } from "../context/CompanyContext";
|
||||||
import { queryKeys } from "../lib/queryKeys";
|
import { queryKeys } from "../lib/queryKeys";
|
||||||
@@ -24,6 +24,8 @@ const adapterLabels: Record<string, string> = {
|
|||||||
http: "HTTP",
|
http: "HTTP",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const roleLabels = AGENT_ROLE_LABELS as Record<string, string>;
|
||||||
|
|
||||||
function PropertyRow({ label, children }: { label: string; children: React.ReactNode }) {
|
function PropertyRow({ label, children }: { label: string; children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-3 py-1.5">
|
<div className="flex items-center gap-3 py-1.5">
|
||||||
@@ -51,7 +53,7 @@ export function AgentProperties({ agent, runtimeState }: AgentPropertiesProps) {
|
|||||||
<StatusBadge status={agent.status} />
|
<StatusBadge status={agent.status} />
|
||||||
</PropertyRow>
|
</PropertyRow>
|
||||||
<PropertyRow label="Role">
|
<PropertyRow label="Role">
|
||||||
<span className="text-sm">{agent.role}</span>
|
<span className="text-sm">{roleLabels[agent.role] ?? agent.role}</span>
|
||||||
</PropertyRow>
|
</PropertyRow>
|
||||||
{agent.title && (
|
{agent.title && (
|
||||||
<PropertyRow label="Title">
|
<PropertyRow label="Title">
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { HelpCircle, ChevronDown, ChevronRight } from "lucide-react";
|
import { HelpCircle, ChevronDown, ChevronRight } from "lucide-react";
|
||||||
import { cn } from "../lib/utils";
|
import { cn } from "../lib/utils";
|
||||||
|
import { AGENT_ROLE_LABELS } from "@paperclipai/shared";
|
||||||
|
|
||||||
/* ---- Help text for (?) tooltips ---- */
|
/* ---- Help text for (?) tooltips ---- */
|
||||||
export const help: Record<string, string> = {
|
export const help: Record<string, string> = {
|
||||||
@@ -59,11 +60,7 @@ export const adapterLabels: Record<string, string> = {
|
|||||||
http: "HTTP",
|
http: "HTTP",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const roleLabels: Record<string, string> = {
|
export const roleLabels = AGENT_ROLE_LABELS as Record<string, string>;
|
||||||
ceo: "CEO", cto: "CTO", cmo: "CMO", cfo: "CFO",
|
|
||||||
engineer: "Engineer", designer: "Designer", pm: "PM",
|
|
||||||
qa: "QA", devops: "DevOps", researcher: "Researcher", general: "General",
|
|
||||||
};
|
|
||||||
|
|
||||||
/* ---- Primitive components ---- */
|
/* ---- Primitive components ---- */
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { PageTabBar } from "../components/PageTabBar";
|
|||||||
import { Tabs } from "@/components/ui/tabs";
|
import { Tabs } from "@/components/ui/tabs";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Bot, Plus, List, GitBranch, SlidersHorizontal } from "lucide-react";
|
import { Bot, Plus, List, GitBranch, SlidersHorizontal } from "lucide-react";
|
||||||
import type { Agent } from "@paperclipai/shared";
|
import { AGENT_ROLE_LABELS, type Agent } from "@paperclipai/shared";
|
||||||
|
|
||||||
const adapterLabels: Record<string, string> = {
|
const adapterLabels: Record<string, string> = {
|
||||||
claude_local: "Claude",
|
claude_local: "Claude",
|
||||||
@@ -30,11 +30,7 @@ const adapterLabels: Record<string, string> = {
|
|||||||
http: "HTTP",
|
http: "HTTP",
|
||||||
};
|
};
|
||||||
|
|
||||||
const roleLabels: Record<string, string> = {
|
const roleLabels = AGENT_ROLE_LABELS as Record<string, string>;
|
||||||
ceo: "CEO", cto: "CTO", cmo: "CMO", cfo: "CFO",
|
|
||||||
engineer: "Engineer", designer: "Designer", pm: "PM",
|
|
||||||
qa: "QA", devops: "DevOps", researcher: "Researcher", general: "General",
|
|
||||||
};
|
|
||||||
|
|
||||||
type FilterTab = "all" | "active" | "paused" | "error";
|
type FilterTab = "all" | "active" | "paused" | "error";
|
||||||
|
|
||||||
@@ -230,7 +226,7 @@ export function Agents() {
|
|||||||
<EntityRow
|
<EntityRow
|
||||||
key={agent.id}
|
key={agent.id}
|
||||||
title={agent.name}
|
title={agent.name}
|
||||||
subtitle={`${agent.role}${agent.title ? ` - ${agent.title}` : ""}`}
|
subtitle={`${roleLabels[agent.role] ?? agent.role}${agent.title ? ` - ${agent.title}` : ""}`}
|
||||||
to={agentUrl(agent)}
|
to={agentUrl(agent)}
|
||||||
leading={
|
leading={
|
||||||
<span className="relative flex h-2.5 w-2.5">
|
<span className="relative flex h-2.5 w-2.5">
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { EmptyState } from "../components/EmptyState";
|
|||||||
import { PageSkeleton } from "../components/PageSkeleton";
|
import { PageSkeleton } from "../components/PageSkeleton";
|
||||||
import { AgentIcon } from "../components/AgentIconPicker";
|
import { AgentIcon } from "../components/AgentIconPicker";
|
||||||
import { Network } from "lucide-react";
|
import { Network } from "lucide-react";
|
||||||
import type { Agent } from "@paperclipai/shared";
|
import { AGENT_ROLE_LABELS, type Agent } from "@paperclipai/shared";
|
||||||
|
|
||||||
// Layout constants
|
// Layout constants
|
||||||
const CARD_W = 200;
|
const CARD_W = 200;
|
||||||
@@ -421,11 +421,7 @@ export function OrgChart() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const roleLabels: Record<string, string> = {
|
const roleLabels = AGENT_ROLE_LABELS as Record<string, string>;
|
||||||
ceo: "CEO", cto: "CTO", cmo: "CMO", cfo: "CFO",
|
|
||||||
engineer: "Engineer", designer: "Designer", pm: "PM",
|
|
||||||
qa: "QA", devops: "DevOps", researcher: "Researcher", general: "General",
|
|
||||||
};
|
|
||||||
|
|
||||||
function roleLabel(role: string): string {
|
function roleLabel(role: string): string {
|
||||||
return roleLabels[role] ?? role;
|
return roleLabels[role] ?? role;
|
||||||
|
|||||||
Reference in New Issue
Block a user