import { APIResource } from "../core/resource.js"; import * as BuildAPI from "./build.js"; import * as Shared from "./shared.js"; import * as CompletionsAPI from "./chat/completions.js"; import { APIPromise } from "../core/api-promise.js"; import { CursorPage, type CursorPageParams, PagePromise } from "../core/pagination.js"; import { Stream } from "../core/streaming.js"; import { type Uploadable } from "../core/uploads.js"; import { RequestOptions } from "../internal/request-options.js"; export declare class Build extends APIResource { /** * Create a container image build record. * * This multipart request accepts exactly one image source. Provide * `context_archive` to stream a tar.gz build context to the configured cloud build * provider, or provide `image_url` to register an existing tagged image as an * immediately successful build without invoking the provider. `build_args` and * `platform` apply only to archive builds. * * Exactly one of `agent_name` or `agent_id` must identify the target agent. * `agent_name` creates a new build-only agent and must be unused. `agent_id` * targets an existing agent. Archive builds normally return in a queued or running * state; prebuilt images can immediately be passed to Cloud Deploy using the * returned build ID. Archives must be non-empty and no larger than 500 MB. */ create(body: BuildCreateParams, options?: RequestOptions): APIPromise; /** * Retrieve a single build by its ID, including its current lifecycle status. * * Because builds run asynchronously after submission, the status returned here * reflects the latest known state and may still be queued or running; call this * endpoint again to observe progression to a terminal state such as success, * failed, cancelled, or timed out. Responds with a not-found error if no such * build exists for the caller's account. */ retrieve(buildID: string, options?: RequestOptions): APIPromise; /** * List container image build records for the caller's account as a paginated * collection. * * Each entry is one individual build with its current lifecycle status; pass * `agent_name`, `source_commit`, or `working_tree_hash` to return only matching * builds. Archived builds are excluded, and results are limited to builds the * caller is permitted to read. Use this to enumerate individual builds; to instead * list agents that have been built but not yet deployed, use * `GET /v5/builds/undeployed`. */ list(query?: BuildListParams | null | undefined, options?: RequestOptions): PagePromise; /** * Request cancellation of a build and return 202 Accepted. * * Cancellation runs asynchronously: the endpoint verifies the build exists and * then hands it off to a background workflow that marks the build as cancelling, * asks the cloud build provider to stop it, and polls until the build reaches a * terminal state before recording the final status. Only builds that are still * queued or running are actually cancelled; if the build has already finished, or * cancellation is already in progress, the request is still accepted but has no * effect. The returned record reflects the build's state at the time of the call, * so it will not yet show the pending cancellation. The request is rejected if no * such build exists for the caller's account. */ cancel(buildID: string, options?: RequestOptions): APIPromise; /** * List agents that exist only as cloud builds and have no healthy deployment yet. * * Unlike listing builds, this aggregates by agent: it returns one entry per * distinct agent name whose builds have never reached a healthy deploy, each * carrying that agent's most recent build and its total build count. The result is * a plain list (not paginated) and is limited to builds the caller is permitted to * read. Use this to surface agents that were built but still need to be deployed; * use `GET /v5/builds` when you need the individual build records instead. */ listUndeployed(options?: RequestOptions): APIPromise; /** * Stream a build's logs as Server-Sent Events. * * The response has content-type `text/event-stream`; each event carries one log * line as an `AgentexCloudBuildLogLine` object, delivered as lines become * available from the cloud build provider. The stream ends when the provider stops * producing output. Responds with a not-found error if no such build exists for * the caller's account. */ logs(buildID: string, options?: RequestOptions): APIPromise>; } export type AgentexCloudBuildsCursorPage = CursorPage; export interface AgentexCloudBuild { /** * The unique identifier of the entity. */ id: string; /** * The ID of the account that owns the given entity. */ account_id: string; /** * The name of the agent that this build belongs to */ agent_name: string; /** * The current build lifecycle status */ build_status: 'queued' | 'running' | 'success' | 'failed' | 'cancelling' | 'cancelled' | 'deleting' | 'delete_failed' | 'timed_out' | 'error' | 'unknown'; /** * The unique identifier of the build from the cloud provider, or an internal UUID * when an existing image is copied without a provider build. */ cloud_provider_build_id: string; /** * The date and time when the entity was created in ISO format. */ created_at: string; /** * The identity that created the entity. */ created_by: Shared.Identity; /** * The name of the container image to build. */ image_name: string; /** * The tag for the container image. */ image_tag: string; /** * Git commit the build context was at, when a git work tree. */ source_commit: string | null; /** * Whether the work tree had uncommitted changes at build time (null outside git). */ source_dirty: boolean | null; /** * Git branch or tag for source_commit, when resolvable. */ source_ref: string | null; /** * Normalized git remote the build context came from (host/path, no credentials). */ source_repo: string | null; /** * Build-context path relative to the repo root (which agent, in a monorepo). */ source_subpath: string | null; /** * Deterministic SHA-256 content hash of the build inputs (not the tarball). */ working_tree_hash: string | null; /** * The UUID of the agent that this build belongs to */ agent_id?: string; /** * When the cloud provider finished the build */ build_end_time?: string; /** * When the cloud provider started the build */ build_start_time?: string; /** * The URL of the container image. This is not guaranteed to be present until the * build is complete. */ image_url?: string; object?: 'agentex_cloud_build'; } /** * A single log line from the build process. */ export interface StreamChunk { /** * The log line content */ line: string; } export type BuildListUndeployedResponse = Array; export declare namespace BuildListUndeployedResponse { /** * An agent that exists only as cloud builds — no healthy deployment yet. */ interface BuildListUndeployedResponseItem { /** * The agent name from cloud builds */ agent_name: string; /** * The most recent cloud build for this agent */ latest_build: BuildAPI.AgentexCloudBuild; /** * Total number of builds for this agent */ total_builds: number; } } export interface BuildCreateParams { /** * Name for the built image */ image_name: string; /** * ID of the existing agent this build targets */ agent_id?: string; /** * Name of the brand-new agent to create from this build */ agent_name?: string; /** * JSON string of build arguments */ build_args?: string; /** * tar.gz archive containing the build context (Dockerfile and any files needed for * the build) */ context_archive?: Uploadable; /** * Tag for the built image */ image_tag?: string; /** * Existing tagged image to register instead of running a build */ image_url?: string; /** * Target platform for the Docker build. Defaults to the build host's native * architecture when not specified. */ platform?: 'linux/amd64' | 'linux/arm64' | 'linux/arm/v7'; /** * Git commit the build context was at. */ source_commit?: string; /** * Whether the work tree had uncommitted changes at build time. */ source_dirty?: boolean; /** * Git branch or tag for source_commit. */ source_ref?: string; /** * Normalized git remote the build context came from. */ source_repo?: string; /** * Build-context path relative to the repo root. */ source_subpath?: string; /** * Deterministic SHA-256 content hash of the build inputs. */ working_tree_hash?: string; } export interface BuildListParams extends CursorPageParams { /** * Filter builds by agent name */ agent_name?: string; sort_by?: string; sort_order?: CompletionsAPI.SortOrder; /** * Filter builds by source git commit */ source_commit?: string; /** * Filter builds by build-context content hash */ working_tree_hash?: string; } export declare namespace Build { export { type AgentexCloudBuild as AgentexCloudBuild, type StreamChunk as StreamChunk, type BuildListUndeployedResponse as BuildListUndeployedResponse, type AgentexCloudBuildsCursorPage as AgentexCloudBuildsCursorPage, type BuildCreateParams as BuildCreateParams, type BuildListParams as BuildListParams, }; } //# sourceMappingURL=build.d.ts.map