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.
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 1 | import type { ActionsApi } from "./actions"; |
| Billing accounts, terms and enterprises; g1t is no longer free | 2 | import type { BillingAdminApi, BillingApi } from "./billing"; |
| Deployments: a preview for every pull request, production on g1t.page | 3 | import type { DeploymentsApi } from "./deployments"; |
| Projects: what a workspace builds and runs, first on every page | 4 | import type { ProjectsApi } from "./projects"; |
| Events service in Rust, with RFC 3339 times and accurate push events | 5 | import type { EventsApi } from "./events"; |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 6 | import type { IdentityAdminApi, IdentityApi } from "./identity"; |
| Integrations: your own model provider, alerts that open issues, tickets agents read | 7 | import type { IntegrationsApi } from "./integrations"; |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 8 | import type { PackagesApi } from "./packages"; |
| Webhooks: every event, to your own addresses, signed and retried | 9 | import type { WebhooksApi } from "./webhooks"; |
| Rust repos service with shipping; pull requests kept in the model | 10 | import type { ReposApi } from "./repos"; |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 11 | import type { PullDetail, WorkApi } from "./work"; |
| 12 | import type { Result } from "./result"; | |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 13 | import type { RunnersApi } from "./runners"; |
| API and MCP server, Rust identity service, registration, site redesign | 14 | |
| 15 | /** A service binding, as far as these clients need it. */ | |
| 16 | export type ServiceBinding = { | |
| 17 | fetch(input: string, init?: RequestInit): Promise<Response>; | |
| 18 | }; | |
| 19 | ||
| 20 | /** | |
| 21 | * Calls a method on a service that speaks the JSON protocol used by the | |
| 22 | * Rust services: `POST /rpc/<method>` with the arguments as the body. | |
| 23 | */ | |
| 24 | async function rpc<T>( | |
| 25 | service: ServiceBinding, | |
| 26 | method: string, | |
| 27 | args: object, | |
| 28 | ): Promise<T> { | |
| 29 | // The hostname is ignored; a service binding always reaches its service. | |
| 30 | const response = await service.fetch(`https://service/rpc/${method}`, { | |
| 31 | method: "POST", | |
| 32 | headers: { "content-type": "application/json" }, | |
| 33 | body: JSON.stringify(args), | |
| 34 | }); | |
| 35 | if (!response.ok) { | |
| 36 | throw new Error(`${method} failed with status ${response.status}`); | |
| 37 | } | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 38 | return (await response.json()) as T; |
| API and MCP server, Rust identity service, registration, site redesign | 39 | } |
| 40 | ||
| 41 | export function identityClient(service: ServiceBinding): IdentityApi { | |
| 42 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 43 | return { | |
| Merge invite emails that confirm the address: the emailed link carries a proof only that email has, so signing up from it needs no code; shared links and typed codes still confirm | 44 | register: (username, email, password, inviteCode, client, emailProof) => |
| 45 | call("register", { | |
| 46 | username, | |
| 47 | email, | |
| 48 | password, | |
| 49 | invite_code: inviteCode ?? null, | |
| 50 | email_proof: emailProof ?? null, | |
| 51 | client: client ?? null, | |
| 52 | }), | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 53 | signIn: (username, password, client) => call("sign_in", { username, password, client: client ?? null }), |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 54 | twoFactorSignIn: (challenge, code, client) => call("two_factor_sign_in", { challenge, code, client: client ?? null }), |
| API and MCP server, Rust identity service, registration, site redesign | 55 | signOut: (sessionToken) => call("sign_out", { sessionToken }), |
| Email verification, password reset, and Git for AI scale positioning | 56 | resendVerification: (user) => call("resend_verification", { user }), |
| 57 | verifyEmail: (token) => call("verify_email", { token }), | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 58 | requestPasswordReset: (email, client) => call("request_password_reset", { email, client: client ?? null }), |
| Email verification, password reset, and Git for AI scale positioning | 59 | resetPassword: (token, password) => |
| 60 | call("reset_password", { token, password }), | |
| Device sign-in replaces registering and minting tokens over the API | 61 | deviceStart: (clientName) => call("device_start", { clientName }), |
| 62 | deviceLookup: (userCode) => call("device_lookup", { userCode }), | |
| 63 | deviceResolve: (userCode, user, approve) => | |
| 64 | call("device_resolve", { userCode, user, approve }), | |
| 65 | deviceClaim: (deviceCode) => call("device_claim", { deviceCode }), | |
| OAuth 2.1 sign-in for MCP clients and other applications | 66 | oauthAuthorize: (user, approval) => call("oauth_authorize", { user, ...approval }), |
| 67 | oauthExchange: (code, codeVerifier, clientId, redirectUri) => | |
| 68 | call("oauth_exchange", { code, codeVerifier, clientId, redirectUri }), | |
| 69 | oauthRefresh: (refreshToken, clientId) => | |
| 70 | call("oauth_refresh", { refreshToken, clientId }), | |
| 71 | listOAuthGrants: (user) => call("list_oauth_grants", { user }), | |
| 72 | revokeOAuthGrant: (user, id) => call("revoke_oauth_grant", { user, id }), | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 73 | updateOAuthGrant: (user, id, grant) => |
| 74 | call("update_oauth_grant", { user, id, scopes: grant.scopes }), | |
| Workspaces own repositories | 75 | createWorkspace: (user, slug, name) => call("create_workspace", { user, slug, name }), |
| 76 | getWorkspace: (slug) => call("get_workspace", { slug }), | |
| Merge branch 'worktree-agent-a2013627e5ea4ab13' | 77 | workspaceResidency: (slug) => call("workspace_residency", { slug }), |
| 78 | setWorkspaceResidency: (actor, slug, residency) => call("set_workspace_residency", { actor, slug, residency }), | |
| Workspaces own repositories | 79 | listMembers: (slug, viewer) => call("list_members", { slug, viewer }), |
| 80 | addMember: (actor, slug, username) => call("add_member", { actor, slug, username }), | |
| 81 | removeMember: (actor, slug, username) => | |
| Merge main (membership, two-factor, GitHub repo roles) into tokens | 82 | call("remove_member", { actor, slug, username, surface: "web" }), |
| 83 | updateMember: (actor, slug, username, change) => | |
| 84 | call("update_member", { actor, slug, username, role: change.role ?? null, org_roles: change.org_roles ?? null, surface: "web" }), | |
| 85 | transferOwnership: (actor, slug, username) => call("transfer_ownership", { actor, slug, username, surface: "web" }), | |
| 86 | leaveWorkspace: (user, slug) => call("leave_workspace", { user, slug, surface: "web" }), | |
| 87 | setMemberPrivileges: (actor, slug, change) => call("set_member_privileges", { actor, slug, privileges: change, surface: "web" }), | |
| 88 | setTwoFactorRequirement: (actor, slug, required) => | |
| 89 | call("set_two_factor_requirement", { actor, slug, required, surface: "web" }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 90 | updateWorkspace: (actor, slug, details) => |
| 91 | call("update_workspace", { actor, slug, ...details }), | |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 92 | renameWorkspace: (actor, slug, newSlug) => call("rename_workspace", { actor, slug, newSlug }), |
| 93 | checkWorkspaceRename: (actor, slug, newSlug) => | |
| 94 | call("check_workspace_rename", { actor, slug, newSlug }), | |
| 95 | resolveSlug: (slug) => call("resolve_slug", { slug }), | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 96 | deleteWorkspace: (actor, slug, confirm) => call("delete_workspace", { actor, slug, confirm }), |
| 97 | checkWorkspaceDeletion: (actor, slug) => call("check_workspace_deletion", { actor, slug }), | |
| Workspace names and icons, and a component kit for every control | 98 | setWorkspaceAvatar: (actor, slug, image) => call("set_workspace_avatar", { actor, slug, image }), |
| 99 | setUserAvatar: (user, image) => call("set_user_avatar", { user, image }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 100 | listWorkspaceTokens: (slug, viewer) => call("list_workspace_tokens", { slug, viewer }), |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 101 | createWorkspaceToken: (actor, slug, name, grant) => |
| 102 | call("create_workspace_token", { | |
| 103 | actor, | |
| 104 | slug, | |
| 105 | name, | |
| 106 | scopes: grant?.scopes ?? null, | |
| 107 | ttl_seconds: grant?.ttlSeconds ?? null, | |
| Settings: fine-grained tokens, workspace token Admin, workspace personal access token rules | 108 | admin: grant?.admin ?? false, |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 109 | }), |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 110 | removeWorkspaceToken: (actor, slug, id) => |
| 111 | call("remove_workspace_token", { actor, slug, id }), | |
| Settings: fine-grained tokens, workspace token Admin, workspace personal access token rules | 112 | createFineGrainedToken: (user, input) => |
| 113 | call("create_fine_grained_token", { | |
| 114 | user, | |
| 115 | name: input.name, | |
| 116 | description: input.description ?? null, | |
| 117 | ttl_seconds: input.ttlSeconds, | |
| 118 | workspace: input.workspace, | |
| 119 | repository_selection: input.repositorySelection, | |
| 120 | repositories: input.repositories, | |
| 121 | permissions: input.permissions, | |
| 122 | }), | |
| 123 | updateFineGrainedToken: (user, id, change) => | |
| 124 | call("update_fine_grained_token", { | |
| 125 | user, | |
| 126 | id, | |
| 127 | name: change.name ?? null, | |
| 128 | description: change.description ?? null, | |
| 129 | repository_selection: change.repositorySelection ?? null, | |
| 130 | repositories: change.repositories ?? null, | |
| 131 | permissions: change.permissions ?? null, | |
| 132 | }), | |
| 133 | getTokenPolicy: (slug, viewer) => call("get_token_policy", { slug, viewer }), | |
| 134 | setTokenPolicy: (actor, slug, change) => | |
| 135 | call("set_token_policy", { | |
| 136 | actor, | |
| 137 | slug, | |
| 138 | allow_classic: change.allowClassic ?? null, | |
| 139 | allow_fine_grained: change.allowFineGrained ?? null, | |
| 140 | require_approval: change.requireApproval ?? null, | |
| 141 | max_lifetime_days: change.maxLifetimeDays ?? null, | |
| 142 | forbid_no_expiry: change.forbidNoExpiry ?? null, | |
| 143 | surface: "web", | |
| 144 | }), | |
| 145 | listMemberTokens: (actor, slug, filter = {}) => | |
| 146 | call("list_member_tokens", { actor, slug, status: filter.status ?? null, kind: filter.kind ?? null }), | |
| 147 | reviewTokenRequest: (actor, slug, id, approve, reason) => | |
| 148 | call("review_token_request", { actor, slug, id, approve, reason: reason ?? null, surface: "web" }), | |
| 149 | revokeMemberToken: (actor, slug, id, reason) => | |
| 150 | call("revoke_member_token", { actor, slug, id, reason: reason ?? null, surface: "web" }), | |
| API and MCP server, Rust identity service, registration, site redesign | 151 | userForSession: (sessionToken) => call("user_for_session", { sessionToken }), |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 152 | registration: () => call("registration", {}), |
| 153 | listInvites: (user) => call("list_invites", { user }), | |
| 154 | createInvite: (user, options = {}) => | |
| 155 | call("create_invite", { user, email: options.email ?? null, workspace: options.workspace ?? null }), | |
| 156 | revokeInvite: (user, id) => call("revoke_invite", { user, id }), | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 157 | checkInvite: (code, client, options = {}) => |
| 158 | call("check_invite", { | |
| 159 | code, | |
| 160 | client: client ?? null, | |
| 161 | viewer: options.viewer ?? null, | |
| 162 | any_status: options.anyStatus ?? false, | |
| Merge invite emails that confirm the address: the emailed link carries a proof only that email has, so signing up from it needs no code; shared links and typed codes still confirm | 163 | email_proof: options.emailProof ?? null, |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 164 | }), |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 165 | acceptInvite: (user, code) => call("accept_invite", { user, code }), |
| 166 | inviteMember: (actor, slug, email) => call("invite_member", { actor, slug, email }), | |
| 167 | workspaceInvites: (slug, viewer) => call("workspace_invites", { slug, viewer }), | |
| 168 | revokeWorkspaceInvite: (actor, slug, id) => call("revoke_workspace_invite", { actor, slug, id }), | |
| 169 | requestAccess: (email, about, client) => call("request_access", { email, about, client: client ?? null }), | |
| API and MCP server, Rust identity service, registration, site redesign | 170 | userForGitCredentials: (username, secret) => |
| 171 | call("user_for_git_credentials", { username, secret }), | |
| 172 | userForAccessToken: (token) => call("user_for_access_token", { token }), | |
| 173 | userForSshKey: (fingerprint) => call("user_for_ssh_key", { fingerprint }), | |
| 174 | userByUsername: (username) => call("user_by_username", { username }), | |
| What happened across an outcome, as a feed beside its graph | 175 | usernames: (ids) => call("usernames", { ids }), |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 176 | profile: (username) => call("profile", { username }), |
| 177 | updateProfile: (actor, fields) => call("update_profile", { actor, ...fields }), | |
| 178 | profileWorkspaces: (username, viewer, publicIn) => | |
| 179 | call("profile_workspaces", { username, viewer, public: publicIn }), | |
| API and MCP server, Rust identity service, registration, site redesign | 180 | listSshKeys: (user) => call("list_ssh_keys", { user }), |
| 181 | addSshKey: (user, title, publicKey) => | |
| 182 | call("add_ssh_key", { user, title, publicKey }), | |
| 183 | removeSshKey: (user, id) => call("remove_ssh_key", { user, id }), | |
| 184 | listAccessTokens: (user) => call("list_access_tokens", { user }), | |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 185 | createAccessToken: (user, name, ttlSeconds, grant) => |
| 186 | call("create_access_token", { | |
| 187 | user, | |
| 188 | name, | |
| 189 | ttlSeconds, | |
| 190 | scopes: grant?.scopes ?? null, | |
| 191 | listed: grant?.listed ?? false, | |
| 192 | }), | |
| 193 | updateAccessToken: (user, id, grant) => | |
| 194 | call("update_access_token", { user, id, scopes: grant.scopes }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 195 | createAgentToken: (onBehalfOf, scope, ttlSeconds) => |
| 196 | call("create_agent_token", { onBehalfOf, scope, ttlSeconds }), | |
| API and MCP server, Rust identity service, registration, site redesign | 197 | removeAccessToken: (user, id) => call("remove_access_token", { user, id }), |
| Agents get guardrails, run credentials, an audit log, a context hub, repository instructions and mentions; security upkeep; snake_case API | 198 | createRunCredential: (input) => call("create_run_credential", input), |
| 199 | bindRunCredentials: (tokenHashes, runId) => call("bind_run_credentials", { tokenHashes, runId }), | |
| 200 | revokeRunCredentials: (target) => call("revoke_run_credentials", target), | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 201 | // Who has access to a repository; see access.ts. |
| 202 | repoAccess: (owner, name, viewer) => call("repo_access", { viewer, path: { namespace: owner, name } }), | |
| 203 | addCollaborator: (actor, owner, name, invitee, role) => | |
| 204 | call("add_collaborator", { actor, path: { namespace: owner, name }, invitee, role }), | |
| 205 | setCollaboratorRole: (actor, owner, name, username, role) => | |
| 206 | call("set_collaborator_role", { actor, path: { namespace: owner, name }, username, role }), | |
| 207 | removeCollaborator: (actor, owner, name, username) => | |
| 208 | call("remove_collaborator", { actor, path: { namespace: owner, name }, username }), | |
| 209 | collaboratorPermission: (viewer, owner, name, username) => | |
| 210 | call("collaborator_permission", { viewer, path: { namespace: owner, name }, username }), | |
| 211 | myRepoInvitations: (user) => call("my_repo_invitations", { user }), | |
| 212 | respondRepoInvitation: (user, id, accept) => call("respond_repo_invitation", { user, id, accept }), | |
| 213 | revokeRepoInvitation: (actor, owner, name, id) => | |
| 214 | call("revoke_repo_invitation", { actor, path: { namespace: owner, name }, id }), | |
| 215 | setBasePermission: (actor, slug, base) => call("set_base_permission", { actor, slug, base_permission: base }), | |
| 216 | outsideCollaborators: (viewer, slug) => call("outside_collaborators", { viewer, slug }), | |
| Merge branch 'worktree-agent-a5a5de74d8863d554' into worktree-agent-a16631325aecf58ca | 217 | // A repository's deploy keys; see deploy-keys.ts. |
| 218 | listDeployKeys: (viewer, owner, name) => call("list_deploy_keys", { viewer, path: { namespace: owner, name } }), | |
| 219 | addDeployKey: (actor, owner, name, key) => | |
| 220 | call("add_deploy_key", { actor, path: { namespace: owner, name }, title: key.title, key: key.key, read_only: key.readOnly }), | |
| 221 | removeDeployKey: (actor, owner, name, id) => call("remove_deploy_key", { actor, path: { namespace: owner, name }, id }), | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 222 | // Teams; see teams.ts. |
| 223 | listTeams: (viewer, workspace, query) => call("list_teams", { viewer, workspace, query: query ?? null }), | |
| 224 | getTeam: (viewer, workspace, team) => call("get_team", { viewer, workspace, team }), | |
| 225 | createTeam: (actor, workspace, team) => call("create_team", { actor, workspace, ...team }), | |
| Merge branch 'worktree-agent-ad7c6d88d93adc817' | 226 | setTeamCreation: (actor, slug, setting) => call("set_team_creation", { actor, slug, team_creation: setting }), |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 227 | updateTeam: (actor, workspace, team, changes) => call("update_team", { actor, workspace, team, ...changes }), |
| 228 | deleteTeam: (actor, workspace, team) => call("delete_team", { actor, workspace, team }), | |
| 229 | teamMembers: (viewer, workspace, team, includeChildTeams) => | |
| 230 | call("team_members", { viewer, workspace, team, include_child_teams: includeChildTeams ?? false }), | |
| 231 | setTeamMember: (actor, workspace, team, username, role) => | |
| 232 | call("set_team_member", { actor, workspace, team, username, role }), | |
| 233 | removeTeamMember: (actor, workspace, team, username) => | |
| 234 | call("remove_team_member", { actor, workspace, team, username }), | |
| 235 | childTeams: (viewer, workspace, team) => call("child_teams", { viewer, workspace, team }), | |
| 236 | teamRepos: (viewer, workspace, team) => call("team_repos", { viewer, workspace, team }), | |
| 237 | setTeamRepo: (actor, workspace, team, owner, name, role) => | |
| 238 | call("set_team_repo", { actor, workspace, team, repo: { namespace: owner, name }, role }), | |
| 239 | removeTeamRepo: (actor, workspace, team, owner, name) => | |
| 240 | call("remove_team_repo", { actor, workspace, team, repo: { namespace: owner, name } }), | |
| 241 | userTeams: (viewer, workspace, username) => call("user_teams", { viewer, workspace, username }), | |
| 242 | teamMemberships: (viewer, workspace) => call("team_memberships", { viewer, workspace }), | |
| API and MCP server, Rust identity service, registration, site redesign | 243 | }; |
| 244 | } | |
| Rust repos service with shipping; pull requests kept in the model | 245 | |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 246 | /** |
| 247 | * The slug a renamed workspace has now, for a `workspace.renamed` handler: | |
| 248 | * asked of identity by the workspace's id, so that renames delivered twice | |
| 249 | * or out of order converge. Falls back to the event's `to`. | |
| 250 | */ | |
| 251 | export async function currentWorkspaceSlug( | |
| 252 | identity: ServiceBinding, | |
| 253 | renamed: { workspaceId: string; to: string }, | |
| 254 | ): Promise<string> { | |
| 255 | const names = await identityClient(identity).usernames([renamed.workspaceId]); | |
| 256 | return names[renamed.workspaceId] ?? renamed.to; | |
| 257 | } | |
| 258 | ||
| 259 | /** The slugs whose rows move to `current`: the two a rename names, less `current`. */ | |
| 260 | export function staleSlugs(renamed: { from: string; to: string }, current: string): string[] { | |
| 261 | return [...new Set([renamed.from, renamed.to])].filter((slug) => slug !== current); | |
| 262 | } | |
| 263 | ||
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 264 | /** |
| 265 | * Where a transferred repository is now, as `namespace/name`, for a | |
| 266 | * `repo.transferred` handler: asked of repos by id, so transfers delivered | |
| 267 | * twice or out of order converge. Falls back to the event's destination. | |
| 268 | */ | |
| 269 | export async function currentRepoPath( | |
| 270 | repos: ServiceBinding, | |
| 271 | transferred: { repoId: string; name: string; to: string }, | |
| 272 | ): Promise<string> { | |
| 273 | const path = await rpc<{ namespace: string; name: string } | null>(repos, "path_by_id", { id: transferred.repoId }); | |
| 274 | return path ? `${path.namespace}/${path.name}` : `${transferred.to}/${transferred.name}`; | |
| 275 | } | |
| 276 | ||
| 277 | /** The paths whose rows move to `current`: the two a transfer names, less `current`. */ | |
| 278 | export function stalePaths(transferred: { name: string; from: string; to: string }, current: string): string[] { | |
| 279 | return [...new Set([transferred.from, transferred.to].map((ns) => `${ns}/${transferred.name}`))].filter( | |
| 280 | (path) => path !== current, | |
| 281 | ); | |
| 282 | } | |
| 283 | ||
| 284 | /** | |
| 285 | * A repository's path change, from `repo.transferred` or `repo.renamed`, | |
| 286 | * read the same way: the two paths (`namespace/name`) the event names, old | |
| 287 | * then new. Null for any other event. | |
| 288 | */ | |
| 289 | export type RepoMove = { repoId: string; paths: [string, string] }; | |
| 290 | ||
| 291 | export function repoMove(event: { type: string; data: unknown }): RepoMove | null { | |
| 292 | const data = event.data as Record<string, string>; | |
| 293 | if (event.type === "repo.transferred") { | |
| 294 | return { repoId: data.repoId!, paths: [`${data.from}/${data.name}`, `${data.to}/${data.name}`] }; | |
| 295 | } | |
| 296 | if (event.type === "repo.renamed") { | |
| 297 | return { repoId: data.repoId!, paths: [`${data.namespace}/${data.from}`, `${data.namespace}/${data.to}`] }; | |
| 298 | } | |
| 299 | return null; | |
| 300 | } | |
| 301 | ||
| 302 | /** | |
| 303 | * Where a moved repository is now, as `namespace/name`: asked of repos by | |
| 304 | * id, so moves delivered twice or out of order converge. Falls back to the | |
| 305 | * event's new path. | |
| 306 | */ | |
| 307 | export async function currentMovedPath(repos: ServiceBinding, move: RepoMove): Promise<string> { | |
| 308 | const path = await rpc<{ namespace: string; name: string } | null>(repos, "path_by_id", { id: move.repoId }); | |
| 309 | return path ? `${path.namespace}/${path.name}` : move.paths[1]; | |
| 310 | } | |
| 311 | ||
| 312 | /** The paths whose rows move to `current`: the two a move names, less `current`. */ | |
| 313 | export function staleMovedPaths(move: RepoMove, current: string): string[] { | |
| 314 | return [...new Set(move.paths)].filter((path) => path !== current); | |
| 315 | } | |
| 316 | ||
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 317 | /** Staff-only identity. Only sudo binds to it; see `IdentityAdminApi`. */ |
| 318 | export function identityAdminClient(service: ServiceBinding): IdentityAdminApi { | |
| 319 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 320 | return { | |
| 321 | workspaces: (query) => call("admin_workspaces", { query: query ?? null }), | |
| 322 | workspace: (slug) => call("admin_workspace", { slug }), | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 323 | waitlist: (query, status) => call("admin_waitlist", { query: query ?? null, status: status ?? null }), |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 324 | waitlistPending: () => call("admin_waitlist_pending", {}), |
| 325 | decideWaitlist: (id, approve, staff, note) => call("admin_decide_waitlist", { id, approve, staff, note: note ?? null }), | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 326 | invites: (query) => call("admin_invites", { query: query ?? null }), |
| 327 | revokeInvite: (id, staff) => call("admin_revoke_invite", { id, staff }), | |
| 328 | mintInvite: (email, staff) => call("admin_mint_invite", { email, staff }), | |
| 329 | grantInvites: (target, name, amount, note, staff) => | |
| 330 | call("admin_grant_invites", { target, name, amount, note, staff }), | |
| 331 | inviteTree: (username) => call("admin_invite_tree", { username }), | |
| 332 | workspaceInvites: (slug) => call("admin_workspace_invites", { slug }), | |
| Merge shared invite links: label, uses, expiry, domains; joined through recorded (identity 0038) | 333 | sharedInvites: () => call("admin_shared_invites", {}), |
| 334 | createSharedInvite: (link, staff) => | |
| 335 | call("admin_create_shared_invite", { | |
| 336 | label: link.label, | |
| 337 | max_uses: link.maxUses, | |
| 338 | expires_on: link.expiresOn, | |
| 339 | domains: link.domains, | |
| 340 | staff, | |
| 341 | }), | |
| 342 | revokeSharedInvite: (id, staff) => call("admin_revoke_shared_invite", { id, staff }), | |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 343 | deletedWorkspaces: () => call("admin_deleted_workspaces", {}), |
| 344 | restoreWorkspace: (workspaceId, staff) => call("admin_restore_workspace", { workspaceId, staff }), | |
| 345 | purgeWorkspace: (workspaceId, staff, confirm) => call("admin_purge_workspace", { workspaceId, staff, confirm }), | |
| Merge branch 'worktree-agent-a8385d293d42c913a' | 346 | aliases: () => call("admin_aliases", {}), |
| 347 | setAlias: (alias, workspace, note, staff) => call("admin_set_alias", { alias, workspace, note, staff }), | |
| 348 | removeAlias: (alias, reason, staff) => call("admin_remove_alias", { alias, reason, staff }), | |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 349 | }; |
| 350 | } | |
| 351 | ||
| Rust repos service with shipping; pull requests kept in the model | 352 | export function reposClient(service: ServiceBinding): ReposApi { |
| 353 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 354 | return { | |
| 355 | get: (path, viewer) => call("get", { path, viewer }), | |
| 356 | getById: (id, viewer) => call("get_by_id", { id, viewer }), | |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 357 | readable: (ids, viewer) => call("readable", { ids, viewer }), |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 358 | publicNamespaces: (ownerId) => call("public_namespaces", { ownerId }), |
| Rust repos service with shipping; pull requests kept in the model | 359 | list: (viewer, options = {}) => call("list", { viewer, ...options }), |
| 360 | create: (owner, input) => call("create", { owner, ...input }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 361 | update: (actor, path, changes) => call("update", { actor, path, ...changes }), |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 362 | transfer: (actor, path, to) => call("transfer", { actor, path, to }), |
| 363 | delete: (actor, path, confirm) => call("delete", { actor, path, confirm }), | |
| 364 | deleted: (viewer, namespace) => call("deleted", { viewer, namespace }), | |
| 365 | restore: (actor, path) => call("restore", { actor, path }), | |
| 366 | purge: (actor, path, confirm) => call("purge", { actor, path, confirm }), | |
| 367 | rename: (actor, path, name) => call("rename", { actor, path, name }), | |
| 368 | archive: (actor, path, archived) => call("archive", { actor, path, archived }), | |
| 369 | setVisibility: (actor, path, isPrivate, confirm) => call("set_visibility", { actor, path, isPrivate, confirm }), | |
| 370 | setDefaultBranch: (actor, path, branch) => call("set_default_branch", { actor, path, branch }), | |
| 371 | renameBranch: (actor, path, from, to) => call("rename_branch", { actor, path, from, to }), | |
| 372 | resolveBranch: (repoId, branch) => call("resolve_branch", { repoId, branch }), | |
| 373 | statusById: (id) => call("status_by_id", { id }), | |
| Merge branch 'worktree-agent-a2013627e5ea4ab13' | 374 | storageOptions: () => call("storage_options", {}), |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 375 | resolvePath: (path) => call("resolve_path", { path }), |
| Rust repos service with shipping; pull requests kept in the model | 376 | tree: (path, viewer, ref, treePath) => |
| 377 | call("tree", { path, viewer, ref, treePath }), | |
| 378 | blob: (path, viewer, ref, filePath) => | |
| 379 | call("blob", { path, viewer, ref, filePath }), | |
| 380 | log: (path, viewer, ref, limit) => call("log", { path, viewer, ref, limit }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 381 | blame: (path, viewer, ref, filePath) => call("blame", { path, viewer, ref, filePath }), |
| Issues and pull requests replace intents and attempts | 382 | forkForPull: (sourceId, pullId, actor) => |
| 383 | call("fork_for_pull", { sourceId, pullId, actor }), | |
| Rust repos service with shipping; pull requests kept in the model | 384 | gitAccess: (path, viewer, service) => |
| 385 | call("git_access", { path, viewer, service }), | |
| Pull requests from branches | 386 | branches: (path, viewer) => call("branches", { path, viewer }), |
| Branches and Tags pages, each file's last commit, and the branch menu on files | 387 | lastCommits: (path, viewer, ref, treePath) => call("last_commits", { path, viewer, ref, treePath }), |
| Merge project overview: one branch_drift call, spliced histories, cached tags, 6 repos calls instead of 25 | 388 | branchDrift: (path, viewer, base, heads) => call("branch_drift", { path, viewer, base, heads }), |
| Branches and Tags pages, each file's last commit, and the branch menu on files | 389 | tags: (path, viewer) => call("tags", { path, viewer }), |
| Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97 | 390 | about: (path, viewer) => call("about", { path, viewer }), |
| 391 | languages: (path, viewer) => call("languages", { path, viewer }), | |
| 392 | contributors: (path, viewer) => call("contributors", { path, viewer }), | |
| 393 | license: (path, viewer) => call("license", { path, viewer }), | |
| 394 | stars: (path, viewer) => call("stars", { path, viewer }), | |
| 395 | star: (actor, path, starred) => call("star", { path, actor, starred }), | |
| 396 | stargazers: (path, viewer, page) => call("stargazers", { path, viewer, page: page ?? null }), | |
| 397 | starred: (username, viewer) => call("starred", { username, viewer }), | |
| 398 | releases: (path, viewer) => call("releases", { path, viewer }), | |
| 399 | release: (path, viewer, which) => call("release", { path, viewer, id: which.id ?? null, tag: which.tag ?? null, latest: which.latest ?? false }), | |
| 400 | createRelease: (actor, path, release) => call("create_release", { path, actor, ...release }), | |
| 401 | updateRelease: (actor, path, id, change) => call("update_release", { path, actor, id, ...change }), | |
| 402 | deleteRelease: (actor, path, id) => call("delete_release", { path, actor, id }), | |
| Download ZIP from the Code button; a slimmer lifecycle panel; agent steps say what was done, not sandbox paths | 403 | listFiles: (repoId, ref, limit) => call("list_files", { repoId, ref, skipDirs: [], limit }), |
| 404 | rawBlobs: (repoId, hashes, maxBytes) => call("raw_blobs", { repoId, hashes, maxBytes }), | |
| Merge g1tusercontent.com: registry answers run nothing in a browser, the site's pages run only their own scripts, repository files and avatars on their own origin, raw files rate limited per address | 405 | rawFile: (repoId, ref, path, maxBytes) => call("raw_file", { repoId, ref, path, maxBytes }), |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 406 | commitFile: (repo, actor, file) => call("commit_file", { repo, actor, ...file }), |
| Pull requests from branches | 407 | land: (sourceId, actor, branch) => call("land", { sourceId, actor, branch }), |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 408 | compare: (repoId, viewer, base, head, baseBranch) => call("compare", { repoId, viewer, base, head, baseBranch }), |
| Merge branch 'worktree-agent-ac5b181a013e54348' | 409 | claimBackups: (limit, maxRunning) => call("claim_backups", { limit, maxRunning }), |
| 410 | // The sandbox's own calls are snake_case (they come through the API). | |
| 411 | failBackup: (jobId, token, error) => call("backup_fail", { job_id: jobId, token, error }), | |
| Rust repos service with shipping; pull requests kept in the model | 412 | }; |
| 413 | } | |
| Work service in Rust, with RFC 3339 timestamps | 414 | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 415 | /** |
| 416 | * `PullDetail`'s own fields that the work service writes in snake_case: | |
| 417 | * `g1t_contracts::work::PullDetail` has no camelCase renaming, though what | |
| 418 | * it holds (`Pull`, `CheckRun` and the rest) does. Each with its name here. | |
| 419 | */ | |
| 420 | const PULL_DETAIL_FIELDS = [ | |
| 421 | ["review_pending", "reviewPending"], | |
| 422 | ["earlier_checks", "earlierChecks"], | |
| 423 | ["required_checks", "requiredChecks"], | |
| 424 | ["code_owners", "codeOwners"], | |
| 425 | ] as const; | |
| 426 | ||
| 427 | /** | |
| 428 | * A pull request's detail as the work service sent it, with its own fields | |
| 429 | * in the camelCase this package uses: read at the edge, by `workClient`'s | |
| 430 | * `getPull`. Either spelling is taken, so a service that already sends | |
| 431 | * camelCase reads the same. | |
| 432 | */ | |
| 433 | export function pullDetailFromWire(raw: Record<string, unknown>): PullDetail { | |
| 434 | const detail: Record<string, unknown> = { ...raw }; | |
| 435 | for (const [snake, camel] of PULL_DETAIL_FIELDS) { | |
| 436 | if (snake in detail) { | |
| 437 | if (!(camel in detail)) detail[camel] = detail[snake]; | |
| 438 | delete detail[snake]; | |
| 439 | } | |
| 440 | } | |
| 441 | if (typeof detail.reviewPending !== "boolean") detail.reviewPending = false; | |
| 442 | return detail as PullDetail; | |
| 443 | } | |
| 444 | ||
| Work service in Rust, with RFC 3339 timestamps | 445 | export function workClient(service: ServiceBinding): WorkApi { |
| 446 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 447 | return { | |
| Issues and pull requests replace intents and attempts | 448 | openIssue: (actor, repo, input) => call("open_issue", { actor, repo, ...input }), |
| Thirteen MCP tools and classic token scopes; agents rate their confidence and can be put on an issue in one step | 449 | delegateIssue: (actor, repo, input) => call("delegate_issue", { actor, repo, ...input }), |
| Issues and pull requests replace intents and attempts | 450 | listIssues: (repo, viewer, filter = {}) => call("list_issues", { repo, viewer, ...filter }), |
| 451 | getIssue: (repo, number, viewer) => call("get_issue", { repo, number, viewer }), | |
| 452 | updateIssue: (actor, repo, number, input) => | |
| 453 | call("update_issue", { actor, repo, number, ...input }), | |
| 454 | closeIssue: (actor, repo, number, reason) => | |
| 455 | call("close_issue", { actor, repo, number, reason }), | |
| 456 | reopenIssue: (actor, repo, number) => call("reopen_issue", { actor, repo, number }), | |
| 457 | listLabels: (repo, viewer) => call("list_labels", { repo, viewer }), | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 458 | saveLabel: (actor, repo, label) => call("save_label", { actor, repo, ...label }), |
| 459 | deleteLabel: (actor, repo, name) => call("delete_label", { actor, repo, name }), | |
| 460 | addDefaultLabels: (actor, repo) => call("add_default_labels", { actor, repo }), | |
| 461 | setLabels: (actor, repo, number, labels, change = "set") => | |
| 462 | call("set_labels", { actor, repo, number, labels, change }), | |
| 463 | listMilestones: (repo, viewer, state) => call("list_milestones", { repo, viewer, state }), | |
| 464 | getMilestone: (repo, number, viewer) => call("get_milestone", { repo, number, viewer }), | |
| 465 | saveMilestone: (actor, repo, milestone) => call("save_milestone", { actor, repo, ...milestone }), | |
| 466 | deleteMilestone: (actor, repo, number) => call("delete_milestone", { actor, repo, number }), | |
| Issues and pull requests replace intents and attempts | 467 | counts: (repo, viewer) => call("counts", { repo, viewer }), |
| Acceptance checks in sandboxes, line comments and review verdicts | 468 | addComment: (actor, repo, number, comment) => |
| 469 | call("add_comment", { actor, repo, number, ...comment }), | |
| Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts | 470 | editComment: (actor, repo, commentId, body) => call("edit_comment", { actor, repo, commentId, body }), |
| 471 | deleteComment: (actor, repo, commentId) => call("delete_comment", { actor, repo, commentId }), | |
| Acceptance checks in sandboxes, line comments and review verdicts | 472 | startChecks: (pullId) => call("start_checks", { pullId }), |
| 473 | reportChecks: (runId, token, report) => | |
| 474 | call("report_checks", { runId, token, ...report }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 475 | startReview: (pullId) => call("start_review", { pullId }), |
| 476 | failReview: (runId, token, error) => call("report_review", { runId, token, error }), | |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 477 | startMergecheck: (pullId) => call("start_mergecheck", { pullId }), |
| 478 | failMergecheck: (pullId, token, error) => call("report_mergecheck", { pullId, token, error }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 479 | advance: (pullId) => call("advance", { pullId }), |
| 480 | stall: (pullId, reason) => call("stall", { pullId, reason }), | |
| 481 | managedPulls: (repoId) => call("managed_pulls", { repoId }), | |
| 482 | queue: (repo, viewer) => call("queue", { repo, viewer }), | |
| 483 | queueBuild: (repoId) => call("queue_build", { repoId }), | |
| 484 | failQueue: (entryId, token, error) => call("report_queue", { entryId, token, error }), | |
| 485 | removeFromQueue: (actor, repo, number) => call("remove_from_queue", { actor, repo, number }), | |
| Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request | 486 | messageAgent: (actor, repo, number, body) => call("message_agent", { actor, repo, number, body }), |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 487 | catchUpJob: (pullId) => call("catch_up_job", { pullId }), |
| Agents asked while not at work are woken to answer | 488 | wakeForMessages: (pullId) => call("wake_for_messages", { pullId }), |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 489 | getSettings: (repo, viewer) => call("get_settings", { repo, viewer }), |
| Merge rulesets: branch and tag rules, agent-first, enforced on push and merge | 490 | // Rulesets travel in snake_case (rules.ts). |
| 491 | listRulesets: (owner, viewer, includeParents = false) => | |
| 492 | call("list_rulesets", { viewer, ...owner, include_parents: includeParents }), | |
| 493 | getRuleset: (owner, id, viewer) => call("get_ruleset", { viewer, ...owner, id }), | |
| 494 | saveRuleset: (actor, owner, ruleset, id) => call("save_ruleset", { actor, ...owner, id: id ?? null, ruleset }), | |
| 495 | deleteRuleset: (actor, owner, id) => call("delete_ruleset", { actor, ...owner, id }), | |
| 496 | effectiveRules: (repo, name, viewer, target = "branch") => call("effective_rules", { viewer, repo, name, target }), | |
| 497 | ruleEvaluations: (owner, viewer, filter = {}) => call("rule_evaluations", { viewer, ...owner, ...filter }), | |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 498 | seenChecks: (repo, viewer) => call("seen_checks", { repo, viewer }), |
| Merge checks: statuses and check runs on every commit | 499 | commitChecks: (repo, viewer, shas) => call("commit_checks", { repo, viewer, shas }), |
| 500 | getCheckRun: (repo, id, viewer) => call("get_check_run", { repo, id, viewer }), | |
| 501 | checkRunAnnotations: (repo, id, viewer) => call("check_run_annotations", { repo, id, viewer }), | |
| 502 | requestCheckAction: (actor, repo, id, identifier) => call("request_check_action", { actor, repo, id, identifier }), | |
| 503 | rerequestCheckRun: (actor, repo, id) => call("rerequest_check_run", { actor, repo, id }), | |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 504 | codeownersErrors: (repo, viewer, ref) => call("codeowners_errors", { repo, viewer, ref: ref ?? null }), |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 505 | updateSettings: (actor, repo, settings) => |
| 506 | call("update_settings", { actor, repo, settings }), | |
| Issues and pull requests replace intents and attempts | 507 | openPull: (actor, repo, input) => call("open_pull", { actor, repo, ...input }), |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 508 | listPulls: (repo, viewer, state, filter = {}) => call("list_pulls", { repo, viewer, state, ...filter }), |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 509 | pullsForRepos: (repoIds, viewer, limit) => call("pulls_for_repos", { repoIds, viewer, limit }), |
| Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar | 510 | // Its own fields arrive in snake_case: read into camelCase here. |
| 511 | getPull: (repo, number, viewer) => | |
| 512 | call<Result<Record<string, unknown>>>("get_pull", { repo, number, viewer }).then( | |
| 513 | (found): Result<PullDetail> => (found.ok ? { ok: true, value: pullDetailFromWire(found.value) } : found), | |
| 514 | ), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 515 | updatePull: (actor, repo, number, changes) => |
| 516 | call("update_pull", { actor, repo, number, ...changes }), | |
| Catching up with main takes seconds when the two sides touched different files | 517 | catchUpPull: (actor, repo, number) => call("catch_up_pull", { actor, repo, number }), |
| Issues and pull requests replace intents and attempts | 518 | readyPull: (actor, repo, number, summary) => |
| 519 | call("ready_pull", { actor, repo, number, summary }), | |
| 520 | closePull: (actor, repo, number) => call("close_pull", { actor, repo, number }), | |
| Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts | 521 | reopenPull: (actor, repo, number) => call("reopen_pull", { actor, repo, number }), |
| 522 | convertPullToDraft: (actor, repo, number) => call("convert_pull_to_draft", { actor, repo, number }), | |
| Acceptance checks in sandboxes, line comments and review verdicts | 523 | mergePull: (actor, repo, number, options = {}) => |
| 524 | call("merge_pull", { actor, repo, number, ...options }), | |
| Issues and pull requests replace intents and attempts | 525 | listActivePulls: (viewer) => call("list_active_pulls", { viewer }), |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 526 | byAuthor: (username, viewer, filter = {}) => call("by_author", { username, viewer, ...filter }), |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 527 | startPlan: (actor, repo, brief) => call("start_plan", { actor, repo, brief }), |
| 528 | failPlan: (planId, token, error) => call("report_plan", { planId, token, error }), | |
| 529 | getPlan: (repo, viewer, id) => call("get_plan", { repo, viewer, id }), | |
| 530 | listPlans: (repo, viewer) => call("list_plans", { repo, viewer }), | |
| 531 | applyPlan: (actor, repo, id, options = {}) => | |
| 532 | call("apply_plan", { actor, repo, id, ...options }), | |
| 533 | queueIssue: (actor, repo, number, queued) => | |
| 534 | call("queue_issue", { actor, repo, number, queued }), | |
| 535 | readyIssues: (repoId) => call("ready_issues", { repoId }), | |
| 536 | listAssignedIssues: (viewer) => call("list_assigned_issues", { viewer }), | |
| Issues and pull requests replace intents and attempts | 537 | appendSession: (actor, repo, number, entries) => |
| 538 | call("append_session", { actor, repo, number, entries }), | |
| 539 | readSession: (repo, number, viewer, afterSeq = 0) => | |
| 540 | call("read_session", { repo, number, viewer, afterSeq }), | |
| Work service in Rust, with RFC 3339 timestamps | 541 | }; |
| 542 | } | |
| Events service in Rust, with RFC 3339 times and accurate push events | 543 | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 544 | export function billingClient(service: ServiceBinding): BillingApi { |
| 545 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 546 | return { | |
| 547 | status: () => call("status", {}), | |
| 548 | account: (workspace, viewer) => call("account", { workspace, viewer }), | |
| 549 | ledger: (workspace, viewer) => call("ledger", { workspace, viewer }), | |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 550 | credits: (workspace, viewer) => call("credits", { workspace, viewer }), |
| The statement is a month at a time, a line per kind of charge | 551 | statement: (workspace, viewer, month = null, group = "day") => call("statement", { workspace, viewer, month, group }), |
| 552 | statementEntries: (workspace, viewer, filter) => | |
| 553 | call("statement_entries", { | |
| 554 | workspace, | |
| 555 | viewer, | |
| 556 | month: filter.month, | |
| 557 | kind: filter.kind, | |
| 558 | day: filter.day ?? null, | |
| 559 | project: filter.project ?? null, | |
| 560 | before: filter.before ?? null, | |
| 561 | }), | |
| Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request | 562 | usage: (workspace, viewer, since) => call("usage", { workspace, viewer, since }), |
| Mission control shows model usage, yours and the workspace's: tokens, cost, active days, cache share, each day, and the mix | 563 | tokenUsage: (workspace, viewer, options = {}) => |
| 564 | call("token_usage", { workspace, viewer, person: options.person ?? null, days: options.days ?? null }), | |
| 565 | recordTokens: (usage) => call("record_tokens", usage), | |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 566 | gatewayModels: () => call("gateway_models", {}), |
| Merge branch 'main' into actions-toolkit-oidc-artifacts | 567 | modelDefaults: () => call("model_defaults", {}), |
| 568 | recordDiscovery: (provider, models, by, error = null) => call("record_discovery", { provider, models, by, error }), | |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 569 | gatewayAdmit: (workspace) => call("gateway_admit", { workspace }), |
| 570 | recordGateway: (record) => call("record_gateway", record), | |
| 571 | gatewayRequests: (workspace, viewer, options = {}) => | |
| 572 | call("gateway_requests", { workspace, viewer, limit: options.limit ?? null, before: options.before ?? null }), | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 573 | checkout: (actor, workspace, amountCents, returnUrl, method = "card") => |
| 574 | call("checkout", { actor, workspace, amountCents, returnUrl, method }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 575 | confirm: (workspace, viewer, session) => call("confirm", { workspace, viewer, session }), |
| 576 | canStart: (workspace) => call("can_start", { workspace }), | |
| A free allowance on g1t's models, so anyone can try its agents | 577 | trial: (workspace, exempt) => call("trial", { workspace, exempt }), |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 578 | startRun: (run) => call("start_run", run), |
| Paid features: a workspace turns on Deployments with a monthly plan | 579 | features: (workspace, viewer) => call("features", { workspace, viewer }), |
| 580 | subscribe: (actor, workspace, feature, returnUrl) => | |
| 581 | call("subscribe", { actor, workspace, feature, returnUrl }), | |
| 582 | confirmSubscription: (workspace, viewer, session) => | |
| 583 | call("confirm_subscription", { workspace, viewer, session }), | |
| 584 | cancelSubscription: (actor, workspace, feature, resume = false) => | |
| 585 | call("cancel_subscription", { actor, workspace, feature, resume }), | |
| 586 | hasFeature: (workspace, feature) => call("has_feature", { workspace, feature }), | |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 587 | freeWorkspaces: (workspaces) => call("free_workspaces", { workspaces }), |
| Paid features: a workspace turns on Deployments with a monthly plan | 588 | chargeFeature: (charge) => call("charge_feature", charge), |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 589 | billingPortal: (actor, workspace, returnUrl) => call("billing_portal", { actor, workspace, return_url: returnUrl }), |
| Every sandbox is metered by the second | 590 | recordSandbox: (usage) => call("record_sandbox", usage), |
| Usage limits: unpaid usage can only go so far | 591 | limit: (workspace, viewer) => call("limit", { workspace, viewer }), |
| 592 | checkLimit: (workspace) => call("check_limit", { workspace }), | |
| Prices keep themselves current with what g1t pays | 593 | prices: () => call("prices", {}), |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 594 | notePending: (workspace, source, costMicros, detail = null) => call("note_pending", { workspace, source, costMicros, detail }), |
| 595 | usageMeters: (workspace, viewer) => call("usage_meters", { workspace, viewer }), | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 596 | setSpendLimit: (actor, workspace, spendLimitMicros, useFullLimit = false, raiseOnce = false) => |
| 597 | call("set_spend_limit", { actor, workspace, spendLimitMicros, use_full_limit: useFullLimit, raise_once: raiseOnce }), | |
| Two limits, real invoices, trust that grows by itself, sales signals | 598 | invoices: (workspace, viewer) => call("invoices", { workspace, viewer }), |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 599 | entitlements: (workspace) => call("entitlements", { workspace }), |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 600 | reserve: (reservation) => call("reserve", reservation), |
| 601 | settle: (reservationId, actualMicros) => call("settle", { reservationId, actualMicros }), | |
| 602 | cardCheck: (actor, workspace, returnUrl) => call("card_check", { actor, workspace, returnUrl }), | |
| 603 | confirmCardCheck: (workspace, viewer, session) => call("confirm_card_check", { workspace, viewer, session }), | |
| 604 | requestLimit: (actor, workspace, request) => call("request_limit", { actor, workspace, ...request }), | |
| 605 | limitRequests: (workspace, viewer) => call("limit_requests", { workspace, viewer }), | |
| 606 | confirmSpike: (actor, workspace, keepGoing) => call("confirm_spike", { actor, workspace, keepGoing }), | |
| 607 | setCaps: (actor, workspace, caps) => call("set_caps", { actor, workspace, ...caps }), | |
| Usage, Billing settings and prepaid AI credit; fixes from the UX audit | 608 | usageReport: (workspace, viewer, range) => |
| 609 | call("usage_report", { workspace, viewer, from: range.from, until: range.until, products: range.products ?? [], projects: range.projects ?? [] }), | |
| 610 | aiCredit: (workspace, viewer) => call("ai_credit", { workspace, viewer }), | |
| 611 | buyAiCredit: (actor, workspace, amountCents, returnUrl) => call("buy_ai_credit", { actor, workspace, amountCents, returnUrl }), | |
| 612 | confirmAiCredit: (workspace, viewer, session) => call("confirm_ai_credit", { workspace, viewer, session }), | |
| 613 | setAiReload: (actor, workspace, reload) => call("set_ai_reload", { actor, workspace, ...reload }), | |
| 614 | setBudget: (actor, workspace, budget) => call("set_budget", { actor, workspace, ...budget }), | |
| 615 | billingDetails: (workspace, viewer) => call("billing_details", { workspace, viewer }), | |
| 616 | setBillingDetails: (actor, workspace, details) => call("set_billing_details", { actor, workspace, ...details }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 617 | }; |
| 618 | } | |
| 619 | ||
| Billing accounts, terms and enterprises; g1t is no longer free | 620 | export function billingAdminClient(service: ServiceBinding): BillingAdminApi { |
| 621 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 622 | return { | |
| 623 | accounts: (query) => call("admin_accounts", { query: query ?? null }), | |
| 624 | account: (id) => call("admin_account", { id }), | |
| 625 | setTerms: (id, terms, by) => call("admin_set_terms", { id, terms, by }), | |
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 626 | setAllowances: (id, allowances, note, by) => call("admin_set_allowances", { id, allowances, note, by }), |
| Billing accounts, terms and enterprises; g1t is no longer free | 627 | createEnterprise: (name, workspaces, by) => call("admin_create_enterprise", { name, workspaces, by }), |
| 628 | attach: (workspace, account, by) => call("admin_attach", { workspace, account, by }), | |
| Billing: credits with a kind and expiry, discounts instead of comped, and safer charging | 629 | credit: (workspace, amountMicros, note, by, options = { kind: "goodwill" }) => |
| 630 | call("admin_credit", { | |
| 631 | workspace, | |
| 632 | amount_micros: amountMicros, | |
| 633 | note, | |
| 634 | by, | |
| 635 | kind: options.kind, | |
| 636 | expires_at: options.expiresAt ?? null, | |
| 637 | refund_for: options.refundFor ?? null, | |
| 638 | refund_day: options.refundDay ?? null, | |
| 639 | }), | |
| 640 | credits: (filter = {}) => | |
| 641 | call("admin_credits", { | |
| 642 | workspace: filter.workspace ?? null, | |
| 643 | kind: filter.kind ?? null, | |
| 644 | month: filter.month ?? null, | |
| 645 | by: filter.by ?? null, | |
| 646 | }), | |
| 647 | revokeCredit: (id, note, by) => call("admin_revoke_credit", { id, note, by }), | |
| sudo: reset a test workspace's billing so it starts again as a new customer; refused on a live Stripe key, for comped workspaces and for an enterprise's | 648 | resetBilling: (workspace, confirm, note, by) => call("admin_reset_billing", { workspace, confirm, note, by }), |
| Billing on Stripe's pages, month-end charges, warnings; sudo by workspace | 649 | billingLink: (workspace, by) => call("admin_billing_link", { workspace, by }), |
| Stripe's webhook secret is a Worker secret, STRIPE_WEBHOOK_SECRET, from a destination made in Stripe's dashboard | 650 | stripe: (fix = false, by) => call("admin_stripe", { fix, by: by ?? null }), |
| Stripe webhooks, enterprise invoices, and sudo for both | 651 | enterpriseBilling: (id, email, by) => call("admin_enterprise_billing", { id, email, by }), |
| Merge Stripe Tax, the card fee on card payments, and one free workspace per person | 652 | enterpriseAddress: (id, address, taxIdType, taxId, by) => call("admin_enterprise_address", { id, address, taxIdType, taxId, by }), |
| Stripe webhooks, enterprise invoices, and sudo for both | 653 | invoiceEnterprise: (id, by) => call("admin_invoice_enterprise", { id, by }), |
| 654 | accountsFor: (workspaces) => call("admin_accounts", { query: null, workspaces }), | |
| Two limits, real invoices, trust that grows by itself, sales signals | 655 | signals: () => call("admin_signals", {}), |
| 656 | overview: () => call("admin_overview", {}), | |
| 657 | sales: (workspace) => call("admin_sales", { workspace }), | |
| 658 | setSales: (workspace, record, by) => | |
| 659 | call("admin_set_sales", { | |
| 660 | workspace, | |
| 661 | stage: record.stage, | |
| 662 | owner: record.owner ?? null, | |
| 663 | next_step: record.nextStep ?? null, | |
| 664 | next_at: record.nextAt ?? null, | |
| 665 | by, | |
| 666 | }), | |
| 667 | addNote: (workspace, text, by) => call("admin_add_note", { workspace, text, by }), | |
| 668 | workspaceInvoices: (workspace) => call("admin_workspace_invoices", { workspace }), | |
| Billing lists every invoice and every staff change; signals carry follow-ups | 669 | allInvoices: (filter = {}) => call("admin_invoices", { status: filter.status ?? null, month: filter.month ?? null }), |
| 670 | audit: (filter = {}) => | |
| 671 | call("admin_audit", { by: filter.by ?? null, action: filter.action ?? null, before: filter.before ?? null }), | |
| Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look | 672 | limitRequests: (status = "open") => call("admin_limit_requests", { status }), |
| 673 | decideLimitRequest: (id, decision, amountMicros, note, by) => | |
| 674 | call("admin_decide_limit_request", { id, decision, amount_micros: amountMicros, note, by }), | |
| 675 | overages: () => call("admin_overages", {}), | |
| 676 | goodwill: (workspace, amountMicros, reason, by, day = null) => | |
| 677 | call("admin_goodwill", { workspace, amount_micros: amountMicros, reason, by, day }), | |
| 678 | velocity: () => call("admin_velocity", {}), | |
| 679 | recordPayment: (workspace, amountMicros, reference, note, by) => | |
| 680 | call("admin_record_payment", { workspace, amount_micros: amountMicros, reference, note, by }), | |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 681 | costs: (days) => call("admin_costs", { days: days ?? null }), |
| 682 | costAlerts: () => call("admin_cost_alerts", {}), | |
| Spend caps: a monthly budget for comped workspaces and a daily breaker on what g1t pays | 683 | spendCaps: () => call("admin_spend_caps", {}), |
| 684 | liftBreaker: (note, by) => call("admin_lift_breaker", { note, by }), | |
| Merge platform pause and the hourly usage watcher: staff can pause compute, schedules, indexing or renders for everyone, the watcher emails on a breach and is never blind quietly, and the models proxy holds each run to its cap (billing 0051, integrations 0006) | 685 | platformGuard: () => call("admin_platform_guard", {}), |
| 686 | setPause: (level, paused, note, by) => call("admin_set_pause", { level, paused, note, by }), | |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 687 | decideProposal: (id, decision, note, by) => call("admin_decide_proposal", { id, decision, note, by }), |
| 688 | setCostSettings: (settings, by) => call("admin_set_cost_settings", { settings, by }), | |
| 689 | setCostMapping: (mapping, by) => | |
| 690 | call("admin_set_cost_mapping", { | |
| 691 | product: mapping.product, | |
| 692 | meter: mapping.meter, | |
| 693 | bucket: mapping.bucket ?? "", | |
| 694 | price_meter: mapping.priceMeter ?? null, | |
| 695 | own_meter: mapping.ownMeter ?? null, | |
| 696 | scale_to_own: mapping.scaleToOwn ?? false, | |
| 697 | drift_percent: mapping.driftPercent ?? null, | |
| 698 | note: mapping.note ?? "", | |
| 699 | remove: mapping.remove ?? false, | |
| 700 | by, | |
| 701 | }), | |
| 702 | runCosts: (by) => call("admin_run_costs", { by }), | |
| Merge branch 'main' into actions-toolkit-oidc-artifacts | 703 | models: () => call("admin_models", {}), |
| 704 | decideModel: (model, decision, details, reason, by) => | |
| 705 | call("admin_decide_model", { | |
| 706 | model, | |
| 707 | decision, | |
| 708 | name: details.name ?? null, | |
| 709 | tier_hint: details.tierHint ?? null, | |
| 710 | prices: details.prices | |
| 711 | ? { | |
| 712 | input_micros: details.prices.inputMicros, | |
| 713 | output_micros: details.prices.outputMicros, | |
| 714 | cache_read_micros: details.prices.cacheReadMicros, | |
| 715 | cache_write_micros: details.prices.cacheWriteMicros, | |
| 716 | cache_write_1h_micros: details.prices.cacheWrite1hMicros, | |
| 717 | threshold: details.prices.threshold, | |
| 718 | over_input_micros: details.prices.overInputMicros, | |
| 719 | over_output_micros: details.prices.overOutputMicros, | |
| 720 | over_cache_read_micros: details.prices.overCacheReadMicros, | |
| 721 | over_cache_write_micros: details.prices.overCacheWriteMicros, | |
| 722 | over_cache_write_1h_micros: details.prices.overCacheWrite1hMicros, | |
| 723 | } | |
| 724 | : null, | |
| 725 | reason, | |
| 726 | by, | |
| 727 | }), | |
| 728 | setModelDefault: (purpose, value, reason, by) => | |
| 729 | call("admin_set_model_default", { | |
| 730 | purpose, | |
| 731 | model: value.model ?? null, | |
| 732 | tier: value.tier ?? null, | |
| 733 | effort: value.effort ?? null, | |
| 734 | reason, | |
| 735 | by, | |
| 736 | }), | |
| Billing accounts, terms and enterprises; g1t is no longer free | 737 | }; |
| 738 | } | |
| 739 | ||
| Events service in Rust, with RFC 3339 times and accurate push events | 740 | export function eventsClient(service: ServiceBinding): EventsApi { |
| 741 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 742 | return { | |
| 743 | publish: (events) => call("publish", { events }), | |
| 744 | list: (query) => call("list", query), | |
| 745 | }; | |
| 746 | } | |
| Integrations: your own model provider, alerts that open issues, tickets agents read | 747 | |
| 748 | export function integrationsClient(service: ServiceBinding): IntegrationsApi { | |
| 749 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 750 | return { | |
| 751 | list: (workspace, viewer) => call("list", { workspace, viewer }), | |
| 752 | connect: (actor, workspace, input) => call("connect", { actor, workspace, ...input }), | |
| 753 | update: (actor, workspace, id, input) => call("update", { actor, workspace, id, ...input }), | |
| 754 | disconnect: (actor, workspace, id) => call("disconnect", { actor, workspace, id }), | |
| 755 | test: (actor, workspace, id) => call("test", { actor, workspace, id }), | |
| 756 | deliveries: (workspace, viewer, id) => call("deliveries", { workspace, viewer, id }), | |
| 757 | resolve: (workspace, viewer, reference) => call("resolve", { workspace, viewer, reference }), | |
| 758 | references: (workspace, text, limit) => call("references", { workspace, text, limit }), | |
| 759 | import: (actor, repo, reference, assign) => call("import", { actor, repo, reference, assign }), | |
| 760 | links: (repo, number) => call("links", { repo, number }), | |
| 761 | modelProvider: (workspace) => call("model_provider", { workspace }), | |
| 762 | openModelSession: (run) => call("open_model_session", run), | |
| 763 | modelUpstream: (token) => call("model_upstream", { token }), | |
| Merge the AI Gateway: Anthropic's Messages API on a workspace's tokens | 764 | gatewayUpstream: (workspace) => call("gateway_upstream", { workspace }), |
| AI Gateway: OpenAI's format, open models, and your own providers | 765 | gatewayProviders: (workspace) => call("gateway_providers", { workspace }), |
| Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily | 766 | closeModelSessions: (tokenHashes) => call("close_model_sessions", { token_hashes: tokenHashes }), |
| Merge platform pause and the hourly usage watcher: staff can pause compute, schedules, indexing or renders for everyone, the watcher emails on a breach and is never blind quietly, and the models proxy holds each run to its cap (billing 0051, integrations 0006) | 767 | capModelSessions: (tokenHashes, capMicros) => call("cap_model_sessions", { token_hashes: tokenHashes, cap_micros: capMicros }), |
| Models per workspace: several providers, routed by kind of work | 768 | routes: (workspace, viewer) => call("routes", { workspace, viewer }), |
| 769 | setRoutes: (actor, workspace, routes) => call("set_routes", { actor, workspace, routes }), | |
| Integrations: your own model provider, alerts that open issues, tickets agents read | 770 | }; |
| 771 | } | |
| Webhooks: every event, to your own addresses, signed and retried | 772 | |
| 773 | export function webhooksClient(service: ServiceBinding): WebhooksApi { | |
| 774 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 775 | return { | |
| 776 | list: (viewer, owner) => call("list", { viewer, ...owner }), | |
| 777 | create: (actor, owner, input) => call("create", { actor, ...owner, ...input }), | |
| 778 | update: (actor, owner, id, input) => call("update", { actor, ...owner, id, ...input }), | |
| 779 | delete: (actor, owner, id) => call("delete", { actor, ...owner, id }), | |
| 780 | ping: (actor, owner, id) => call("ping", { actor, ...owner, id }), | |
| 781 | deliveries: (viewer, owner, id) => call("deliveries", { viewer, ...owner, id }), | |
| 782 | redeliver: (actor, owner, deliveryId) => call("redeliver", { actor, ...owner, deliveryId }), | |
| 783 | }; | |
| 784 | } | |
| Automations: rules in .g1t/automations that act when something happens | 785 | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 786 | export function actionsClient(service: ServiceBinding): ActionsApi { |
| 787 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 788 | return { | |
| 789 | workflows: (repo, viewer) => call("workflows", { repo, viewer }), | |
| 790 | runs: (repo, viewer, filter = {}) => call("runs", { repo, viewer, ...filter }), | |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 791 | run: (repo, viewer, id, attempt) => call("run", { repo, viewer, id, attempt: attempt ?? null }), |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 792 | logs: (repo, viewer, job, after = 0) => call("logs", { repo, viewer, job, after }), |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 793 | summaries: (repo, viewer, id, attempt) => call("summaries", { repo, viewer, id, attempt: attempt ?? null }), |
| 794 | jobLogText: (repo, viewer, job) => call("job_log_text", { repo, viewer, job }), | |
| 795 | runLogs: (repo, viewer, id, attempt) => call("run_logs", { repo, viewer, id, attempt: attempt ?? null }), | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 796 | dispatch: (actor, repo, workflow, ref, inputs) => call("dispatch", { actor, repo, workflow, ref, inputs }), |
| Merge Actions runs: summaries, attempts and re-runs, graceful cancel, log downloads, badges (actions 0009) | 797 | cancel: (actor, repo, id, force = false) => call("cancel", { actor, repo, id, force }), |
| 798 | rerun: (actor, repo, id, failedOnly = false, options = {}) => | |
| 799 | call("rerun", { actor, repo, id, failed_only: failedOnly, job: options.job ?? null, debug: options.debug ?? false }), | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 800 | setWorkflowEnabled: (actor, repo, workflow, enabled) => |
| 801 | call("set_workflow_enabled", { actor, repo, workflow, enabled }), | |
| 802 | settings: (actor, owner, kind) => call("settings", { actor, ...owner, kind }), | |
| Secrets and variables: one list, rows per environment, for workflows and deployments | 803 | setSetting: (actor, owner, kind, name, value, options = {}) => |
| 804 | call("set_setting", { actor, ...owner, kind, name, value, ...options }), | |
| 805 | deleteSetting: (actor, owner, kind, name, id) => call("delete_setting", { actor, ...owner, kind, name, id }), | |
| Merge branch 'worktree-agent-a3abfcce648e87dca' | 806 | approveRun: (actor, repo, id) => call("approve_run", { actor, repo, id }), |
| 807 | pendingDeployments: (repo, viewer, id) => call("pending_deployments", { repo, viewer, id }), | |
| 808 | reviewDeployments: (actor, repo, id, state, environments = [], comment) => | |
| 809 | call("review_deployments", { actor, repo, id, state, environments, comment: comment ?? null }), | |
| 810 | actionsSettings: (repo, viewer) => call("actions_settings", { repo, viewer }), | |
| 811 | setActionsSettings: (actor, repo, change) => call("set_actions_settings", { actor, repo, ...change }), | |
| 812 | workspaceActionsSettings: (workspace, viewer) => call("workspace_actions_settings", { workspace, viewer }), | |
| 813 | setWorkspaceActionsSettings: (actor, workspace, change) => | |
| 814 | call("set_workspace_actions_settings", { actor, workspace, ...change }), | |
| 815 | environments: (repo, viewer) => call("environments", { repo, viewer }), | |
| 816 | setEnvironment: (actor, repo, name, change) => call("set_environment", { actor, repo, name, ...change }), | |
| 817 | deleteEnvironment: (actor, repo, name) => call("delete_environment", { actor, repo, name }), | |
| Actions: OIDC tokens, the toolkit's cache and artifact services, and artifacts in R2 | 818 | artifacts: (repo, viewer, filter = {}) => call("artifacts", { repo, viewer, ...filter }), |
| 819 | artifactDownload: (repo, viewer, by) => call("artifact_download", { repo, viewer, ...by }), | |
| 820 | deleteArtifact: (actor, repo, id) => call("delete_artifact", { actor, repo, id }), | |
| 821 | artifactRetention: (repo, viewer, days) => call("artifact_retention", { repo, viewer, days }), | |
| GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs | 822 | }; |
| 823 | } | |
| 824 | ||
| Deployments: a preview for every pull request, production on g1t.page | 825 | |
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 826 | /** Self-hosted runners, kept by the actions service. */ |
| 827 | export function runnersClient(service: ServiceBinding): RunnersApi { | |
| 828 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 829 | return { | |
| 830 | stuck: (viewer) => call("stuck_jobs", { viewer }), | |
| 831 | list: (actor, owner) => call("runners", { actor, ...owner }), | |
| 832 | createToken: (actor, owner, group) => call("create_registration_token", { actor, ...owner, group }), | |
| 833 | remove: (actor, owner, id) => call("remove_runner", { actor, ...owner, id }), | |
| 834 | groups: (actor, workspace) => call("runner_groups", { actor, workspace }), | |
| 835 | setGroup: (actor, workspace, group) => call("set_runner_group", { actor, workspace, ...group }), | |
| 836 | deleteGroup: (actor, workspace, id) => call("delete_runner_group", { actor, workspace, id }), | |
| 837 | settings: (actor, owner) => call("runner_settings", { actor, ...owner }), | |
| 838 | setSettings: (actor, owner, change) => call("set_runner_settings", { actor, ...owner, ...change }), | |
| 839 | }; | |
| 840 | } | |
| 841 | ||
| Deployments: a preview for every pull request, production on g1t.page | 842 | export function deploymentsClient(service: ServiceBinding): DeploymentsApi { |
| 843 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 844 | return { | |
| Projects: what a workspace builds and runs, first on every page | 845 | settings: (project, viewer) => call("settings", { project, viewer }), |
| 846 | updateSettings: (actor, project, changes) => call("update_settings", { actor, project, changes }), | |
| 847 | list: (project, viewer) => call("list", { project, viewer }), | |
| 848 | get: (project, id, viewer) => call("get", { project, id, viewer }), | |
| 849 | redeploy: (actor, project, branch) => call("redeploy", { actor, project, branch }), | |
| 850 | takeDown: (actor, project, branch) => call("take_down", { actor, project, branch }), | |
| Project dependencies: addresses, preview stacks, Affects, and agents who know | 851 | stack: (actor, project, branch) => call("stack", { actor, project, branch }), |
| Projects: what a workspace builds and runs, first on every page | 852 | overview: (workspace, viewer) => call("overview", { workspace, viewer }), |
| Deployments: a preview for every pull request, production on g1t.page | 853 | usage: (workspace, viewer) => call("usage", { workspace, viewer }), |
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 854 | domains: (project, viewer) => call("domains", { project, viewer }), |
| 855 | addDomain: (actor, project, hostname, options = {}) => | |
| 856 | call("add_domain", { actor, project, hostname, twin: !!options.twin }), | |
| 857 | removeDomain: (actor, project, id) => call("remove_domain", { actor, project, id }), | |
| 858 | refreshDomain: (actor, project, id) => call("refresh_domain", { actor, project, id }), | |
| Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97 | 859 | repoDeployments: (repo, viewer, filter = {}) => call("list_deployments", { repo, viewer, ...filter }), |
| 860 | repoDeployment: (repo, id, viewer) => call("get_deployment", { repo, id, viewer }), | |
| 861 | environments: (repo, viewer) => call("list_environments", { repo, viewer }), | |
| 862 | createDeployment: (actor, repo, input) => call("create_deployment", { repo, actor, ...input }), | |
| 863 | createDeploymentStatus: (actor, repo, id, input) => call("create_deployment_status", { repo, actor, id, ...input }), | |
| Deployments: a preview for every pull request, production on g1t.page | 864 | }; |
| 865 | } | |
| Projects: what a workspace builds and runs, first on every page | 866 | |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 867 | /** Packages: the registries beside the code (services/packages). */ |
| 868 | export function packagesClient(service: ServiceBinding): PackagesApi { | |
| 869 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 870 | return { | |
| 871 | list: (workspace, viewer, filter = {}) => | |
| 872 | call("list_packages", { | |
| 873 | workspace, | |
| 874 | viewer, | |
| 875 | ecosystem: filter.ecosystem ?? null, | |
| 876 | repo_id: filter.repoId ?? null, | |
| 877 | query: filter.query ?? null, | |
| 878 | }), | |
| 879 | get: (workspace, ecosystem, name, viewer) => call("get_package", { workspace, ecosystem, name, viewer }), | |
| 880 | deleteVersion: (actor, workspace, ecosystem, name, version, surface) => | |
| 881 | call("delete_version", { actor, workspace, ecosystem, name, version, surface: surface ?? null }), | |
| 882 | deletePackage: (actor, workspace, ecosystem, name, surface) => | |
| 883 | call("delete_package", { actor, workspace, ecosystem, name, surface: surface ?? null }), | |
| 884 | set: (actor, workspace, ecosystem, name, change, surface) => | |
| 885 | call("set_package", { | |
| 886 | actor, | |
| 887 | workspace, | |
| 888 | ecosystem, | |
| 889 | name, | |
| 890 | visibility: change.visibility ?? null, | |
| 891 | link: change.link ?? null, | |
| 892 | unlink: change.unlink ?? false, | |
| Merge packages: roles, Actions access, source label, soft delete, API | 893 | inherit_access: change.inheritAccess ?? null, |
| 894 | surface: surface ?? null, | |
| 895 | }), | |
| 896 | settings: (workspace, ecosystem, name, viewer) => call("package_settings", { workspace, ecosystem, name, viewer }), | |
| 897 | deleted: (workspace, viewer) => call("deleted_packages", { workspace, viewer }), | |
| 898 | restorePackage: (actor, workspace, ecosystem, name, surface) => | |
| 899 | call("restore_package", { actor, workspace, ecosystem, name, surface: surface ?? null }), | |
| 900 | restoreVersion: (actor, workspace, ecosystem, name, version, surface) => | |
| 901 | call("restore_version", { actor, workspace, ecosystem, name, version, surface: surface ?? null }), | |
| 902 | setAccess: (actor, workspace, ecosystem, name, who, role, surface) => | |
| 903 | call("set_package_access", { | |
| 904 | actor, | |
| 905 | workspace, | |
| 906 | ecosystem, | |
| 907 | name, | |
| 908 | user: "user" in who ? who.user : null, | |
| 909 | team: "team" in who ? who.team : null, | |
| 910 | role, | |
| 911 | surface: surface ?? null, | |
| 912 | }), | |
| 913 | removeAccess: (actor, workspace, ecosystem, name, who, surface) => | |
| 914 | call("remove_package_access", { | |
| 915 | actor, | |
| 916 | workspace, | |
| 917 | ecosystem, | |
| 918 | name, | |
| 919 | user: "user" in who ? who.user : null, | |
| 920 | team: "team" in who ? who.team : null, | |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 921 | surface: surface ?? null, |
| 922 | }), | |
| Merge packages: roles, Actions access, source label, soft delete, API | 923 | setActionsAccess: (actor, workspace, ecosystem, name, repo, role, surface) => |
| 924 | call("set_actions_access", { actor, workspace, ecosystem, name, repo, role, surface: surface ?? null }), | |
| 925 | removeActionsAccess: (actor, workspace, ecosystem, name, repo, surface) => | |
| 926 | call("remove_actions_access", { actor, workspace, ecosystem, name, repo, surface: surface ?? null }), | |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 927 | storage: (workspace) => call("storage", { workspace }), |
| 928 | storageAll: () => call("storage_all", {}), | |
| Composer from the workspace's own repositories, and go get from g1t.sh | 929 | syncComposer: (repoId) => call("sync_composer", { repo_id: repoId }), |
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 930 | }; |
| 931 | } | |
| 932 | ||
| Projects: what a workspace builds and runs, first on every page | 933 | export function projectsClient(service: ServiceBinding): ProjectsApi { |
| 934 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 935 | return { | |
| 936 | list: (workspace, viewer) => call("list", { workspace, viewer }), | |
| 937 | get: (workspace, slug, viewer) => call("get", { workspace, slug, viewer }), | |
| 938 | byRepo: (repoId) => call("by_repo", { repoId }), | |
| 939 | create: (actor, workspace, input) => call("create", { actor, workspace, input }), | |
| 940 | update: (actor, workspace, slug, changes) => call("update", { actor, workspace, slug, changes }), | |
| A project is an app or a library: libraries show their package and how to ship a release, not production | 941 | deploymentsChanged: (projectId, enabled) => call("deployments_changed", { projectId, enabled }), |
| Project dependencies: addresses, preview stacks, Affects, and agents who know | 942 | dependencies: (workspace, slug, viewer) => call("dependencies", { workspace, slug, viewer }), |
| 943 | addDependency: (actor, workspace, slug, on, as) => call("add_dependency", { actor, workspace, slug, on, as }), | |
| 944 | removeDependency: (actor, workspace, slug, on) => call("remove_dependency", { actor, workspace, slug, on }), | |
| 945 | graph: (projectId) => call("graph", { projectId }), | |
| Projects: pinned and recent projects, per person per workspace | 946 | shortcuts: (workspace, viewer) => call("shortcuts", { workspace, viewer }), |
| 947 | pin: (actor, workspace, slug, position) => call("pin", { actor, workspace, slug, position: position ?? null }), | |
| 948 | unpin: (actor, workspace, slug) => call("unpin", { actor, workspace, slug }), | |
| 949 | reorderPins: (actor, workspace, slugs) => call("reorder_pins", { actor, workspace, slugs }), | |
| 950 | visited: (actor, projectId) => call("visited", { actor, projectId }), | |
| Merge branch 'main' into worktree-agent-a69aeabc4b0deeb97 | 951 | publicLinks: (repos) => call("public_links", { repos }), |
| Projects: what a workspace builds and runs, first on every page | 952 | }; |
| 953 | } |
This file's history is long; its oldest lines are credited to the oldest commit read.