/** * Starts `factory-environment-build` runs on the booted `Mastra`. Every * trigger goes through a workflow run so the start decision and the poll are * recorded the same way whether a route, the scheduler or a webhook asked. */ import type { Mastra } from '@mastra/core/mastra'; import type { FactorySandboxContext } from '@mastra/core/workspace'; import type { RepositoryPushEvent } from '../integrations/base.js'; import type { ScheduleService } from './build-schedule.js'; import type { EnvironmentBuildWorkflowOptions } from './build-workflow.js'; import type { EnvironmentBuildDeps, EnvironmentBuildOutcome, EnvironmentBuildTrigger } from './build.js'; export type StartEnvironmentBuild = (projectId: string, trigger: EnvironmentBuildTrigger) => Promise; export interface EnvironmentBuildRunnerOptions extends Omit { /** The booted instance; `undefined` until the host finished `finalize()`. */ getMastra: () => Mastra | undefined; logger?: { info: (msg: string, meta?: Record) => void; }; } /** What a read of a build's status or history hands the provider. */ export interface EnvironmentBuildReadContext { ctx: FactorySandboxContext; settings: Record; } export declare class EnvironmentBuildRunner { #private; readonly workflow: import("@mastra/core/workflows").Workflow[], "factory-environment-build", unknown, { projectId: string; trigger: "manual" | "push" | "schedule"; }, { outcome: "started" | "failed" | "skipped" | "unavailable"; buildId?: string | undefined; templateId?: string | undefined; reason?: string | undefined; status?: "unknown" | "failed" | "ready" | undefined; }, { outcome: "started" | "failed" | "skipped" | "unavailable"; buildId?: string | undefined; templateId?: string | undefined; reason?: string | undefined; status?: "unknown" | "failed" | "ready" | undefined; }, unknown>; constructor(deps: EnvironmentBuildDeps, options: EnvironmentBuildRunnerOptions); /** The schedule service of the booted host, `undefined` before boot. */ schedules(): ScheduleService | undefined; /** Whether the host's storage implements schedules; false until `probeSchedules()` ran. */ get scheduleAvailable(): boolean; /** Probe once after the host booted; a storage without the domain disables the cron trigger. */ probeSchedules(): Promise; /** * The context a status or history read hands the provider. Heads come from * the stored last attempt (the build being read was pinned to them), else * the active template, so a read never calls GitHub; before the first build * they are resolved live once. */ readContext(projectId: string): Promise; /** * A push to an environment repository's default branch starts a `push` run * when the project opted in; the run's debounce claim decides whether it * builds. Fire and forget: the webhook never waits on it. */ readonly onRepositoryPush: (event: RepositoryPushEvent) => void; /** * Start a run and resolve with the first step's answer; the poll step keeps * running in the background. Resolves `unavailable` before the host booted * or when the host never registered the workflow, and `failed` when the run * could not be created; a caller that already saved its own change must not * fail on the build it merely requested. */ readonly start: StartEnvironmentBuild; } //# sourceMappingURL=build-runner.d.ts.map