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