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"; |
| Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API | 2 | import type { Acting, CreateRunCredentialInput, RunBinding } from "./audit"; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 3 | import type { RepoPath } from "./repos"; |
| Initial g1t: services, event bus, intents and attempts | 4 | import type { Result } from "./result"; |
| 5 | ||
| Email verification, password reset, and Git for AI scale positioning | 6 | export type User = { |
| 7 | id: string; | |
| 8 | username: string; | |
| 9 | /** | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 10 | * `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 | 11 | * tokens: `id` is then the workspace's and `username` its slug. `system` |
| 12 | * is g1t itself doing platform work, such as a security update | |
| 13 | * (`username` `g1t`). Absent means `user`. | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 14 | */ |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 15 | kind?: "user" | "workspace" | "agent" | "system"; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 16 | /** |
| Email verification, password reset, and Git for AI scale positioning | 17 | * Whether the account's email address is confirmed. Only set on users |
| 18 | * resolved from credentials; unverified accounts cannot change anything. | |
| 19 | */ | |
| 20 | verified?: boolean; | |
| Workspaces own repositories | 21 | /** |
| 22 | * The workspaces this user belongs to. Set on users resolved from | |
| 23 | * credentials, so any service can authorize from it. | |
| 24 | */ | |
| 25 | workspaces?: Membership[]; | |
| Workspace names and icons, and a component kit for every control | 26 | /** |
| 27 | * The person's uploaded avatar: the SHA-256 of its bytes, served at | |
| 28 | * `/avatars/<avatar>`. Only set on the signed-in person; absent means | |
| 29 | * the generated letter avatar. | |
| 30 | */ | |
| 31 | avatar?: string; | |
| Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API | 32 | /** |
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 33 | * 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 | 34 | * on behalf of syntaqx"), with which credential, and what it may do. |
| 35 | */ | |
| 36 | acting?: Acting; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 37 | /** |
| 38 | * The repositories this user has a role on directly, whether or not they | |
| 39 | * belong to its workspace. Set with `workspaces`; see `access.ts`. | |
| 40 | */ | |
| 41 | grants?: RepoGrant[]; | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 42 | /** |
| 43 | * Set on a user resolved from an access token: its scopes (null for full | |
| 44 | * access) and the workspaces or repositories it reaches. See scopes.ts. | |
| 45 | */ | |
| 46 | token?: { | |
| 47 | token_id: string; | |
| 48 | scopes?: string[] | null; | |
| 49 | legacy?: boolean; | |
| 50 | }; | |
| Email verification, password reset, and Git for AI scale positioning | 51 | }; |
| Initial g1t: services, event bus, intents and attempts | 52 | |
| Workspaces own repositories | 53 | /** What a member may do: an owner also manages the workspace's members. */ |
| 54 | export type Role = "owner" | "member"; | |
| 55 | ||
| Workspace names and icons, and a component kit for every control | 56 | export type Membership = { |
| 57 | /** The workspace's name in URLs: `g1t.sh/<slug>`. */ | |
| 58 | slug: string; | |
| 59 | role: Role; | |
| 60 | /** Its display name. Set on users resolved from credentials. */ | |
| 61 | name?: string; | |
| 62 | /** Its uploaded icon, as `Workspace.avatar`. */ | |
| 63 | avatar?: string; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 64 | /** The workspace's base permission: what members get on every repository. Absent means `write`. */ |
| 65 | base_permission?: BasePermission; | |
| Workspace names and icons, and a component kit for every control | 66 | }; |
| Workspaces own repositories | 67 | |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 68 | /** How long an old workspace slug redirects, and stays reserved for it, after a rename. */ |
| 69 | export const SLUG_HOLD_DAYS = 90; | |
| 70 | ||
| 71 | /** How long a workspace must wait between renames. */ | |
| 72 | export const RENAME_COOLDOWN_HOURS = 24; | |
| 73 | ||
| Workspace names and icons, and a component kit for every control | 74 | /** The largest avatar that can be uploaded, in bytes. */ |
| 75 | export const MAX_AVATAR_BYTES = 1024 * 1024; | |
| 76 | ||
| Workspaces own repositories | 77 | /** |
| 78 | * A workspace: the owner of repositories, and the first segment of their | |
| 79 | * URLs. A person's own space and a team's are the same thing. | |
| 80 | */ | |
| 81 | export type Workspace = { | |
| 82 | id: string; | |
| 83 | slug: string; | |
| 84 | name: string; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 85 | /** One line saying what the workspace is for. */ |
| 86 | description: string | null; | |
| Workspaces own repositories | 87 | /** RFC 3339. */ |
| 88 | createdAt: string; | |
| 89 | memberCount: number; | |
| Workspace names and icons, and a component kit for every control | 90 | /** |
| 91 | * The workspace's uploaded icon: the SHA-256 of its bytes, served at | |
| 92 | * `/avatars/<avatar>`. Null means the generated letter avatar. | |
| 93 | */ | |
| 94 | avatar: string | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 95 | /** What every member gets on each repository; owners have Admin. */ |
| 96 | basePermission?: BasePermission; | |
| Workspaces own repositories | 97 | }; |
| 98 | ||
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 99 | export type Member = { |
| 100 | username: string; | |
| 101 | role: Role; | |
| 102 | /** Their display name, when they set one. */ | |
| 103 | name?: string | null; | |
| 104 | /** Their uploaded avatar's hash, served at `/avatars/<avatar>`; null for the generated letter avatar. */ | |
| 105 | avatar?: string | null; | |
| 106 | }; | |
| Workspaces own repositories | 107 | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 108 | /** An owner of a workspace, as staff see them. */ |
| 109 | export type AdminOwner = { username: string; email: string | null }; | |
| 110 | ||
| 111 | /** A workspace as staff see it. Mirrors `AdminWorkspace` in `crates/contracts/src/identity.rs`. */ | |
| 112 | export type AdminWorkspace = { | |
| 113 | slug: string; | |
| 114 | name: string; | |
| 115 | /** RFC 3339. */ | |
| 116 | createdAt: string; | |
| 117 | owners: AdminOwner[]; | |
| 118 | memberCount: number; | |
| 119 | }; | |
| 120 | ||
| 121 | /** A member of a workspace, as staff see them. */ | |
| 122 | export type AdminMember = { username: string; email: string | null; role: Role; /** RFC 3339. */ joined: string }; | |
| 123 | ||
| 124 | export type AdminWorkspaceDetail = { | |
| 125 | slug: string; | |
| 126 | name: string; | |
| 127 | description: string | null; | |
| 128 | /** RFC 3339. */ | |
| 129 | createdAt: string; | |
| 130 | /** Owners first, then by username. */ | |
| 131 | members: AdminMember[]; | |
| 132 | }; | |
| 133 | ||
| 134 | /** The most workspaces one `workspaces` call returns. */ | |
| 135 | export const ADMIN_WORKSPACES_LIMIT = 500; | |
| 136 | ||
| 137 | /** | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 138 | * Whether anyone may make an account, or only someone with an invite. |
| 139 | * Identity's `REGISTRATION_MODE`; unset means `invite`. | |
| 140 | */ | |
| 141 | export type RegistrationMode = "invite" | "open"; | |
| 142 | ||
| 143 | /** How many invites a person may have out at once, unless identity's `INVITES_PER_USER` says otherwise. */ | |
| 144 | export const INVITES_PER_USER = 5; | |
| 145 | /** How long an invite works, unless identity's `INVITE_TTL_DAYS` says otherwise. */ | |
| 146 | export const INVITE_TTL_DAYS = 30; | |
| 147 | ||
| 148 | /** Only a pending invite can be used or revoked. Revoked and expired ones never used give the invite back. */ | |
| 149 | export type InviteStatus = "pending" | "redeemed" | "expired" | "revoked"; | |
| 150 | ||
| 151 | /** One invite. Mirrors `Invite` in `crates/contracts/src/identity.rs`. */ | |
| 152 | export type Invite = { | |
| 153 | id: string; | |
| 154 | /** `g1t-k7m2-…`: returned when it is made, and to its maker while pending. */ | |
| 155 | code: string | null; | |
| 156 | /** The code's first group, such as `g1t-k7m2`. */ | |
| 157 | hint: string; | |
| 158 | /** Only this address can use it. */ | |
| 159 | email: string | null; | |
| 160 | /** `account` makes an account; `workspace` joins an existing one to `workspace`. */ | |
| 161 | kind: "account" | "workspace"; | |
| 162 | /** The workspace using it joins. */ | |
| 163 | workspace: string | null; | |
| 164 | status: InviteStatus; | |
| 165 | /** Whose allowance it used. */ | |
| 166 | chargedTo: "user" | "workspace" | "none"; | |
| 167 | /** Its maker's username; null when g1t staff made it. */ | |
| 168 | invitedBy: string | null; | |
| 169 | /** The account that used it. */ | |
| 170 | redeemedBy: string | null; | |
| 171 | /** RFC 3339. */ | |
| 172 | createdAt: string; | |
| 173 | /** RFC 3339. */ | |
| 174 | expiresAt: string; | |
| 175 | redeemedAt: string | null; | |
| 176 | revokedAt: string | null; | |
| 177 | /** The staff member who minted it; only in staff views. */ | |
| 178 | staff?: string | null; | |
| 179 | }; | |
| 180 | ||
| 181 | /** How many invites someone may have out. `limit` and `remaining` are null for no limit. */ | |
| 182 | export type Allowance = { limit: number | null; used: number; remaining: number | null }; | |
| 183 | ||
| 184 | export type InvitesOverview = { | |
| 185 | mode: RegistrationMode; | |
| 186 | allowance: Allowance; | |
| 187 | /** Workspaces the person owns that were granted invites to share. */ | |
| 188 | workspaces: { slug: string; allowance: Allowance }[]; | |
| 189 | invites: Invite[]; | |
| 190 | }; | |
| 191 | ||
| 192 | /** What a valid code is for, before it is used. */ | |
| 193 | export type InvitePreview = { | |
| 194 | kind: "account" | "workspace"; | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 195 | /** Pending, unless `anyStatus` asked about a code that is spent. */ |
| 196 | status: InviteStatus; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 197 | /** Null when g1t staff sent it. */ |
| 198 | invitedBy: { username: string; name: string | null; avatar: string | null } | null; | |
| 199 | workspace: ProfileWorkspace | null; | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 200 | /** The repository it accepts an invitation to, such as `{ name: "flagon-io/g1t", role: "write" }`. */ |
| 201 | repository: { name: string; role: string } | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 202 | /** Partly hidden, such as `a•••@example.com`. */ |
| 203 | email: string | null; | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 204 | /** The bound address in full, while the invite is pending: it fills in and locks the sign-up form. */ |
| 205 | address: string | null; | |
| 206 | /** Whether the bound address has a g1t account already: sign in to accept. */ | |
| 207 | hasAccount: boolean; | |
| 208 | /** With a viewer: whether it is theirs (for one of their confirmed addresses, or used by them). */ | |
| 209 | forViewer: boolean | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 210 | expiresAt: string; |
| 211 | }; | |
| 212 | ||
| 213 | export type WaitlistStatus = "waiting" | "invited" | "dismissed"; | |
| 214 | ||
| 215 | export type WaitlistEntry = { | |
| 216 | id: string; | |
| 217 | email: string; | |
| 218 | about: string | null; | |
| 219 | status: WaitlistStatus; | |
| 220 | inviteId: string | null; | |
| 221 | decidedBy: string | null; | |
| 222 | decidedAt: string | null; | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 223 | /** What staff wrote when approving; it went in the invite email. */ |
| 224 | note: string | null; | |
| 225 | /** The account made with the invite, once it was used. */ | |
| 226 | joinedAs: string | null; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 227 | /** When they first asked. */ |
| 228 | createdAt: string; | |
| 229 | /** When they last asked. */ | |
| 230 | updatedAt: string; | |
| 231 | }; | |
| 232 | ||
| 233 | export type InviteGrant = { amount: number; note: string | null; grantedBy: string; createdAt: string }; | |
| 234 | export type InviteTreeNode = { username: string; joinedAt: string; invited: InviteTreeNode[] }; | |
| 235 | ||
| 236 | /** Where a person came from and whom they brought. For a workspace, `username` is its slug. */ | |
| 237 | export type InviteTree = { | |
| 238 | username: string; | |
| 239 | /** Who invited them, then who invited that person, and so on. */ | |
| 240 | invitedBy: string[]; | |
| 241 | /** The staff member who minted their invite, when staff did. */ | |
| 242 | staff: string | null; | |
| 243 | allowance: Allowance; | |
| 244 | grants: InviteGrant[]; | |
| 245 | invites: Invite[]; | |
| 246 | /** Whom they invited, three levels down. */ | |
| 247 | invited: InviteTreeNode[]; | |
| 248 | }; | |
| 249 | ||
| 250 | /** The most rows one staff listing of invites or the waitlist returns. */ | |
| 251 | export const ADMIN_INVITES_LIMIT = 500; | |
| 252 | ||
| 253 | /** | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 254 | * Staff-only identity, for sudo.g1t.sh. It takes no viewer and checks no |
| 255 | * membership: only sudo calls it, over its service binding, once Cloudflare | |
| 256 | * Access and its staff list have let someone in. Never call it on behalf of | |
| 257 | * a customer. | |
| 258 | */ | |
| 259 | export interface IdentityAdminApi { | |
| 260 | /** Every workspace, newest first, at most 500; `query` matches slug, name, or an owner's username or email. */ | |
| 261 | workspaces(query?: string): Promise<AdminWorkspace[]>; | |
| 262 | /** One workspace with all its members, or null. */ | |
| 263 | workspace(slug: string): Promise<AdminWorkspaceDetail | null>; | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 264 | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 265 | /** 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 | 266 | 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 | 267 | /** How many requests are waiting, for the navigation's badge. */ |
| 268 | waitlistPending(): Promise<number>; | |
| 269 | /** | |
| 270 | * Approving mints an invite bound to the address and emails it, with | |
| 271 | * `note` (up to 500 characters) if given; dismissing only marks it. | |
| 272 | */ | |
| 273 | 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 | 274 | /** Invites, newest first; `query` is a code's start, or part of an email, inviter or redeemer. */ |
| 275 | invites(query?: string | null): Promise<Invite[]>; | |
| 276 | revokeInvite(id: string, staff: string): Promise<Result<Invite>>; | |
| 277 | /** An invite that uses nobody's allowance, optionally bound to (and emailed to) `email`. */ | |
| 278 | mintInvite(email: string | null, staff: string): Promise<Result<Invite>>; | |
| 279 | /** More invites (or fewer, with a negative amount) for a person or a workspace. */ | |
| 280 | grantInvites( | |
| 281 | target: "user" | "workspace", | |
| 282 | name: string, | |
| 283 | amount: number, | |
| 284 | note: string, | |
| 285 | staff: string, | |
| 286 | ): Promise<Result<Allowance>>; | |
| 287 | /** Where a person came from and whom they brought, or null. */ | |
| 288 | inviteTree(username: string): Promise<InviteTree | null>; | |
| 289 | /** A workspace's granted invites and the invites made for it, or null. */ | |
| 290 | workspaceInvites(slug: string): Promise<InviteTree | null>; | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 291 | } |
| 292 | ||
| Initial g1t: services, event bus, intents and attempts | 293 | /** Who is asking. Every read and write in every service takes one. */ |
| 294 | export type Viewer = User | null; | |
| 295 | ||
| 296 | export type SshKey = { | |
| 297 | id: string; | |
| 298 | title: string; | |
| 299 | fingerprint: string; | |
| RFC 3339 timestamps in identity and repos | 300 | /** RFC 3339. */ |
| 301 | createdAt: string; | |
| Initial g1t: services, event bus, intents and attempts | 302 | }; |
| 303 | ||
| Agents as a team: lifecycle, merge queue, billing and a new shell | 304 | export type AccessToken = { |
| 305 | id: string; | |
| 306 | name: string; | |
| 307 | /** RFC 3339. */ | |
| 308 | createdAt: string; | |
| 309 | /** RFC 3339, to within a few minutes. Null until it is first used. */ | |
| 310 | lastUsedAt: string | null; | |
| 311 | /** | |
| 312 | * For a workspace's token, the username of the member who made it. Null | |
| 313 | * once that account is gone, and on personal tokens. | |
| 314 | */ | |
| 315 | createdBy: string | null; | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 316 | /** Its scopes, as `resource:level`. Null: full access. */ |
| 317 | scopes: string[] | null; | |
| 318 | /** Made before tokens had scopes: full access until someone narrows it. */ | |
| 319 | legacy: boolean; | |
| 320 | /** RFC 3339. Null: it does not expire. */ | |
| 321 | expiresAt: string | null; | |
| 322 | }; | |
| 323 | ||
| 324 | /** What a new or changed token may do. */ | |
| 325 | export type TokenGrant = { | |
| 326 | /** Null: full access. */ | |
| 327 | scopes: string[] | null; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 328 | }; |
| Initial g1t: services, event bus, intents and attempts | 329 | |
| Device sign-in replaces registering and minting tokens over the API | 330 | export type DeviceStart = { |
| 331 | /** Secret held by the tool and exchanged for a token once approved. */ | |
| 332 | deviceCode: string; | |
| 333 | /** Short code shown to the person, e.g. `WDJB-MJHT`. */ | |
| 334 | userCode: string; | |
| 335 | /** Seconds until both codes stop working. */ | |
| 336 | expiresIn: number; | |
| 337 | /** Seconds the tool should wait between polls. */ | |
| 338 | interval: number; | |
| 339 | }; | |
| 340 | ||
| 341 | export type DeviceRequest = { userCode: string; clientName: string }; | |
| 342 | ||
| 343 | export type DeviceClaim = | |
| 344 | | { status: "pending" | "denied" | "expired" } | |
| 345 | | { status: "approved"; token: string; user: User }; | |
| 346 | ||
| OAuth 2.1 sign-in for MCP clients and other applications | 347 | /** What the site passes on once a person has approved an application. */ |
| 348 | export type OAuthApproval = { | |
| 349 | clientId: string; | |
| 350 | /** Shown wherever the application's access is listed. */ | |
| 351 | clientName: string; | |
| 352 | redirectUri: string; | |
| 353 | /** PKCE challenge, method S256. */ | |
| 354 | codeChallenge: string; | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 355 | /** What the person granted. Null: full access. */ |
| 356 | scopes: string[] | null; | |
| OAuth 2.1 sign-in for MCP clients and other applications | 357 | }; |
| 358 | ||
| 359 | export type OAuthTokens = { | |
| 360 | accessToken: string; | |
| 361 | /** Works once; using it returns the next one. */ | |
| 362 | refreshToken: string; | |
| 363 | /** Seconds until the access token stops working. */ | |
| 364 | expiresIn: number; | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 365 | /** The scopes granted, space-separated, or `*` for full access. */ |
| 366 | scope?: string | null; | |
| OAuth 2.1 sign-in for MCP clients and other applications | 367 | }; |
| 368 | ||
| 369 | /** An application a person has signed in to. */ | |
| 370 | export type OAuthGrant = { | |
| 371 | id: string; | |
| 372 | clientName: string; | |
| 373 | /** RFC 3339. */ | |
| 374 | createdAt: string; | |
| 375 | /** RFC 3339. */ | |
| 376 | lastUsedAt: string; | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 377 | /** What the person granted. Null: full access. */ |
| 378 | scopes: string[] | null; | |
| 379 | /** Signed in before applications had scopes: full access until narrowed. */ | |
| 380 | legacy: boolean; | |
| OAuth 2.1 sign-in for MCP clients and other applications | 381 | }; |
| 382 | ||
| Initial g1t: services, event bus, intents and attempts | 383 | /** Accounts, credentials and sessions. */ |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 384 | /** What stands between a workspace and its deletion; nothing when both counts are 0 and `billing` is null. */ |
| 385 | export type WorkspaceDeletion = { | |
| 386 | repositories: number; | |
| 387 | projects: number; | |
| 388 | /** Why billing cannot close it yet, in words for its owner. */ | |
| 389 | billing: string | null; | |
| 390 | }; | |
| 391 | ||
| 392 | export interface IdentityApi extends AccessClient { | |
| 393 | /** | |
| 394 | * Creates an account and signs it in. While registration is invite-only, | |
| 395 | * `inviteCode` must be an unused, unexpired invite (and, when it names an | |
| 396 | * email, that address); it is ignored while registration is open. | |
| 397 | */ | |
| 398 | register( | |
| 399 | username: string, | |
| 400 | email: string, | |
| 401 | password: string, | |
| 402 | inviteCode?: string | null, | |
| 403 | /** Who is asking, such as the visitor's IP address, for rate limits. */ | |
| 404 | client?: string | null, | |
| 405 | ): Promise<Result<{ user: User; sessionToken: string }>>; | |
| Initial g1t: services, event bus, intents and attempts | 406 | /** 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 | 407 | /** |
| 408 | * Verifies a username, or any confirmed address of the account, and its | |
| 409 | * password. Wrong passwords are counted against the account and `client` | |
| 410 | * (the visitor's IP address); past a limit nothing is checked for a while. | |
| 411 | */ | |
| 412 | signIn(username: string, password: string, client?: string | null): Promise<Result<{ user: User; sessionToken: string }>>; | |
| Initial g1t: services, event bus, intents and attempts | 413 | signOut(sessionToken: string): Promise<void>; |
| Email verification, password reset, and Git for AI scale positioning | 414 | |
| 415 | /** Sends the confirmation email again. */ | |
| 416 | resendVerification(user: User): Promise<Result<boolean>>; | |
| 417 | /** Confirms the address the emailed token was sent to. */ | |
| 418 | verifyEmail(token: string): Promise<Result<User>>; | |
| 419 | /** 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 | 420 | /** |
| 421 | * Any confirmed address of an account works; the link goes to it, and the | |
| 422 | * primary and backup are told. A few an hour per address and per `client`. | |
| 423 | */ | |
| 424 | requestPasswordReset(email: string, client?: string | null): Promise<boolean>; | |
| Email verification, password reset, and Git for AI scale positioning | 425 | /** Sets a new password from an emailed token and ends every session. */ |
| 426 | resetPassword(token: string, password: string): Promise<Result<User>>; | |
| 427 | ||
| Device sign-in replaces registering and minting tokens over the API | 428 | /** |
| 429 | * Device sign-in (RFC 8628). A tool starts a request, a person approves | |
| 430 | * its short code in a browser, and the tool claims an access token. | |
| 431 | */ | |
| 432 | deviceStart(clientName: string): Promise<DeviceStart>; | |
| 433 | /** What a user code is asking for, or null if it is not valid. */ | |
| 434 | deviceLookup(userCode: string): Promise<DeviceRequest | null>; | |
| 435 | deviceResolve(userCode: string, user: User, approve: boolean): Promise<Result<boolean>>; | |
| 436 | deviceClaim(deviceCode: string): Promise<DeviceClaim>; | |
| 437 | ||
| OAuth 2.1 sign-in for MCP clients and other applications | 438 | /** |
| 439 | * OAuth 2.1 for applications that sign a person in through the browser. | |
| 440 | * The caller has checked the client and its redirect address; this | |
| 441 | * returns the one-time code the application exchanges for tokens. | |
| 442 | */ | |
| 443 | oauthAuthorize(user: User, approval: OAuthApproval): Promise<{ code: string }>; | |
| 444 | /** Redeems a code. It works once, for that client, with the PKCE verifier. */ | |
| 445 | oauthExchange(code: string, codeVerifier: string, clientId: string, redirectUri: string): Promise<Result<OAuthTokens>>; | |
| 446 | /** Trades a refresh token for new tokens; the old ones stop working. */ | |
| 447 | oauthRefresh(refreshToken: string, clientId: string): Promise<Result<OAuthTokens>>; | |
| 448 | /** Applications the user has signed in to, most recently used first. */ | |
| 449 | listOAuthGrants(user: User): Promise<OAuthGrant[]>; | |
| 450 | /** Signs an application out. */ | |
| 451 | 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 | 452 | /** Changes what an application may do, at once and when it refreshes. */ |
| 453 | updateOAuthGrant(user: User, id: string, grant: TokenGrant): Promise<Result<OAuthGrant>>; | |
| OAuth 2.1 sign-in for MCP clients and other applications | 454 | |
| Workspaces own repositories | 455 | createWorkspace(user: User, slug: string, name: string): Promise<Result<Workspace>>; |
| 456 | /** Public details of a workspace, or null. */ | |
| 457 | getWorkspace(slug: string): Promise<Workspace | null>; | |
| 458 | /** Members only. */ | |
| 459 | listMembers(slug: string, viewer: Viewer): Promise<Result<Member[]>>; | |
| 460 | /** Owners only. */ | |
| 461 | addMember(actor: User, slug: string, username: string): Promise<Result<boolean>>; | |
| 462 | /** Owners only. */ | |
| 463 | removeMember(actor: User, slug: string, username: string): Promise<Result<boolean>>; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 464 | /** Owners only. An empty name falls back to the slug. */ |
| 465 | updateWorkspace(actor: User, slug: string, details: { name: string; description: string }): Promise<Result<Workspace>>; | |
| Workspace names and icons, and a component kit for every control | 466 | /** |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 467 | * Owners only. Changes the slug, the first segment of the workspace's |
| 468 | * URLs; the display name is untouched. The old slug redirects to the new | |
| 469 | * one, and stays reserved for this workspace, for `SLUG_HOLD_DAYS`. | |
| 470 | * Publishes `workspace.renamed`. | |
| 471 | */ | |
| 472 | renameWorkspace(actor: User, slug: string, newSlug: string): Promise<Result<Workspace>>; | |
| 473 | /** Whether `renameWorkspace` would be allowed, changing nothing. */ | |
| 474 | checkWorkspaceRename(actor: User, slug: string, newSlug: string): Promise<Result<boolean>>; | |
| 475 | /** | |
| 476 | * The workspace's current slug when `slug` is one it was renamed from | |
| 477 | * within `SLUG_HOLD_DAYS`; null otherwise, including for a slug in use. | |
| 478 | */ | |
| 479 | resolveSlug(slug: string): Promise<string | null>; | |
| 480 | /** | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 481 | * Owners only, a person only. `confirm` is the slug, typed out. Refused |
| 482 | * while the workspace holds repositories or projects, or billing cannot | |
| 483 | * settle it. Its slug is never given to anyone else; the person whose | |
| 484 | * username it is may make it again. Publishes `workspace.deleted`. | |
| 485 | */ | |
| 486 | deleteWorkspace(actor: User, slug: string, confirm: string): Promise<Result<boolean>>; | |
| 487 | /** What stands in the way of `deleteWorkspace`, changing nothing. */ | |
| 488 | checkWorkspaceDeletion(actor: User, slug: string): Promise<Result<WorkspaceDeletion>>; | |
| 489 | /** | |
| Workspace names and icons, and a component kit for every control | 490 | * Owners only. `image` is the file in base64: PNG, JPEG, WebP or GIF, at |
| 491 | * most `MAX_AVATAR_BYTES`, checked by its bytes. Null removes the icon. | |
| 492 | */ | |
| 493 | setWorkspaceAvatar(actor: User, slug: string, image: string | null): Promise<Result<Workspace>>; | |
| 494 | /** A person's own avatar, as `setWorkspaceAvatar`: the new one, or null. */ | |
| 495 | setUserAvatar(user: User, image: string | null): Promise<Result<string | null>>; | |
| Workspaces own repositories | 496 | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 497 | /** |
| 498 | * A workspace's own access tokens. They belong to the workspace, act as | |
| 499 | * it, and keep working when the member who made one leaves. Members only. | |
| 500 | */ | |
| 501 | listWorkspaceTokens(slug: string, viewer: Viewer): Promise<Result<AccessToken[]>>; | |
| 502 | /** 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 | 503 | createWorkspaceToken( |
| 504 | actor: User, | |
| 505 | slug: string, | |
| 506 | name: string, | |
| 507 | grant?: TokenGrant & { ttlSeconds?: number }, | |
| 508 | ): Promise<Result<{ token: string; info: AccessToken }>>; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 509 | /** Owners only. */ |
| 510 | removeWorkspaceToken(actor: User, slug: string, id: string): Promise<Result<boolean>>; | |
| 511 | ||
| Initial g1t: services, event bus, intents and attempts | 512 | userForSession(sessionToken: string): Promise<Viewer>; |
| 513 | ||
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 514 | /** Whether registration is invite-only. */ |
| 515 | registration(): Promise<RegistrationMode>; | |
| 516 | /** A person's invites and what they have left. */ | |
| 517 | listInvites(user: User): Promise<InvitesOverview>; | |
| 518 | /** | |
| 519 | * A person makes an invite, optionally for one address (emailed to it), | |
| 520 | * using one of theirs or, with `workspace`, one the workspace was granted. | |
| 521 | * People only: never an agent or a workspace's token. | |
| 522 | */ | |
| 523 | createInvite(user: User, options?: { email?: string | null; workspace?: string | null }): Promise<Result<Invite>>; | |
| 524 | /** Its maker, or an owner of its workspace, revokes a pending invite; the invite comes back. */ | |
| 525 | 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 | 526 | /** |
| 527 | * What a code is for. Unknown, used, revoked and expired codes all get the | |
| 528 | * same answer, unless `anyStatus`: then a real code that is spent is | |
| 529 | * described, with its `status`. `viewer` sets `forViewer`. | |
| 530 | */ | |
| 531 | checkInvite( | |
| 532 | code: string, | |
| 533 | client?: string | null, | |
| 534 | options?: { viewer?: User | null; anyStatus?: boolean }, | |
| 535 | ): Promise<Result<InvitePreview>>; | |
| 536 | /** | |
| 537 | * A signed-in person uses a workspace invite sent to their address, or one | |
| 538 | * sent with a repository invitation; returns the workspace's slug, or | |
| 539 | * `workspace/repo`. | |
| 540 | */ | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 541 | acceptInvite(user: User, code: string): Promise<Result<string>>; |
| 542 | /** Owners only. Invites an address into a workspace, always with an invite bound to it. */ | |
| 543 | inviteMember(actor: User, slug: string, email: string): Promise<Result<Invite>>; | |
| 544 | /** Owners only: the workspace's invites, newest first. */ | |
| 545 | workspaceInvites(slug: string, viewer: Viewer): Promise<Result<Invite[]>>; | |
| 546 | /** Owners only. */ | |
| 547 | revokeWorkspaceInvite(actor: User, slug: string, id: string): Promise<Result<Invite>>; | |
| 548 | /** Someone without an invite asks for one. Always the same answer for a valid address. */ | |
| 549 | requestAccess(email: string, about: string, client?: string | null): Promise<Result<boolean>>; | |
| 550 | ||
| Initial g1t: services, event bus, intents and attempts | 551 | /** Verifies git credentials: the account password or an access token. */ |
| 552 | userForGitCredentials(username: string, secret: string): Promise<Viewer>; | |
| API and MCP server, Rust identity service, registration, site redesign | 553 | /** Resolves a `g1t_…` access token, as sent to the API and MCP server. */ |
| 554 | userForAccessToken(token: string): Promise<Viewer>; | |
| Initial g1t: services, event bus, intents and attempts | 555 | userForSshKey(fingerprint: string): Promise<Viewer>; |
| 556 | userByUsername(username: string): Promise<Viewer>; | |
| What happened across an outcome, as a feed beside its graph | 557 | /** The names behind account and workspace ids; unknown ids are left out. */ |
| 558 | usernames(ids: string[]): Promise<Record<string, string>>; | |
| Initial g1t: services, event bus, intents and attempts | 559 | |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 560 | /** A person's public profile, or null if there is no such account. Never an email address. */ |
| 561 | profile(username: string): Promise<Profile | null>; | |
| 562 | /** A person changes their own profile. Every field is replaced; an empty one is cleared. */ | |
| 563 | updateProfile(actor: User, fields: ProfileFields): Promise<Result<Profile>>; | |
| 564 | /** | |
| 565 | * The workspaces a profile shows `viewer`: those the viewer belongs to | |
| 566 | * as well, and those of `publicIn` (where the person made a public | |
| 567 | * project) that the person really belongs to. Nothing else. | |
| 568 | */ | |
| 569 | profileWorkspaces(username: string, viewer: Viewer, publicIn: string[]): Promise<ProfileWorkspace[]>; | |
| 570 | ||
| Initial g1t: services, event bus, intents and attempts | 571 | listSshKeys(user: User): Promise<SshKey[]>; |
| 572 | /** Takes one line in OpenSSH public key format. */ | |
| 573 | addSshKey(user: User, title: string, publicKey: string): Promise<Result<SshKey>>; | |
| 574 | removeSshKey(user: User, id: string): Promise<void>; | |
| 575 | ||
| 576 | listAccessTokens(user: User): Promise<AccessToken[]>; | |
| Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed) | 577 | /** |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 578 | * The plaintext token is returned once and never stored. With |
| 579 | * `ttlSeconds` the token expires and is left out of token lists; that | |
| 580 | * form is used for hosted agents. A token made for a workspace acting | |
| 581 | * through a token of its own belongs to that workspace too. | |
| Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed) | 582 | */ |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 583 | createAccessToken( |
| 584 | user: User, | |
| 585 | name: string, | |
| 586 | ttlSeconds?: number, | |
| 587 | grant?: TokenGrant & { listed?: boolean }, | |
| 588 | ): Promise<{ token: string; info: AccessToken }>; | |
| 589 | /** Changes what one of a person's tokens may do; the token is unchanged. */ | |
| 590 | updateAccessToken(user: User, id: string, grant: TokenGrant): Promise<Result<AccessToken>>; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 591 | /** |
| 592 | * 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 | 593 | * `g1t`, in `scope.repo` only, and only for `scope.operations`. |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 594 | */ |
| 595 | createAgentToken( | |
| 596 | onBehalfOf: User, | |
| 597 | scope: AgentScope, | |
| 598 | ttlSeconds: number, | |
| 599 | ): Promise<{ token: string; info: AccessToken }>; | |
| Initial g1t: services, event bus, intents and attempts | 600 | 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 | 601 | /** |
| 602 | * A token for one sandbox run: it acts as the agent on behalf of | |
| 603 | * `onBehalfOf`, can do only what the run's kind needs in `repo`, and | |
| 604 | * expires after `ttlSeconds`. See `audit.ts`. | |
| 605 | */ | |
| 606 | createRunCredential(input: CreateRunCredentialInput): Promise<{ token: string; info: AccessToken }>; | |
| 607 | /** Ties tokens, by the SHA-256 of their text in hex, to the agent run their sandbox recorded. */ | |
| 608 | bindRunCredentials(tokenHashes: string[], runId: string): Promise<boolean>; | |
| 609 | /** Ends a sandbox's run credentials, by hash or by run. Never touches another token. */ | |
| 610 | revokeRunCredentials(target: { tokenHashes?: string[]; runId?: string | null }): Promise<boolean>; | |
| Initial g1t: services, event bus, intents and attempts | 611 | } |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 612 | |
| 613 | ||
| 614 | /** 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 | 615 | export type AgentScope = { repo: RepoPath; operations: string[]; run?: RunBinding }; |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 616 | |
| 617 | /** The most characters each profile field takes. Mirrors `crates/contracts/src/identity.rs`. */ | |
| 618 | export const PROFILE_LIMITS = { name: 80, bio: 160, location: 80, website: 200, pronouns: 40 } as const; | |
| 619 | ||
| 620 | /** What anyone may see about a person, at `g1t.sh/u/<username>`. */ | |
| 621 | export type Profile = { | |
| 622 | username: string; | |
| 623 | /** The name they go by, if they gave one. */ | |
| 624 | name: string | null; | |
| 625 | bio: string | null; | |
| 626 | location: string | null; | |
| 627 | /** Always an `https://` address. */ | |
| 628 | website: string | null; | |
| 629 | pronouns: string | null; | |
| 630 | /** The uploaded avatar's hash, served at `/avatars/<avatar>`. */ | |
| 631 | avatar: string | null; | |
| 632 | /** When the account was made. RFC 3339. */ | |
| 633 | createdAt: string; | |
| 634 | }; | |
| 635 | ||
| 636 | /** What a person may change on their profile. Empty clears a field. */ | |
| 637 | export type ProfileFields = { | |
| 638 | name: string; | |
| 639 | bio: string; | |
| 640 | location: string; | |
| 641 | /** `https://…`; a bare `example.com` is taken as `https://example.com`. */ | |
| 642 | website: string; | |
| 643 | pronouns: string; | |
| 644 | }; | |
| 645 | ||
| 646 | /** A workspace on a person's profile. */ | |
| 647 | export type ProfileWorkspace = { slug: string; name: string; avatar: string | null }; |