pr_01m47d24b0e6n91zwymwxg0vpx/packages/contracts/src/runner.ts

61 lines2,575 bytesCodeBlame

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 intent1import type { User, Viewer } from "./identity";
2import type { Result } from "./result";
Issues and pull requests replace intents and attempts3import type { RepoPath } from "./repos";
Agents as a team: lifecycle, merge queue, billing and a new shell4import type { Plan, Pull } from "./work";
g1t agents: model menu and optional AI Gateway routing5
Hosted agents: sandboxes on Cloudflare Containers started from an intent6export type RunHostedInput = {
Agents as a team: lifecycle, merge queue, billing and a new shell7 /** Extra guidance given to the agent along with the issue. */
Hosted agents: sandboxes on Cloudflare Containers started from an intent8 instructions?: string;
9};
10
Agents as a team: lifecycle, merge queue, billing and a new shell11/**
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 */
Hosted agents: sandboxes on Cloudflare Containers started from an intent17export interface RunnerApi {
Agents as a team: lifecycle, merge queue, billing and a new shell18 /** Whether this viewer may put g1t agents to work. */
19 enabled(viewer: Viewer): Promise<boolean>;
Hosted agents: sandboxes on Cloudflare Containers started from an intent20 /**
Agents as a team: lifecycle, merge queue, billing and a new shell21 * Assigns the issue to a g1t agent: opens a draft pull request for it,
22 * made by an agent in a sandbox of its own. Returns as soon as the
23 * sandbox is starting; progress shows up in the pull request's session.
24 * Scale comes from assigning many issues, each to its own agent.
Hosted agents: sandboxes on Cloudflare Containers started from an intent25 */
Agents as a team: lifecycle, merge queue, billing and a new shell26 run(actor: User, repo: RepoPath, issue: number, input?: RunHostedInput): Promise<Result<Pull>>;
Acceptance checks in sandboxes, line comments and review verdicts27 /**
Agents as a team: lifecycle, merge queue, billing and a new shell28 * Has an agent read the repository and turn an outcome into a plan: the
29 * issues that would get there and the order they have to land in. Returns
30 * the plan's id as soon as the sandbox is starting; the plan fills in when
31 * the agent has written it. Members of the repository's workspace only.
32 */
33 plan(actor: User, repo: RepoPath, brief: string): Promise<Result<{ planId: string }>>;
34 /**
35 * Opens a plan's issues. With `assign`, a g1t agent starts on each that
36 * depends on nothing, and on the others as what they depend on merges.
37 */
38 applyPlan(
39 actor: User,
40 repo: RepoPath,
41 planId: string,
42 options?: { assign?: boolean; keep?: number[] },
43 ): Promise<Result<Plan>>;
44 /**
Acceptance checks in sandboxes, line comments and review verdicts45 * Runs the acceptance checks of a pull request again. Whoever opened it,
46 * or a member of the repository's workspace, may ask.
47 */
48 recheck(actor: User, repo: RepoPath, number: number): Promise<Result<boolean>>;
Agents as a team: lifecycle, merge queue, billing and a new shell49 /**
50 * Brings a pull request up to date with the branch it would merge into,
51 * in a sandbox. A clean merge is pushed as it is; a conflict is resolved
52 * by a g1t agent. Whoever can push to the pull request's source may ask:
53 * its author, or for one from a branch, a workspace member.
54 */
55 update(actor: User, repo: RepoPath, number: number): Promise<Result<boolean>>;
56 /**
57 * Has a g1t agent review a pull request: line comments, a summary and a
58 * verdict, posted as `g1t-agent`.
59 */
60 review(actor: User, repo: RepoPath, number: number): Promise<Result<boolean>>;
Hosted agents: sandboxes on Cloudflare Containers started from an intent61}