Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| An archived agent can be found, brought back, or deleted for good. The Agents page ends with Archived, folded, where owners see every archived agent and members their own personal ones, each with when and by whom it was archived and what deleting it would take; Restore brings it back, under a new handle when a live agent has taken its old one, and Delete permanently asks for the handle to be typed and then removes its sessions, replies, memories, routines, versions, drafts, skills and its computer's home, leaving its messages in chat under its saved name, the workspace's spend totals and the audit log. In Chat an archived agent is deactivated the way people expect: never offered as someone to message or mention, never woken, a conversation with it kept in the list, dimmed and marked Archived, open to read with a note in place of the composer and a way to restore it for owners; after deletion the conversation still reads, its messages marked as a deleted agent's. The agents, chat and agent budgets guides say so. | 1 | /** |
| 2 | * The Archived section of the Agents page (docs.g1t.sh/guides/agents/, | |
| 3 | * "Archive, restore and delete"): what each archived agent's row says | |
| 4 | * about what deleting it would take. Pure, so it is tested on its own. | |
| 5 | */ | |
| 6 | import type { ArchivedAgent } from "@g1t/contracts"; | |
| 7 | ||
| 8 | const COUNTED: [keyof ArchivedAgent["counts"], string, string][] = [ | |
| 9 | ["sessions", "session", "sessions"], | |
| 10 | ["replies", "reply", "replies"], | |
| 11 | ["memories", "memory", "memories"], | |
| 12 | ["routines", "routine", "routines"], | |
| 13 | ]; | |
| 14 | ||
| 15 | /** "14 sessions · 231 replies · 3 memories": what is kept about the agent, zeros left out. */ | |
| 16 | export function countsLine(counts: ArchivedAgent["counts"]): string { | |
| 17 | const parts = COUNTED.filter(([key]) => counts[key] > 0).map(([key, one, many]) => `${counts[key].toLocaleString("en-US")} ${counts[key] === 1 ? one : many}`); | |
| 18 | return parts.length ? parts.join(" · ") : "Nothing recorded"; | |
| 19 | } | |
| 20 | ||
| 21 | /** Whether what was typed confirms deleting the agent: its handle, with or without the @, in any case. */ | |
| 22 | export function confirmsHandle(typed: string, handle: string): boolean { | |
| 23 | return typed.trim().replace(/^@/, "").toLowerCase() === handle.toLowerCase(); | |
| 24 | } |