pr_01m47d15m3e54sn21z27rpy5n9/packages/contracts/src/runner.ts
| 1 | import type { User, Viewer } from "./identity"; |
| 2 | import type { Result } from "./result"; |
| 3 | import type { RepoPath } from "./repos"; |
| 4 | import type { Pull } from "./work"; |
| 5 | |
| 6 | /** A model a g1t agent can run on, as offered to the person starting it. */ |
| 7 | export type AgentModel = { |
| 8 | /** Stable name used in requests, e.g. `balanced`. */ |
| 9 | id: string; |
| 10 | label: string; |
| 11 | description: string; |
| 12 | /** The model behind it, by its public name, e.g. `Claude Sonnet 5.5`. */ |
| 13 | modelName: string; |
| 14 | }; |
| 15 | |
| 16 | export type RunHostedInput = { |
| 17 | /** How many agents to put on the issue, each in its own sandbox. */ |
| 18 | count: number; |
| 19 | /** Extra guidance given to the agents along with the issue. */ |
| 20 | instructions?: string; |
| 21 | /** One of the offered model ids; the first offered when absent. */ |
| 22 | model?: string; |
| 23 | }; |
| 24 | |
| 25 | /** Sandboxes on g1t: agents that work on an issue, and acceptance checks. */ |
| 26 | export interface RunnerApi { |
| 27 | /** The models this viewer may run g1t agents on; empty if they may not. */ |
| 28 | models(viewer: Viewer): Promise<AgentModel[]>; |
| 29 | /** |
| 30 | * Opens `count` draft pull requests for the issue, each made by an agent |
| 31 | * in its own sandbox. Returns as soon as the sandboxes are starting; |
| 32 | * progress shows up in each pull request's session. |
| 33 | */ |
| 34 | run(actor: User, repo: RepoPath, issue: number, input: RunHostedInput): Promise<Result<Pull[]>>; |
| 35 | /** |
| 36 | * Runs the acceptance checks of a pull request again. Whoever opened it, |
| 37 | * or a member of the repository's workspace, may ask. |
| 38 | */ |
| 39 | recheck(actor: User, repo: RepoPath, number: number): Promise<Result<boolean>>; |
| 40 | } |