Skip to content
226 linesCodeBlameRaw

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.

Merge branch 'worktree-agent-ad7c6d88d93adc817'1import { Package, Plus } from "lucide-react";
2import { Outlet, data, redirect, useLocation, useNavigation } from "react-router";
Docs: merge_group in the merge queue and Actions guides3
4import type { Route } from "./+types/layout";
Social cards for every page: og.g1t.sh5import { page } from "../../lib/meta";
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put6import { Avatar, ButtonLink, Pill } from "../../components/ui";
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas7import { WelcomeBanner } from "../../components/welcome";
8import { clearWelcome, welcomes } from "../../lib/invites";
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put9import { notFound } from "../../lib/not-found.server";
Agents and memory, checks and conflicts, profiles, slug renames, custom domains10import { redirectIfRenamed } from "../../lib/renamed.server";
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put11import { rememberWorkspace } from "../../lib/workspace-choice";
Merge branch 'worktree-agent-ad7c6d88d93adc817'12import { workspacePage, workspaceRedirect } from "../../lib/workspace-nav";
13import { WorkspacePageSkeleton } from "../../components/workspace-skeletons";
Docs: merge_group in the merge queue and Actions guides14import { identity } from "../../lib/services.server";
15import { getViewer, roleIn } from "../../lib/session.server";
16
Social cards for every page: og.g1t.sh17export function meta({ loaderData, params, ...args }: Route.MetaArgs) {
18 return page(args, { title: `${loaderData?.workspace.name ?? params.owner} · g1t` });
Docs: merge_group in the merge queue and Actions guides19}
20
Agents and memory, checks and conflicts, profiles, slug renames, custom domains21export async function loader({ params, context, request }: Route.LoaderArgs) {
Navigation: the workspace's own page with tabs, pins and recent in the sidebar22 const url = new URL(request.url);
Merge branch 'worktree-agent-ad7c6d88d93adc817'23 // `?tab=projects` and the like, from the tabs this page once had: that
24 // page's own address.
Navigation: the workspace's own page with tabs, pins and recent in the sidebar25 const moved = url.search ? workspaceRedirect(url.pathname, url.search) : null;
26 if (moved) throw redirect(moved);
27 const viewer = getViewer(context);
Merge branch 'worktree-agent-ad7c6d88d93adc817'28 const workspace = await identity.getWorkspace(params.owner);
Agents and memory, checks and conflicts, profiles, slug renames, custom domains29 if (!workspace) {
30 // A workspace's old name, after a rename: its pages are at the new one.
31 await redirectIfRenamed(request, params.owner);
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put32 throw notFound("workspace");
Agents and memory, checks and conflicts, profiles, slug renames, custom domains33 }
Navigation: the workspace's own page with tabs, pins and recent in the sidebar34 const role = roleIn(viewer, workspace.slug);
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put35 // Opening one of your workspaces makes it the one you are in.
Merge branch 'worktree-agent-ad7c6d88d93adc817'36 if (!role) return { workspace, role, welcome: false };
Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put37 const secure = new URL(request.url).protocol === "https:";
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas38 const headers = new Headers({ "Set-Cookie": rememberWorkspace(workspace.slug, secure) });
39 // Just joined with an invite: welcomed once (routes/invite.tsx).
40 const welcome = welcomes(request.headers.get("cookie"), workspace.slug);
41 if (welcome) headers.append("Set-Cookie", clearWelcome(secure));
Merge branch 'worktree-agent-ad7c6d88d93adc817'42 return data({ workspace, role, welcome }, { headers });
Docs: merge_group in the merge queue and Actions guides43}
44
45/** A workspace's own pages, each with its title and what it is for. */
46const PAGES: Record<string, { title: string; about: string }> = {
Merge the workspace shell: navigation and phone shell, g1t as orchestrator, agents in roles with audience-checked reads, reactions and custom emoji, live notifications and browser push, the homepage tour (agents 0002, chat 0002)47 workspace: {
48 title: "Workspace",
49 about: "Who is in it, what it is on, and what it has spent this month. Everything about the workspace itself is in this sidebar.",
50 },
Merge branch 'worktree-agent-ad7c6d88d93adc817'51 settings: { title: "General", about: "The workspace's name, icon, address and description, who can create teams, and deleting it." },
Docs: merge_group in the merge queue and Actions guides52 people: {
Navigation: the workspace's own page with tabs, pins and recent in the sidebar53 title: "People",
People and teams are front and centre: one directory of people and agents with presence, local time, titles, teams and what each owns; profiles with manager and reports and the agents they work with; an org chart with each team's agents beside the person who leads it; and teams of any mix, with a lead, a channel, a budget agents keep to and the agents on them. Every agent is told its teams each turn (who leads, who owns what, who's around and who to page), and the team page shows exactly what. Member management is Members and invites; the people and teams guide says how.54 about: "Everyone in the workspace, people and agents, in one directory: who they are, what they own, the teams they're on and who's around.",
55 },
56 members: {
57 title: "Members and invites",
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look58 about: "Members create repositories and have the base permission on each one. Owners are Admins on every repository, and also manage members, tokens, billing and integrations.",
59 },
People and teams are front and centre: one directory of people and agents with presence, local time, titles, teams and what each owns; profiles with manager and reports and the agents they work with; an org chart with each team's agents beside the person who leads it; and teams of any mix, with a lead, a channel, a budget agents keep to and the agents on them. Every agent is told its teams each turn (who leads, who owns what, who's around and who to page), and the team page shows exactly what. Member management is Members and invites; the people and teams guide says how.60 "org-chart": {
61 title: "Org chart",
62 about: "Who reports to whom, with each team's agents beside the person who leads it.",
63 },
Navigation: the workspace's own page with tabs, pins and recent in the sidebar64 projects: {
65 title: "Projects",
66 about: "Everything the workspace builds and runs. Search, filter and sort them, and pin the ones you use most to keep them in your sidebar.",
67 },
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar68 teams: {
69 title: "Teams",
People and teams are front and centre: one directory of people and agents with presence, local time, titles, teams and what each owns; profiles with manager and reports and the agents they work with; an org chart with each team's agents beside the person who leads it; and teams of any mix, with a lead, a channel, a budget agents keep to and the agents on them. Every agent is told its teams each turn (who leads, who owns what, who's around and who to page), and the team page shows exactly what. Member management is Members and invites; the people and teams guide says how.70 about: "People, agents, or both, with a lead, a channel, roles on repositories and a budget for their agents. Everyone on a team, agents included, knows who their teammates are.",
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar71 },
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look72 repositories: {
73 title: "Repositories",
74 about: "Every repository in the workspace: who can see it, whether it is archived, and the ones deleted recently.",
Docs: merge_group in the merge queue and Actions guides75 },
76 tokens: {
77 title: "Access tokens",
One kind of access token; presence and status; usernames keep their case; the tour is a miniature of the real app; icons for password managers78 about: "Tokens that belong to the workspace, not a person: for CI, integrations and agents that work for the whole team. Each has the permissions an owner gives it, in all of the workspace's repositories or the ones chosen.",
Settings: fine-grained tokens, workspace token Admin, workspace personal access token rules79 },
80 "personal-access-tokens": {
81 title: "Personal access tokens",
One kind of access token; presence and status; usernames keep their case; the tour is a miniature of the real app; icons for password managers82 about: "Which of your members' own tokens may reach the workspace and for how long, the tokens made for it that wait for an owner's approval, and every token that can reach it.",
Docs: merge_group in the merge queue and Actions guides83 },
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member84 packages: {
85 title: "Packages",
The Packages page names every registry it has86 about: "What the workspace publishes and installs, beside its code: container images, npm, Composer, Go, Cargo, Maven, NuGet and RubyGems, with the same members, roles and tokens.",
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member87 },
Docs: merge_group in the merge queue and Actions guides88 usage: { title: "Usage", about: "What the workspace's agents cost, run by run, by repository, pull request and model." },
Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens89 gateway: {
90 title: "AI Gateway",
91 about: "Your own code's model requests, sent with the workspace's access tokens: each one's model, tokens, cost and status.",
92 },
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look93 billing: { title: "Billing and plans", about: "The g1t plan, the trial, your spend limit and caps, prepaying, and every charge." },
Agents and memory, checks and conflicts, profiles, slug renames, custom domains94 agents: {
Agents mode: an overview of every agent's work and spend, and each agent's sessions, memory, routines, spend, activity and versions95 title: "Agents",
96 about: "The workspace's agents together: what they are working on now, what waits on you, and where this month's agent budget went.",
Agents and memory, checks and conflicts, profiles, slug renames, custom domains97 },
98 memory: {
99 title: "Workspace memory",
100 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.",
101 },
Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API102 context: {
103 title: "Context",
104 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.",
105 },
106 audit: {
107 title: "Audit log",
108 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.",
109 },
110 guardrails: {
111 title: "Guardrails",
112 about: "What agents may reach, run, spend and take in every project's sandboxes. Each project can override these under its settings.",
113 },
Docs: merge_group in the merge queue and Actions guides114 webhooks: {
115 title: "Webhooks",
116 about: "Every repository's events, sent to your own addresses as they happen. A repository can also have its own, under its settings.",
117 },
118 secrets: {
119 title: "Secrets and variables",
Secrets and variables: one list, rows per environment, for workflows and deployments120 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.",
Docs: merge_group in the merge queue and Actions guides121 },
Security matches the workspace's other pages and leaves out deleted repositories; every section has a name in the trail122 security: {
123 title: "Security",
124 about: "Open alerts in every project: secrets found in pushes and history, and vulnerable dependencies. Each project's Security page has the details and the security update g1t opened for each.",
125 },
Docs: merge_group in the merge queue and Actions guides126 integrations: {
127 title: "Integrations",
Integrations are a directory of connectors, for a workspace and for each person128 about:
129 "The tools your team works with, connected once for everyone in the workspace and its agents. Secrets are sealed when saved, and agents never see them.",
Docs: merge_group in the merge queue and Actions guides130 },
131};
132
Merge branch 'worktree-agent-ad7c6d88d93adc817'133/** A workspace page's heading: its title and what it is for. */
134function PageHeader({ title, about }: { title: string; about: string }) {
Navigation: the workspace's own page with tabs, pins and recent in the sidebar135 return (
Merge branch 'worktree-agent-ad7c6d88d93adc817'136 <header className="mb-8 border-b border-line pb-6">
137 <h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
138 <p className="mt-1.5 text-sm text-muted">{about}</p>
139 </header>
Navigation: the workspace's own page with tabs, pins and recent in the sidebar140 );
141}
142
Docs: merge_group in the merge queue and Actions guides143export default function WorkspaceLayout({ loaderData }: Route.ComponentProps) {
Merge branch 'worktree-agent-ad7c6d88d93adc817'144 const { workspace, role, welcome } = loaderData;
Navigation: the workspace's own page with tabs, pins and recent in the sidebar145 const { pathname } = useLocation();
146 const going = useNavigation().location;
Merge branch 'worktree-agent-ad7c6d88d93adc817'147 // The workspace's own page is its overview. Its other pages are found
148 // from the sidebar, which lights the one you are on, and the top bar's
149 // trail leads back here; each has a heading of its own.
150 const here = workspacePage(pathname, workspace.slug);
151 // On the way to another of its pages: that page's heading and shape
152 // until it arrives.
153 const next = going && going.pathname !== pathname ? workspacePage(going.pathname, workspace.slug) : null;
154 const shown = next ?? here;
Navigation: the workspace's own page with tabs, pins and recent in the sidebar155 const parts = (pathname.split("/-/")[1] ?? "").split("/").filter(Boolean);
Chat and workspace agents: channels, DMs and named agents you talk to156 // Chat fills the page edge to edge: its conversation, thread and details
157 // are columns of their own (components/chat/channel.tsx).
158 if (parts[0] === "chat" && !next) return <Outlet />;
Merge the workspace shell: navigation and phone shell, g1t as orchestrator, agents in roles with audience-checked reads, reactions and custom emoji, live notifications and browser push, the homepage tour (agents 0002, chat 0002)159 // Code's Overview lays itself out, as Mission control did.
160 if (parts[0] === "overview" && parts.length === 1 && !next) return <Outlet />;
Merge branch 'worktree-agent-ad7c6d88d93adc817'161 if (shown !== "overview") {
162 const key = shown ?? parts[0] ?? "";
163 const heading = PAGES[key];
164 // A page within one (a single package or team) and a page that is
165 // coming (Insights) have headings of their own.
166 const titled = heading && (shown != null || parts.length === 1);
Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member167 return (
168 <div className="mx-auto max-w-5xl px-4 py-10 sm:px-8">
Merge the workspace shell: navigation and phone shell, g1t as orchestrator, agents in roles with audience-checked reads, reactions and custom emoji, live notifications and browser push, the homepage tour (agents 0002, chat 0002)169 {titled && (
170 // A phone's Agents tab opens on its list of agents (agents/layout.tsx); the fleet's heading would sit above it.
171 <div className={key === "agents" ? "max-md:hidden" : undefined}>
172 <PageHeader title={heading.title} about={heading.about} />
173 </div>
174 )}
Merge branch 'worktree-agent-ad7c6d88d93adc817'175 {next ? <WorkspacePageSkeleton page={next} /> : <Outlet />}
Docs: merge_group in the merge queue and Actions guides176 </div>
177 );
178 }
179 return (
180 <>
Merge branch 'worktree-agent-ad7c6d88d93adc817'181 {/* The workspace's own header band, above its overview. */}
Docs: merge_group in the merge queue and Actions guides182 <div className="border-b border-line bg-surface/60">
Merge branch 'worktree-agent-ad7c6d88d93adc817'183 <div className="mx-auto max-w-6xl px-4 py-8">
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas184 {welcome && (
185 <div className="mb-6">
186 <WelcomeBanner title={`You're in ${workspace.name}`}>
187 You joined as a {role}. Its projects, issues and agents are all here.
188 </WelcomeBanner>
189 </div>
190 )}
Docs: merge_group in the merge queue and Actions guides191 <div className="flex flex-wrap items-center gap-4">
Workspace names and icons, and a component kit for every control192 <Avatar name={workspace.slug} image={workspace.avatar} size={52} square />
Docs: merge_group in the merge queue and Actions guides193 <div className="min-w-0 grow">
194 <div className="flex flex-wrap items-center gap-2.5">
195 <h1 className="truncate text-2xl font-semibold tracking-tight">
196 {workspace.name}
197 </h1>
198 {role && <Pill>{role}</Pill>}
199 </div>
200 <p className="font-mono text-sm text-muted">g1t.sh/{workspace.slug}</p>
201 </div>
Merge branch 'worktree-agent-ad7c6d88d93adc817'202 {role ? (
Docs: merge_group in the merge queue and Actions guides203 <ButtonLink to={`/new?workspace=${workspace.slug}`}>
204 <Plus size={15} />
Projects live: fixes from walking them end to end205 New project
Docs: merge_group in the merge queue and Actions guides206 </ButtonLink>
Merge branch 'worktree-agent-ad7c6d88d93adc817'207 ) : (
208 // A visitor's sidebar is not this workspace's: its packages
209 // are a link here, as its projects are below.
210 <ButtonLink to={`/${workspace.slug}/-/packages`} variant="quiet" prefetch="intent">
211 <Package size={15} />
212 Packages
213 </ButtonLink>
Docs: merge_group in the merge queue and Actions guides214 )}
215 </div>
216 {workspace.description && (
217 <p className="mt-4 max-w-2xl text-sm text-muted">{workspace.description}</p>
218 )}
219 </div>
220 </div>
221 <div className="mx-auto max-w-6xl px-4 py-8">
Merge branch 'worktree-agent-ad7c6d88d93adc817'222 {next ? <WorkspacePageSkeleton page="overview" /> : <Outlet />}
Docs: merge_group in the merge queue and Actions guides223 </div>
224 </>
225 );
226}

This file's history is long; its oldest lines are credited to the oldest commit read.