import { $ as TokenUser, A as ApiTokenResponse, B as DiskStatus, C as PutObjectOptions, D as ShareUrlResult, E as ShareUrlOptions, F as CreateApiTokenRequest, G as GrepMatch, H as ExecDiskResult, I as CreateDiskRequest, J as MountConfigResponse, K as GrepStoppedReason, L as Delegation, M as AwsStsUser, N as AzureBlobMount, O as UploadPart, P as ConnectedClient, Q as S3Mount, R as DiskMetrics, S as PosixCreateAttrs, T as S3Object, U as ExecRequest, V as DiskUser, W as GCSMount, X as R2Mount, Y as MountResponse, Z as S3CompatibleMount, _ as MultipartUploadListing, a as DeleteObjectsResult, b as PartInfo, c as ExecResult, d as ListMultipartUploadsOptions, et as FileSystem, f as ListObjectsOptions, g as MultipartUpload, h as MountOptions, i as DeleteObjectsOptions, j as AuthorizedUser, k as effectiveUploadPartSize, l as GrepOptions, m as ListPartsOptions, n as CompletedMultipartUpload, o as Disk, p as ListObjectsResult, q as MountConfig, r as DeleteObjectsError, s as DiskMultipart, t as AppendObjectOptions, tt as ApiClient, u as GrepResult, v as MultipartUploadSummary, w as PutObjectResult, x as PartListing, y as ObjectMetadata, z as DiskResponse } from "./disk-DEqV3mtA.cjs"; //#region src/disks.d.ts interface ListDisksOptions { /** Cap on the total number of disks returned. */ limit?: number; /** Resume listing from a previous page's `nextCursor`. */ cursor?: string; name?: string; } interface DiskListPage { disks: Disk[]; /** * Set when more disks remain beyond this page; pass it back as `cursor` to * fetch the next one. Undefined on the last page. */ nextCursor?: string; } interface CreateDiskResult { disk: Disk; token: string | null; tokenIdentifier: string | null; authorizedUsers: AuthorizedUser[]; } declare class Disks { /** @internal */ private readonly _client; /** @internal */ private readonly _region; /** @internal */ private readonly _s3BaseUrl?; /** @internal */ constructor(client: ApiClient, region: string, s3BaseUrl?: string); /** * List the account's disks. Fetches in cursor-driven pages (bounded server * work per request) and follows `nextCursor` until exhausted, so the result * is complete even for very large accounts. Use `limit` to cap the total, or * {@link listPage} to walk pages yourself. */ list(opts?: ListDisksOptions): Promise; /** * Fetch a single page of disks. `nextCursor` on the result resumes the * listing (it can also be persisted, e.g. across requests of a paginated UI). */ listPage(opts?: ListDisksOptions): Promise; get(id: string): Promise; /** * Create a new disk with an auto-generated mount token. * * Returns the Disk, the one-time token (save it — it cannot be retrieved * again), and the token identifier for later management. */ create(req: CreateDiskRequest): Promise; } //#endregion //#region src/tokens.d.ts interface ListTokensOptions { limit?: number; cursor?: string; } declare class Tokens { /** @internal */ private readonly _client; /** @internal */ constructor(client: ApiClient); list(opts?: ListTokensOptions): Promise; create(req: CreateApiTokenRequest): Promise; delete(id: string): Promise; } //#endregion //#region src/workspace.d.ts /** Anything that can run a multi-disk exec — i.e. an `Archil` client. A narrow * structural type so this module doesn't import the Archil class (avoiding a * value-import cycle with archil.ts). */ interface WorkspaceExecCapable { exec(opts: ExecOptions): Promise; } /** * A key-routed filesystem spanning several Archil disks. Each disk is mounted * under a name and addressed as the first segment of a key (`/...`); * `getObject`, `putObject`, `deleteObject`, `listObjects`, and `grep` route to * the right disk by that segment (and `listObjects` / `grep` fan out across all * of them when the key/prefix doesn't name one). Implements the same * {@link FileSystem} surface as a single {@link Disk}, so it works anywhere a * disk does. Mounts can be changed at runtime with {@link addDisk} / * {@link removeDisk}. */ declare class Workspace implements FileSystem { private readonly client; private readonly mounts; /** @internal Use `archil.workspace({ ... })`. */ constructor(client: WorkspaceExecCapable, mounts: Record); /** Mount (or replace) a disk at `name`; its objects are addressed as * `/...`. Accepts a `Disk` or a mount spec (read-only / subdirectory / * conditional / delegation checkouts); a bare disk-id string is rejected — * fetch the disk first. */ addDisk(name: string, disk: ExecMount): this; /** Unmount the disk at `name`. Returns whether a disk was removed. Refuses to * remove the last disk — a workspace must always have at least one (the same * invariant the constructor enforces), else fan-out/exec would have nothing to * route to. */ removeDisk(name: string): boolean; /** The names of the currently-mounted disks. */ diskNames(): string[]; private unknownDisk; /** Resolve a workspace key (`/...`) to the disk and the disk-relative key. */ private route; /** Mounts touched by a key prefix; an empty prefix fans out to all of them. */ private covered; /** Map a workspace-relative key to the disk's key, applying the mount's subdirectory. */ private diskKey; /** Map a disk key back to its workspace key (`/...`), stripping the mount subdirectory. */ private abs; getObject(key: string): Promise; putObject(key: string, body: string | Uint8Array | ArrayBuffer, options?: string | PutObjectOptions): Promise; deleteObject(key: string): Promise; listObjects(prefix?: string, opts?: ListObjectsOptions): Promise; grep(opts: GrepOptions): Promise; exec(command: string): Promise; } //#endregion //#region src/archil.d.ts interface ArchilOptions { /** API key. Falls back to ARCHIL_API_KEY env var if not provided. */ apiKey?: string; /** Region. Falls back to ARCHIL_REGION env var if not provided. */ region?: string; /** Override the control plane base URL (useful for testing). */ baseUrl?: string; /** * Override the S3-compatible API base URL used by Disk#getObject / * putObject / deleteObject. Falls back to ARCHIL_S3_BASE_URL, then to the * control plane URL with its `control.` hostname prefix swapped for `s3.`. */ s3BaseUrl?: string; } /** * Options that apply to a single mounted disk in an exec request. * Use this object form when you need to pin the mount to a subdirectory * of the disk, mount it read-only, mount it in conditional mode, or request * delegation checkouts; for the default case (mount the disk's root, * read-write with no checkout), pass a `Disk` or disk-id string instead. */ interface ExecMountSpec { /** Disk to mount, by `Disk` instance or raw disk id string. */ disk: Disk | string; /** * Subdirectory of the disk to expose at the mountpoint. Must be a * relative path with no `.` or `..` segments. When omitted, the disk's * root is exposed. */ subdirectory?: string; /** * When true, mount the disk read-only inside the container. Writes * against the mount fail with EROFS. Defaults to false. */ readOnly?: boolean; /** * When true, mount the disk in conditional mode, where mutating operations * are sent directly to the server without a delegation checkout. This * enables concurrent writes from multiple clients to the same disk. * Defaults to false. */ conditional?: boolean; /** * Milliseconds to wait in the delegation queue for each requested checkout. * If set without `checkoutPaths`, the exposed mount root is acquired during * mount setup. Cannot be combined with `readOnly: true`. */ queueMs?: number; /** * Paths relative to this disk's exposed mount root to check out before the * command starts. May be set without `queueMs`; those checkouts try * immediately without waiting in the delegation queue. Cannot be combined * with `readOnly: true`. */ checkoutPaths?: string[]; } /** * One disk to mount in an exec request. Either a `Disk`/disk-id string * (mounts the disk's root, read-write) or an `ExecMountSpec` object that * additionally selects a subdirectory of the disk and/or marks the mount as * read-only, conditional, or requests delegation checkouts. Used * by Archil#exec, where the map key is the relative path under /mnt/archil at * which to mount the disk. */ type ExecMount = Disk | string | ExecMountSpec; interface ExecOptions { /** * Disks to mount, keyed by the relative path under `/mnt/archil` at which * to mount each one. At least one entry is required. Paths must be * non-empty, non-absolute, and contain no `.` or `..` segments. */ disks: Record; /** Shell command to run inside the container. */ command: string; } declare class Archil { readonly disks: Disks; readonly tokens: Tokens; /** @internal */ private readonly _client; constructor(opts?: ArchilOptions); /** * Run a command in a container with multiple disks mounted simultaneously, * each at its own relative path under `/mnt/archil`. Blocks until the * command completes and returns its stdout, stderr, exit code, and timing. */ exec(opts: ExecOptions): Promise; /** * Build an agent filesystem toolset spanning several disks at once. `mounts` * maps a relative path to a disk (or `ExecMountSpec`), exactly like * {@link exec}; each disk appears under `/mnt/archil/`. Hand the result * to a framework adapter (`createDiskTools(workspace)`) to get tools that route * file operations by path and fan `grep`/`list_files` out across the disks. */ workspace(mounts: Record): Workspace; } //#endregion //#region src/errors.d.ts /** * Base class for every error the SDK throws. Catch with `instanceof ArchilError` * to handle control-plane and S3 failures uniformly; `status` is the HTTP status * code and `code` a machine-readable error code when the server provided one. */ declare class ArchilError extends Error { /** HTTP status code associated with the failure. */ readonly status: number; /** Machine-readable error code (e.g. an S3 code like "NoSuchKey"), if known. */ readonly code?: string; constructor(message: string, status: number, code?: string); } /** Error from the control-plane REST API. */ declare class ArchilApiError extends ArchilError { constructor(message: string, status: number, code?: string); } /** * Error from the S3-compatible object API (getObject/putObject/deleteObject/ * headObject/listObjects). The gateway returns an S3-style XML `` body; * this surfaces its parts as structured fields (`status`, `code`, `requestId`) * rather than a raw blob, while keeping the full body on `raw` for debugging. */ declare class ArchilS3Error extends ArchilError { /** S3 request id, if the gateway returned one. */ readonly requestId?: string; /** Raw response body (the XML document), for debugging. */ readonly raw: string; constructor(opts: { operation: string; statusCode: number; statusText?: string; code?: string; message?: string; requestId?: string; raw: string; }); } //#endregion //#region src/version.d.ts declare const VERSION: string; declare const USER_AGENT: string; //#endregion //#region src/index.d.ts declare function configure(options: ArchilOptions): void; declare function createDisk(req: CreateDiskRequest): Promise; declare function listDisks(opts?: ListDisksOptions): Promise; declare function getDisk(id: string): Promise; declare function listApiKeys(opts?: ListTokensOptions): Promise; declare function createApiKey(req: CreateApiTokenRequest): Promise; declare function deleteApiKey(id: string): Promise; /** * Run a command in a container with multiple disks mounted simultaneously, * each at its own relative path under `/mnt/archil`. Blocks until the * command completes and returns its stdout, stderr, exit code, and timing. */ declare function exec(opts: ExecOptions): Promise; /** * Build an agent filesystem toolset spanning several disks, using the * module-level client. See {@link Archil.workspace}. */ declare function workspace(mounts: Record): Workspace; //#endregion export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type Delegation, type DeleteObjectsError, type DeleteObjectsOptions, type DeleteObjectsResult, Disk, type DiskListPage, type DiskMetrics, DiskMultipart, type DiskResponse, type DiskStatus, type DiskUser, Disks, type ExecMount, type ExecMountSpec, type ExecOptions, type ExecRequest, type ExecResult, type FileSystem, type GCSMount, type GrepMatch, type GrepOptions, type GrepResult, type GrepStoppedReason, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListTokensOptions, type MountConfig, type MountConfigResponse, type MountOptions, type MountResponse, type MultipartUpload, type MultipartUploadListing, type MultipartUploadSummary, type ObjectMetadata, type PartInfo, type PartListing, type PosixCreateAttrs, type PutObjectOptions, type PutObjectResult, type R2Mount, type S3CompatibleMount, type S3Mount, type S3Object, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, deleteApiKey, effectiveUploadPartSize, exec, getDisk, listApiKeys, listDisks, workspace };