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.
| Agents as a team: lifecycle, merge queue, billing and a new shell | 1 | import type { BillingApi } from "./billing"; |
| Events service in Rust, with RFC 3339 times and accurate push events | 2 | import type { EventsApi } from "./events"; |
| API and MCP server, Rust identity service, registration, site redesign | 3 | import type { IdentityApi } from "./identity"; |
| Rust repos service with shipping; pull requests kept in the model | 4 | import type { ReposApi } from "./repos"; |
| Work service in Rust, with RFC 3339 timestamps | 5 | import type { WorkApi } from "./work"; |
| API and MCP server, Rust identity service, registration, site redesign | 6 | |
| 7 | /** A service binding, as far as these clients need it. */ | |
| 8 | export type ServiceBinding = { | |
| 9 | fetch(input: string, init?: RequestInit): Promise<Response>; | |
| 10 | }; | |
| 11 | ||
| 12 | /** | |
| 13 | * Calls a method on a service that speaks the JSON protocol used by the | |
| 14 | * Rust services: `POST /rpc/<method>` with the arguments as the body. | |
| 15 | */ | |
| 16 | async function rpc<T>( | |
| 17 | service: ServiceBinding, | |
| 18 | method: string, | |
| 19 | args: object, | |
| 20 | ): Promise<T> { | |
| 21 | // The hostname is ignored; a service binding always reaches its service. | |
| 22 | const response = await service.fetch(`https://service/rpc/${method}`, { | |
| 23 | method: "POST", | |
| 24 | headers: { "content-type": "application/json" }, | |
| 25 | body: JSON.stringify(args), | |
| 26 | }); | |
| 27 | if (!response.ok) { | |
| 28 | throw new Error(`${method} failed with status ${response.status}`); | |
| 29 | } | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 30 | return (await response.json()) as T; |
| API and MCP server, Rust identity service, registration, site redesign | 31 | } |
| 32 | ||
| 33 | export function identityClient(service: ServiceBinding): IdentityApi { | |
| 34 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 35 | return { | |
| 36 | register: (username, email, password) => | |
| 37 | call("register", { username, email, password }), | |
| 38 | signIn: (username, password) => call("sign_in", { username, password }), | |
| 39 | signOut: (sessionToken) => call("sign_out", { sessionToken }), | |
| Email verification, password reset, and Git for AI scale positioning | 40 | resendVerification: (user) => call("resend_verification", { user }), |
| 41 | verifyEmail: (token) => call("verify_email", { token }), | |
| 42 | requestPasswordReset: (email) => call("request_password_reset", { email }), | |
| 43 | resetPassword: (token, password) => | |
| 44 | call("reset_password", { token, password }), | |
| Device sign-in replaces registering and minting tokens over the API | 45 | deviceStart: (clientName) => call("device_start", { clientName }), |
| 46 | deviceLookup: (userCode) => call("device_lookup", { userCode }), | |
| 47 | deviceResolve: (userCode, user, approve) => | |
| 48 | call("device_resolve", { userCode, user, approve }), | |
| 49 | deviceClaim: (deviceCode) => call("device_claim", { deviceCode }), | |
| OAuth 2.1 sign-in for MCP clients and other applications | 50 | oauthAuthorize: (user, approval) => call("oauth_authorize", { user, ...approval }), |
| 51 | oauthExchange: (code, codeVerifier, clientId, redirectUri) => | |
| 52 | call("oauth_exchange", { code, codeVerifier, clientId, redirectUri }), | |
| 53 | oauthRefresh: (refreshToken, clientId) => | |
| 54 | call("oauth_refresh", { refreshToken, clientId }), | |
| 55 | listOAuthGrants: (user) => call("list_oauth_grants", { user }), | |
| 56 | revokeOAuthGrant: (user, id) => call("revoke_oauth_grant", { user, id }), | |
| Workspaces own repositories | 57 | createWorkspace: (user, slug, name) => call("create_workspace", { user, slug, name }), |
| 58 | getWorkspace: (slug) => call("get_workspace", { slug }), | |
| 59 | listMembers: (slug, viewer) => call("list_members", { slug, viewer }), | |
| 60 | addMember: (actor, slug, username) => call("add_member", { actor, slug, username }), | |
| 61 | removeMember: (actor, slug, username) => | |
| 62 | call("remove_member", { actor, slug, username }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 63 | updateWorkspace: (actor, slug, details) => |
| 64 | call("update_workspace", { actor, slug, ...details }), | |
| 65 | listWorkspaceTokens: (slug, viewer) => call("list_workspace_tokens", { slug, viewer }), | |
| 66 | createWorkspaceToken: (actor, slug, name) => | |
| 67 | call("create_workspace_token", { actor, slug, name }), | |
| 68 | removeWorkspaceToken: (actor, slug, id) => | |
| 69 | call("remove_workspace_token", { actor, slug, id }), | |
| API and MCP server, Rust identity service, registration, site redesign | 70 | userForSession: (sessionToken) => call("user_for_session", { sessionToken }), |
| 71 | userForGitCredentials: (username, secret) => | |
| 72 | call("user_for_git_credentials", { username, secret }), | |
| 73 | userForAccessToken: (token) => call("user_for_access_token", { token }), | |
| 74 | userForSshKey: (fingerprint) => call("user_for_ssh_key", { fingerprint }), | |
| 75 | userByUsername: (username) => call("user_by_username", { username }), | |
| What happened across an outcome, as a feed beside its graph | 76 | usernames: (ids) => call("usernames", { ids }), |
| API and MCP server, Rust identity service, registration, site redesign | 77 | listSshKeys: (user) => call("list_ssh_keys", { user }), |
| 78 | addSshKey: (user, title, publicKey) => | |
| 79 | call("add_ssh_key", { user, title, publicKey }), | |
| 80 | removeSshKey: (user, id) => call("remove_ssh_key", { user, id }), | |
| 81 | listAccessTokens: (user) => call("list_access_tokens", { user }), | |
| Account dropdown, llms.txt onboarding, hosted agent runner (not yet deployed) | 82 | createAccessToken: (user, name, ttlSeconds) => |
| 83 | call("create_access_token", { user, name, ttlSeconds }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 84 | createAgentToken: (onBehalfOf, scope, ttlSeconds) => |
| 85 | call("create_agent_token", { onBehalfOf, scope, ttlSeconds }), | |
| API and MCP server, Rust identity service, registration, site redesign | 86 | removeAccessToken: (user, id) => call("remove_access_token", { user, id }), |
| 87 | }; | |
| 88 | } | |
| Rust repos service with shipping; pull requests kept in the model | 89 | |
| 90 | export function reposClient(service: ServiceBinding): ReposApi { | |
| 91 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 92 | return { | |
| 93 | get: (path, viewer) => call("get", { path, viewer }), | |
| 94 | getById: (id, viewer) => call("get_by_id", { id, viewer }), | |
| 95 | list: (viewer, options = {}) => call("list", { viewer, ...options }), | |
| 96 | create: (owner, input) => call("create", { owner, ...input }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 97 | update: (actor, path, changes) => call("update", { actor, path, ...changes }), |
| Rust repos service with shipping; pull requests kept in the model | 98 | tree: (path, viewer, ref, treePath) => |
| 99 | call("tree", { path, viewer, ref, treePath }), | |
| 100 | blob: (path, viewer, ref, filePath) => | |
| 101 | call("blob", { path, viewer, ref, filePath }), | |
| 102 | log: (path, viewer, ref, limit) => call("log", { path, viewer, ref, limit }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 103 | blame: (path, viewer, ref, filePath) => call("blame", { path, viewer, ref, filePath }), |
| Issues and pull requests replace intents and attempts | 104 | forkForPull: (sourceId, pullId, actor) => |
| 105 | call("fork_for_pull", { sourceId, pullId, actor }), | |
| Rust repos service with shipping; pull requests kept in the model | 106 | gitAccess: (path, viewer, service) => |
| 107 | call("git_access", { path, viewer, service }), | |
| Pull requests from branches | 108 | branches: (path, viewer) => call("branches", { path, viewer }), |
| 109 | land: (sourceId, actor, branch) => call("land", { sourceId, actor, branch }), | |
| 110 | compare: (repoId, viewer, base, head) => call("compare", { repoId, viewer, base, head }), | |
| Rust repos service with shipping; pull requests kept in the model | 111 | }; |
| 112 | } | |
| Work service in Rust, with RFC 3339 timestamps | 113 | |
| 114 | export function workClient(service: ServiceBinding): WorkApi { | |
| 115 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 116 | return { | |
| Issues and pull requests replace intents and attempts | 117 | openIssue: (actor, repo, input) => call("open_issue", { actor, repo, ...input }), |
| 118 | listIssues: (repo, viewer, filter = {}) => call("list_issues", { repo, viewer, ...filter }), | |
| 119 | getIssue: (repo, number, viewer) => call("get_issue", { repo, number, viewer }), | |
| 120 | updateIssue: (actor, repo, number, input) => | |
| 121 | call("update_issue", { actor, repo, number, ...input }), | |
| 122 | closeIssue: (actor, repo, number, reason) => | |
| 123 | call("close_issue", { actor, repo, number, reason }), | |
| 124 | reopenIssue: (actor, repo, number) => call("reopen_issue", { actor, repo, number }), | |
| 125 | listLabels: (repo, viewer) => call("list_labels", { repo, viewer }), | |
| 126 | counts: (repo, viewer) => call("counts", { repo, viewer }), | |
| Acceptance checks in sandboxes, line comments and review verdicts | 127 | addComment: (actor, repo, number, comment) => |
| 128 | call("add_comment", { actor, repo, number, ...comment }), | |
| 129 | startChecks: (pullId) => call("start_checks", { pullId }), | |
| 130 | reportChecks: (runId, token, report) => | |
| 131 | call("report_checks", { runId, token, ...report }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 132 | startReview: (pullId) => call("start_review", { pullId }), |
| 133 | failReview: (runId, token, error) => call("report_review", { runId, token, error }), | |
| 134 | advance: (pullId) => call("advance", { pullId }), | |
| 135 | stall: (pullId, reason) => call("stall", { pullId, reason }), | |
| 136 | managedPulls: (repoId) => call("managed_pulls", { repoId }), | |
| 137 | queue: (repo, viewer) => call("queue", { repo, viewer }), | |
| 138 | queueBuild: (repoId) => call("queue_build", { repoId }), | |
| 139 | failQueue: (entryId, token, error) => call("report_queue", { entryId, token, error }), | |
| 140 | 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 | 141 | messageAgent: (actor, repo, number, body) => call("message_agent", { actor, repo, number, body }), |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 142 | catchUpJob: (pullId) => call("catch_up_job", { pullId }), |
| 143 | getSettings: (repo, viewer) => call("get_settings", { repo, viewer }), | |
| 144 | updateSettings: (actor, repo, settings) => | |
| 145 | call("update_settings", { actor, repo, settings }), | |
| Issues and pull requests replace intents and attempts | 146 | openPull: (actor, repo, input) => call("open_pull", { actor, repo, ...input }), |
| 147 | listPulls: (repo, viewer, state) => call("list_pulls", { repo, viewer, state }), | |
| 148 | getPull: (repo, number, viewer) => call("get_pull", { repo, number, viewer }), | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 149 | updatePull: (actor, repo, number, changes) => |
| 150 | call("update_pull", { actor, repo, number, ...changes }), | |
| Issues and pull requests replace intents and attempts | 151 | readyPull: (actor, repo, number, summary) => |
| 152 | call("ready_pull", { actor, repo, number, summary }), | |
| 153 | closePull: (actor, repo, number) => call("close_pull", { actor, repo, number }), | |
| Acceptance checks in sandboxes, line comments and review verdicts | 154 | mergePull: (actor, repo, number, options = {}) => |
| 155 | call("merge_pull", { actor, repo, number, ...options }), | |
| Issues and pull requests replace intents and attempts | 156 | listActivePulls: (viewer) => call("list_active_pulls", { viewer }), |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 157 | startPlan: (actor, repo, brief) => call("start_plan", { actor, repo, brief }), |
| 158 | failPlan: (planId, token, error) => call("report_plan", { planId, token, error }), | |
| 159 | getPlan: (repo, viewer, id) => call("get_plan", { repo, viewer, id }), | |
| 160 | listPlans: (repo, viewer) => call("list_plans", { repo, viewer }), | |
| 161 | applyPlan: (actor, repo, id, options = {}) => | |
| 162 | call("apply_plan", { actor, repo, id, ...options }), | |
| 163 | queueIssue: (actor, repo, number, queued) => | |
| 164 | call("queue_issue", { actor, repo, number, queued }), | |
| 165 | readyIssues: (repoId) => call("ready_issues", { repoId }), | |
| 166 | listAssignedIssues: (viewer) => call("list_assigned_issues", { viewer }), | |
| Issues and pull requests replace intents and attempts | 167 | appendSession: (actor, repo, number, entries) => |
| 168 | call("append_session", { actor, repo, number, entries }), | |
| 169 | readSession: (repo, number, viewer, afterSeq = 0) => | |
| 170 | call("read_session", { repo, number, viewer, afterSeq }), | |
| Work service in Rust, with RFC 3339 timestamps | 171 | }; |
| 172 | } | |
| Events service in Rust, with RFC 3339 times and accurate push events | 173 | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 174 | export function billingClient(service: ServiceBinding): BillingApi { |
| 175 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 176 | return { | |
| 177 | status: () => call("status", {}), | |
| 178 | account: (workspace, viewer) => call("account", { workspace, viewer }), | |
| 179 | ledger: (workspace, viewer) => call("ledger", { workspace, viewer }), | |
| Usage, like a hosting provider's: what agents cost, per day, task, repository and pull request | 180 | usage: (workspace, viewer, since) => call("usage", { workspace, viewer, since }), |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 181 | checkout: (actor, workspace, amountCents, returnUrl) => |
| 182 | call("checkout", { actor, workspace, amountCents, returnUrl }), | |
| 183 | confirm: (workspace, viewer, session) => call("confirm", { workspace, viewer, session }), | |
| 184 | canStart: (workspace) => call("can_start", { workspace }), | |
| 185 | startRun: (run) => call("start_run", run), | |
| 186 | }; | |
| 187 | } | |
| 188 | ||
| Events service in Rust, with RFC 3339 times and accurate push events | 189 | export function eventsClient(service: ServiceBinding): EventsApi { |
| 190 | const call = <T>(method: string, args: object) => rpc<T>(service, method, args); | |
| 191 | return { | |
| 192 | publish: (events) => call("publish", { events }), | |
| 193 | list: (query) => call("list", query), | |
| 194 | }; | |
| 195 | } |