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.
| Cards you act on in chat; agents comment and review as themselves; names shown cleanly; commits on the calendar | 1 | /** |
| The site no longer has g1t's own agents. g1t is where the coding agents you already use do their work, so the Agents mode is gone from the rail, with every page under /<workspace>/-/agents: personas, faces, skills, abilities, routines, computers, sessions and agent spend. Customize (skills, connectors, plugins, marketplaces), the context hub, model providers, the AI Gateway page, the Spend page and pill, Ask g1t, and the repository's Agents, Plans and agent settings pages go too, and their addresses now answer 404. | 2 | * Cards in chat: how a card's state reads, which of its actions show (its |
| 3 | * links), and when its preview folds. Pure, so it is tested on its own; | |
| 4 | * components/chat/card.tsx draws them. | |
| Cards you act on in chat; agents comment and review as themselves; names shown cleanly; commits on the calendar | 5 | */ |
| 6 | import type { CardAction, MessageCard } from "@g1t/contracts"; | |
| 7 | ||
| 8 | import type { SessionChip } from "./session-card"; | |
| 9 | ||
| 10 | /** A card's state chip, as a session's is, outlined only when it is waiting quietly. */ | |
| 11 | export type CardChip = { tone: SessionChip["tone"] | "merged"; live: boolean; outline?: boolean }; | |
| 12 | ||
| 13 | const DRAFT_CHIPS: Record<string, CardChip> = { | |
| 14 | // Waiting on someone to file it: lavender, outlined only. | |
| 15 | draft: { tone: "accent", live: false, outline: true }, | |
| 16 | filed: { tone: "success", live: false }, | |
| 17 | discarded: { tone: "neutral", live: false }, | |
| 18 | }; | |
| 19 | ||
| 20 | /** | |
| 21 | * How a draft issue's state reads; null for other kinds (a session's chip | |
| 22 | * is lib/session-card.ts's, others are guessed from their words). | |
| 23 | */ | |
| 24 | export function cardChip(card: Pick<MessageCard, "kind" | "state">): CardChip | null { | |
| 25 | if (!card.state) return null; | |
| 26 | if (card.kind === "draft_issue") return DRAFT_CHIPS[card.state.trim().toLowerCase()] ?? { tone: "neutral", live: false }; | |
| 27 | return null; | |
| 28 | } | |
| 29 | ||
| 30 | /** | |
| The site no longer has g1t's own agents. g1t is where the coding agents you already use do their work, so the Agents mode is gone from the rail, with every page under /<workspace>/-/agents: personas, faces, skills, abilities, routines, computers, sessions and agent spend. Customize (skills, connectors, plugins, marketplaces), the context hub, model providers, the AI Gateway page, the Spend page and pill, Ask g1t, and the repository's Agents, Plans and agent settings pages go too, and their addresses now answer 404. | 31 | * The actions a card shows: its links. The service that answered the |
| 32 | * others (agents) is gone, so an old card's buttons that ran something are | |
| 33 | * left out; the card stays to read. | |
| Cards you act on in chat; agents comment and review as themselves; names shown cleanly; commits on the calendar | 34 | */ |
| The site no longer has g1t's own agents. g1t is where the coding agents you already use do their work, so the Agents mode is gone from the rail, with every page under /<workspace>/-/agents: personas, faces, skills, abilities, routines, computers, sessions and agent spend. Customize (skills, connectors, plugins, marketplaces), the context hub, model providers, the AI Gateway page, the Spend page and pill, Ask g1t, and the repository's Agents, Plans and agent settings pages go too, and their addresses now answer 404. | 35 | export function shownActions(card: Pick<MessageCard, "actions">): CardAction[] { |
| 36 | return (card.actions ?? []).filter((a) => !!a.href); | |
| Cards you act on in chat; agents comment and review as themselves; names shown cleanly; commits on the calendar | 37 | } |
| 38 | ||
| 39 | /** Whether a body is long enough that its preview starts folded (over about eight lines). */ | |
| 40 | export function foldsBody(body: string, lines = 8): boolean { | |
| 41 | const rows = body.split("\n").reduce((n, line) => n + Math.max(1, Math.ceil(line.length / 80)), 0); | |
| 42 | return rows > lines; | |
| 43 | } |