522 lines31,378 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 }),
Workspaces own repositories62 createWorkspace: (user, slug, name) => call("create_workspace", { user, slug, name }),
63 getWorkspace: (slug) => call("get_workspace", { slug }),
64 listMembers: (slug, viewer) => call("list_members", { slug, viewer }),
65 addMember: (actor, slug, username) => call("add_member", { actor, slug, username }),
66 removeMember: (actor, slug, username) =>
67 call("remove_member", { actor, slug, username }),
Agents as a team: lifecycle, merge queue, billing and a new shell68 updateWorkspace: (actor, slug, details) =>
69 call("update_workspace", { actor, slug, ...details }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains70 renameWorkspace: (actor, slug, newSlug) => call("rename_workspace", { actor, slug, newSlug }),
71 checkWorkspaceRename: (actor, slug, newSlug) =>
72 call("check_workspace_rename", { actor, slug, newSlug }),
73 resolveSlug: (slug) => call("resolve_slug", { slug }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look74 deleteWorkspace: (actor, slug, confirm) => call("delete_workspace", { actor, slug, confirm }),
75 checkWorkspaceDeletion: (actor, slug) => call("check_workspace_deletion", { actor, slug }),
Workspace names and icons, and a component kit for every control76 setWorkspaceAvatar: (actor, slug, image) => call("set_workspace_avatar", { actor, slug, image }),
77 setUserAvatar: (user, image) => call("set_user_avatar", { user, image }),
Agents as a team: lifecycle, merge queue, billing and a new shell78 listWorkspaceTokens: (slug, viewer) => call("list_workspace_tokens", { slug, viewer }),
79 createWorkspaceToken: (actor, slug, name) =>
80 call("create_workspace_token", { actor, slug, name }),
81 removeWorkspaceToken: (actor, slug, id) =>
82 call("remove_workspace_token", { actor, slug, id }),
API and MCP server, Rust identity service, registration, site redesign83 userForSession: (sessionToken) => call("user_for_session", { sessionToken }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look84 registration: () => call("registration", {}),
85 listInvites: (user) => call("list_invites", { user }),
86 createInvite: (user, options = {}) =>
87 call("create_invite", { user, email: options.email ?? null, workspace: options.workspace ?? null }),
88 revokeInvite: (user, id) => call("revoke_invite", { user, id }),
89 checkInvite: (code, client) => call("check_invite", { code, client: client ?? null }),
90 acceptInvite: (user, code) => call("accept_invite", { user, code }),
91 inviteMember: (actor, slug, email) => call("invite_member", { actor, slug, email }),
92 workspaceInvites: (slug, viewer) => call("workspace_invites", { slug, viewer }),
93 revokeWorkspaceInvite: (actor, slug, id) => call("revoke_workspace_invite", { actor, slug, id }),
94 requestAccess: (email, about, client) => call("request_access", { email, about, client: client ?? null }),
API and MCP server, Rust identity service, registration, site redesign95 userForGitCredentials: (username, secret) =>
96 call("user_for_git_credentials", { username, secret }),
97 userForAccessToken: (token) => call("user_for_access_token", { token }),
98 userForSshKey: (fingerprint) => call("user_for_ssh_key", { fingerprint }),
99 userByUsername: (username) => call("user_by_username", { username }),
What happened across an outcome, as a feed beside its graph100 usernames: (ids) => call("usernames", { ids }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains101 profile: (username) => call("profile", { username }),
102 updateProfile: (actor, fields) => call("update_profile", { actor, ...fields }),
103 profileWorkspaces: (username, viewer, publicIn) =>
104 call("profile_workspaces", { username, viewer, public: publicIn }),
API and MCP server, Rust identity service, registration, site redesign105 listSshKeys: (user) => call("list_ssh_keys", { user }),
106 addSshKey: (user, title, publicKey) =>
107 call("add_ssh_key", { user, title, publicKey }),
108 removeSshKey: (user, id) => call("remove_ssh_key", { user, id }),
109 listAccessTokens: (user) => call("list_access_tokens", { user }),
Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed)110 createAccessToken: (user, name, ttlSeconds) =>
111 call("create_access_token", { user, name, ttlSeconds }),
Agents as a team: lifecycle, merge queue, billing and a new shell112 createAgentToken: (onBehalfOf, scope, ttlSeconds) =>
113 call("create_agent_token", { onBehalfOf, scope, ttlSeconds }),
API and MCP server, Rust identity service, registration, site redesign114 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 API115 createRunCredential: (input) => call("create_run_credential", input),
116 bindRunCredentials: (tokenHashes, runId) => call("bind_run_credentials", { tokenHashes, runId }),
117 revokeRunCredentials: (target) => call("revoke_run_credentials", target),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look118 // Who has access to a repository; see access.ts.
119 repoAccess: (owner, name, viewer) => call("repo_access", { viewer, path: { namespace: owner, name } }),
120 addCollaborator: (actor, owner, name, invitee, role) =>
121 call("add_collaborator", { actor, path: { namespace: owner, name }, invitee, role }),
122 setCollaboratorRole: (actor, owner, name, username, role) =>
123 call("set_collaborator_role", { actor, path: { namespace: owner, name }, username, role }),
124 removeCollaborator: (actor, owner, name, username) =>
125 call("remove_collaborator", { actor, path: { namespace: owner, name }, username }),
126 collaboratorPermission: (viewer, owner, name, username) =>
127 call("collaborator_permission", { viewer, path: { namespace: owner, name }, username }),
128 myRepoInvitations: (user) => call("my_repo_invitations", { user }),
129 respondRepoInvitation: (user, id, accept) => call("respond_repo_invitation", { user, id, accept }),
130 revokeRepoInvitation: (actor, owner, name, id) =>
131 call("revoke_repo_invitation", { actor, path: { namespace: owner, name }, id }),
132 setBasePermission: (actor, slug, base) => call("set_base_permission", { actor, slug, base_permission: base }),
133 outsideCollaborators: (viewer, slug) => call("outside_collaborators", { viewer, slug }),
API and MCP server, Rust identity service, registration, site redesign134 };
135}
Rust repos service with shipping; pull requests kept in the model136
Agents and memory, checks and conflicts, profiles, slug renames, custom domains137/**
138 * The slug a renamed workspace has now, for a `workspace.renamed` handler:
139 * asked of identity by the workspace's id, so that renames delivered twice
140 * or out of order converge. Falls back to the event's `to`.
141 */
142export async function currentWorkspaceSlug(
143 identity: ServiceBinding,
144 renamed: { workspaceId: string; to: string },
145): Promise<string> {
146 const names = await identityClient(identity).usernames([renamed.workspaceId]);
147 return names[renamed.workspaceId] ?? renamed.to;
148}
149
150/** The slugs whose rows move to `current`: the two a rename names, less `current`. */
151export function staleSlugs(renamed: { from: string; to: string }, current: string): string[] {
152 return [...new Set([renamed.from, renamed.to])].filter((slug) => slug !== current);
153}
154
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look155/**
156 * Where a transferred repository is now, as `namespace/name`, for a
157 * `repo.transferred` handler: asked of repos by id, so transfers delivered
158 * twice or out of order converge. Falls back to the event's destination.
159 */
160export async function currentRepoPath(
161 repos: ServiceBinding,
162 transferred: { repoId: string; name: string; to: string },
163): Promise<string> {
164 const path = await rpc<{ namespace: string; name: string } | null>(repos, "path_by_id", { id: transferred.repoId });
165 return path ? `${path.namespace}/${path.name}` : `${transferred.to}/${transferred.name}`;
166}
167
168/** The paths whose rows move to `current`: the two a transfer names, less `current`. */
169export function stalePaths(transferred: { name: string; from: string; to: string }, current: string): string[] {
170 return [...new Set([transferred.from, transferred.to].map((ns) => `${ns}/${transferred.name}`))].filter(
171 (path) => path !== current,
172 );
173}
174
175/**
176 * A repository's path change, from `repo.transferred` or `repo.renamed`,
177 * read the same way: the two paths (`namespace/name`) the event names, old
178 * then new. Null for any other event.
179 */
180export type RepoMove = { repoId: string; paths: [string, string] };
181
182export function repoMove(event: { type: string; data: unknown }): RepoMove | null {
183 const data = event.data as Record<string, string>;
184 if (event.type === "repo.transferred") {
185 return { repoId: data.repoId!, paths: [`${data.from}/${data.name}`, `${data.to}/${data.name}`] };
186 }
187 if (event.type === "repo.renamed") {
188 return { repoId: data.repoId!, paths: [`${data.namespace}/${data.from}`, `${data.namespace}/${data.to}`] };
189 }
190 return null;
191}
192
193/**
194 * Where a moved repository is now, as `namespace/name`: asked of repos by
195 * id, so moves delivered twice or out of order converge. Falls back to the
196 * event's new path.
197 */
198export async function currentMovedPath(repos: ServiceBinding, move: RepoMove): Promise<string> {
199 const path = await rpc<{ namespace: string; name: string } | null>(repos, "path_by_id", { id: move.repoId });
200 return path ? `${path.namespace}/${path.name}` : move.paths[1];
201}
202
203/** The paths whose rows move to `current`: the two a move names, less `current`. */
204export function staleMovedPaths(move: RepoMove, current: string): string[] {
205 return [...new Set(move.paths)].filter((path) => path !== current);
206}
207
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace208/** Staff-only identity. Only sudo binds to it; see `IdentityAdminApi`. */
209export function identityAdminClient(service: ServiceBinding): IdentityAdminApi {
210 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
211 return {
212 workspaces: (query) => call("admin_workspaces", { query: query ?? null }),
213 workspace: (slug) => call("admin_workspace", { slug }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look214 waitlist: (query, status) => call("admin_waitlist", { query: query ?? null, status: status ?? null }),
215 decideWaitlist: (id, approve, staff) => call("admin_decide_waitlist", { id, approve, staff }),
216 invites: (query) => call("admin_invites", { query: query ?? null }),
217 revokeInvite: (id, staff) => call("admin_revoke_invite", { id, staff }),
218 mintInvite: (email, staff) => call("admin_mint_invite", { email, staff }),
219 grantInvites: (target, name, amount, note, staff) =>
220 call("admin_grant_invites", { target, name, amount, note, staff }),
221 inviteTree: (username) => call("admin_invite_tree", { username }),
222 workspaceInvites: (slug) => call("admin_workspace_invites", { slug }),
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace223 };
224}
225
Rust repos service with shipping; pull requests kept in the model226export function reposClient(service: ServiceBinding): ReposApi {
227 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
228 return {
229 get: (path, viewer) => call("get", { path, viewer }),
230 getById: (id, viewer) => call("get_by_id", { id, viewer }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains231 publicNamespaces: (ownerId) => call("public_namespaces", { ownerId }),
Rust repos service with shipping; pull requests kept in the model232 list: (viewer, options = {}) => call("list", { viewer, ...options }),
233 create: (owner, input) => call("create", { owner, ...input }),
Agents as a team: lifecycle, merge queue, billing and a new shell234 update: (actor, path, changes) => call("update", { actor, path, ...changes }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look235 transfer: (actor, path, to) => call("transfer", { actor, path, to }),
236 delete: (actor, path, confirm) => call("delete", { actor, path, confirm }),
237 deleted: (viewer, namespace) => call("deleted", { viewer, namespace }),
238 restore: (actor, path) => call("restore", { actor, path }),
239 purge: (actor, path, confirm) => call("purge", { actor, path, confirm }),
240 rename: (actor, path, name) => call("rename", { actor, path, name }),
241 archive: (actor, path, archived) => call("archive", { actor, path, archived }),
242 setVisibility: (actor, path, isPrivate, confirm) => call("set_visibility", { actor, path, isPrivate, confirm }),
243 setDefaultBranch: (actor, path, branch) => call("set_default_branch", { actor, path, branch }),
244 renameBranch: (actor, path, from, to) => call("rename_branch", { actor, path, from, to }),
245 resolveBranch: (repoId, branch) => call("resolve_branch", { repoId, branch }),
246 statusById: (id) => call("status_by_id", { id }),
247 resolvePath: (path) => call("resolve_path", { path }),
Rust repos service with shipping; pull requests kept in the model248 tree: (path, viewer, ref, treePath) =>
249 call("tree", { path, viewer, ref, treePath }),
250 blob: (path, viewer, ref, filePath) =>
251 call("blob", { path, viewer, ref, filePath }),
252 log: (path, viewer, ref, limit) => call("log", { path, viewer, ref, limit }),
Agents as a team: lifecycle, merge queue, billing and a new shell253 blame: (path, viewer, ref, filePath) => call("blame", { path, viewer, ref, filePath }),
Issues and pull requests replace intents and attempts254 forkForPull: (sourceId, pullId, actor) =>
255 call("fork_for_pull", { sourceId, pullId, actor }),
Rust repos service with shipping; pull requests kept in the model256 gitAccess: (path, viewer, service) =>
257 call("git_access", { path, viewer, service }),
Pull requests from branches258 branches: (path, viewer) => call("branches", { path, viewer }),
259 land: (sourceId, actor, branch) => call("land", { sourceId, actor, branch }),
260 compare: (repoId, viewer, base, head) => call("compare", { repoId, viewer, base, head }),
Rust repos service with shipping; pull requests kept in the model261 };
262}
Work service in Rust, with RFC 3339 timestamps263
264export function workClient(service: ServiceBinding): WorkApi {
265 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
266 return {
Issues and pull requests replace intents and attempts267 openIssue: (actor, repo, input) => call("open_issue", { actor, repo, ...input }),
268 listIssues: (repo, viewer, filter = {}) => call("list_issues", { repo, viewer, ...filter }),
269 getIssue: (repo, number, viewer) => call("get_issue", { repo, number, viewer }),
270 updateIssue: (actor, repo, number, input) =>
271 call("update_issue", { actor, repo, number, ...input }),
272 closeIssue: (actor, repo, number, reason) =>
273 call("close_issue", { actor, repo, number, reason }),
274 reopenIssue: (actor, repo, number) => call("reopen_issue", { actor, repo, number }),
275 listLabels: (repo, viewer) => call("list_labels", { repo, viewer }),
276 counts: (repo, viewer) => call("counts", { repo, viewer }),
Acceptance checks in sandboxes, line comments and review verdicts277 addComment: (actor, repo, number, comment) =>
278 call("add_comment", { actor, repo, number, ...comment }),
279 startChecks: (pullId) => call("start_checks", { pullId }),
280 reportChecks: (runId, token, report) =>
281 call("report_checks", { runId, token, ...report }),
Agents as a team: lifecycle, merge queue, billing and a new shell282 startReview: (pullId) => call("start_review", { pullId }),
283 failReview: (runId, token, error) => call("report_review", { runId, token, error }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains284 startMergecheck: (pullId) => call("start_mergecheck", { pullId }),
285 failMergecheck: (pullId, token, error) => call("report_mergecheck", { pullId, token, error }),
Agents as a team: lifecycle, merge queue, billing and a new shell286 advance: (pullId) => call("advance", { pullId }),
287 stall: (pullId, reason) => call("stall", { pullId, reason }),
288 managedPulls: (repoId) => call("managed_pulls", { repoId }),
289 queue: (repo, viewer) => call("queue", { repo, viewer }),
290 queueBuild: (repoId) => call("queue_build", { repoId }),
291 failQueue: (entryId, token, error) => call("report_queue", { entryId, token, error }),
292 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 request293 messageAgent: (actor, repo, number, body) => call("message_agent", { actor, repo, number, body }),
Agents as a team: lifecycle, merge queue, billing and a new shell294 catchUpJob: (pullId) => call("catch_up_job", { pullId }),
Agents asked while not at work are woken to answer295 wakeForMessages: (pullId) => call("wake_for_messages", { pullId }),
Agents as a team: lifecycle, merge queue, billing and a new shell296 getSettings: (repo, viewer) => call("get_settings", { repo, viewer }),
297 updateSettings: (actor, repo, settings) =>
298 call("update_settings", { actor, repo, settings }),
Issues and pull requests replace intents and attempts299 openPull: (actor, repo, input) => call("open_pull", { actor, repo, ...input }),
300 listPulls: (repo, viewer, state) => call("list_pulls", { repo, viewer, state }),
301 getPull: (repo, number, viewer) => call("get_pull", { repo, number, viewer }),
Agents as a team: lifecycle, merge queue, billing and a new shell302 updatePull: (actor, repo, number, changes) =>
303 call("update_pull", { actor, repo, number, ...changes }),
Catching up with main takes seconds when the two sides touched different files304 catchUpPull: (actor, repo, number) => call("catch_up_pull", { actor, repo, number }),
Issues and pull requests replace intents and attempts305 readyPull: (actor, repo, number, summary) =>
306 call("ready_pull", { actor, repo, number, summary }),
307 closePull: (actor, repo, number) => call("close_pull", { actor, repo, number }),
Acceptance checks in sandboxes, line comments and review verdicts308 mergePull: (actor, repo, number, options = {}) =>
309 call("merge_pull", { actor, repo, number, ...options }),
Issues and pull requests replace intents and attempts310 listActivePulls: (viewer) => call("list_active_pulls", { viewer }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains311 byAuthor: (username, viewer, filter = {}) => call("by_author", { username, viewer, ...filter }),
Agents as a team: lifecycle, merge queue, billing and a new shell312 startPlan: (actor, repo, brief) => call("start_plan", { actor, repo, brief }),
313 failPlan: (planId, token, error) => call("report_plan", { planId, token, error }),
314 getPlan: (repo, viewer, id) => call("get_plan", { repo, viewer, id }),
315 listPlans: (repo, viewer) => call("list_plans", { repo, viewer }),
316 applyPlan: (actor, repo, id, options = {}) =>
317 call("apply_plan", { actor, repo, id, ...options }),
318 queueIssue: (actor, repo, number, queued) =>
319 call("queue_issue", { actor, repo, number, queued }),
320 readyIssues: (repoId) => call("ready_issues", { repoId }),
321 listAssignedIssues: (viewer) => call("list_assigned_issues", { viewer }),
Issues and pull requests replace intents and attempts322 appendSession: (actor, repo, number, entries) =>
323 call("append_session", { actor, repo, number, entries }),
324 readSession: (repo, number, viewer, afterSeq = 0) =>
325 call("read_session", { repo, number, viewer, afterSeq }),
Work service in Rust, with RFC 3339 timestamps326 };
327}
Events service in Rust, with RFC 3339 times and accurate push events328
Agents as a team: lifecycle, merge queue, billing and a new shell329export function billingClient(service: ServiceBinding): BillingApi {
330 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
331 return {
332 status: () => call("status", {}),
333 account: (workspace, viewer) => call("account", { workspace, viewer }),
334 ledger: (workspace, viewer) => call("ledger", { workspace, viewer }),
The statement is a month at a time, a line per kind of charge335 statement: (workspace, viewer, month = null, group = "day") => call("statement", { workspace, viewer, month, group }),
336 statementEntries: (workspace, viewer, filter) =>
337 call("statement_entries", {
338 workspace,
339 viewer,
340 month: filter.month,
341 kind: filter.kind,
342 day: filter.day ?? null,
343 project: filter.project ?? null,
344 before: filter.before ?? null,
345 }),
Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request346 usage: (workspace, viewer, since) => call("usage", { workspace, viewer, since }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look347 checkout: (actor, workspace, amountCents, returnUrl, method = "card") =>
348 call("checkout", { actor, workspace, amountCents, returnUrl, method }),
Agents as a team: lifecycle, merge queue, billing and a new shell349 confirm: (workspace, viewer, session) => call("confirm", { workspace, viewer, session }),
350 canStart: (workspace) => call("can_start", { workspace }),
A free allowance on g1t's models, so anyone can try its agents351 trial: (workspace, exempt) => call("trial", { workspace, exempt }),
Agents as a team: lifecycle, merge queue, billing and a new shell352 startRun: (run) => call("start_run", run),
Paid features: a workspace turns on Deployments with a monthly plan353 features: (workspace, viewer) => call("features", { workspace, viewer }),
354 subscribe: (actor, workspace, feature, returnUrl) =>
355 call("subscribe", { actor, workspace, feature, returnUrl }),
356 confirmSubscription: (workspace, viewer, session) =>
357 call("confirm_subscription", { workspace, viewer, session }),
358 cancelSubscription: (actor, workspace, feature, resume = false) =>
359 call("cancel_subscription", { actor, workspace, feature, resume }),
360 hasFeature: (workspace, feature) => call("has_feature", { workspace, feature }),
361 chargeFeature: (charge) => call("charge_feature", charge),
Billing on Stripe's pages, month-end charges, warnings; sudo by workspace362 billingPortal: (actor, workspace, returnUrl) => call("billing_portal", { actor, workspace, return_url: returnUrl }),
Every sandbox is metered by the second363 recordSandbox: (usage) => call("record_sandbox", usage),
Usage limits: unpaid usage can only go so far364 limit: (workspace, viewer) => call("limit", { workspace, viewer }),
365 checkLimit: (workspace) => call("check_limit", { workspace }),
Prices keep themselves current with what g1t pays366 prices: () => call("prices", {}),
367 notePending: (workspace, source, costMicros) => call("note_pending", { workspace, source, costMicros }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look368 setSpendLimit: (actor, workspace, spendLimitMicros, useFullLimit = false, raiseOnce = false) =>
369 call("set_spend_limit", { actor, workspace, spendLimitMicros, use_full_limit: useFullLimit, raise_once: raiseOnce }),
Two limits, real invoices, trust that grows by itself, sales signals370 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 put371 entitlements: (workspace) => call("entitlements", { workspace }),
Invite-only launch: sign in with GitHub, repository access and lifecycle, many emails, a new look372 reserve: (reservation) => call("reserve", reservation),
373 settle: (reservationId, actualMicros) => call("settle", { reservationId, actualMicros }),
374 cardCheck: (actor, workspace, returnUrl) => call("card_check", { actor, workspace, returnUrl }),
375 confirmCardCheck: (workspace, viewer, session) => call("confirm_card_check", { workspace, viewer, session }),
376 requestLimit: (actor, workspace, request) => call("request_limit", { actor, workspace, ...request }),
377 limitRequests: (workspace, viewer) => call("limit_requests", { workspace, viewer }),
378 confirmSpike: (actor, workspace, keepGoing) => call("confirm_spike", { actor, workspace, keepGoing }),
379 setCaps: (actor, workspace, caps) => call("set_caps", { actor, workspace, ...caps }),
Agents as a team: lifecycle, merge queue, billing and a new shell380 };
381}
382
Billing accounts, terms and enterprises; g1t is no longer free383export function billingAdminClient(service: ServiceBinding): BillingAdminApi {
384 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
385 return {
386 accounts: (query) => call("admin_accounts", { query: query ?? null }),
387 account: (id) => call("admin_account", { id }),
388 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 put389 setAllowances: (id, allowances, note, by) => call("admin_set_allowances", { id, allowances, note, by }),
Billing accounts, terms and enterprises; g1t is no longer free390 createEnterprise: (name, workspaces, by) => call("admin_create_enterprise", { name, workspaces, by }),
391 attach: (workspace, account, by) => call("admin_attach", { workspace, account, by }),
392 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 workspace393 billingLink: (workspace, by) => call("admin_billing_link", { workspace, by }),
Stripe webhooks, enterprise invoices, and sudo for both394 stripe: (setup = false, by) => call("admin_stripe", { setup, by: by ?? null }),
395 enterpriseBilling: (id, email, by) => call("admin_enterprise_billing", { id, email, by }),
396 invoiceEnterprise: (id, by) => call("admin_invoice_enterprise", { id, by }),
397 accountsFor: (workspaces) => call("admin_accounts", { query: null, workspaces }),
Two limits, real invoices, trust that grows by itself, sales signals398 signals: () => call("admin_signals", {}),
399 overview: () => call("admin_overview", {}),
400 sales: (workspace) => call("admin_sales", { workspace }),
401 setSales: (workspace, record, by) =>
402 call("admin_set_sales", {
403 workspace,
404 stage: record.stage,
405 owner: record.owner ?? null,
406 next_step: record.nextStep ?? null,
407 next_at: record.nextAt ?? null,
408 by,
409 }),
410 addNote: (workspace, text, by) => call("admin_add_note", { workspace, text, by }),
411 workspaceInvoices: (workspace) => call("admin_workspace_invoices", { workspace }),
Billing lists every invoice and every staff change; signals carry follow-ups412 allInvoices: (filter = {}) => call("admin_invoices", { status: filter.status ?? null, month: filter.month ?? null }),
413 audit: (filter = {}) =>
414 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 look415 limitRequests: (status = "open") => call("admin_limit_requests", { status }),
416 decideLimitRequest: (id, decision, amountMicros, note, by) =>
417 call("admin_decide_limit_request", { id, decision, amount_micros: amountMicros, note, by }),
418 overages: () => call("admin_overages", {}),
419 goodwill: (workspace, amountMicros, reason, by, day = null) =>
420 call("admin_goodwill", { workspace, amount_micros: amountMicros, reason, by, day }),
421 velocity: () => call("admin_velocity", {}),
422 recordPayment: (workspace, amountMicros, reference, note, by) =>
423 call("admin_record_payment", { workspace, amount_micros: amountMicros, reference, note, by }),
Billing accounts, terms and enterprises; g1t is no longer free424 };
425}
426
Events service in Rust, with RFC 3339 times and accurate push events427export function eventsClient(service: ServiceBinding): EventsApi {
428 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
429 return {
430 publish: (events) => call("publish", { events }),
431 list: (query) => call("list", query),
432 };
433}
Integrations: your own model provider, alerts that open issues, tickets agents read434
435export function integrationsClient(service: ServiceBinding): IntegrationsApi {
436 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
437 return {
438 list: (workspace, viewer) => call("list", { workspace, viewer }),
439 connect: (actor, workspace, input) => call("connect", { actor, workspace, ...input }),
440 update: (actor, workspace, id, input) => call("update", { actor, workspace, id, ...input }),
441 disconnect: (actor, workspace, id) => call("disconnect", { actor, workspace, id }),
442 test: (actor, workspace, id) => call("test", { actor, workspace, id }),
443 deliveries: (workspace, viewer, id) => call("deliveries", { workspace, viewer, id }),
444 resolve: (workspace, viewer, reference) => call("resolve", { workspace, viewer, reference }),
445 references: (workspace, text, limit) => call("references", { workspace, text, limit }),
446 import: (actor, repo, reference, assign) => call("import", { actor, repo, reference, assign }),
447 links: (repo, number) => call("links", { repo, number }),
448 modelProvider: (workspace) => call("model_provider", { workspace }),
449 openModelSession: (run) => call("open_model_session", run),
450 modelUpstream: (token) => call("model_upstream", { token }),
Models per workspace: several providers, routed by kind of work451 routes: (workspace, viewer) => call("routes", { workspace, viewer }),
452 setRoutes: (actor, workspace, routes) => call("set_routes", { actor, workspace, routes }),
Integrations: your own model provider, alerts that open issues, tickets agents read453 };
454}
Webhooks: every event, to your own addresses, signed and retried455
456export function webhooksClient(service: ServiceBinding): WebhooksApi {
457 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
458 return {
459 list: (viewer, owner) => call("list", { viewer, ...owner }),
460 create: (actor, owner, input) => call("create", { actor, ...owner, ...input }),
461 update: (actor, owner, id, input) => call("update", { actor, ...owner, id, ...input }),
462 delete: (actor, owner, id) => call("delete", { actor, ...owner, id }),
463 ping: (actor, owner, id) => call("ping", { actor, ...owner, id }),
464 deliveries: (viewer, owner, id) => call("deliveries", { viewer, ...owner, id }),
465 redeliver: (actor, owner, deliveryId) => call("redeliver", { actor, ...owner, deliveryId }),
466 };
467}
Automations: rules in .g1t/automations that act when something happens468
GitHub Actions on g1t, part three: .g1t/workflows, the pages, the docs469export function actionsClient(service: ServiceBinding): ActionsApi {
470 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
471 return {
472 workflows: (repo, viewer) => call("workflows", { repo, viewer }),
473 runs: (repo, viewer, filter = {}) => call("runs", { repo, viewer, ...filter }),
474 run: (repo, viewer, id) => call("run", { repo, viewer, id }),
475 logs: (repo, viewer, job, after = 0) => call("logs", { repo, viewer, job, after }),
476 dispatch: (actor, repo, workflow, ref, inputs) => call("dispatch", { actor, repo, workflow, ref, inputs }),
477 cancel: (actor, repo, id) => call("cancel", { actor, repo, id }),
478 rerun: (actor, repo, id, failedOnly = false) => call("rerun", { actor, repo, id, failed_only: failedOnly }),
479 setWorkflowEnabled: (actor, repo, workflow, enabled) =>
480 call("set_workflow_enabled", { actor, repo, workflow, enabled }),
481 settings: (actor, owner, kind) => call("settings", { actor, ...owner, kind }),
Secrets and variables: one list, rows per environment, for workflows and deployments482 setSetting: (actor, owner, kind, name, value, options = {}) =>
483 call("set_setting", { actor, ...owner, kind, name, value, ...options }),
484 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 docs485 };
486}
487
Deployments: a preview for every pull request, production on g1t.page488
489export function deploymentsClient(service: ServiceBinding): DeploymentsApi {
490 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
491 return {
Projects: what a workspace builds and runs, first on every page492 settings: (project, viewer) => call("settings", { project, viewer }),
493 updateSettings: (actor, project, changes) => call("update_settings", { actor, project, changes }),
494 list: (project, viewer) => call("list", { project, viewer }),
495 get: (project, id, viewer) => call("get", { project, id, viewer }),
496 redeploy: (actor, project, branch) => call("redeploy", { actor, project, branch }),
497 takeDown: (actor, project, branch) => call("take_down", { actor, project, branch }),
Project dependencies: addresses, preview stacks, Affects, and agents who know498 stack: (actor, project, branch) => call("stack", { actor, project, branch }),
Projects: what a workspace builds and runs, first on every page499 overview: (workspace, viewer) => call("overview", { workspace, viewer }),
Deployments: a preview for every pull request, production on g1t.page500 usage: (workspace, viewer) => call("usage", { workspace, viewer }),
Agents and memory, checks and conflicts, profiles, slug renames, custom domains501 domains: (project, viewer) => call("domains", { project, viewer }),
502 addDomain: (actor, project, hostname, options = {}) =>
503 call("add_domain", { actor, project, hostname, twin: !!options.twin }),
504 removeDomain: (actor, project, id) => call("remove_domain", { actor, project, id }),
505 refreshDomain: (actor, project, id) => call("refresh_domain", { actor, project, id }),
Deployments: a preview for every pull request, production on g1t.page506 };
507}
Projects: what a workspace builds and runs, first on every page508
509export function projectsClient(service: ServiceBinding): ProjectsApi {
510 const call = <T>(method: string, args: object) => rpc<T>(service, method, args);
511 return {
512 list: (workspace, viewer) => call("list", { workspace, viewer }),
513 get: (workspace, slug, viewer) => call("get", { workspace, slug, viewer }),
514 byRepo: (repoId) => call("by_repo", { repoId }),
515 create: (actor, workspace, input) => call("create", { actor, workspace, input }),
516 update: (actor, workspace, slug, changes) => call("update", { actor, workspace, slug, changes }),
Project dependencies: addresses, preview stacks, Affects, and agents who know517 dependencies: (workspace, slug, viewer) => call("dependencies", { workspace, slug, viewer }),
518 addDependency: (actor, workspace, slug, on, as) => call("add_dependency", { actor, workspace, slug, on, as }),
519 removeDependency: (actor, workspace, slug, on) => call("remove_dependency", { actor, workspace, slug, on }),
520 graph: (projectId) => call("graph", { projectId }),
Projects: what a workspace builds and runs, first on every page521 };
522}