g1t/packages/contracts/src/runner.ts

35 lines1,317 bytesCodeBlame
1import type { User, Viewer } from "./identity";
2import type { Result } from "./result";
3import type { RepoPath } from "./repos";
4import type { Pull } from "./work";
5
6/** A model a g1t agent can run on, as offered to the person starting it. */
7export 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
16export 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/** Hosted agents: sandboxes on g1t that work on an issue. */
26export 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}