g1t/packages/contracts/src/runner.ts

86 lines3,625 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.

Agents and memory, checks and conflicts, profiles, slug renames, custom domains1import type { AgentRun } from "./agents";
A free allowance on g1t's models, so anyone can try its agents2import type { Trial } from "./billing";
Hosted agents: sandboxes on Cloudflare Containers started from an intent3import type { User, Viewer } from "./identity";
4import type { Result } from "./result";
Issues and pull requests replace intents and attempts5import type { RepoPath } from "./repos";
Agents as a team: lifecycle, merge queue, billing and a new shell6import type { Plan, Pull } from "./work";
g1t agents: model menu and optional AI Gateway routing7
Hosted agents: sandboxes on Cloudflare Containers started from an intent8export type RunHostedInput = {
Agents as a team: lifecycle, merge queue, billing and a new shell9 /** Extra guidance given to the agent along with the issue. */
Hosted agents: sandboxes on Cloudflare Containers started from an intent10 instructions?: string;
11};
12
Agents as a team: lifecycle, merge queue, billing and a new shell13/**
14 * Sandboxes on g1t: agents that work on an issue, and acceptance checks.
15 *
16 * Nobody who assigns a g1t agent picks a model. g1t routes each kind of
17 * work itself, and says in the session which model ran.
18 */
Models per workspace: several providers, routed by kind of work19/**
20 * How a workspace's agents reach a model. The workspace decides: its own
21 * provider (`own` names it), or g1t's hosted models paid from its credit.
22 */
23export type ModelAccess = {
24 /** The workspace's own model connection, by name, if it has one. */
25 own: string | null;
A free allowance on g1t's models, so anyone can try its agents26 /** Whether g1t's hosted models are open to it, on its free allowance or otherwise. */
Models per workspace: several providers, routed by kind of work27 hosted: boolean;
A free allowance on g1t's models, so anyone can try its agents28 /** Its free allowance, when that is how it reaches g1t's hosted models; null when it needs none. */
29 trial: Trial | null;
Models per workspace: several providers, routed by kind of work30};
31
Hosted agents: sandboxes on Cloudflare Containers started from an intent32export interface RunnerApi {
Models per workspace: several providers, routed by kind of work33 /** How `workspace`'s agents would reach a model now. */
34 modelAccess(workspace: string): Promise<ModelAccess>;
Hosted agents: sandboxes on Cloudflare Containers started from an intent35 /**
g1t's agents only for listed workspaces, whatever the state of billing36 * Whether `viewer` may put g1t's agents to work: in `repo`'s workspace,
37 * or with none named, in any of theirs.
38 */
39 enabled(viewer: Viewer, repo?: RepoPath): Promise<boolean>;
40 /**
Agents as a team: lifecycle, merge queue, billing and a new shell41 * Assigns the issue to a g1t agent: opens a draft pull request for it,
42 * made by an agent in a sandbox of its own. Returns as soon as the
43 * sandbox is starting; progress shows up in the pull request's session.
44 * Scale comes from assigning many issues, each to its own agent.
Hosted agents: sandboxes on Cloudflare Containers started from an intent45 */
Agents as a team: lifecycle, merge queue, billing and a new shell46 run(actor: User, repo: RepoPath, issue: number, input?: RunHostedInput): Promise<Result<Pull>>;
Acceptance checks in sandboxes, line comments and review verdicts47 /**
Agents as a team: lifecycle, merge queue, billing and a new shell48 * Has an agent read the repository and turn an outcome into a plan: the
49 * issues that would get there and the order they have to land in. Returns
50 * the plan's id as soon as the sandbox is starting; the plan fills in when
51 * the agent has written it. Members of the repository's workspace only.
52 */
53 plan(actor: User, repo: RepoPath, brief: string): Promise<Result<{ planId: string }>>;
54 /**
55 * Opens a plan's issues. With `assign`, a g1t agent starts on each that
56 * depends on nothing, and on the others as what they depend on merges.
57 */
58 applyPlan(
59 actor: User,
60 repo: RepoPath,
61 planId: string,
62 options?: { assign?: boolean; keep?: number[] },
63 ): Promise<Result<Plan>>;
64 /**
Acceptance checks in sandboxes, line comments and review verdicts65 * Runs the acceptance checks of a pull request again. Whoever opened it,
66 * or a member of the repository's workspace, may ask.
67 */
68 recheck(actor: User, repo: RepoPath, number: number): Promise<Result<boolean>>;
Agents as a team: lifecycle, merge queue, billing and a new shell69 /**
70 * Brings a pull request up to date with the branch it would merge into,
71 * in a sandbox. A clean merge is pushed as it is; a conflict is resolved
72 * by a g1t agent. Whoever can push to the pull request's source may ask:
73 * its author, or for one from a branch, a workspace member.
74 */
75 update(actor: User, repo: RepoPath, number: number): Promise<Result<boolean>>;
76 /**
77 * Has a g1t agent review a pull request: line comments, a summary and a
78 * verdict, posted as `g1t-agent`.
79 */
80 review(actor: User, repo: RepoPath, number: number): Promise<Result<boolean>>;
Agents and memory, checks and conflicts, profiles, slug renames, custom domains81 /**
82 * Stops an agent run: marks it stopped, destroys its sandbox, and leaves
83 * the pull request it was on for a person. Members of the workspace only.
84 */
85 stopRun(actor: User, repo: RepoPath, runId: string): Promise<Result<AgentRun>>;
Hosted agents: sandboxes on Cloudflare Containers started from an intent86}