g1t/packages/contracts/src/clients.ts

547 lines32,270 bytesCodeBlame

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 docs1import type { ActionsApi } from "./actions";
Billing accounts, terms and enterprises; g1t is no longer free2import type { BillingAdminApi, BillingApi } from "./billing";
Deployments: a preview for every pull request, production on g1t.page3import type { DeploymentsApi } from "./deployments";
Projects: what a workspace builds and runs, first on every page4import type { ProjectsApi } from "./projects";
Events service in Rust, with RFC 3339 times and accurate push events5import type { EventsApi } from "./events";
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace6import type { IdentityAdminApi, IdentityApi } from "./identity";
Integrations: your own model provider, alerts that open issues, tickets agents read7import type { IntegrationsApi } from "./integrations";
Webhooks: every event, to your own addresses, signed and retried8import type { WebhooksApi } from "./webhooks";
Rust repos service with shipping; pull requests kept in the model9import type { ReposApi } from "./repos";
Work service in Rust, with RFC 3339 timestamps10import type { WorkApi } from "./work";
API and MCP server, Rust identity service, registration, site redesign11
12/** A service binding, as far as these clients need it. */
13export type ServiceBinding = {
14 fetch(input: string, init?: RequestInit): Promise<Response>;
15};
16
17/**
18 * Calls a method on a service that speaks the JSON protocol used by the
19 * Rust services: `POST /rpc/<method>` with the arguments as the body.
20 */
21async function rpc<T>(
22 service: ServiceBinding,
23 method: string,
24 args: object,
25): Promise<T> {
26 // The hostname is ignored; a service binding always reaches its service.
27 const response = await service.fetch(`https://service/rpc/${method}`, {
28 method: "POST",
29 headers: { "content-type": "application/json" },
30 body: JSON.stringify(args),
31 });
32 if (!response.ok) {
33 throw new Error(`${method} failed with status ${response.status}`);
34 }
Agents as a team: lifecycle, merge queue, billing and a new shell35 return (await response.json()) as T;
API and MCP server, Rust identity service, registration, site redesign36}
37
38export function identityClient(service: ServiceBinding): IdentityApi {
39 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
40 return {
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look41 register: (username, email, password, inviteCode, client) =>
42 call("register", { username, email, password, invite_code: inviteCode ?? null, client: client ?? null }),
43 signIn: (username, password, client) => call("sign_in", { username, password, client: client ?? null }),
API and MCP server, Rust identity service, registration, site redesign44 signOut: (sessionToken) => call("sign_out", { sessionToken }),
Email verification, password reset, and Git for AI scale positioning45 resendVerification: (user) => call("resend_verification", { user }),
46 verifyEmail: (token) => call("verify_email", { token }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look47 requestPasswordReset: (email, client) => call("request_password_reset", { email, client: client ?? null }),
Email verification, password reset, and Git for AI scale positioning48 resetPassword: (token, password) =>
49 call("reset_password", { token, password }),
Device sign-in replaces registering and minting tokens over the API50 deviceStart: (clientName) => call("device_start", { clientName }),
51 deviceLookup: (userCode) => call("device_lookup", { userCode }),
52 deviceResolve: (userCode, user, approve) =>
53 call("device_resolve", { userCode, user, approve }),
54 deviceClaim: (deviceCode) => call("device_claim", { deviceCode }),
OAuth 2.1 sign-in for MCP clients and other applications55 oauthAuthorize: (user, approval) => call("oauth_authorize", { user, ...approval }),
56 oauthExchange: (code, codeVerifier, clientId, redirectUri) =>
57 call("oauth_exchange", { code, codeVerifier, clientId, redirectUri }),
58 oauthRefresh: (refreshToken, clientId) =>
59 call("oauth_refresh", { refreshToken, clientId }),
60 listOAuthGrants: (user) => call("list_oauth_grants", { user }),
61 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 step62 updateOAuthGrant: (user, id, grant) =>
63 call("update_oauth_grant", { user, id, scopes: grant.scopes }),
Workspaces own repositories64 createWorkspace: (user, slug, name) => call("create_workspace", { user, slug, name }),
65 getWorkspace: (slug) => call("get_workspace", { slug }),
66 listMembers: (slug, viewer) => call("list_members", { slug, viewer }),
67 addMember: (actor, slug, username) => call("add_member", { actor, slug, username }),
68 removeMember: (actor, slug, username) =>
69 call("remove_member", { actor, slug, username }),
Agents as a team: lifecycle, merge queue, billing and a new shell70 updateWorkspace: (actor, slug, details) =>
71 call("update_workspace", { actor, slug, ...details }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains72 renameWorkspace: (actor, slug, newSlug) => call("rename_workspace", { actor, slug, newSlug }),
73 checkWorkspaceRename: (actor, slug, newSlug) =>
74 call("check_workspace_rename", { actor, slug, newSlug }),
75 resolveSlug: (slug) => call("resolve_slug", { slug }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look76 deleteWorkspace: (actor, slug, confirm) => call("delete_workspace", { actor, slug, confirm }),
77 checkWorkspaceDeletion: (actor, slug) => call("check_workspace_deletion", { actor, slug }),
Workspace names and icons, and a component kit for every control78 setWorkspaceAvatar: (actor, slug, image) => call("set_workspace_avatar", { actor, slug, image }),
79 setUserAvatar: (user, image) => call("set_user_avatar", { user, image }),
Agents as a team: lifecycle, merge queue, billing and a new shell80 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 step81 createWorkspaceToken: (actor, slug, name, grant) =>
82 call("create_workspace_token", {
83 actor,
84 slug,
85 name,
86 scopes: grant?.scopes ?? null,
87 ttl_seconds: grant?.ttlSeconds ?? null,
88 }),
Agents as a team: lifecycle, merge queue, billing and a new shell89 removeWorkspaceToken: (actor, slug, id) =>
90 call("remove_workspace_token", { actor, slug, id }),
API and MCP server, Rust identity service, registration, site redesign91 userForSession: (sessionToken) => call("user_for_session", { sessionToken }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look92 registration: () => call("registration", {}),
93 listInvites: (user) => call("list_invites", { user }),
94 createInvite: (user, options = {}) =>
95 call("create_invite", { user, email: options.email ?? null, workspace: options.workspace ?? null }),
96 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 quotas97 checkInvite: (code, client, options = {}) =>
98 call("check_invite", {
99 code,
100 client: client ?? null,
101 viewer: options.viewer ?? null,
102 any_status: options.anyStatus ?? false,
103 }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look104 acceptInvite: (user, code) => call("accept_invite", { user, code }),
105 inviteMember: (actor, slug, email) => call("invite_member", { actor, slug, email }),
106 workspaceInvites: (slug, viewer) => call("workspace_invites", { slug, viewer }),
107 revokeWorkspaceInvite: (actor, slug, id) => call("revoke_workspace_invite", { actor, slug, id }),
108 requestAccess: (email, about, client) => call("request_access", { email, about, client: client ?? null }),
API and MCP server, Rust identity service, registration, site redesign109 userForGitCredentials: (username, secret) =>
110 call("user_for_git_credentials", { username, secret }),
111 userForAccessToken: (token) => call("user_for_access_token", { token }),
112 userForSshKey: (fingerprint) => call("user_for_ssh_key", { fingerprint }),
113 userByUsername: (username) => call("user_by_username", { username }),
What happened across an outcome, as a feed beside its graph114 usernames: (ids) => call("usernames", { ids }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains115 profile: (username) => call("profile", { username }),
116 updateProfile: (actor, fields) => call("update_profile", { actor, ...fields }),
117 profileWorkspaces: (username, viewer, publicIn) =>
118 call("profile_workspaces", { username, viewer, public: publicIn }),
API and MCP server, Rust identity service, registration, site redesign119 listSshKeys: (user) => call("list_ssh_keys", { user }),
120 addSshKey: (user, title, publicKey) =>
121 call("add_ssh_key", { user, title, publicKey }),
122 removeSshKey: (user, id) => call("remove_ssh_key", { user, id }),
123 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 step124 createAccessToken: (user, name, ttlSeconds, grant) =>
125 call("create_access_token", {
126 user,
127 name,
128 ttlSeconds,
129 scopes: grant?.scopes ?? null,
130 listed: grant?.listed ?? false,
131 }),
132 updateAccessToken: (user, id, grant) =>
133 call("update_access_token", { user, id, scopes: grant.scopes }),
Agents as a team: lifecycle, merge queue, billing and a new shell134 createAgentToken: (onBehalfOf, scope, ttlSeconds) =>
135 call("create_agent_token", { onBehalfOf, scope, ttlSeconds }),
API and MCP server, Rust identity service, registration, site redesign136 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 API137 createRunCredential: (input) => call("create_run_credential", input),
138 bindRunCredentials: (tokenHashes, runId) => call("bind_run_credentials", { tokenHashes, runId }),
139 revokeRunCredentials: (target) => call("revoke_run_credentials", target),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look140 // Who has access to a repository; see access.ts.
141 repoAccess: (owner, name, viewer) => call("repo_access", { viewer, path: { namespace: owner, name } }),
142 addCollaborator: (actor, owner, name, invitee, role) =>
143 call("add_collaborator", { actor, path: { namespace: owner, name }, invitee, role }),
144 setCollaboratorRole: (actor, owner, name, username, role) =>
145 call("set_collaborator_role", { actor, path: { namespace: owner, name }, username, role }),
146 removeCollaborator: (actor, owner, name, username) =>
147 call("remove_collaborator", { actor, path: { namespace: owner, name }, username }),
148 collaboratorPermission: (viewer, owner, name, username) =>
149 call("collaborator_permission", { viewer, path: { namespace: owner, name }, username }),
150 myRepoInvitations: (user) => call("my_repo_invitations", { user }),
151 respondRepoInvitation: (user, id, accept) => call("respond_repo_invitation", { user, id, accept }),
152 revokeRepoInvitation: (actor, owner, name, id) =>
153 call("revoke_repo_invitation", { actor, path: { namespace: owner, name }, id }),
154 setBasePermission: (actor, slug, base) => call("set_base_permission", { actor, slug, base_permission: base }),
155 outsideCollaborators: (viewer, slug) => call("outside_collaborators", { viewer, slug }),
API and MCP server, Rust identity service, registration, site redesign156 };
157}
Rust repos service with shipping; pull requests kept in the model158
Agents and memory, checks and conflicts, profiles, slug renames, custom domains159/**
160 * The slug a renamed workspace has now, for a `workspace.renamed` handler:
161 * asked of identity by the workspace's id, so that renames delivered twice
162 * or out of order converge. Falls back to the event's `to`.
163 */
164export async function currentWorkspaceSlug(
165 identity: ServiceBinding,
166 renamed: { workspaceId: string; to: string },
167): Promise<string> {
168 const names = await identityClient(identity).usernames([renamed.workspaceId]);
169 return names[renamed.workspaceId] ?? renamed.to;
170}
171
172/** The slugs whose rows move to `current`: the two a rename names, less `current`. */
173export function staleSlugs(renamed: { from: string; to: string }, current: string): string[] {
174 return [...new Set([renamed.from, renamed.to])].filter((slug) => slug !== current);
175}
176
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look177/**
178 * Where a transferred repository is now, as `namespace/name`, for a
179 * `repo.transferred` handler: asked of repos by id, so transfers delivered
180 * twice or out of order converge. Falls back to the event's destination.
181 */
182export async function currentRepoPath(
183 repos: ServiceBinding,
184 transferred: { repoId: string; name: string; to: string },
185): Promise<string> {
186 const path = await rpc<{ namespace: string; name: string } | null>(repos, "path_by_id", { id: transferred.repoId });
187 return path ? `${path.namespace}/${path.name}` : `${transferred.to}/${transferred.name}`;
188}
189
190/** The paths whose rows move to `current`: the two a transfer names, less `current`. */
191export function stalePaths(transferred: { name: string; from: string; to: string }, current: string): string[] {
192 return [...new Set([transferred.from, transferred.to].map((ns) => `${ns}/${transferred.name}`))].filter(
193 (path) => path !== current,
194 );
195}
196
197/**
198 * A repository's path change, from `repo.transferred` or `repo.renamed`,
199 * read the same way: the two paths (`namespace/name`) the event names, old
200 * then new. Null for any other event.
201 */
202export type RepoMove = { repoId: string; paths: [string, string] };
203
204export function repoMove(event: { type: string; data: unknown }): RepoMove | null {
205 const data = event.data as Record<string, string>;
206 if (event.type === "repo.transferred") {
207 return { repoId: data.repoId!, paths: [`${data.from}/${data.name}`, `${data.to}/${data.name}`] };
208 }
209 if (event.type === "repo.renamed") {
210 return { repoId: data.repoId!, paths: [`${data.namespace}/${data.from}`, `${data.namespace}/${data.to}`] };
211 }
212 return null;
213}
214
215/**
216 * Where a moved repository is now, as `namespace/name`: asked of repos by
217 * id, so moves delivered twice or out of order converge. Falls back to the
218 * event's new path.
219 */
220export async function currentMovedPath(repos: ServiceBinding, move: RepoMove): Promise<string> {
221 const path = await rpc<{ namespace: string; name: string } | null>(repos, "path_by_id", { id: move.repoId });
222 return path ? `${path.namespace}/${path.name}` : move.paths[1];
223}
224
225/** The paths whose rows move to `current`: the two a move names, less `current`. */
226export function staleMovedPaths(move: RepoMove, current: string): string[] {
227 return [...new Set(move.paths)].filter((path) => path !== current);
228}
229
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace230/** Staff-only identity. Only sudo binds to it; see `IdentityAdminApi`. */
231export function identityAdminClient(service: ServiceBinding): IdentityAdminApi {
232 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
233 return {
234 workspaces: (query) => call("admin_workspaces", { query: query ?? null }),
235 workspace: (slug) => call("admin_workspace", { slug }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look236 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 quotas237 waitlistPending: () => call("admin_waitlist_pending", {}),
238 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 look239 invites: (query) => call("admin_invites", { query: query ?? null }),
240 revokeInvite: (id, staff) => call("admin_revoke_invite", { id, staff }),
241 mintInvite: (email, staff) => call("admin_mint_invite", { email, staff }),
242 grantInvites: (target, name, amount, note, staff) =>
243 call("admin_grant_invites", { target, name, amount, note, staff }),
244 inviteTree: (username) => call("admin_invite_tree", { username }),
245 workspaceInvites: (slug) => call("admin_workspace_invites", { slug }),
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace246 };
247}
248
Rust repos service with shipping; pull requests kept in the model249export function reposClient(service: ServiceBinding): ReposApi {
250 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
251 return {
252 get: (path, viewer) => call("get", { path, viewer }),
253 getById: (id, viewer) => call("get_by_id", { id, viewer }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains254 publicNamespaces: (ownerId) => call("public_namespaces", { ownerId }),
Rust repos service with shipping; pull requests kept in the model255 list: (viewer, options = {}) => call("list", { viewer, ...options }),
256 create: (owner, input) => call("create", { owner, ...input }),
Agents as a team: lifecycle, merge queue, billing and a new shell257 update: (actor, path, changes) => call("update", { actor, path, ...changes }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look258 transfer: (actor, path, to) => call("transfer", { actor, path, to }),
259 delete: (actor, path, confirm) => call("delete", { actor, path, confirm }),
260 deleted: (viewer, namespace) => call("deleted", { viewer, namespace }),
261 restore: (actor, path) => call("restore", { actor, path }),
262 purge: (actor, path, confirm) => call("purge", { actor, path, confirm }),
263 rename: (actor, path, name) => call("rename", { actor, path, name }),
264 archive: (actor, path, archived) => call("archive", { actor, path, archived }),
265 setVisibility: (actor, path, isPrivate, confirm) => call("set_visibility", { actor, path, isPrivate, confirm }),
266 setDefaultBranch: (actor, path, branch) => call("set_default_branch", { actor, path, branch }),
267 renameBranch: (actor, path, from, to) => call("rename_branch", { actor, path, from, to }),
268 resolveBranch: (repoId, branch) => call("resolve_branch", { repoId, branch }),
269 statusById: (id) => call("status_by_id", { id }),
270 resolvePath: (path) => call("resolve_path", { path }),
Rust repos service with shipping; pull requests kept in the model271 tree: (path, viewer, ref, treePath) =>
272 call("tree", { path, viewer, ref, treePath }),
273 blob: (path, viewer, ref, filePath) =>
274 call("blob", { path, viewer, ref, filePath }),
275 log: (path, viewer, ref, limit) => call("log", { path, viewer, ref, limit }),
Agents as a team: lifecycle, merge queue, billing and a new shell276 blame: (path, viewer, ref, filePath) => call("blame", { path, viewer, ref, filePath }),
Issues and pull requests replace intents and attempts277 forkForPull: (sourceId, pullId, actor) =>
278 call("fork_for_pull", { sourceId, pullId, actor }),
Rust repos service with shipping; pull requests kept in the model279 gitAccess: (path, viewer, service) =>
280 call("git_access", { path, viewer, service }),
Pull requests from branches281 branches: (path, viewer) => call("branches", { path, viewer }),
282 land: (sourceId, actor, branch) => call("land", { sourceId, actor, branch }),
283 compare: (repoId, viewer, base, head) => call("compare", { repoId, viewer, base, head }),
Rust repos service with shipping; pull requests kept in the model284 };
285}
Work service in Rust, with RFC 3339 timestamps286
287export function workClient(service: ServiceBinding): WorkApi {
288 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
289 return {
Issues and pull requests replace intents and attempts290 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 step291 delegateIssue: (actor, repo, input) => call("delegate_issue", { actor, repo, ...input }),
Issues and pull requests replace intents and attempts292 listIssues: (repo, viewer, filter = {}) => call("list_issues", { repo, viewer, ...filter }),
293 getIssue: (repo, number, viewer) => call("get_issue", { repo, number, viewer }),
294 updateIssue: (actor, repo, number, input) =>
295 call("update_issue", { actor, repo, number, ...input }),
296 closeIssue: (actor, repo, number, reason) =>
297 call("close_issue", { actor, repo, number, reason }),
298 reopenIssue: (actor, repo, number) => call("reopen_issue", { actor, repo, number }),
299 listLabels: (repo, viewer) => call("list_labels", { repo, viewer }),
300 counts: (repo, viewer) => call("counts", { repo, viewer }),
Acceptance checks in sandboxes, line comments and review verdicts301 addComment: (actor, repo, number, comment) =>
302 call("add_comment", { actor, repo, number, ...comment }),
303 startChecks: (pullId) => call("start_checks", { pullId }),
304 reportChecks: (runId, token, report) =>
305 call("report_checks", { runId, token, ...report }),
Agents as a team: lifecycle, merge queue, billing and a new shell306 startReview: (pullId) => call("start_review", { pullId }),
307 failReview: (runId, token, error) => call("report_review", { runId, token, error }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains308 startMergecheck: (pullId) => call("start_mergecheck", { pullId }),
309 failMergecheck: (pullId, token, error) => call("report_mergecheck", { pullId, token, error }),
Agents as a team: lifecycle, merge queue, billing and a new shell310 advance: (pullId) => call("advance", { pullId }),
311 stall: (pullId, reason) => call("stall", { pullId, reason }),
312 managedPulls: (repoId) => call("managed_pulls", { repoId }),
313 queue: (repo, viewer) => call("queue", { repo, viewer }),
314 queueBuild: (repoId) => call("queue_build", { repoId }),
315 failQueue: (entryId, token, error) => call("report_queue", { entryId, token, error }),
316 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 request317 messageAgent: (actor, repo, number, body) => call("message_agent", { actor, repo, number, body }),
Agents as a team: lifecycle, merge queue, billing and a new shell318 catchUpJob: (pullId) => call("catch_up_job", { pullId }),
Agents asked while not at work are woken to answer319 wakeForMessages: (pullId) => call("wake_for_messages", { pullId }),
Agents as a team: lifecycle, merge queue, billing and a new shell320 getSettings: (repo, viewer) => call("get_settings", { repo, viewer }),
321 updateSettings: (actor, repo, settings) =>
322 call("update_settings", { actor, repo, settings }),
Issues and pull requests replace intents and attempts323 openPull: (actor, repo, input) => call("open_pull", { actor, repo, ...input }),
324 listPulls: (repo, viewer, state) => call("list_pulls", { repo, viewer, state }),
325 getPull: (repo, number, viewer) => call("get_pull", { repo, number, viewer }),
Agents as a team: lifecycle, merge queue, billing and a new shell326 updatePull: (actor, repo, number, changes) =>
327 call("update_pull", { actor, repo, number, ...changes }),
Catching up with main takes seconds when the two sides touched different files328 catchUpPull: (actor, repo, number) => call("catch_up_pull", { actor, repo, number }),
Issues and pull requests replace intents and attempts329 readyPull: (actor, repo, number, summary) =>
330 call("ready_pull", { actor, repo, number, summary }),
331 closePull: (actor, repo, number) => call("close_pull", { actor, repo, number }),
Acceptance checks in sandboxes, line comments and review verdicts332 mergePull: (actor, repo, number, options = {}) =>
333 call("merge_pull", { actor, repo, number, ...options }),
Issues and pull requests replace intents and attempts334 listActivePulls: (viewer) => call("list_active_pulls", { viewer }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains335 byAuthor: (username, viewer, filter = {}) => call("by_author", { username, viewer, ...filter }),
Agents as a team: lifecycle, merge queue, billing and a new shell336 startPlan: (actor, repo, brief) => call("start_plan", { actor, repo, brief }),
337 failPlan: (planId, token, error) => call("report_plan", { planId, token, error }),
338 getPlan: (repo, viewer, id) => call("get_plan", { repo, viewer, id }),
339 listPlans: (repo, viewer) => call("list_plans", { repo, viewer }),
340 applyPlan: (actor, repo, id, options = {}) =>
341 call("apply_plan", { actor, repo, id, ...options }),
342 queueIssue: (actor, repo, number, queued) =>
343 call("queue_issue", { actor, repo, number, queued }),
344 readyIssues: (repoId) => call("ready_issues", { repoId }),
345 listAssignedIssues: (viewer) => call("list_assigned_issues", { viewer }),
Issues and pull requests replace intents and attempts346 appendSession: (actor, repo, number, entries) =>
347 call("append_session", { actor, repo, number, entries }),
348 readSession: (repo, number, viewer, afterSeq = 0) =>
349 call("read_session", { repo, number, viewer, afterSeq }),
Work service in Rust, with RFC 3339 timestamps350 };
351}
Events service in Rust, with RFC 3339 times and accurate push events352
Agents as a team: lifecycle, merge queue, billing and a new shell353export function billingClient(service: ServiceBinding): BillingApi {
354 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
355 return {
356 status: () => call("status", {}),
357 account: (workspace, viewer) => call("account", { workspace, viewer }),
358 ledger: (workspace, viewer) => call("ledger", { workspace, viewer }),
The statement is a month at a time, a line per kind of charge359 statement: (workspace, viewer, month = null, group = "day") => call("statement", { workspace, viewer, month, group }),
360 statementEntries: (workspace, viewer, filter) =>
361 call("statement_entries", {
362 workspace,
363 viewer,
364 month: filter.month,
365 kind: filter.kind,
366 day: filter.day ?? null,
367 project: filter.project ?? null,
368 before: filter.before ?? null,
369 }),
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request370 usage: (workspace, viewer, since) => call("usage", { workspace, viewer, since }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look371 checkout: (actor, workspace, amountCents, returnUrl, method = "card") =>
372 call("checkout", { actor, workspace, amountCents, returnUrl, method }),
Agents as a team: lifecycle, merge queue, billing and a new shell373 confirm: (workspace, viewer, session) => call("confirm", { workspace, viewer, session }),
374 canStart: (workspace) => call("can_start", { workspace }),
A free allowance on g1t's models, so anyone can try its agents375 trial: (workspace, exempt) => call("trial", { workspace, exempt }),
Agents as a team: lifecycle, merge queue, billing and a new shell376 startRun: (run) => call("start_run", run),
Paid features: a workspace turns on Deployments with a monthly plan377 features: (workspace, viewer) => call("features", { workspace, viewer }),
378 subscribe: (actor, workspace, feature, returnUrl) =>
379 call("subscribe", { actor, workspace, feature, returnUrl }),
380 confirmSubscription: (workspace, viewer, session) =>
381 call("confirm_subscription", { workspace, viewer, session }),
382 cancelSubscription: (actor, workspace, feature, resume = false) =>
383 call("cancel_subscription", { actor, workspace, feature, resume }),
384 hasFeature: (workspace, feature) => call("has_feature", { workspace, feature }),
385 chargeFeature: (charge) => call("charge_feature", charge),
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace386 billingPortal: (actor, workspace, returnUrl) => call("billing_portal", { actor, workspace, return_url: returnUrl }),
Every sandbox is metered by the second387 recordSandbox: (usage) => call("record_sandbox", usage),
Usage limits: unpaid usage can only go so far388 limit: (workspace, viewer) => call("limit", { workspace, viewer }),
389 checkLimit: (workspace) => call("check_limit", { workspace }),
Prices keep themselves current with what g1t pays390 prices: () => call("prices", {}),
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas391 notePending: (workspace, source, costMicros, detail = null) => call("note_pending", { workspace, source, costMicros, detail }),
392 usageMeters: (workspace, viewer) => call("usage_meters", { workspace, viewer }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look393 setSpendLimit: (actor, workspace, spendLimitMicros, useFullLimit = false, raiseOnce = false) =>
394 call("set_spend_limit", { actor, workspace, spendLimitMicros, use_full_limit: useFullLimit, raise_once: raiseOnce }),
Two limits, real invoices, trust that grows by itself, sales signals395 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 put396 entitlements: (workspace) => call("entitlements", { workspace }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look397 reserve: (reservation) => call("reserve", reservation),
398 settle: (reservationId, actualMicros) => call("settle", { reservationId, actualMicros }),
399 cardCheck: (actor, workspace, returnUrl) => call("card_check", { actor, workspace, returnUrl }),
400 confirmCardCheck: (workspace, viewer, session) => call("confirm_card_check", { workspace, viewer, session }),
401 requestLimit: (actor, workspace, request) => call("request_limit", { actor, workspace, ...request }),
402 limitRequests: (workspace, viewer) => call("limit_requests", { workspace, viewer }),
403 confirmSpike: (actor, workspace, keepGoing) => call("confirm_spike", { actor, workspace, keepGoing }),
404 setCaps: (actor, workspace, caps) => call("set_caps", { actor, workspace, ...caps }),
Agents as a team: lifecycle, merge queue, billing and a new shell405 };
406}
407
Billing accounts, terms and enterprises; g1t is no longer free408export function billingAdminClient(service: ServiceBinding): BillingAdminApi {
409 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
410 return {
411 accounts: (query) => call("admin_accounts", { query: query ?? null }),
412 account: (id) => call("admin_account", { id }),
413 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 put414 setAllowances: (id, allowances, note, by) => call("admin_set_allowances", { id, allowances, note, by }),
Billing accounts, terms and enterprises; g1t is no longer free415 createEnterprise: (name, workspaces, by) => call("admin_create_enterprise", { name, workspaces, by }),
416 attach: (workspace, account, by) => call("admin_attach", { workspace, account, by }),
417 credit: (workspace, amountMicros, note, by) => call("admin_credit", { workspace, amount_micros: amountMicros, note, by }),
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace418 billingLink: (workspace, by) => call("admin_billing_link", { workspace, by }),
Stripe webhooks, enterprise invoices, and sudo for both419 stripe: (setup = false, by) => call("admin_stripe", { setup, by: by ?? null }),
420 enterpriseBilling: (id, email, by) => call("admin_enterprise_billing", { id, email, by }),
421 invoiceEnterprise: (id, by) => call("admin_invoice_enterprise", { id, by }),
422 accountsFor: (workspaces) => call("admin_accounts", { query: null, workspaces }),
Two limits, real invoices, trust that grows by itself, sales signals423 signals: () => call("admin_signals", {}),
424 overview: () => call("admin_overview", {}),
425 sales: (workspace) => call("admin_sales", { workspace }),
426 setSales: (workspace, record, by) =>
427 call("admin_set_sales", {
428 workspace,
429 stage: record.stage,
430 owner: record.owner ?? null,
431 next_step: record.nextStep ?? null,
432 next_at: record.nextAt ?? null,
433 by,
434 }),
435 addNote: (workspace, text, by) => call("admin_add_note", { workspace, text, by }),
436 workspaceInvoices: (workspace) => call("admin_workspace_invoices", { workspace }),
Billing lists every invoice and every staff change; signals carry follow-ups437 allInvoices: (filter = {}) => call("admin_invoices", { status: filter.status ?? null, month: filter.month ?? null }),
438 audit: (filter = {}) =>
439 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 look440 limitRequests: (status = "open") => call("admin_limit_requests", { status }),
441 decideLimitRequest: (id, decision, amountMicros, note, by) =>
442 call("admin_decide_limit_request", { id, decision, amount_micros: amountMicros, note, by }),
443 overages: () => call("admin_overages", {}),
444 goodwill: (workspace, amountMicros, reason, by, day = null) =>
445 call("admin_goodwill", { workspace, amount_micros: amountMicros, reason, by, day }),
446 velocity: () => call("admin_velocity", {}),
447 recordPayment: (workspace, amountMicros, reference, note, by) =>
448 call("admin_record_payment", { workspace, amount_micros: amountMicros, reference, note, by }),
Billing accounts, terms and enterprises; g1t is no longer free449 };
450}
451
Events service in Rust, with RFC 3339 times and accurate push events452export function eventsClient(service: ServiceBinding): EventsApi {
453 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
454 return {
455 publish: (events) => call("publish", { events }),
456 list: (query) => call("list", query),
457 };
458}
Integrations: your own model provider, alerts that open issues, tickets agents read459
460export function integrationsClient(service: ServiceBinding): IntegrationsApi {
461 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
462 return {
463 list: (workspace, viewer) => call("list", { workspace, viewer }),
464 connect: (actor, workspace, input) => call("connect", { actor, workspace, ...input }),
465 update: (actor, workspace, id, input) => call("update", { actor, workspace, id, ...input }),
466 disconnect: (actor, workspace, id) => call("disconnect", { actor, workspace, id }),
467 test: (actor, workspace, id) => call("test", { actor, workspace, id }),
468 deliveries: (workspace, viewer, id) => call("deliveries", { workspace, viewer, id }),
469 resolve: (workspace, viewer, reference) => call("resolve", { workspace, viewer, reference }),
470 references: (workspace, text, limit) => call("references", { workspace, text, limit }),
471 import: (actor, repo, reference, assign) => call("import", { actor, repo, reference, assign }),
472 links: (repo, number) => call("links", { repo, number }),
473 modelProvider: (workspace) => call("model_provider", { workspace }),
474 openModelSession: (run) => call("open_model_session", run),
475 modelUpstream: (token) => call("model_upstream", { token }),
Models per workspace: several providers, routed by kind of work476 routes: (workspace, viewer) => call("routes", { workspace, viewer }),
477 setRoutes: (actor, workspace, routes) => call("set_routes", { actor, workspace, routes }),
Integrations: your own model provider, alerts that open issues, tickets agents read478 };
479}
Webhooks: every event, to your own addresses, signed and retried480
481export function webhooksClient(service: ServiceBinding): WebhooksApi {
482 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
483 return {
484 list: (viewer, owner) => call("list", { viewer, ...owner }),
485 create: (actor, owner, input) => call("create", { actor, ...owner, ...input }),
486 update: (actor, owner, id, input) => call("update", { actor, ...owner, id, ...input }),
487 delete: (actor, owner, id) => call("delete", { actor, ...owner, id }),
488 ping: (actor, owner, id) => call("ping", { actor, ...owner, id }),
489 deliveries: (viewer, owner, id) => call("deliveries", { viewer, ...owner, id }),
490 redeliver: (actor, owner, deliveryId) => call("redeliver", { actor, ...owner, deliveryId }),
491 };
492}
Automations: rules in .g1t/automations that act when something happens493
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs494export function actionsClient(service: ServiceBinding): ActionsApi {
495 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
496 return {
497 workflows: (repo, viewer) => call("workflows", { repo, viewer }),
498 runs: (repo, viewer, filter = {}) => call("runs", { repo, viewer, ...filter }),
499 run: (repo, viewer, id) => call("run", { repo, viewer, id }),
500 logs: (repo, viewer, job, after = 0) => call("logs", { repo, viewer, job, after }),
501 dispatch: (actor, repo, workflow, ref, inputs) => call("dispatch", { actor, repo, workflow, ref, inputs }),
502 cancel: (actor, repo, id) => call("cancel", { actor, repo, id }),
503 rerun: (actor, repo, id, failedOnly = false) => call("rerun", { actor, repo, id, failed_only: failedOnly }),
504 setWorkflowEnabled: (actor, repo, workflow, enabled) =>
505 call("set_workflow_enabled", { actor, repo, workflow, enabled }),
506 settings: (actor, owner, kind) => call("settings", { actor, ...owner, kind }),
Secrets and variables: one list, rows per environment, for workflows and deployments507 setSetting: (actor, owner, kind, name, value, options = {}) =>
508 call("set_setting", { actor, ...owner, kind, name, value, ...options }),
509 deleteSetting: (actor, owner, kind, name, id) => call("delete_setting", { actor, ...owner, kind, name, id }),
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs510 };
511}
512
Deployments: a preview for every pull request, production on g1t.page513
514export function deploymentsClient(service: ServiceBinding): DeploymentsApi {
515 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
516 return {
Projects: what a workspace builds and runs, first on every page517 settings: (project, viewer) => call("settings", { project, viewer }),
518 updateSettings: (actor, project, changes) => call("update_settings", { actor, project, changes }),
519 list: (project, viewer) => call("list", { project, viewer }),
520 get: (project, id, viewer) => call("get", { project, id, viewer }),
521 redeploy: (actor, project, branch) => call("redeploy", { actor, project, branch }),
522 takeDown: (actor, project, branch) => call("take_down", { actor, project, branch }),
Project dependencies: addresses, preview stacks, Affects, and agents who know523 stack: (actor, project, branch) => call("stack", { actor, project, branch }),
Projects: what a workspace builds and runs, first on every page524 overview: (workspace, viewer) => call("overview", { workspace, viewer }),
Deployments: a preview for every pull request, production on g1t.page525 usage: (workspace, viewer) => call("usage", { workspace, viewer }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains526 domains: (project, viewer) => call("domains", { project, viewer }),
527 addDomain: (actor, project, hostname, options = {}) =>
528 call("add_domain", { actor, project, hostname, twin: !!options.twin }),
529 removeDomain: (actor, project, id) => call("remove_domain", { actor, project, id }),
530 refreshDomain: (actor, project, id) => call("refresh_domain", { actor, project, id }),
Deployments: a preview for every pull request, production on g1t.page531 };
532}
Projects: what a workspace builds and runs, first on every page533
534export function projectsClient(service: ServiceBinding): ProjectsApi {
535 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
536 return {
537 list: (workspace, viewer) => call("list", { workspace, viewer }),
538 get: (workspace, slug, viewer) => call("get", { workspace, slug, viewer }),
539 byRepo: (repoId) => call("by_repo", { repoId }),
540 create: (actor, workspace, input) => call("create", { actor, workspace, input }),
541 update: (actor, workspace, slug, changes) => call("update", { actor, workspace, slug, changes }),
Project dependencies: addresses, preview stacks, Affects, and agents who know542 dependencies: (workspace, slug, viewer) => call("dependencies", { workspace, slug, viewer }),
543 addDependency: (actor, workspace, slug, on, as) => call("add_dependency", { actor, workspace, slug, on, as }),
544 removeDependency: (actor, workspace, slug, on) => call("remove_dependency", { actor, workspace, slug, on }),
545 graph: (projectId) => call("graph", { projectId }),
Projects: what a workspace builds and runs, first on every page546 };
547}