g1t/packages/contracts/src/runner.ts
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.
| Hosted agents: sandboxes on Cloudflare Containers started from an intent | 1 | import type { User, Viewer } from "./identity"; |
| 2 | import type { Result } from "./result"; | |
| Issues and pull requests replace intents and attempts | 3 | import type { RepoPath } from "./repos"; |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 4 | import type { Plan, Pull } from "./work"; |
| g1t agents: model menu and optional AI Gateway routing | 5 | |
| Hosted agents: sandboxes on Cloudflare Containers started from an intent | 6 | export type RunHostedInput = { |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 7 | /** Extra guidance given to the agent along with the issue. */ |
| Hosted agents: sandboxes on Cloudflare Containers started from an intent | 8 | instructions?: string; |
| 9 | }; | |
| 10 | ||
| Agents as a team: lifecycle, merge queue, billing and a new shell | 11 | /** |
| 12 | * Sandboxes on g1t: agents that work on an issue, and acceptance checks. | |
| 13 | * | |
| 14 | * Nobody who assigns a g1t agent picks a model. g1t routes each kind of | |
| 15 | * work itself, and says in the session which model ran. | |
| 16 | */ | |
| Models per workspace: several providers, routed by kind of work | 17 | /** |
| 18 | * How a workspace's agents reach a model. The workspace decides: its own | |
| 19 | * provider (`own` names it), or g1t's hosted models paid from its credit. | |
| 20 | */ | |
| 21 | export type ModelAccess = { | |
| 22 | /** The workspace's own model connection, by name, if it has one. */ | |
| 23 | own: string | null; | |
| 24 | /** Whether g1t's hosted models are open to it. */ | |
| 25 | hosted: boolean; | |
| 26 | }; | |
| 27 | ||
| Hosted agents: sandboxes on Cloudflare Containers started from an intent | 28 | export interface RunnerApi { |
| Models per workspace: several providers, routed by kind of work | 29 | /** How `workspace`'s agents would reach a model now. */ |
| 30 | modelAccess(workspace: string): Promise<ModelAccess>; | |
| Hosted agents: sandboxes on Cloudflare Containers started from an intent | 31 | /** |
| g1t's agents only for listed workspaces, whatever the state of billing | 32 | * Whether `viewer` may put g1t's agents to work: in `repo`'s workspace, |
| 33 | * or with none named, in any of theirs. | |
| 34 | */ | |
| 35 | enabled(viewer: Viewer, repo?: RepoPath): Promise<boolean>; | |
| 36 | /** | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 37 | * Assigns the issue to a g1t agent: opens a draft pull request for it, |
| 38 | * made by an agent in a sandbox of its own. Returns as soon as the | |
| 39 | * sandbox is starting; progress shows up in the pull request's session. | |
| 40 | * Scale comes from assigning many issues, each to its own agent. | |
| Hosted agents: sandboxes on Cloudflare Containers started from an intent | 41 | */ |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 42 | run(actor: User, repo: RepoPath, issue: number, input?: RunHostedInput): Promise<Result<Pull>>; |
| Acceptance checks in sandboxes, line comments and review verdicts | 43 | /** |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 44 | * Has an agent read the repository and turn an outcome into a plan: the |
| 45 | * issues that would get there and the order they have to land in. Returns | |
| 46 | * the plan's id as soon as the sandbox is starting; the plan fills in when | |
| 47 | * the agent has written it. Members of the repository's workspace only. | |
| 48 | */ | |
| 49 | plan(actor: User, repo: RepoPath, brief: string): Promise<Result<{ planId: string }>>; | |
| 50 | /** | |
| 51 | * Opens a plan's issues. With `assign`, a g1t agent starts on each that | |
| 52 | * depends on nothing, and on the others as what they depend on merges. | |
| 53 | */ | |
| 54 | applyPlan( | |
| 55 | actor: User, | |
| 56 | repo: RepoPath, | |
| 57 | planId: string, | |
| 58 | options?: { assign?: boolean; keep?: number[] }, | |
| 59 | ): Promise<Result<Plan>>; | |
| 60 | /** | |
| Acceptance checks in sandboxes, line comments and review verdicts | 61 | * Runs the acceptance checks of a pull request again. Whoever opened it, |
| 62 | * or a member of the repository's workspace, may ask. | |
| 63 | */ | |
| 64 | recheck(actor: User, repo: RepoPath, number: number): Promise<Result<boolean>>; | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 65 | /** |
| 66 | * Brings a pull request up to date with the branch it would merge into, | |
| 67 | * in a sandbox. A clean merge is pushed as it is; a conflict is resolved | |
| 68 | * by a g1t agent. Whoever can push to the pull request's source may ask: | |
| 69 | * its author, or for one from a branch, a workspace member. | |
| 70 | */ | |
| 71 | update(actor: User, repo: RepoPath, number: number): Promise<Result<boolean>>; | |
| 72 | /** | |
| 73 | * Has a g1t agent review a pull request: line comments, a summary and a | |
| 74 | * verdict, posted as `g1t-agent`. | |
| 75 | */ | |
| 76 | review(actor: User, repo: RepoPath, number: number): Promise<Result<boolean>>; | |
| Hosted agents: sandboxes on Cloudflare Containers started from an intent | 77 | } |