| 1 | import { useOutletContext, useParams } from "react-router"; |
| 2 | |
| 3 | import type { WorkspaceAgent } from "@g1t/contracts"; |
| 4 | |
| 5 | import { MessageAgent } from "./agent"; |
| 6 | import { AgentAvatar } from "../../../components/agent-avatar"; |
| 7 | import { isOrchestrator } from "../../../components/orchestrator"; |
| 8 | |
| 9 | /** An empty desk, in the agent's own voice. */ |
| 10 | const EMPTY_DESK: Record<string, string> = { |
| 11 | crisp: "Nothing on my desk. Send me something and I'll take it from there.", |
| 12 | friendly: "My desk is all clear! Send me something to work on and I'll get going.", |
| 13 | socratic: "Nothing here yet. What would you like me to look at first?", |
| 14 | terse: "Desk empty. Send work.", |
| 15 | }; |
| 16 | |
| 17 | /** |
| 18 | * Every task the agent holds, as live cards. Tasks arrive with the desk |
| 19 | * (docs/WORKSPACE.md, "Tasks"); until then, the way to give it one. |
| 20 | */ |
| 21 | export default function Desk() { |
| 22 | const agent = useOutletContext<WorkspaceAgent>(); |
| 23 | const { owner = "" } = useParams(); |
| 24 | return ( |
| 25 | <div className="rounded-2xl border border-dashed border-line bg-surface/40 px-6 py-16 text-center"> |
| 26 | <span className="mx-auto flex justify-center"> |
| 27 | <AgentAvatar agent={{ ...agent, builtin: isOrchestrator(agent) }} size={52} /> |
| 28 | </span> |
| 29 | <h2 className="mt-4 text-base font-semibold">No tasks yet</h2> |
| 30 | <blockquote className="mx-auto mt-3 max-w-md text-[0.9375rem] text-fg-soft"> |
| 31 | “{EMPTY_DESK[agent.personality_preset] ?? EMPTY_DESK.crisp}” |
| 32 | <footer className="mt-1 text-xs text-faint">{agent.display_name}</footer> |
| 33 | </blockquote> |
| 34 | <p className="mx-auto mt-4 max-w-md text-sm text-muted"> |
| 35 | DM {agent.display_name} to give it one. Each task shows here with its steps, cost and what it's waiting on. |
| 36 | </p> |
| 37 | <div className="mt-6 flex justify-center"> |
| 38 | <MessageAgent slug={owner} agent={agent} variant="accent" /> |
| 39 | </div> |
| 40 | <p className="mt-4 text-xs text-faint"> |
| 41 | Works up to {agent.capacity} {agent.capacity === 1 ? "task" : "tasks"} at once; more wait here in line. |
| 42 | </p> |
| 43 | </div> |
| 44 | ); |
| 45 | } |