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