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.
| 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. | 1 | import { type ChatSidebar, type Principal, type User, shownUsername } from "@g1t/contracts"; |
| Chat and workspace agents: channels, DMs and named agents you talk to | 2 | |
| 3 | import type { Mentionable } from "./chat"; | |
| 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. | 4 | import { chat, identity } from "./services.server"; |
| Chat and workspace agents: channels, DMs and named agents you talk to | 5 | |
| 6 | /** | |
| 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. | 7 | * Who can be talked to in a workspace: its people, for mentions and for |
| 8 | * starting a direct message. Empty, not an error, when identity does not | |
| 9 | * answer. | |
| Chat and workspace agents: channels, DMs and named agents you talk to | 10 | */ |
| 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. | 11 | export async function workspacePeople(slug: string, viewer: User): Promise<Mentionable[]> { |
| 12 | const members = await identity.listMembers(slug, viewer).catch(() => null); | |
| 13 | return members?.ok | |
| Chat and workspace agents: channels, DMs and named agents you talk to | 14 | ? members.value.map((member) => ({ |
| 15 | kind: "user" as const, | |
| 16 | name: member.username, | |
| Cards you act on in chat; agents comment and review as themselves; names shown cleanly; commits on the calendar | 17 | display_username: member.display_username ?? null, |
| 18 | // As chat names them (`memberName`): display name, else the username as they wrote it. | |
| 19 | display_name: member.name?.trim() || shownUsername(member), | |
| Chat and workspace agents: channels, DMs and named agents you talk to | 20 | avatar: member.avatar ?? null, |
| 21 | })) | |
| 22 | : []; | |
| 23 | } | |
| 24 | ||
| 25 | /** The sidebar, or null when chat does not answer. */ | |
| 26 | export async function sidebarOrNull(slug: string, viewer: User): Promise<ChatSidebar | null> { | |
| 27 | try { | |
| 28 | const result = await chat.sidebar(slug, viewer); | |
| 29 | return result.ok ? result.value : null; | |
| 30 | } catch { | |
| 31 | return null; | |
| 32 | } | |
| 33 | } | |
| 34 | ||
| 35 | /** | |
| 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. | 36 | * Members as a form sends them, `user:<username>`, as the chat service |
| 37 | * names them: a person by their account id. Anyone who is not a member of | |
| 38 | * the workspace is left out, and so is anything that is not a person. | |
| Chat and workspace agents: channels, DMs and named agents you talk to | 39 | */ |
| 40 | export async function principalsFrom(slug: string, viewer: User, fields: string[]): Promise<Principal[]> { | |
| 41 | const usernames = fields.filter((f) => f.startsWith("user:")).map((f) => f.slice(5).toLowerCase()); | |
| 42 | const members = usernames.length > 0 ? await identity.listMembers(slug, viewer).catch(() => null) : null; | |
| 43 | const known = new Set(members?.ok ? members.value.map((m) => m.username.toLowerCase()) : []); | |
| 44 | const people = await Promise.all( | |
| 45 | usernames | |
| 46 | .filter((name) => known.has(name) && name !== viewer.username.toLowerCase()) | |
| 47 | .map((name) => identity.userByUsername(name).catch(() => null)), | |
| 48 | ); | |
| 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. | 49 | return people.filter((user): user is User => user != null).map((user) => ({ kind: "user" as const, id: user.id })); |
| Chat and workspace agents: channels, DMs and named agents you talk to | 50 | } |
| 51 | ||
| 52 | /** The cookie that remembers the last conversation open, so Chat opens there again. */ | |
| 53 | export const LAST_CHAT_COOKIE = "g1t_chat"; | |
| 54 | ||
| 55 | export function rememberChat(path: string, secure: boolean): string { | |
| 56 | return `${LAST_CHAT_COOKIE}=${encodeURIComponent(path)}; Path=/; Max-Age=2592000; SameSite=Lax; HttpOnly${secure ? "; Secure" : ""}`; | |
| 57 | } |