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