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.
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 1 | import type { AccessClient, BasePermission, RepoGrant } from "./access"; |
| Settings: fine-grained tokens, workspace token Admin, workspace personal access token rules | 2 | import type { PermissionAccess, RepositorySelection } from "./fine-grained"; |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 3 | import type { MemberPrivileges, OrgRole, PolicyHold } from "./members"; |
| Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API | 4 | import type { Acting, CreateRunCredentialInput, RunBinding } from "./audit"; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 5 | import type { RepoPath } from "./repos"; |
| Initial g1t: services, event bus, intents and attempts | 6 | import type { Result } from "./result"; |
| Merge branch 'worktree-agent-ad7c6d88d93adc817' | 7 | import type { TeamCreation, TeamsClient } from "./teams"; |
| Merge branch 'worktree-agent-a5a5de74d8863d554' into worktree-agent-a16631325aecf58ca | 8 | import type { DeployKeysClient } from "./deploy-keys"; |
| Merge email confirmation gate: a code and a link, nothing until confirmed (identity 0036) | 9 | import type { EmailConfirmed } from "./accounts"; |
| Initial g1t: services, event bus, intents and attempts | 10 | |
| Email verification, password reset, and Git for AI scale positioning | 11 | export type User = { |
| 12 | id: string; | |
| 13 | username: string; | |
| 14 | /** | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 15 | * `workspace` when a workspace is acting through one of its own access |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 16 | * tokens: `id` is then the workspace's and `username` its slug. `system` |
| 17 | * is g1t itself doing platform work, such as a security update | |
| 18 | * (`username` `g1t`). Absent means `user`. | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 19 | */ |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 20 | kind?: "user" | "workspace" | "agent" | "system"; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 21 | /** |
| Email verification, password reset, and Git for AI scale positioning | 22 | * Whether the account's email address is confirmed. Only set on users |
| Merge email confirmation gate: a code and a link, nothing until confirmed (identity 0036) | 23 | * resolved from credentials. An account that has not confirmed it can |
| 24 | * only confirm it: see `awaitsConfirmation`. | |
| Email verification, password reset, and Git for AI scale positioning | 25 | */ |
| 26 | verified?: boolean; | |
| Workspaces own repositories | 27 | /** |
| 28 | * The workspaces this user belongs to. Set on users resolved from | |
| 29 | * credentials, so any service can authorize from it. | |
| 30 | */ | |
| 31 | workspaces?: Membership[]; | |
| Workspace names and icons, and a component kit for every control | 32 | /** |
| 33 | * The person's uploaded avatar: the SHA-256 of its bytes, served at | |
| 34 | * `/avatars/<avatar>`. Only set on the signed-in person; absent means | |
| 35 | * the generated letter avatar. | |
| 36 | */ | |
| 37 | avatar?: string; | |
| Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API | 38 | /** |
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 39 | * Set on an agent resolved from its token: who it acts for ("g1t |
| Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API | 40 | * on behalf of syntaqx"), with which credential, and what it may do. |
| 41 | */ | |
| 42 | acting?: Acting; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 43 | /** |
| 44 | * The repositories this user has a role on directly, whether or not they | |
| 45 | * belong to its workspace. Set with `workspaces`; see `access.ts`. | |
| 46 | */ | |
| 47 | grants?: RepoGrant[]; | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 48 | /** |
| 49 | * Set on a user resolved from an access token: its scopes (null for full | |
| 50 | * access) and the workspaces or repositories it reaches. See scopes.ts. | |
| 51 | */ | |
| 52 | token?: { | |
| 53 | token_id: string; | |
| 54 | scopes?: string[] | null; | |
| 55 | legacy?: boolean; | |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 56 | /** The token's name, as its owner gave it. */ |
| 57 | name?: string; | |
| TS access mirrors the workspace token cap and fine-grained reach | 58 | /** A fine-grained token's reach: its resource owner and repositories. */ |
| 59 | fine_grained?: { | |
| 60 | workspace?: string | null; | |
| 61 | repositories?: "all" | "selected" | "public"; | |
| 62 | repo_ids?: string[]; | |
| 63 | }; | |
| 64 | /** A workspace's own token an owner gave Admin. */ | |
| 65 | admin?: boolean; | |
| 66 | /** Set on what a deploy key resolves to. */ | |
| 67 | deploy_key?: string; | |
| 68 | /** The one repository a job's token or a deploy key reaches. */ | |
| 69 | repo?: string; | |
| Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts | 70 | /** Set on a workflow job's token (`G1T_TOKEN`): the run and job it was made for. */ |
| 71 | job?: { run_id: string; job_id: string; pull_requests?: boolean }; | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 72 | }; |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 73 | /** |
| 74 | * Workspaces the person belongs to but cannot use until they meet its | |
| 75 | * policy, such as turning on two-factor authentication. Left out of | |
| 76 | * `workspaces` and `grants` meanwhile. | |
| 77 | */ | |
| 78 | held?: PolicyHold[]; | |
| Email verification, password reset, and Git for AI scale positioning | 79 | }; |
| Initial g1t: services, event bus, intents and attempts | 80 | |
| Workspaces own repositories | 81 | /** What a member may do: an owner also manages the workspace's members. */ |
| 82 | export type Role = "owner" | "member"; | |
| 83 | ||
| Workspace names and icons, and a component kit for every control | 84 | export type Membership = { |
| 85 | /** The workspace's name in URLs: `g1t.sh/<slug>`. */ | |
| 86 | slug: string; | |
| 87 | role: Role; | |
| 88 | /** Its display name. Set on users resolved from credentials. */ | |
| 89 | name?: string; | |
| 90 | /** Its uploaded icon, as `Workspace.avatar`. */ | |
| 91 | avatar?: string; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 92 | /** The workspace's base permission: what members get on every repository. Absent means `write`. */ |
| 93 | base_permission?: BasePermission; | |
| Merge branch 'worktree-agent-ad7c6d88d93adc817' | 94 | /** Who may create its teams. Absent means any member. */ |
| 95 | team_creation?: TeamCreation; | |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 96 | /** The roles held besides owner or member. */ |
| 97 | org_roles?: OrgRole[]; | |
| 98 | /** What the workspace lets its members do. Absent means the defaults. */ | |
| 99 | privileges?: MemberPrivileges; | |
| Workspace names and icons, and a component kit for every control | 100 | }; |
| Workspaces own repositories | 101 | |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 102 | /** How long an old workspace slug redirects, and stays reserved for it, after a rename. */ |
| 103 | export const SLUG_HOLD_DAYS = 90; | |
| 104 | ||
| 105 | /** How long a workspace must wait between renames. */ | |
| 106 | export const RENAME_COOLDOWN_HOURS = 24; | |
| 107 | ||
| Workspace names and icons, and a component kit for every control | 108 | /** The largest avatar that can be uploaded, in bytes. */ |
| 109 | export const MAX_AVATAR_BYTES = 1024 * 1024; | |
| 110 | ||
| Workspaces own repositories | 111 | /** |
| Merge branch 'worktree-agent-a2013627e5ea4ab13' | 112 | * Where a workspace keeps its repositories' git data: anywhere g1t stores |
| 113 | * it (the default), or in the EU only. It applies to repositories made | |
| 114 | * after it is set. | |
| 115 | */ | |
| 116 | export type DataResidency = "anywhere" | "eu"; | |
| 117 | ||
| 118 | /** | |
| Workspaces own repositories | 119 | * A workspace: the owner of repositories, and the first segment of their |
| 120 | * URLs. A person's own space and a team's are the same thing. | |
| 121 | */ | |
| 122 | export type Workspace = { | |
| 123 | id: string; | |
| 124 | slug: string; | |
| 125 | name: string; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 126 | /** One line saying what the workspace is for. */ |
| 127 | description: string | null; | |
| Workspaces own repositories | 128 | /** RFC 3339. */ |
| 129 | createdAt: string; | |
| 130 | memberCount: number; | |
| Workspace names and icons, and a component kit for every control | 131 | /** |
| 132 | * The workspace's uploaded icon: the SHA-256 of its bytes, served at | |
| 133 | * `/avatars/<avatar>`. Null means the generated letter avatar. | |
| 134 | */ | |
| 135 | avatar: string | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 136 | /** What every member gets on each repository; owners have Admin. */ |
| 137 | basePermission?: BasePermission; | |
| Merge branch 'worktree-agent-ad7c6d88d93adc817' | 138 | /** Who may create its teams. Absent means any member. */ |
| 139 | teamCreation?: TeamCreation; | |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 140 | /** Whether members and outside collaborators need two-factor authentication. */ |
| 141 | twoFactorRequirementEnabled?: boolean; | |
| 142 | } & Partial<MemberPrivileges>; | |
| Workspaces own repositories | 143 | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 144 | export type Member = { |
| 145 | username: string; | |
| 146 | role: Role; | |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 147 | /** The roles they hold besides `role`. */ |
| 148 | org_roles?: OrgRole[]; | |
| 149 | /** Whether two-factor authentication is on; owners only, null for anyone else. */ | |
| 150 | two_factor?: boolean | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 151 | /** Their display name, when they set one. */ |
| 152 | name?: string | null; | |
| 153 | /** Their uploaded avatar's hash, served at `/avatars/<avatar>`; null for the generated letter avatar. */ | |
| 154 | avatar?: string | null; | |
| 155 | }; | |
| Workspaces own repositories | 156 | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 157 | /** An owner of a workspace, as staff see them. */ |
| 158 | export type AdminOwner = { username: string; email: string | null }; | |
| 159 | ||
| 160 | /** A workspace as staff see it. Mirrors `AdminWorkspace` in `crates/contracts/src/identity.rs`. */ | |
| 161 | export type AdminWorkspace = { | |
| 162 | slug: string; | |
| 163 | name: string; | |
| 164 | /** RFC 3339. */ | |
| 165 | createdAt: string; | |
| 166 | owners: AdminOwner[]; | |
| 167 | memberCount: number; | |
| 168 | }; | |
| 169 | ||
| 170 | /** A member of a workspace, as staff see them. */ | |
| 171 | export type AdminMember = { username: string; email: string | null; role: Role; /** RFC 3339. */ joined: string }; | |
| 172 | ||
| 173 | export type AdminWorkspaceDetail = { | |
| 174 | slug: string; | |
| 175 | name: string; | |
| 176 | description: string | null; | |
| 177 | /** RFC 3339. */ | |
| 178 | createdAt: string; | |
| 179 | /** Owners first, then by username. */ | |
| 180 | members: AdminMember[]; | |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 181 | /** It can never be deleted, by anyone (identity's `PROTECTED_WORKSPACES`). */ |
| 182 | protected: boolean; | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 183 | }; |
| 184 | ||
| 185 | /** The most workspaces one `workspaces` call returns. */ | |
| 186 | export const ADMIN_WORKSPACES_LIMIT = 500; | |
| 187 | ||
| 188 | /** | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 189 | * Whether anyone may make an account, or only someone with an invite. |
| 190 | * Identity's `REGISTRATION_MODE`; unset means `invite`. | |
| 191 | */ | |
| 192 | export type RegistrationMode = "invite" | "open"; | |
| 193 | ||
| 194 | /** How many invites a person may have out at once, unless identity's `INVITES_PER_USER` says otherwise. */ | |
| 195 | export const INVITES_PER_USER = 5; | |
| 196 | /** How long an invite works, unless identity's `INVITE_TTL_DAYS` says otherwise. */ | |
| 197 | export const INVITE_TTL_DAYS = 30; | |
| 198 | ||
| 199 | /** Only a pending invite can be used or revoked. Revoked and expired ones never used give the invite back. */ | |
| Merge email confirmation gate: a code and a link, nothing until confirmed (identity 0036) | 200 | /** |
| 201 | * `awaiting_confirmation`: used to make an account that has not confirmed its | |
| 202 | * email address yet; what it gives is joined when the address is confirmed, | |
| 203 | * unless it is revoked first. | |
| 204 | */ | |
| 205 | export type InviteStatus = "pending" | "awaiting_confirmation" | "redeemed" | "expired" | "revoked"; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 206 | |
| 207 | /** One invite. Mirrors `Invite` in `crates/contracts/src/identity.rs`. */ | |
| 208 | export type Invite = { | |
| 209 | id: string; | |
| 210 | /** `g1t-k7m2-…`: returned when it is made, and to its maker while pending. */ | |
| 211 | code: string | null; | |
| 212 | /** The code's first group, such as `g1t-k7m2`. */ | |
| 213 | hint: string; | |
| 214 | /** Only this address can use it. */ | |
| 215 | email: string | null; | |
| 216 | /** `account` makes an account; `workspace` joins an existing one to `workspace`. */ | |
| 217 | kind: "account" | "workspace"; | |
| 218 | /** The workspace using it joins. */ | |
| 219 | workspace: string | null; | |
| 220 | status: InviteStatus; | |
| 221 | /** Whose allowance it used. */ | |
| 222 | chargedTo: "user" | "workspace" | "none"; | |
| 223 | /** Its maker's username; null when g1t staff made it. */ | |
| 224 | invitedBy: string | null; | |
| 225 | /** The account that used it. */ | |
| 226 | redeemedBy: string | null; | |
| 227 | /** RFC 3339. */ | |
| 228 | createdAt: string; | |
| 229 | /** RFC 3339. */ | |
| 230 | expiresAt: string; | |
| 231 | redeemedAt: string | null; | |
| 232 | revokedAt: string | null; | |
| 233 | /** The staff member who minted it; only in staff views. */ | |
| 234 | staff?: string | null; | |
| 235 | }; | |
| 236 | ||
| 237 | /** How many invites someone may have out. `limit` and `remaining` are null for no limit. */ | |
| 238 | export type Allowance = { limit: number | null; used: number; remaining: number | null }; | |
| 239 | ||
| 240 | export type InvitesOverview = { | |
| 241 | mode: RegistrationMode; | |
| 242 | allowance: Allowance; | |
| 243 | /** Workspaces the person owns that were granted invites to share. */ | |
| 244 | workspaces: { slug: string; allowance: Allowance }[]; | |
| 245 | invites: Invite[]; | |
| 246 | }; | |
| 247 | ||
| 248 | /** What a valid code is for, before it is used. */ | |
| 249 | export type InvitePreview = { | |
| 250 | kind: "account" | "workspace"; | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 251 | /** Pending, unless `anyStatus` asked about a code that is spent. */ |
| 252 | status: InviteStatus; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 253 | /** Null when g1t staff sent it. */ |
| 254 | invitedBy: { username: string; name: string | null; avatar: string | null } | null; | |
| 255 | workspace: ProfileWorkspace | null; | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 256 | /** The repository it accepts an invitation to, such as `{ name: "flagon-io/g1t", role: "write" }`. */ |
| 257 | repository: { name: string; role: string } | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 258 | /** Partly hidden, such as `a•••@example.com`. */ |
| 259 | email: string | null; | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 260 | /** The bound address in full, while the invite is pending: it fills in and locks the sign-up form. */ |
| 261 | address: string | null; | |
| 262 | /** Whether the bound address has a g1t account already: sign in to accept. */ | |
| 263 | hasAccount: boolean; | |
| 264 | /** With a viewer: whether it is theirs (for one of their confirmed addresses, or used by them). */ | |
| 265 | forViewer: boolean | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 266 | expiresAt: string; |
| 267 | }; | |
| 268 | ||
| 269 | export type WaitlistStatus = "waiting" | "invited" | "dismissed"; | |
| 270 | ||
| 271 | export type WaitlistEntry = { | |
| 272 | id: string; | |
| 273 | email: string; | |
| 274 | about: string | null; | |
| 275 | status: WaitlistStatus; | |
| 276 | inviteId: string | null; | |
| 277 | decidedBy: string | null; | |
| 278 | decidedAt: string | null; | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 279 | /** What staff wrote when approving; it went in the invite email. */ |
| 280 | note: string | null; | |
| 281 | /** The account made with the invite, once it was used. */ | |
| 282 | joinedAs: string | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 283 | /** When they first asked. */ |
| 284 | createdAt: string; | |
| 285 | /** When they last asked. */ | |
| 286 | updatedAt: string; | |
| 287 | }; | |
| 288 | ||
| 289 | export type InviteGrant = { amount: number; note: string | null; grantedBy: string; createdAt: string }; | |
| 290 | export type InviteTreeNode = { username: string; joinedAt: string; invited: InviteTreeNode[] }; | |
| 291 | ||
| 292 | /** Where a person came from and whom they brought. For a workspace, `username` is its slug. */ | |
| 293 | export type InviteTree = { | |
| 294 | username: string; | |
| 295 | /** Who invited them, then who invited that person, and so on. */ | |
| 296 | invitedBy: string[]; | |
| 297 | /** The staff member who minted their invite, when staff did. */ | |
| 298 | staff: string | null; | |
| 299 | allowance: Allowance; | |
| 300 | grants: InviteGrant[]; | |
| 301 | invites: Invite[]; | |
| 302 | /** Whom they invited, three levels down. */ | |
| 303 | invited: InviteTreeNode[]; | |
| 304 | }; | |
| 305 | ||
| 306 | /** The most rows one staff listing of invites or the waitlist returns. */ | |
| 307 | export const ADMIN_INVITES_LIMIT = 500; | |
| 308 | ||
| 309 | /** | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 310 | * Staff-only identity, for sudo.g1t.sh. It takes no viewer and checks no |
| 311 | * membership: only sudo calls it, over its service binding, once Cloudflare | |
| 312 | * Access and its staff list have let someone in. Never call it on behalf of | |
| 313 | * a customer. | |
| 314 | */ | |
| 315 | export interface IdentityAdminApi { | |
| 316 | /** Every workspace, newest first, at most 500; `query` matches slug, name, or an owner's username or email. */ | |
| 317 | workspaces(query?: string): Promise<AdminWorkspace[]>; | |
| 318 | /** One workspace with all its members, or null. */ | |
| 319 | workspace(slug: string): Promise<AdminWorkspaceDetail | null>; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 320 | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 321 | /** The waitlist, newest first; `query` matches the address or what they said. */ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 322 | waitlist(query?: string | null, status?: WaitlistStatus | null): Promise<WaitlistEntry[]>; |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 323 | /** How many requests are waiting, for the navigation's badge. */ |
| 324 | waitlistPending(): Promise<number>; | |
| 325 | /** | |
| 326 | * Approving mints an invite bound to the address and emails it, with | |
| 327 | * `note` (up to 500 characters) if given; dismissing only marks it. | |
| 328 | */ | |
| 329 | decideWaitlist(id: string, approve: boolean, staff: string, note?: string | null): Promise<Result<WaitlistEntry>>; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 330 | /** Invites, newest first; `query` is a code's start, or part of an email, inviter or redeemer. */ |
| 331 | invites(query?: string | null): Promise<Invite[]>; | |
| 332 | revokeInvite(id: string, staff: string): Promise<Result<Invite>>; | |
| 333 | /** An invite that uses nobody's allowance, optionally bound to (and emailed to) `email`. */ | |
| 334 | mintInvite(email: string | null, staff: string): Promise<Result<Invite>>; | |
| 335 | /** More invites (or fewer, with a negative amount) for a person or a workspace. */ | |
| 336 | grantInvites( | |
| 337 | target: "user" | "workspace", | |
| 338 | name: string, | |
| 339 | amount: number, | |
| 340 | note: string, | |
| 341 | staff: string, | |
| 342 | ): Promise<Result<Allowance>>; | |
| 343 | /** Where a person came from and whom they brought, or null. */ | |
| 344 | inviteTree(username: string): Promise<InviteTree | null>; | |
| 345 | /** A workspace's granted invites and the invites made for it, or null. */ | |
| 346 | workspaceInvites(slug: string): Promise<InviteTree | null>; | |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 347 | |
| 348 | /** Workspaces owners deleted that are not purged yet, newest first. */ | |
| 349 | deletedWorkspaces(): Promise<DeletedWorkspace[]>; | |
| 350 | /** | |
| 351 | * Brings a deleted workspace back, with its members, tokens and what went | |
| 352 | * with it, while it is still restorable. Publishes `workspace.restored`. | |
| 353 | */ | |
| 354 | restoreWorkspace(workspaceId: string, staff: string): Promise<Result<boolean>>; | |
| 355 | /** | |
| 356 | * Purges a deleted workspace now rather than at `purgeAfter`. `confirm` is | |
| 357 | * its slug, typed out. Refused for a protected workspace. Publishes | |
| 358 | * `workspace.deleted`. | |
| 359 | */ | |
| 360 | purgeWorkspace(workspaceId: string, staff: string, confirm: string): Promise<Result<boolean>>; | |
| Merge branch 'worktree-agent-a8385d293d42c913a' | 361 | |
| 362 | /** Every workspace alias, by name. */ | |
| 363 | aliases(): Promise<WorkspaceAlias[]>; | |
| 364 | /** | |
| 365 | * Points `alias` at the workspace whose slug is `workspace`. Refused for | |
| 366 | * one of the site's routes, anyone's username, a workspace's slug (deleted | |
| 367 | * or held after a rename) and an existing alias. `note` says why. | |
| 368 | */ | |
| 369 | setAlias(alias: string, workspace: string, note: string, staff: string): Promise<Result<WorkspaceAlias>>; | |
| 370 | /** Removes an alias; `reason` goes in sudo's audit log. */ | |
| 371 | removeAlias(alias: string, reason: string, staff: string): Promise<Result<boolean>>; | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 372 | } |
| 373 | ||
| Merge branch 'worktree-agent-a8385d293d42c913a' | 374 | /** |
| 375 | * A name g1t's staff point at a workspace, so its addresses lead there under | |
| 376 | * the workspace's own name: `g1t`, the product, leads to `flagon-io`, Flagon, | |
| 377 | * Inc. Staff-managed only; it follows the workspace through renames. | |
| 378 | */ | |
| 379 | export type WorkspaceAlias = { | |
| 380 | alias: string; | |
| 381 | workspaceId: string; | |
| 382 | /** The workspace's slug and name now. */ | |
| 383 | workspace: string; | |
| 384 | workspaceName: string; | |
| 385 | /** Why it exists. */ | |
| 386 | note: string; | |
| 387 | /** The staff member who set it, or `migration`. */ | |
| 388 | createdBy: string; | |
| 389 | /** RFC 3339. */ | |
| 390 | createdAt: string; | |
| 391 | }; | |
| 392 | ||
| Initial g1t: services, event bus, intents and attempts | 393 | /** Who is asking. Every read and write in every service takes one. */ |
| 394 | export type Viewer = User | null; | |
| 395 | ||
| Merge email confirmation gate: a code and a link, nothing until confirmed (identity 0036) | 396 | /** |
| 397 | * Whether this is a person whose account has not confirmed its email | |
| 398 | * address. Such an account can only confirm it, change it, or sign out. | |
| 399 | */ | |
| 400 | export function awaitsConfirmation(user: Pick<User, "kind" | "verified"> | null | undefined): boolean { | |
| 401 | return !!user && (user.kind ?? "user") === "user" && !user.verified; | |
| 402 | } | |
| 403 | ||
| Initial g1t: services, event bus, intents and attempts | 404 | export type SshKey = { |
| 405 | id: string; | |
| 406 | title: string; | |
| 407 | fingerprint: string; | |
| RFC 3339 timestamps in identity and repos | 408 | /** RFC 3339. */ |
| 409 | createdAt: string; | |
| Merge branch 'worktree-agent-a5a5de74d8863d554' into worktree-agent-a16631325aecf58ca | 410 | /** When it last signed in over SSH, RFC 3339, to within 5 minutes; null when it never has. */ |
| 411 | lastUsedAt: string | null; | |
| Initial g1t: services, event bus, intents and attempts | 412 | }; |
| 413 | ||
| Agents as a team: lifecycle, merge queue, billing and a new shell | 414 | export type AccessToken = { |
| 415 | id: string; | |
| 416 | name: string; | |
| 417 | /** RFC 3339. */ | |
| 418 | createdAt: string; | |
| 419 | /** RFC 3339, to within a few minutes. Null until it is first used. */ | |
| 420 | lastUsedAt: string | null; | |
| 421 | /** | |
| 422 | * For a workspace's token, the username of the member who made it. Null | |
| 423 | * once that account is gone, and on personal tokens. | |
| 424 | */ | |
| 425 | createdBy: string | null; | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 426 | /** Its scopes, as `resource:level`. Null: full access. */ |
| 427 | scopes: string[] | null; | |
| 428 | /** Made before tokens had scopes: full access until someone narrows it. */ | |
| 429 | legacy: boolean; | |
| 430 | /** RFC 3339. Null: it does not expire. */ | |
| 431 | expiresAt: string | null; | |
| Settings: fine-grained tokens, workspace token Admin, workspace personal access token rules | 432 | /** Classic, fine-grained, or a workspace's own. */ |
| 433 | kind?: TokenKind; | |
| 434 | /** What it is for, as its owner wrote it. */ | |
| 435 | description?: string | null; | |
| 436 | /** A fine-grained token's resource owner, repositories, permissions and status. */ | |
| 437 | fineGrained?: FineGrainedDetails | null; | |
| 438 | /** A workspace's own token an owner gave Admin when making it. */ | |
| 439 | admin?: boolean; | |
| 440 | }; | |
| 441 | ||
| 442 | export type TokenKind = "classic" | "fine_grained" | "workspace"; | |
| 443 | ||
| 444 | /** Whether a fine-grained token may be used on its resource owner. */ | |
| 445 | export type TokenStatus = "active" | "pending" | "denied" | "revoked"; | |
| 446 | ||
| 447 | export type FineGrainedDetails = { | |
| 448 | /** The resource owner's slug; null for your own account. */ | |
| 449 | workspace: string | null; | |
| 450 | repositorySelection: RepositorySelection; | |
| 451 | /** With `selected`: the repositories, as `owner/name`, that you can see. */ | |
| 452 | repositories: string[]; | |
| 453 | permissions: Partial<Record<string, PermissionAccess>>; | |
| 454 | status: TokenStatus; | |
| 455 | /** Why an owner denied or revoked it. */ | |
| 456 | reviewReason?: string | null; | |
| 457 | }; | |
| 458 | ||
| 459 | /** What a new fine-grained token is. */ | |
| 460 | export type FineGrainedTokenInput = { | |
| 461 | name: string; | |
| 462 | description?: string | null; | |
| 463 | /** Between 1 and 366 days, and no more than the workspace allows. */ | |
| 464 | ttlSeconds: number; | |
| 465 | /** The resource owner: a workspace's slug, or null for your own account. */ | |
| 466 | workspace: string | null; | |
| 467 | repositorySelection: RepositorySelection; | |
| 468 | /** With `selected`: `owner/name` or names in the workspace. */ | |
| 469 | repositories: string[]; | |
| 470 | /** Each permission's level by name; names left out are none. */ | |
| 471 | permissions: Record<string, PermissionAccess>; | |
| 472 | }; | |
| 473 | ||
| 474 | /** A workspace's rules for personal access tokens. */ | |
| 475 | export type TokenPolicy = { | |
| 476 | allowClassic: boolean; | |
| 477 | allowFineGrained: boolean; | |
| 478 | requireApproval: boolean; | |
| 479 | /** Null: no limit. */ | |
| 480 | maxLifetimeDays: number | null; | |
| 481 | forbidNoExpiry: boolean; | |
| 482 | updatedBy?: string | null; | |
| 483 | updatedAt?: string | null; | |
| 484 | }; | |
| 485 | ||
| 486 | /** A member's personal token that reaches a workspace, as its owners see it. */ | |
| 487 | export type MemberToken = { | |
| 488 | owner: string; | |
| 489 | token: AccessToken; | |
| 490 | /** Whether it reaches the workspace now. */ | |
| 491 | reaches: boolean; | |
| 492 | /** Why not: pending approval, denied, revoked, classic tokens not allowed, lasts too long, never expires. */ | |
| 493 | blockedBy?: string | null; | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 494 | }; |
| 495 | ||
| 496 | /** What a new or changed token may do. */ | |
| 497 | export type TokenGrant = { | |
| 498 | /** Null: full access. */ | |
| 499 | scopes: string[] | null; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 500 | }; |
| Initial g1t: services, event bus, intents and attempts | 501 | |
| Device sign-in replaces registering and minting tokens over the API | 502 | export type DeviceStart = { |
| 503 | /** Secret held by the tool and exchanged for a token once approved. */ | |
| 504 | deviceCode: string; | |
| 505 | /** Short code shown to the person, e.g. `WDJB-MJHT`. */ | |
| 506 | userCode: string; | |
| 507 | /** Seconds until both codes stop working. */ | |
| 508 | expiresIn: number; | |
| 509 | /** Seconds the tool should wait between polls. */ | |
| 510 | interval: number; | |
| 511 | }; | |
| 512 | ||
| 513 | export type DeviceRequest = { userCode: string; clientName: string }; | |
| 514 | ||
| 515 | export type DeviceClaim = | |
| 516 | | { status: "pending" | "denied" | "expired" } | |
| 517 | | { status: "approved"; token: string; user: User }; | |
| 518 | ||
| OAuth 2.1 sign-in for MCP clients and other applications | 519 | /** What the site passes on once a person has approved an application. */ |
| 520 | export type OAuthApproval = { | |
| 521 | clientId: string; | |
| 522 | /** Shown wherever the application's access is listed. */ | |
| 523 | clientName: string; | |
| 524 | redirectUri: string; | |
| 525 | /** PKCE challenge, method S256. */ | |
| 526 | codeChallenge: string; | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 527 | /** What the person granted. Null: full access. */ |
| 528 | scopes: string[] | null; | |
| OAuth 2.1 sign-in for MCP clients and other applications | 529 | }; |
| 530 | ||
| 531 | export type OAuthTokens = { | |
| 532 | accessToken: string; | |
| 533 | /** Works once; using it returns the next one. */ | |
| 534 | refreshToken: string; | |
| 535 | /** Seconds until the access token stops working. */ | |
| 536 | expiresIn: number; | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 537 | /** The scopes granted, space-separated, or `*` for full access. */ |
| 538 | scope?: string | null; | |
| OAuth 2.1 sign-in for MCP clients and other applications | 539 | }; |
| 540 | ||
| 541 | /** An application a person has signed in to. */ | |
| 542 | export type OAuthGrant = { | |
| 543 | id: string; | |
| 544 | clientName: string; | |
| 545 | /** RFC 3339. */ | |
| 546 | createdAt: string; | |
| 547 | /** RFC 3339. */ | |
| 548 | lastUsedAt: string; | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 549 | /** What the person granted. Null: full access. */ |
| 550 | scopes: string[] | null; | |
| 551 | /** Signed in before applications had scopes: full access until narrowed. */ | |
| 552 | legacy: boolean; | |
| OAuth 2.1 sign-in for MCP clients and other applications | 553 | }; |
| 554 | ||
| Initial g1t: services, event bus, intents and attempts | 555 | /** Accounts, credentials and sessions. */ |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 556 | /** |
| 557 | * What deleting a workspace takes with it, and what stands in the way: | |
| 558 | * nothing does while `billing` is null and it is not `protected`. | |
| 559 | */ | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 560 | export type WorkspaceDeletion = { |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 561 | /** Its live repositories, deleted with it. */ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 562 | repositories: number; |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 563 | /** Its projects, hidden with it. */ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 564 | projects: number; |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 565 | members: number; |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 566 | /** Why billing cannot close it yet, in words for its owner. */ |
| 567 | billing: string | null; | |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 568 | /** It can never be deleted, by anyone. */ |
| 569 | protected: boolean; | |
| 570 | }; | |
| 571 | ||
| 572 | /** How long a deleted workspace is kept, for g1t's staff to restore, before it is purged. */ | |
| 573 | export const WORKSPACE_RESTORE_DAYS = 30; | |
| 574 | ||
| 575 | /** | |
| 576 | * Workspaces nobody can delete, whatever identity's `PROTECTED_WORKSPACES` | |
| 577 | * says: Flagon's, which runs g1t. Services that act on `workspace.deleting` | |
| 578 | * check it too, so one published for it by mistake changes nothing. | |
| 579 | */ | |
| 580 | export const ALWAYS_PROTECTED_WORKSPACES: readonly string[] = ["flagon-io"]; | |
| 581 | ||
| 582 | /** Whether `slug` is one of `ALWAYS_PROTECTED_WORKSPACES`, in any case. */ | |
| 583 | export function isProtectedWorkspace(slug: string): boolean { | |
| 584 | return ALWAYS_PROTECTED_WORKSPACES.includes(slug.trim().toLowerCase()); | |
| 585 | } | |
| 586 | ||
| 587 | /** A workspace an owner deleted, kept until `purgeAfter` for staff to restore. */ | |
| 588 | export type DeletedWorkspace = { | |
| 589 | workspaceId: string; | |
| 590 | slug: string; | |
| 591 | name: string; | |
| 592 | /** RFC 3339. */ | |
| 593 | deletedAt: string; | |
| Merge sudo: delete an account with the workspaces it alone owns, purge each | 594 | /** The username of the owner who deleted it, or the staff member who deleted it with the account that alone owned it. */ |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 595 | deletedBy: string; |
| 596 | /** RFC 3339: when it is purged unless restored first. */ | |
| 597 | purgeAfter: string; | |
| 598 | /** What went with it, counted when it was deleted. */ | |
| 599 | went: WorkspaceDeletion; | |
| 600 | /** Whether staff can still restore it. */ | |
| 601 | restorable: boolean; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 602 | }; |
| 603 | ||
| Merge branch 'worktree-agent-a5a5de74d8863d554' into worktree-agent-a16631325aecf58ca | 604 | export interface IdentityApi extends AccessClient, TeamsClient, DeployKeysClient { |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 605 | /** |
| 606 | * Creates an account and signs it in. While registration is invite-only, | |
| 607 | * `inviteCode` must be an unused, unexpired invite (and, when it names an | |
| 608 | * email, that address); it is ignored while registration is open. | |
| 609 | */ | |
| 610 | register( | |
| 611 | username: string, | |
| 612 | email: string, | |
| 613 | password: string, | |
| 614 | inviteCode?: string | null, | |
| 615 | /** Who is asking, such as the visitor's IP address, for rate limits. */ | |
| 616 | client?: string | null, | |
| 617 | ): Promise<Result<{ user: User; sessionToken: string }>>; | |
| Initial g1t: services, event bus, intents and attempts | 618 | /** Verifies a username and password for website sign-in. */ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 619 | /** |
| 620 | * Verifies a username, or any confirmed address of the account, and its | |
| 621 | * password. Wrong passwords are counted against the account and `client` | |
| 622 | * (the visitor's IP address); past a limit nothing is checked for a while. | |
| 623 | */ | |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 624 | signIn( |
| 625 | username: string, | |
| 626 | password: string, | |
| 627 | client?: string | null, | |
| 628 | ): Promise<Result<{ user: User; sessionToken: string; twoFactorChallenge?: string | null }>>; | |
| 629 | /** | |
| 630 | * The second step of signing in, for an account with two-factor | |
| 631 | * authentication: the challenge `signIn` returned, and a code from the | |
| 632 | * app or a recovery code. | |
| 633 | */ | |
| 634 | twoFactorSignIn(challenge: string, code: string, client?: string | null): Promise<Result<{ user: User; sessionToken: string }>>; | |
| Initial g1t: services, event bus, intents and attempts | 635 | signOut(sessionToken: string): Promise<void>; |
| Email verification, password reset, and Git for AI scale positioning | 636 | |
| Merge email confirmation gate: a code and a link, nothing until confirmed (identity 0036) | 637 | /** |
| 638 | * Sends a new confirmation code and link to the primary of an account | |
| 639 | * that has not confirmed it, at most once a minute. | |
| 640 | */ | |
| Email verification, password reset, and Git for AI scale positioning | 641 | resendVerification(user: User): Promise<Result<boolean>>; |
| Merge email confirmation gate: a code and a link, nothing until confirmed (identity 0036) | 642 | /** Confirms the address the emailed link was sent to, signed in or not; ends the code sent with it. */ |
| 643 | verifyEmail(token: string): Promise<Result<EmailConfirmed>>; | |
| Email verification, password reset, and Git for AI scale positioning | 644 | /** Emails a reset link if the address has an account. Always resolves. */ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 645 | /** |
| 646 | * Any confirmed address of an account works; the link goes to it, and the | |
| 647 | * primary and backup are told. A few an hour per address and per `client`. | |
| 648 | */ | |
| 649 | requestPasswordReset(email: string, client?: string | null): Promise<boolean>; | |
| Email verification, password reset, and Git for AI scale positioning | 650 | /** Sets a new password from an emailed token and ends every session. */ |
| 651 | resetPassword(token: string, password: string): Promise<Result<User>>; | |
| 652 | ||
| Device sign-in replaces registering and minting tokens over the API | 653 | /** |
| 654 | * Device sign-in (RFC 8628). A tool starts a request, a person approves | |
| 655 | * its short code in a browser, and the tool claims an access token. | |
| 656 | */ | |
| 657 | deviceStart(clientName: string): Promise<DeviceStart>; | |
| 658 | /** What a user code is asking for, or null if it is not valid. */ | |
| 659 | deviceLookup(userCode: string): Promise<DeviceRequest | null>; | |
| 660 | deviceResolve(userCode: string, user: User, approve: boolean): Promise<Result<boolean>>; | |
| 661 | deviceClaim(deviceCode: string): Promise<DeviceClaim>; | |
| 662 | ||
| OAuth 2.1 sign-in for MCP clients and other applications | 663 | /** |
| 664 | * OAuth 2.1 for applications that sign a person in through the browser. | |
| 665 | * The caller has checked the client and its redirect address; this | |
| 666 | * returns the one-time code the application exchanges for tokens. | |
| 667 | */ | |
| 668 | oauthAuthorize(user: User, approval: OAuthApproval): Promise<{ code: string }>; | |
| 669 | /** Redeems a code. It works once, for that client, with the PKCE verifier. */ | |
| 670 | oauthExchange(code: string, codeVerifier: string, clientId: string, redirectUri: string): Promise<Result<OAuthTokens>>; | |
| 671 | /** Trades a refresh token for new tokens; the old ones stop working. */ | |
| 672 | oauthRefresh(refreshToken: string, clientId: string): Promise<Result<OAuthTokens>>; | |
| 673 | /** Applications the user has signed in to, most recently used first. */ | |
| 674 | listOAuthGrants(user: User): Promise<OAuthGrant[]>; | |
| 675 | /** Signs an application out. */ | |
| 676 | revokeOAuthGrant(user: User, id: string): Promise<void>; | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 677 | /** Changes what an application may do, at once and when it refreshes. */ |
| 678 | updateOAuthGrant(user: User, id: string, grant: TokenGrant): Promise<Result<OAuthGrant>>; | |
| OAuth 2.1 sign-in for MCP clients and other applications | 679 | |
| Workspaces own repositories | 680 | createWorkspace(user: User, slug: string, name: string): Promise<Result<Workspace>>; |
| 681 | /** Public details of a workspace, or null. */ | |
| 682 | getWorkspace(slug: string): Promise<Workspace | null>; | |
| Merge branch 'worktree-agent-a2013627e5ea4ab13' | 683 | /** Where a workspace keeps its repositories' git data; null when there is no such workspace. */ |
| 684 | workspaceResidency(slug: string): Promise<DataResidency | null>; | |
| 685 | /** | |
| 686 | * Owners only. Applies to repositories made from then on. Offer `eu` | |
| 687 | * only when the repos service's `storageOptions()` says it is available. | |
| 688 | */ | |
| 689 | setWorkspaceResidency(actor: User, slug: string, residency: DataResidency): Promise<Result<DataResidency>>; | |
| Workspaces own repositories | 690 | /** Members only. */ |
| 691 | listMembers(slug: string, viewer: Viewer): Promise<Result<Member[]>>; | |
| 692 | /** Owners only. */ | |
| 693 | addMember(actor: User, slug: string, username: string): Promise<Result<boolean>>; | |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 694 | /** Owners only; your own username is leaving. Never the last owner. */ |
| Workspaces own repositories | 695 | removeMember(actor: User, slug: string, username: string): Promise<Result<boolean>>; |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 696 | /** Owners only: owner or member, and the roles held besides it. Never leaves no owner. */ |
| 697 | updateMember(actor: User, slug: string, username: string, change: { role?: Role; org_roles?: OrgRole[] }): Promise<Result<Member>>; | |
| 698 | /** Owners only: `username` becomes an owner, and you a member. */ | |
| 699 | transferOwnership(actor: User, slug: string, username: string): Promise<Result<boolean>>; | |
| 700 | /** You leave the workspace. Never the last owner. */ | |
| 701 | leaveWorkspace(user: User, slug: string): Promise<Result<boolean>>; | |
| 702 | /** Owners only: change some member privileges; returns all of them. */ | |
| 703 | setMemberPrivileges(actor: User, slug: string, change: Partial<MemberPrivileges>): Promise<Result<MemberPrivileges>>; | |
| 704 | /** Owners only, with two-factor on themselves: require it of everyone. */ | |
| 705 | setTwoFactorRequirement(actor: User, slug: string, required: boolean): Promise<Result<boolean>>; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 706 | /** Owners only. An empty name falls back to the slug. */ |
| 707 | updateWorkspace(actor: User, slug: string, details: { name: string; description: string }): Promise<Result<Workspace>>; | |
| Workspace names and icons, and a component kit for every control | 708 | /** |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 709 | * Owners only. Changes the slug, the first segment of the workspace's |
| 710 | * URLs; the display name is untouched. The old slug redirects to the new | |
| 711 | * one, and stays reserved for this workspace, for `SLUG_HOLD_DAYS`. | |
| 712 | * Publishes `workspace.renamed`. | |
| 713 | */ | |
| 714 | renameWorkspace(actor: User, slug: string, newSlug: string): Promise<Result<Workspace>>; | |
| 715 | /** Whether `renameWorkspace` would be allowed, changing nothing. */ | |
| 716 | checkWorkspaceRename(actor: User, slug: string, newSlug: string): Promise<Result<boolean>>; | |
| 717 | /** | |
| 718 | * The workspace's current slug when `slug` is one it was renamed from | |
| Merge branch 'worktree-agent-a8385d293d42c913a' | 719 | * within `SLUG_HOLD_DAYS`, or when `slug` is an alias staff set for it |
| 720 | * (`WorkspaceAlias`); null otherwise, including for a slug in use. | |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 721 | */ |
| 722 | resolveSlug(slug: string): Promise<string | null>; | |
| 723 | /** | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 724 | * Owners only, a person only. `confirm` is the slug, typed out. Refused |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 725 | * for a protected workspace, and while billing cannot settle it. Its |
| 726 | * repositories, projects and apps go with it; it is kept for | |
| 727 | * `WORKSPACE_RESTORE_DAYS`, when g1t's staff can restore it, then purged. | |
| 728 | * Its slug is never given to anyone else; the person whose username it is | |
| 729 | * may make it again once it is purged. Publishes `workspace.deleting`. | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 730 | */ |
| 731 | deleteWorkspace(actor: User, slug: string, confirm: string): Promise<Result<boolean>>; | |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 732 | /** What `deleteWorkspace` would take with it, and what stands in its way, changing nothing. */ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 733 | checkWorkspaceDeletion(actor: User, slug: string): Promise<Result<WorkspaceDeletion>>; |
| 734 | /** | |
| Workspace names and icons, and a component kit for every control | 735 | * Owners only. `image` is the file in base64: PNG, JPEG, WebP or GIF, at |
| 736 | * most `MAX_AVATAR_BYTES`, checked by its bytes. Null removes the icon. | |
| 737 | */ | |
| 738 | setWorkspaceAvatar(actor: User, slug: string, image: string | null): Promise<Result<Workspace>>; | |
| 739 | /** A person's own avatar, as `setWorkspaceAvatar`: the new one, or null. */ | |
| 740 | setUserAvatar(user: User, image: string | null): Promise<Result<string | null>>; | |
| Workspaces own repositories | 741 | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 742 | /** |
| 743 | * A workspace's own access tokens. They belong to the workspace, act as | |
| 744 | * it, and keep working when the member who made one leaves. Members only. | |
| 745 | */ | |
| 746 | listWorkspaceTokens(slug: string, viewer: Viewer): Promise<Result<AccessToken[]>>; | |
| 747 | /** Owners only. The plaintext token is returned once and never stored. */ | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 748 | createWorkspaceToken( |
| 749 | actor: User, | |
| 750 | slug: string, | |
| 751 | name: string, | |
| Settings: fine-grained tokens, workspace token Admin, workspace personal access token rules | 752 | grant?: TokenGrant & { ttlSeconds?: number; admin?: boolean }, |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 753 | ): Promise<Result<{ token: string; info: AccessToken }>>; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 754 | /** Owners only. */ |
| 755 | removeWorkspaceToken(actor: User, slug: string, id: string): Promise<Result<boolean>>; | |
| 756 | ||
| Settings: fine-grained tokens, workspace token Admin, workspace personal access token rules | 757 | /** |
| 758 | * A fine-grained personal access token: one resource owner, some of its | |
| 759 | * repositories, a level for each permission. People only. It starts | |
| 760 | * pending when its workspace asks for approval and you are not an owner. | |
| 761 | */ | |
| 762 | createFineGrainedToken(user: User, input: FineGrainedTokenInput): Promise<Result<{ token: string; info: AccessToken }>>; | |
| 763 | /** Its owner changes it; what is left out stays. Widening it asks for approval again. */ | |
| 764 | updateFineGrainedToken( | |
| 765 | user: User, | |
| 766 | id: string, | |
| 767 | change: Partial<Omit<FineGrainedTokenInput, "ttlSeconds" | "workspace">>, | |
| 768 | ): Promise<Result<AccessToken>>; | |
| 769 | /** A workspace's rules for personal access tokens. Members only. */ | |
| 770 | getTokenPolicy(slug: string, viewer: Viewer): Promise<Result<TokenPolicy>>; | |
| 771 | /** Owners only, as people. `maxLifetimeDays` of 0 removes the limit. */ | |
| 772 | setTokenPolicy( | |
| 773 | actor: User, | |
| 774 | slug: string, | |
| 775 | change: Partial<Omit<TokenPolicy, "updatedBy" | "updatedAt">>, | |
| 776 | ): Promise<Result<TokenPolicy>>; | |
| 777 | /** The members' tokens that can reach a workspace. Owners only. */ | |
| 778 | listMemberTokens( | |
| 779 | actor: User, | |
| 780 | slug: string, | |
| 781 | filter?: { status?: TokenStatus; kind?: TokenKind }, | |
| 782 | ): Promise<Result<MemberToken[]>>; | |
| 783 | /** Approve or deny a fine-grained token waiting for approval. Owners only. */ | |
| 784 | reviewTokenRequest(actor: User, slug: string, id: string, approve: boolean, reason?: string | null): Promise<Result<MemberToken>>; | |
| 785 | /** Take a member's token out of the workspace. Owners only. */ | |
| 786 | revokeMemberToken(actor: User, slug: string, id: string, reason?: string | null): Promise<Result<boolean>>; | |
| 787 | ||
| Initial g1t: services, event bus, intents and attempts | 788 | userForSession(sessionToken: string): Promise<Viewer>; |
| 789 | ||
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 790 | /** Whether registration is invite-only. */ |
| 791 | registration(): Promise<RegistrationMode>; | |
| 792 | /** A person's invites and what they have left. */ | |
| 793 | listInvites(user: User): Promise<InvitesOverview>; | |
| 794 | /** | |
| 795 | * A person makes an invite, optionally for one address (emailed to it), | |
| 796 | * using one of theirs or, with `workspace`, one the workspace was granted. | |
| 797 | * People only: never an agent or a workspace's token. | |
| 798 | */ | |
| 799 | createInvite(user: User, options?: { email?: string | null; workspace?: string | null }): Promise<Result<Invite>>; | |
| 800 | /** Its maker, or an owner of its workspace, revokes a pending invite; the invite comes back. */ | |
| 801 | revokeInvite(user: User, id: string): Promise<Result<Invite>>; | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 802 | /** |
| 803 | * What a code is for. Unknown, used, revoked and expired codes all get the | |
| 804 | * same answer, unless `anyStatus`: then a real code that is spent is | |
| 805 | * described, with its `status`. `viewer` sets `forViewer`. | |
| 806 | */ | |
| 807 | checkInvite( | |
| 808 | code: string, | |
| 809 | client?: string | null, | |
| 810 | options?: { viewer?: User | null; anyStatus?: boolean }, | |
| 811 | ): Promise<Result<InvitePreview>>; | |
| 812 | /** | |
| 813 | * A signed-in person uses a workspace invite sent to their address, or one | |
| 814 | * sent with a repository invitation; returns the workspace's slug, or | |
| 815 | * `workspace/repo`. | |
| 816 | */ | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 817 | acceptInvite(user: User, code: string): Promise<Result<string>>; |
| 818 | /** Owners only. Invites an address into a workspace, always with an invite bound to it. */ | |
| 819 | inviteMember(actor: User, slug: string, email: string): Promise<Result<Invite>>; | |
| 820 | /** Owners only: the workspace's invites, newest first. */ | |
| 821 | workspaceInvites(slug: string, viewer: Viewer): Promise<Result<Invite[]>>; | |
| 822 | /** Owners only. */ | |
| 823 | revokeWorkspaceInvite(actor: User, slug: string, id: string): Promise<Result<Invite>>; | |
| 824 | /** Someone without an invite asks for one. Always the same answer for a valid address. */ | |
| 825 | requestAccess(email: string, about: string, client?: string | null): Promise<Result<boolean>>; | |
| 826 | ||
| Initial g1t: services, event bus, intents and attempts | 827 | /** Verifies git credentials: the account password or an access token. */ |
| 828 | userForGitCredentials(username: string, secret: string): Promise<Viewer>; | |
| API and MCP server, Rust identity service, registration, site redesign | 829 | /** Resolves a `g1t_…` access token, as sent to the API and MCP server. */ |
| 830 | userForAccessToken(token: string): Promise<Viewer>; | |
| Initial g1t: services, event bus, intents and attempts | 831 | userForSshKey(fingerprint: string): Promise<Viewer>; |
| 832 | userByUsername(username: string): Promise<Viewer>; | |
| What happened across an outcome, as a feed beside its graph | 833 | /** The names behind account and workspace ids; unknown ids are left out. */ |
| 834 | usernames(ids: string[]): Promise<Record<string, string>>; | |
| Initial g1t: services, event bus, intents and attempts | 835 | |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 836 | /** A person's public profile, or null if there is no such account. Never an email address. */ |
| 837 | profile(username: string): Promise<Profile | null>; | |
| 838 | /** A person changes their own profile. Every field is replaced; an empty one is cleared. */ | |
| 839 | updateProfile(actor: User, fields: ProfileFields): Promise<Result<Profile>>; | |
| 840 | /** | |
| 841 | * The workspaces a profile shows `viewer`: those the viewer belongs to | |
| 842 | * as well, and those of `publicIn` (where the person made a public | |
| 843 | * project) that the person really belongs to. Nothing else. | |
| 844 | */ | |
| 845 | profileWorkspaces(username: string, viewer: Viewer, publicIn: string[]): Promise<ProfileWorkspace[]>; | |
| 846 | ||
| Initial g1t: services, event bus, intents and attempts | 847 | listSshKeys(user: User): Promise<SshKey[]>; |
| 848 | /** Takes one line in OpenSSH public key format. */ | |
| 849 | addSshKey(user: User, title: string, publicKey: string): Promise<Result<SshKey>>; | |
| 850 | removeSshKey(user: User, id: string): Promise<void>; | |
| 851 | ||
| 852 | listAccessTokens(user: User): Promise<AccessToken[]>; | |
| Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed) | 853 | /** |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 854 | * The plaintext token is returned once and never stored. With |
| 855 | * `ttlSeconds` the token expires and is left out of token lists; that | |
| 856 | * form is used for hosted agents. A token made for a workspace acting | |
| 857 | * through a token of its own belongs to that workspace too. | |
| Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed) | 858 | */ |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 859 | createAccessToken( |
| 860 | user: User, | |
| 861 | name: string, | |
| 862 | ttlSeconds?: number, | |
| 863 | grant?: TokenGrant & { listed?: boolean }, | |
| 864 | ): Promise<{ token: string; info: AccessToken }>; | |
| 865 | /** Changes what one of a person's tokens may do; the token is unchanged. */ | |
| 866 | updateAccessToken(user: User, id: string, grant: TokenGrant): Promise<Result<AccessToken>>; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 867 | /** |
| 868 | * A token for a g1t agent working for `onBehalfOf`: it acts as | |
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 869 | * `g1t`, in `scope.repo` only, and only for `scope.operations`. |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 870 | */ |
| 871 | createAgentToken( | |
| 872 | onBehalfOf: User, | |
| 873 | scope: AgentScope, | |
| 874 | ttlSeconds: number, | |
| 875 | ): Promise<{ token: string; info: AccessToken }>; | |
| Initial g1t: services, event bus, intents and attempts | 876 | removeAccessToken(user: User, id: string): Promise<void>; |
| Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API | 877 | /** |
| 878 | * A token for one sandbox run: it acts as the agent on behalf of | |
| 879 | * `onBehalfOf`, can do only what the run's kind needs in `repo`, and | |
| 880 | * expires after `ttlSeconds`. See `audit.ts`. | |
| 881 | */ | |
| 882 | createRunCredential(input: CreateRunCredentialInput): Promise<{ token: string; info: AccessToken }>; | |
| 883 | /** Ties tokens, by the SHA-256 of their text in hex, to the agent run their sandbox recorded. */ | |
| 884 | bindRunCredentials(tokenHashes: string[], runId: string): Promise<boolean>; | |
| 885 | /** Ends a sandbox's run credentials, by hash or by run. Never touches another token. */ | |
| 886 | revokeRunCredentials(target: { tokenHashes?: string[]; runId?: string | null }): Promise<boolean>; | |
| Initial g1t: services, event bus, intents and attempts | 887 | } |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 888 | |
| 889 | ||
| 890 | /** What an agent's token may do: these operations, in this repository. */ | |
| Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API | 891 | export type AgentScope = { repo: RepoPath; operations: string[]; run?: RunBinding }; |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 892 | |
| 893 | /** The most characters each profile field takes. Mirrors `crates/contracts/src/identity.rs`. */ | |
| 894 | export const PROFILE_LIMITS = { name: 80, bio: 160, location: 80, website: 200, pronouns: 40 } as const; | |
| 895 | ||
| 896 | /** What anyone may see about a person, at `g1t.sh/u/<username>`. */ | |
| 897 | export type Profile = { | |
| 898 | username: string; | |
| 899 | /** The name they go by, if they gave one. */ | |
| 900 | name: string | null; | |
| 901 | bio: string | null; | |
| 902 | location: string | null; | |
| 903 | /** Always an `https://` address. */ | |
| 904 | website: string | null; | |
| 905 | pronouns: string | null; | |
| 906 | /** The uploaded avatar's hash, served at `/avatars/<avatar>`. */ | |
| 907 | avatar: string | null; | |
| 908 | /** When the account was made. RFC 3339. */ | |
| 909 | createdAt: string; | |
| 910 | }; | |
| 911 | ||
| 912 | /** What a person may change on their profile. Empty clears a field. */ | |
| 913 | export type ProfileFields = { | |
| 914 | name: string; | |
| 915 | bio: string; | |
| 916 | location: string; | |
| 917 | /** `https://…`; a bare `example.com` is taken as `https://example.com`. */ | |
| 918 | website: string; | |
| 919 | pronouns: string; | |
| 920 | }; | |
| 921 | ||
| 922 | /** A workspace on a person's profile. */ | |
| 923 | export type ProfileWorkspace = { slug: string; name: string; avatar: string | null }; |
This file's history is long; its oldest lines are credited to the oldest commit read.