g1t/apps/web/app/routes/workspace/layout.tsx
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.
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 1 | import { Plus } from "lucide-react"; |
| 2 | import { Outlet, data, useLocation } from "react-router"; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 3 | |
| 4 | import type { Route } from "./+types/layout"; | |
| Social cards for every page: og.g1t.sh | 5 | import { page } from "../../lib/meta"; |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 6 | import { Avatar, ButtonLink, Pill } from "../../components/ui"; |
| 7 | import { notFound } from "../../lib/not-found.server"; | |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 8 | import { redirectIfRenamed } from "../../lib/renamed.server"; |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 9 | import { rememberWorkspace } from "../../lib/workspace-choice"; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 10 | import { identity } from "../../lib/services.server"; |
| 11 | import { getViewer, roleIn } from "../../lib/session.server"; | |
| 12 | ||
| Social cards for every page: og.g1t.sh | 13 | export function meta({ loaderData, params, ...args }: Route.MetaArgs) { |
| 14 | return page(args, { title: `${loaderData?.workspace.name ?? params.owner} · g1t` }); | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 15 | } |
| 16 | ||
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 17 | export async function loader({ params, context, request }: Route.LoaderArgs) { |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 18 | const workspace = await identity.getWorkspace(params.owner); |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 19 | if (!workspace) { |
| 20 | // A workspace's old name, after a rename: its pages are at the new one. | |
| 21 | await redirectIfRenamed(request, params.owner); | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 22 | throw notFound("workspace"); |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 23 | } |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 24 | const role = roleIn(getViewer(context), workspace.slug); |
| 25 | // Opening one of your workspaces makes it the one you are in. | |
| 26 | if (!role) return { workspace, role }; | |
| 27 | const secure = new URL(request.url).protocol === "https:"; | |
| 28 | return data({ workspace, role }, { headers: { "Set-Cookie": rememberWorkspace(workspace.slug, secure) } }); | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 29 | } |
| 30 | ||
| A catalogue of model providers, and settings that feel like settings | 31 | /** A workspace's own pages, each with its title and what it is for. */ |
| 32 | const PAGES: Record<string, { title: string; about: string }> = { | |
| Workspace names and icons, and a component kit for every control | 33 | settings: { title: "General", about: "The workspace's name, icon, address and description." }, |
| A catalogue of model providers, and settings that feel like settings | 34 | people: { |
| 35 | title: "Members", | |
| 36 | about: "Members create repositories, push, manage issues and merge pull requests. Owners also manage members, tokens, billing and integrations.", | |
| 37 | }, | |
| 38 | tokens: { | |
| 39 | title: "Access tokens", | |
| 40 | about: "Tokens that belong to the workspace, not a person: for CI, integrations and agents that work for the whole team.", | |
| 41 | }, | |
| 42 | usage: { title: "Usage", about: "What the workspace's agents cost, run by run, by repository, pull request and model." }, | |
| Secrets and variables: one list, rows per environment, for workflows and deployments | 43 | billing: { title: "Billing and plans", about: "Paid plans, agent credit, and every charge against it." }, |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 44 | agents: { |
| 45 | title: "Agent fleet", | |
| 46 | about: "Every agent at work across the workspace's projects: what each holds, what it is doing now, and what it has cost.", | |
| 47 | }, | |
| 48 | memory: { | |
| 49 | title: "Workspace memory", | |
| 50 | about: "What holds across all of the workspace's projects, given to every agent in every one of them, beside each project's own memory.", | |
| 51 | }, | |
| Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API | 52 | context: { |
| 53 | title: "Context", | |
| 54 | about: "Everything the workspace builds and runs, and what it knows: a catalog built from its projects, memory with a review queue, one search over all of it, and a scorecard for each project.", | |
| 55 | }, | |
| 56 | audit: { | |
| 57 | title: "Audit log", | |
| 58 | about: "Every action agents took with their run credentials, and every change people and tokens made: by whom, on whose behalf, to what, and whether it was allowed.", | |
| 59 | }, | |
| 60 | guardrails: { | |
| 61 | title: "Guardrails", | |
| 62 | about: "What agents may reach, run, spend and take in every project's sandboxes. Each project can override these under its settings.", | |
| 63 | }, | |
| Webhooks: every event, to your own addresses, signed and retried | 64 | webhooks: { |
| 65 | title: "Webhooks", | |
| 66 | about: "Every repository's events, sent to your own addresses as they happen. A repository can also have its own, under its settings.", | |
| 67 | }, | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 68 | secrets: { |
| 69 | title: "Secrets and variables", | |
| Secrets and variables: one list, rows per environment, for workflows and deployments | 70 | about: "Shared with every repository, or the ones you link: read by workflows, deployments, or both. A repository's own row of the same key wins.", |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 71 | }, |
| A catalogue of model providers, and settings that feel like settings | 72 | integrations: { |
| 73 | title: "Integrations", | |
| 74 | about: "Model providers, alerts and trackers. Secrets are sealed when saved, and agents never see them.", | |
| 75 | }, | |
| 76 | }; | |
| 77 | ||
| Agents as a team: lifecycle, merge queue, billing and a new shell | 78 | export default function WorkspaceLayout({ loaderData }: Route.ComponentProps) { |
| 79 | const { workspace, role } = loaderData; | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 80 | // The sidebar finds the workspace's pages, for everyone, so its pages |
| 81 | // need a title, not the workspace's whole header again. | |
| A catalogue of model providers, and settings that feel like settings | 82 | const page = PAGES[useLocation().pathname.split("/-/")[1]?.split("/")[0] ?? ""]; |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 83 | if (page) { |
| A catalogue of model providers, and settings that feel like settings | 84 | return ( |
| 85 | <div className="mx-auto max-w-5xl px-4 py-10 sm:px-8"> | |
| 86 | <header className="mb-8 border-b border-line pb-6"> | |
| 87 | <h1 className="text-2xl font-semibold tracking-tight">{page.title}</h1> | |
| 88 | <p className="mt-1.5 text-sm text-muted">{page.about}</p> | |
| 89 | </header> | |
| 90 | <Outlet /> | |
| 91 | </div> | |
| 92 | ); | |
| 93 | } | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 94 | return ( |
| 95 | <> | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 96 | {/* The workspace's own header band. */} |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 97 | <div className="border-b border-line bg-surface/60"> |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 98 | <div className="mx-auto max-w-6xl px-4 pt-8 pb-8"> |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 99 | <div className="flex flex-wrap items-center gap-4"> |
| Workspace names and icons, and a component kit for every control | 100 | <Avatar name={workspace.slug} image={workspace.avatar} size={52} square /> |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 101 | <div className="min-w-0 grow"> |
| 102 | <div className="flex flex-wrap items-center gap-2.5"> | |
| 103 | <h1 className="truncate text-2xl font-semibold tracking-tight"> | |
| 104 | {workspace.name} | |
| 105 | </h1> | |
| 106 | {role && <Pill>{role}</Pill>} | |
| 107 | </div> | |
| 108 | <p className="font-mono text-sm text-muted">g1t.sh/{workspace.slug}</p> | |
| 109 | </div> | |
| 110 | {role && ( | |
| 111 | <ButtonLink to={`/new?workspace=${workspace.slug}`}> | |
| 112 | <Plus size={15} /> | |
| Projects live: fixes from walking them end to end | 113 | New project |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 114 | </ButtonLink> |
| 115 | )} | |
| 116 | </div> | |
| 117 | {workspace.description && ( | |
| 118 | <p className="mt-4 max-w-2xl text-sm text-muted">{workspace.description}</p> | |
| 119 | )} | |
| 120 | </div> | |
| 121 | </div> | |
| 122 | <div className="mx-auto max-w-6xl px-4 py-8"> | |
| 123 | <Outlet /> | |
| 124 | </div> | |
| 125 | </> | |
| 126 | ); | |
| 127 | } |