export const BUILT_IN_IMAGES = ["base", "node", "python", "go", "rust", "android"] as const; export type BuiltInImage = (typeof BUILT_IN_IMAGES)[number]; export const INSTANCE_SIZES = ["lite", "standard-1", "standard-2", "standard-3", "standard-4"] as const; export type InstanceSize = (typeof INSTANCE_SIZES)[number]; export const DEFAULT_SIZE: InstanceSize = "standard-2"; export const DEFAULT_TIMEOUT_MINUTES = 60; export const AGENT_TIMEOUT_MINUTES = 20; export const MAX_TIMEOUT_MINUTES = 360; /** A built-in image, optionally pinned to a dated release (`rust@2026-12`). Images deploy with the Worker, so a repo cannot bring its own. */ export type ImageRef = { readonly kind: "built-in"; readonly name: BuiltInImage; readonly version: string | null }; export interface Step { readonly name: string; readonly run: string; } export interface CacheSpec { readonly key: string; readonly paths: readonly string[]; } /** A job that runs a hosted agent on the run's pull request instead of shell steps in a container. */ export interface AgentTask { readonly handle: string; /** What the job asks the agent, added to the agent's own instructions. Empty asks for the instructions alone. */ readonly prompt: string; } export interface Job { readonly name: string; readonly agent: AgentTask | null; readonly image: ImageRef; readonly size: InstanceSize; readonly needs: readonly string[]; readonly steps: readonly Step[]; readonly environment: string | null; readonly timeoutMinutes: number; readonly cache: CacheSpec | null; readonly artifacts: readonly string[]; /** The secrets the job's steps get as environment variables. A job gets no secret it does not name. */ readonly secrets: readonly string[]; } /** Branch patterns a trigger accepts. An empty list accepts every branch. */ export interface BranchFilter { readonly branches: readonly string[]; } export interface Triggers { readonly push: BranchFilter | null; readonly pullRequest: BranchFilter | null; readonly manual: boolean; } export interface Pipeline { readonly triggers: Triggers; readonly jobs: ReadonlyMap; } export interface ConfigProblem { readonly path: string; readonly message: string; } export type ParseResult = { readonly kind: "valid"; readonly pipeline: Pipeline } | { readonly kind: "invalid"; readonly problems: readonly ConfigProblem[] };