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.
| Chat and workspace agents: channels, DMs and named agents you talk to | 1 | /** |
| 2 | * An agent's handle: how it is mentioned (`@ship`). Pure, so it is tested | |
| 3 | * on its own. | |
| 4 | * | |
| 5 | * Lowercase letters, digits and hyphens, 2 to 32 characters, with no | |
| 6 | * leading, trailing or doubled hyphen (the same shape as a username, so a | |
| 7 | * mention reads the same for both). Never a name nobody may register: | |
| 8 | * `g1t` is the platform's own agent, and routes such as `settings` would | |
| 9 | * read as links. | |
| 10 | */ | |
| 11 | import { isReservedName } from "../../../packages/contracts/src/names.ts"; | |
| 12 | ||
| 13 | /** | |
| 14 | * Handles the site's agent pages would read as their own routes | |
| Agents → Skills is the workspace's skill library in the open SKILL.md format: write a skill in g1t, import a SKILL.md or zip, link a repository whose .g1t/skills folders publish on every push, or save a finished session as a skill once a person reviews it; attach a skill to an agent, a team or the whole workspace, each attachment pinned to a version. Agents see each skill's name and when to use it, and read the rest with use_skill when a request needs it; a skill never adds a permission, and scripts wait for an agent's own computer. The agent skills guide says how. | 15 | * (`/<workspace>/-/agents/new`, `…/templates`, `…/skills`, `…/runs`, `…/fleet`), |
| The Marketplace adds what g1t doesn't do and connects what you already use: extensions (Mail, Support, CRM, Recruiting, On-call, and bridges to a helpdesk, CRM or ERP you run, all Soon), starter kits, and integrations connected by the workspace or by each person; agents aren't installed there. Agent templates live in Agents, as starting points you configure, at Agents → Templates, and the Marketplace's old agent addresses lead there. The marketplace and agents guides say how. | 16 | * besides the names nobody may register. |
| Chat and workspace agents: channels, DMs and named agents you talk to | 17 | */ |
| Agents → Skills is the workspace's skill library in the open SKILL.md format: write a skill in g1t, import a SKILL.md or zip, link a repository whose .g1t/skills folders publish on every push, or save a finished session as a skill once a person reviews it; attach a skill to an agent, a team or the whole workspace, each attachment pinned to a version. Agents see each skill's name and when to use it, and read the rest with use_skill when a request needs it; a skill never adds a permission, and scripts wait for an agent's own computer. The agent skills guide says how. | 18 | const ROUTES = new Set(["new", "templates", "skills", "runs", "fleet"]); |
| Chat and workspace agents: channels, DMs and named agents you talk to | 19 | |
| 20 | const HANDLE = /^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){1,31}$/; | |
| 21 | ||
| 22 | export const HANDLE_RULE = "A handle is 2 to 32 lowercase letters, digits and single hyphens, starting and ending with a letter or digit."; | |
| 23 | ||
| 24 | export type HandleCheck = { ok: true; handle: string } | { ok: false; message: string }; | |
| 25 | ||
| 26 | /** `value` as a handle (trimmed, lowercased, a leading `@` dropped), or why it cannot be one. */ | |
| 27 | export function checkHandle(value: unknown): HandleCheck { | |
| 28 | if (typeof value !== "string") return { ok: false, message: HANDLE_RULE }; | |
| 29 | const handle = value.trim().replace(/^@/, "").toLowerCase(); | |
| 30 | if (!HANDLE.test(handle)) return { ok: false, message: HANDLE_RULE }; | |
| 31 | if (isReservedName(handle) || ROUTES.has(handle)) return { ok: false, message: `@${handle} is reserved. Choose another handle.` }; | |
| 32 | return { ok: true, handle }; | |
| 33 | } |