disk 1.7.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -261,6 +261,36 @@ a duration up to `"8760h"` (365 days). `listPortTokens` follows all pages (its
261
261
  Public ports bypass token authentication. Revocation and expiry deny new
262
262
  connections with HTTP 401; existing connections remain open.
263
263
 
264
+ Archil disks can be mounted inside the sandbox at creation. They are mounted on every
265
+ boot and persist across stop/start and pause/resume. A sandbox with mounts must be stopped
266
+ before it is forked; the fork inherits them:
267
+
268
+ ```ts
269
+ const workspace = await client.sandboxes.create({
270
+ mounts: [
271
+ { disk: "dsk-0123456789abcdef", path: "/mnt/archil" },
272
+ { disk: "dsk-fedcba9876543210", path: "/mnt/models", subdirectory: "llama", readOnly: true },
273
+ { disk: "dsk-0000000000000001", path: "/workspace", conditional: true },
274
+ ],
275
+ });
276
+ console.log(workspace.mounts.map((mount) => mount.path));
277
+
278
+ await workspace.stop();
279
+ await workspace.start({ mounts: [{ disk: "dsk-0123456789abcdef", path: "/mnt/other" }] });
280
+ ```
281
+
282
+ These disks are additional mounts; the sandbox retains its internal root disk.
283
+ A sole mount defaults to `/mnt/archil`; `path` is required for every mount when
284
+ more than one disk is mounted. Options: `readOnly`, `conditional`
285
+ (concurrent writers without delegation checkouts), `subdirectory`, and `queueMs` (how long a
286
+ plain mount waits for the disk's exclusive root delegation). A plain read-write mount holds
287
+ that delegation for as long as the sandbox does, including while paused, so use `readOnly`
288
+ or `conditional` for disks that other clients or forks also write.
289
+
290
+ On a cold start, omit `mounts` to retain the current list, pass `mounts: []` to
291
+ clear it, or supply a list to replace it. Mounts cannot be changed on resume or
292
+ while the sandbox is running. `queueMs` cannot be combined with `readOnly` or `conditional`.
293
+
264
294
  Network egress can optionally be restricted when creating a sandbox:
265
295
 
266
296
  ```ts
@@ -673,6 +703,38 @@ A delegation has no ID of its own — it is identified by the
673
703
  connected to the disk. `path` is resolved best-effort by the server and may be
674
704
  absent.
675
705
 
706
+ ## Branches
707
+
708
+ A branch is an independent, writable fork of a disk that starts from a
709
+ committed checkpoint. Writes on a branch don't affect its source. Create a
710
+ checkpoint from a mounted disk with `archil checkpoints create <mountpoint> <name>`,
711
+ then branch from it:
712
+
713
+ ```ts
714
+ const disk = await archil.disks.get("dsk-0123456789abcdef");
715
+
716
+ const branch = await disk.createBranch({ name: "experiment", fromCheckpoint: "nightly" });
717
+ // { branch_name, filesystem_id, from_checkpoint_name, created_at, ... }
718
+
719
+ // Branch from a checkpoint taken on another branch:
720
+ await disk.createBranch({ name: "experiment-2", fromCheckpoint: "cp1", fromBranch: "experiment" });
721
+
722
+ await disk.listBranches();
723
+ await disk.getBranch("experiment");
724
+ ```
725
+
726
+ Branch names are 1-100 letters, digits, hyphens, or underscores, and are unique
727
+ across the disk. `createBranch` rejects with a 409 `ArchilApiError` when the
728
+ name is taken or the checkpoint isn't committed yet. The SDK's own retries are
729
+ safe: it sends the same idempotency key on every attempt. To retry a create
730
+ yourself, pass your own key and reuse it, so a retry of a create that already
731
+ succeeded returns that branch instead of a 409:
732
+
733
+ ```ts
734
+ const idempotencyKey = crypto.randomUUID(); // store it alongside the job
735
+ await disk.createBranch({ name: "experiment", fromCheckpoint: "nightly", idempotencyKey });
736
+ ```
737
+
676
738
  A `Workspace` is a full filesystem in its own right — it has the same object API
677
739
  a `Disk` does (`getObject` / `putObject` / `deleteObject` / `listObjects` /
678
740
  `grep` / `exec`; both implement the `FileSystem` interface), so you can use it
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { a as deleteApiKey, k as ArchilApiError, l as listApiKeys, n as createApiKey, r as createDisk, s as getDisk, t as configure, u as listDisks } from "./src-CXTEUmMV.mjs";
3
- import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-BkH4aHPf.mjs";
2
+ import { a as deleteApiKey, k as ArchilApiError, l as listApiKeys, n as createApiKey, r as createDisk, s as getDisk, t as configure, u as listDisks } from "./src-vpVe_Scb.mjs";
3
+ import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-Dl6NSqjY.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { Command } from "commander";
6
6
  //#region bin/cli.ts
@@ -1,4 +1,4 @@
1
- import { O as REGION_URLS, p as Archil } from "./src-CXTEUmMV.mjs";
1
+ import { O as REGION_URLS, p as Archil } from "./src-vpVe_Scb.mjs";
2
2
  import { Option } from "commander";
3
3
  import { isCancel, password, spinner } from "@clack/prompts";
4
4
  import { chmod, mkdir, open, readFile, rename, rm, stat } from "node:fs/promises";
@@ -61,6 +61,7 @@ type R2Mount = components["schemas"]["R2Mount"];
61
61
  type S3CompatibleMount = components["schemas"]["S3CompatibleMount"];
62
62
  type AzureBlobMount = components["schemas"]["AzureBlobMount"];
63
63
  type Delegation = components["schemas"]["DelegationEntry"];
64
+ type Branch = components["schemas"]["BranchResponse"];
64
65
  type DiskUser = components["schemas"]["DiskUser"];
65
66
  type TokenUser = components["schemas"]["TokenUser"];
66
67
  type AwsStsUser = components["schemas"]["AwsStsUser"];
@@ -80,6 +81,21 @@ interface MountOptions {
80
81
  serverAddress?: string;
81
82
  insecure?: boolean;
82
83
  }
84
+ interface CreateBranchOptions {
85
+ /** 1-100 letters, digits, hyphens, or underscores. Unique across the disk. */
86
+ name: string;
87
+ /** Name of a committed checkpoint on the source. */
88
+ fromCheckpoint: string;
89
+ /** Branch the checkpoint was taken on. Omit to branch from the root disk. */
90
+ fromBranch?: string;
91
+ /**
92
+ * UUID identifying this create. Pass the same key (and options) when you
93
+ * retry a create yourself, so a retry of one that succeeded returns that
94
+ * branch instead of a 409. Defaults to a fresh key per call; the SDK's own
95
+ * retries always reuse it.
96
+ */
97
+ idempotencyKey?: string;
98
+ }
83
99
  type ExecResult = ExecDiskResult;
84
100
  type GrepResult = GrepDiskResult;
85
101
  interface GrepOptions {
@@ -438,6 +454,18 @@ declare class Disk implements FileSystem {
438
454
  * ```
439
455
  */
440
456
  revokeDelegation(delegation: Pick<Delegation, "clientId" | "inodeId">): Promise<void>;
457
+ /**
458
+ * Create a branch: an independent, writable fork of this disk that starts
459
+ * from a committed checkpoint. Writes on the branch don't affect its source.
460
+ *
461
+ * Fails with a 409 if a branch with this name already exists or the
462
+ * checkpoint is not yet committed, and a 404 if the checkpoint or
463
+ * `fromBranch` doesn't exist.
464
+ */
465
+ createBranch(options: CreateBranchOptions): Promise<Branch>;
466
+ /** List every branch of this disk, including branches of branches, in no particular order. */
467
+ listBranches(): Promise<Branch[]>;
468
+ getBranch(name: string): Promise<Branch>;
441
469
  getAllowedIPs(): Promise<string[]>;
442
470
  setAllowedIPs(allowedIps: string[]): Promise<string[]>;
443
471
  addAllowedIP(ip: string): Promise<string[]>;
@@ -718,4 +746,4 @@ declare class DiskMultipart {
718
746
  */
719
747
  declare function effectiveUploadPartSize(totalBytes: number, requestedPartSize: number): number;
720
748
  //#endregion
721
- export { S3Mount as $, ApiTokenResponse as A, DiskStatus as B, PutObjectOptions as C, ShareUrlResult as D, ShareUrlOptions as E, CreateApiTokenRequest as F, GrepMatch as G, ExecDiskResult as H, CreateDiskRequest as I, MountConfigResponse as J, GrepStoppedReason as K, Delegation as L, AwsStsUser as M, AzureBlobMount as N, UploadPart as O, ConnectedClient as P, S3CompatibleMount as Q, DiskMetrics as R, PosixCreateAttrs as S, S3Object as T, ExecRequest as U, DiskUser as V, GCSMount as W, R2Mount as X, MountResponse as Y, RootAttrs as Z, MultipartUploadListing as _, DeleteObjectsResult as a, PartInfo as b, ExecResult as c, ListMultipartUploadsOptions as d, TokenUser as et, ListObjectsOptions as f, MultipartUpload as g, MountOptions as h, DeleteObjectsOptions as i, AuthorizedUser as j, effectiveUploadPartSize as k, GrepOptions as l, ListPartsOptions as m, CompletedMultipartUpload as n, ApiClient as nt, Disk as o, ListObjectsResult as p, MountConfig as q, DeleteObjectsError as r, ArchilTlsOptions as rt, DiskMultipart as s, AppendObjectOptions as t, FileSystem as tt, GrepResult as u, MultipartUploadSummary as v, PutObjectResult as w, PartListing as x, ObjectMetadata as y, DiskResponse as z };
749
+ export { RootAttrs as $, effectiveUploadPartSize as A, DiskMetrics as B, PosixCreateAttrs as C, ShareUrlOptions as D, S3Object as E, Branch as F, ExecRequest as G, DiskStatus as H, ConnectedClient as I, GrepStoppedReason as J, GCSMount as K, CreateApiTokenRequest as L, AuthorizedUser as M, AwsStsUser as N, ShareUrlResult as O, AzureBlobMount as P, R2Mount as Q, CreateDiskRequest as R, PartListing as S, PutObjectResult as T, DiskUser as U, DiskResponse as V, ExecDiskResult as W, MountConfigResponse as X, MountConfig as Y, MountResponse as Z, MultipartUpload as _, DeleteObjectsOptions as a, ArchilTlsOptions as at, ObjectMetadata as b, DiskMultipart as c, GrepResult as d, S3CompatibleMount as et, ListMultipartUploadsOptions as f, MountOptions as g, ListPartsOptions as h, DeleteObjectsError as i, ApiClient as it, ApiTokenResponse as j, UploadPart as k, ExecResult as l, ListObjectsResult as m, CompletedMultipartUpload as n, TokenUser as nt, DeleteObjectsResult as o, ListObjectsOptions as p, GrepMatch as q, CreateBranchOptions as r, FileSystem as rt, Disk as s, AppendObjectOptions as t, S3Mount as tt, GrepOptions as u, MultipartUploadListing as v, PutObjectOptions as w, PartInfo as x, MultipartUploadSummary as y, Delegation as z };
@@ -61,6 +61,7 @@ type R2Mount = components["schemas"]["R2Mount"];
61
61
  type S3CompatibleMount = components["schemas"]["S3CompatibleMount"];
62
62
  type AzureBlobMount = components["schemas"]["AzureBlobMount"];
63
63
  type Delegation = components["schemas"]["DelegationEntry"];
64
+ type Branch = components["schemas"]["BranchResponse"];
64
65
  type DiskUser = components["schemas"]["DiskUser"];
65
66
  type TokenUser = components["schemas"]["TokenUser"];
66
67
  type AwsStsUser = components["schemas"]["AwsStsUser"];
@@ -80,6 +81,21 @@ interface MountOptions {
80
81
  serverAddress?: string;
81
82
  insecure?: boolean;
82
83
  }
84
+ interface CreateBranchOptions {
85
+ /** 1-100 letters, digits, hyphens, or underscores. Unique across the disk. */
86
+ name: string;
87
+ /** Name of a committed checkpoint on the source. */
88
+ fromCheckpoint: string;
89
+ /** Branch the checkpoint was taken on. Omit to branch from the root disk. */
90
+ fromBranch?: string;
91
+ /**
92
+ * UUID identifying this create. Pass the same key (and options) when you
93
+ * retry a create yourself, so a retry of one that succeeded returns that
94
+ * branch instead of a 409. Defaults to a fresh key per call; the SDK's own
95
+ * retries always reuse it.
96
+ */
97
+ idempotencyKey?: string;
98
+ }
83
99
  type ExecResult = ExecDiskResult;
84
100
  type GrepResult = GrepDiskResult;
85
101
  interface GrepOptions {
@@ -438,6 +454,18 @@ declare class Disk implements FileSystem {
438
454
  * ```
439
455
  */
440
456
  revokeDelegation(delegation: Pick<Delegation, "clientId" | "inodeId">): Promise<void>;
457
+ /**
458
+ * Create a branch: an independent, writable fork of this disk that starts
459
+ * from a committed checkpoint. Writes on the branch don't affect its source.
460
+ *
461
+ * Fails with a 409 if a branch with this name already exists or the
462
+ * checkpoint is not yet committed, and a 404 if the checkpoint or
463
+ * `fromBranch` doesn't exist.
464
+ */
465
+ createBranch(options: CreateBranchOptions): Promise<Branch>;
466
+ /** List every branch of this disk, including branches of branches, in no particular order. */
467
+ listBranches(): Promise<Branch[]>;
468
+ getBranch(name: string): Promise<Branch>;
441
469
  getAllowedIPs(): Promise<string[]>;
442
470
  setAllowedIPs(allowedIps: string[]): Promise<string[]>;
443
471
  addAllowedIP(ip: string): Promise<string[]>;
@@ -718,4 +746,4 @@ declare class DiskMultipart {
718
746
  */
719
747
  declare function effectiveUploadPartSize(totalBytes: number, requestedPartSize: number): number;
720
748
  //#endregion
721
- export { S3Mount as $, ApiTokenResponse as A, DiskStatus as B, PutObjectOptions as C, ShareUrlResult as D, ShareUrlOptions as E, CreateApiTokenRequest as F, GrepMatch as G, ExecDiskResult as H, CreateDiskRequest as I, MountConfigResponse as J, GrepStoppedReason as K, Delegation as L, AwsStsUser as M, AzureBlobMount as N, UploadPart as O, ConnectedClient as P, S3CompatibleMount as Q, DiskMetrics as R, PosixCreateAttrs as S, S3Object as T, ExecRequest as U, DiskUser as V, GCSMount as W, R2Mount as X, MountResponse as Y, RootAttrs as Z, MultipartUploadListing as _, DeleteObjectsResult as a, PartInfo as b, ExecResult as c, ListMultipartUploadsOptions as d, TokenUser as et, ListObjectsOptions as f, MultipartUpload as g, MountOptions as h, DeleteObjectsOptions as i, AuthorizedUser as j, effectiveUploadPartSize as k, GrepOptions as l, ListPartsOptions as m, CompletedMultipartUpload as n, ApiClient as nt, Disk as o, ListObjectsResult as p, MountConfig as q, DeleteObjectsError as r, ArchilTlsOptions as rt, DiskMultipart as s, AppendObjectOptions as t, FileSystem as tt, GrepResult as u, MultipartUploadSummary as v, PutObjectResult as w, PartListing as x, ObjectMetadata as y, DiskResponse as z };
749
+ export { RootAttrs as $, effectiveUploadPartSize as A, DiskMetrics as B, PosixCreateAttrs as C, ShareUrlOptions as D, S3Object as E, Branch as F, ExecRequest as G, DiskStatus as H, ConnectedClient as I, GrepStoppedReason as J, GCSMount as K, CreateApiTokenRequest as L, AuthorizedUser as M, AwsStsUser as N, ShareUrlResult as O, AzureBlobMount as P, R2Mount as Q, CreateDiskRequest as R, PartListing as S, PutObjectResult as T, DiskUser as U, DiskResponse as V, ExecDiskResult as W, MountConfigResponse as X, MountConfig as Y, MountResponse as Z, MultipartUpload as _, DeleteObjectsOptions as a, ArchilTlsOptions as at, ObjectMetadata as b, DiskMultipart as c, GrepResult as d, S3CompatibleMount as et, ListMultipartUploadsOptions as f, MountOptions as g, ListPartsOptions as h, DeleteObjectsError as i, ApiClient as it, ApiTokenResponse as j, UploadPart as k, ExecResult as l, ListObjectsResult as m, CompletedMultipartUpload as n, TokenUser as nt, DeleteObjectsResult as o, ListObjectsOptions as p, GrepMatch as q, CreateBranchOptions as r, FileSystem as rt, Disk as s, AppendObjectOptions as t, S3Mount as tt, GrepOptions as u, MultipartUploadListing as v, PutObjectOptions as w, PartInfo as x, MultipartUploadSummary as y, Delegation as z };
package/dist/index.cjs CHANGED
@@ -163,7 +163,7 @@ function deriveS3BaseUrl(controlBaseUrl) {
163
163
  }
164
164
  //#endregion
165
165
  //#region src/version.ts
166
- const VERSION = "1.7.0";
166
+ const VERSION = "1.9.0";
167
167
  const USER_AGENT = `archil-js/${VERSION}`;
168
168
  //#endregion
169
169
  //#region src/client.ts
@@ -499,6 +499,38 @@ var Disk = class {
499
499
  }
500
500
  }), "connect"));
501
501
  }
502
+ /**
503
+ * Create a branch: an independent, writable fork of this disk that starts
504
+ * from a committed checkpoint. Writes on the branch don't affect its source.
505
+ *
506
+ * Fails with a 409 if a branch with this name already exists or the
507
+ * checkpoint is not yet committed, and a 404 if the checkpoint or
508
+ * `fromBranch` doesn't exist.
509
+ */
510
+ async createBranch(options) {
511
+ const idempotencyKey = options.idempotencyKey ?? globalThis.crypto.randomUUID();
512
+ return unwrap(retryApiRequest(() => this._client.POST("/api/disks/{id}/branches", {
513
+ params: {
514
+ path: { id: this.id },
515
+ header: { "Idempotency-Key": idempotencyKey }
516
+ },
517
+ body: {
518
+ branch_name: options.name,
519
+ from_checkpoint_name: options.fromCheckpoint,
520
+ from_branch: options.fromBranch
521
+ }
522
+ }), "transient"));
523
+ }
524
+ /** List every branch of this disk, including branches of branches, in no particular order. */
525
+ async listBranches() {
526
+ return unwrap(retryApiRequest(() => this._client.GET("/api/disks/{id}/branches", { params: { path: { id: this.id } } }), "transient"));
527
+ }
528
+ async getBranch(name) {
529
+ return unwrap(retryApiRequest(() => this._client.GET("/api/disks/{id}/branches/{name}", { params: { path: {
530
+ id: this.id,
531
+ name
532
+ } } }), "transient"));
533
+ }
502
534
  async getAllowedIPs() {
503
535
  return (await unwrap(retryApiRequest(() => this._client.GET("/api/disks/{id}/allowed-ips", { params: { path: { id: this.id } } }), "transient"))).allowedIps;
504
536
  }
@@ -1906,6 +1938,29 @@ function toError(error) {
1906
1938
  }
1907
1939
  //#endregion
1908
1940
  //#region src/sandbox.ts
1941
+ /** @internal */
1942
+ function sandboxMountWire(mount) {
1943
+ const entry = {
1944
+ disk_id: typeof mount.disk === "string" ? mount.disk : mount.disk.id,
1945
+ read_only: mount.readOnly ?? false,
1946
+ conditional: mount.conditional ?? false
1947
+ };
1948
+ if (mount.path !== void 0) entry.path = mount.path;
1949
+ if (mount.subdirectory !== void 0) entry.subdirectory = mount.subdirectory;
1950
+ if (mount.queueMs !== void 0) entry.queue_ms = mount.queueMs;
1951
+ return entry;
1952
+ }
1953
+ function sandboxMountFromWire(mount) {
1954
+ const out = {
1955
+ diskId: mount.disk_id,
1956
+ path: mount.path,
1957
+ readOnly: mount.read_only ?? false,
1958
+ conditional: mount.conditional ?? false
1959
+ };
1960
+ if (mount.subdirectory !== void 0) out.subdirectory = mount.subdirectory;
1961
+ if (mount.queue_ms !== void 0) out.queueMs = mount.queue_ms;
1962
+ return out;
1963
+ }
1909
1964
  function portTokenFromWire(data) {
1910
1965
  return {
1911
1966
  id: data.id,
@@ -1931,6 +1986,7 @@ var Sandbox = class Sandbox {
1931
1986
  idleTtlSeconds;
1932
1987
  maxConcurrentExecs;
1933
1988
  endpoints;
1989
+ mounts;
1934
1990
  createdAt;
1935
1991
  runningAt;
1936
1992
  finishedAt;
@@ -1963,6 +2019,7 @@ var Sandbox = class Sandbox {
1963
2019
  this.idleTtlSeconds = data.idle_ttl_seconds ?? 0;
1964
2020
  this.maxConcurrentExecs = data.max_concurrent_execs;
1965
2021
  this.endpoints = data.endpoints?.map((endpoint) => ({ ...endpoint }));
2022
+ this.mounts = (data.mounts ?? []).map(sandboxMountFromWire);
1966
2023
  this.createdAt = new Date(data.created_at);
1967
2024
  this.runningAt = data.running_at ? new Date(data.running_at) : void 0;
1968
2025
  this.finishedAt = data.finished_at ? new Date(data.finished_at) : void 0;
@@ -1985,6 +2042,7 @@ var Sandbox = class Sandbox {
1985
2042
  idleTtlSeconds: this.idleTtlSeconds,
1986
2043
  maxConcurrentExecs: this.maxConcurrentExecs,
1987
2044
  endpoints: this.endpoints?.map((endpoint) => ({ ...endpoint })),
2045
+ mounts: this.mounts.map((mount) => ({ ...mount })),
1988
2046
  createdAt: this.createdAt,
1989
2047
  runningAt: this.runningAt,
1990
2048
  finishedAt: this.finishedAt,
@@ -2056,10 +2114,13 @@ var Sandbox = class Sandbox {
2056
2114
  }
2057
2115
  /** Start this sandbox. */
2058
2116
  async start(options = {}) {
2059
- const data = await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes/{sid}/start", { params: {
2060
- path: { sid: this.id },
2061
- query: { wait: options.wait ?? true }
2062
- } }), "transient"));
2117
+ const data = await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes/{sid}/start", {
2118
+ params: {
2119
+ path: { sid: this.id },
2120
+ query: { wait: options.wait ?? true }
2121
+ },
2122
+ ...options.mounts !== void 0 && { body: { mounts: options.mounts.map(sandboxMountWire) } }
2123
+ }), options.mounts === void 0 ? "transient" : "connect"));
2063
2124
  this._apply(data);
2064
2125
  return options.wait === false ? this : waitForSandboxStart(this);
2065
2126
  }
@@ -2270,7 +2331,8 @@ var Sandboxes = class {
2270
2331
  idle_ttl_seconds: request.idleTtlSeconds,
2271
2332
  max_concurrent_execs: request.maxConcurrentExecs,
2272
2333
  network: request.network,
2273
- ports: request.ports
2334
+ ports: request.ports,
2335
+ ...request.mounts !== void 0 && { mounts: request.mounts.map(sandboxMountWire) }
2274
2336
  };
2275
2337
  const sandbox = new Sandbox(await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes", {
2276
2338
  params: { query: { wait: options.wait ?? true } },
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as S3Mount, 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 S3CompatibleMount, 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 RootAttrs, _ as MultipartUploadListing, a as DeleteObjectsResult, b as PartInfo, c as ExecResult, d as ListMultipartUploadsOptions, et as TokenUser, 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, nt as ApiClient, o as Disk, p as ListObjectsResult, q as MountConfig, r as DeleteObjectsError, rt as ArchilTlsOptions, s as DiskMultipart, t as AppendObjectOptions, tt as FileSystem, u as GrepResult, v as MultipartUploadSummary, w as PutObjectResult, x as PartListing, y as ObjectMetadata, z as DiskResponse } from "./disk-iq-QAbnz.cjs";
1
+ import { $ as RootAttrs, A as effectiveUploadPartSize, B as DiskMetrics, C as PosixCreateAttrs, D as ShareUrlOptions, E as S3Object, F as Branch, G as ExecRequest, H as DiskStatus, I as ConnectedClient, J as GrepStoppedReason, K as GCSMount, L as CreateApiTokenRequest, M as AuthorizedUser, N as AwsStsUser, O as ShareUrlResult, P as AzureBlobMount, Q as R2Mount, R as CreateDiskRequest, S as PartListing, T as PutObjectResult, U as DiskUser, V as DiskResponse, W as ExecDiskResult, X as MountConfigResponse, Y as MountConfig, Z as MountResponse, _ as MultipartUpload, a as DeleteObjectsOptions, at as ArchilTlsOptions, b as ObjectMetadata, c as DiskMultipart, d as GrepResult, et as S3CompatibleMount, f as ListMultipartUploadsOptions, g as MountOptions, h as ListPartsOptions, i as DeleteObjectsError, it as ApiClient, j as ApiTokenResponse, k as UploadPart, l as ExecResult, m as ListObjectsResult, n as CompletedMultipartUpload, nt as TokenUser, o as DeleteObjectsResult, p as ListObjectsOptions, q as GrepMatch, r as CreateBranchOptions, rt as FileSystem, s as Disk, t as AppendObjectOptions, tt as S3Mount, u as GrepOptions, v as MultipartUploadListing, w as PutObjectOptions, x as PartInfo, y as MultipartUploadSummary, z as Delegation } from "./disk-MmfqVyPo.cjs";
2
2
  import { components } from "@archildata/api-types";
3
3
 
4
4
  //#region src/disks.d.ts
@@ -263,9 +263,31 @@ type SandboxNetwork = Omit<components["schemas"]["SandboxNetwork"], "egress"> &
263
263
  egress?: SandboxEgressPolicy;
264
264
  };
265
265
  /** @internal */
266
- type SandboxWire = components["schemas"]["Sandbox"] & {
267
- idle_ttl_seconds?: number;
268
- };
266
+ type SandboxWire = components["schemas"]["Sandbox"];
267
+ /**
268
+ * One Archil disk to mount inside a sandbox. `path` is the absolute guest
269
+ * directory; it may be omitted only for a sole mount, which then lands at
270
+ * `/mnt/archil`. A plain mount is exclusive and `queueMs` bounds the wait for
271
+ * its root delegation; `readOnly` and `conditional` mounts never take it.
272
+ */
273
+ interface SandboxMountSpec extends Omit<ExecMountSpec, "checkoutPaths" | "queueMs"> {
274
+ path?: string;
275
+ /**
276
+ * Milliseconds a plain mount waits for the disk's exclusive root delegation
277
+ * before the boot fails. Cannot be combined with `readOnly` or `conditional`.
278
+ */
279
+ queueMs?: number;
280
+ }
281
+ /** An Archil disk mounted inside the sandbox, as currently configured. */
282
+ interface SandboxMount {
283
+ diskId: string;
284
+ /** Absolute guest directory the disk is mounted at. */
285
+ path: string;
286
+ subdirectory?: string;
287
+ readOnly: boolean;
288
+ conditional: boolean;
289
+ queueMs?: number;
290
+ }
269
291
  type SandboxStatus = components["schemas"]["SandboxState"];
270
292
  interface SandboxEndpoint {
271
293
  port: number;
@@ -311,6 +333,8 @@ interface SandboxResponse {
311
333
  /** Maximum concurrently attached process sessions. Detached processes and one-shot controls do not count. */
312
334
  maxConcurrentExecs: number;
313
335
  endpoints?: SandboxEndpoint[];
336
+ /** Disks mounted inside the guest on every boot. */
337
+ mounts: SandboxMount[];
314
338
  createdAt: Date;
315
339
  runningAt?: Date;
316
340
  finishedAt?: Date;
@@ -326,6 +350,14 @@ interface SandboxWaitOptions {
326
350
  */
327
351
  wait?: boolean;
328
352
  }
353
+ interface SandboxStartOptions extends SandboxWaitOptions {
354
+ /**
355
+ * Replace the sandbox's disk mounts for this and later sessions. Omit to
356
+ * keep the current ones. A cold start only: resume keeps the paused
357
+ * session's mounts.
358
+ */
359
+ mounts?: SandboxMountSpec[];
360
+ }
329
361
  interface SandboxForkOptions extends SandboxWaitOptions {
330
362
  /** Name for the fork. The server generates one when omitted. */
331
363
  name?: string;
@@ -349,6 +381,7 @@ declare class Sandbox {
349
381
  idleTtlSeconds: number;
350
382
  maxConcurrentExecs: number;
351
383
  endpoints?: SandboxEndpoint[];
384
+ mounts: SandboxMount[];
352
385
  createdAt: Date;
353
386
  runningAt?: Date;
354
387
  finishedAt?: Date;
@@ -376,7 +409,7 @@ declare class Sandbox {
376
409
  /** Re-fetch this sandbox. */
377
410
  refresh(): Promise<this>;
378
411
  /** Start this sandbox. */
379
- start(options?: SandboxWaitOptions): Promise<Sandbox | this>;
412
+ start(options?: SandboxStartOptions): Promise<Sandbox | this>;
380
413
  /** Stop this sandbox. */
381
414
  stop(options?: SandboxWaitOptions): Promise<Sandbox | this>;
382
415
  /** Pause this sandbox, preserving its CPU and memory state. */
@@ -449,6 +482,12 @@ interface CreateSandboxRequest {
449
482
  network?: SandboxNetwork;
450
483
  /** TCP ports to expose publicly, from 1 to 65535. */
451
484
  ports?: number[];
485
+ /**
486
+ * Disks mounted inside the guest for the first session; `sandbox.start()`
487
+ * can replace them later. A sandbox with mounts must be stopped before it
488
+ * is forked.
489
+ */
490
+ mounts?: SandboxMountSpec[];
452
491
  }
453
492
  interface ListSandboxesOptions {
454
493
  /** Only return sandboxes that mount this disk. */
@@ -717,4 +756,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
717
756
  */
718
757
  declare function workspace(mounts: Record<string, ExecMount>): Workspace;
719
758
  //#endregion
720
- export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type ArchilTlsOptions, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type BuildImageOptions, type BuildImageRequest, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type CreateSandboxPortTokenOptions, type CreateSandboxRequest, type CreatedSandboxPortToken, 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 Image, ImageBuildError, type ImageFailureReason, type ImageStatus, Images, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListSandboxPortTokensOptions, type ListSandboxesOptions, 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 RegistryAuth, type RootAttrs, type S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxEgressPolicy, type SandboxEgressRule, type SandboxEgressTransform, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxNetwork, type SandboxNetworkAction, SandboxPauseError, type SandboxPortToken, type SandboxPortTokenPage, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStatus, type SandboxTerminalOptions, type SandboxTimeoutOptions, type SandboxWaitOptions, Sandboxes, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
759
+ export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type ArchilTlsOptions, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type Branch, type BuildImageOptions, type BuildImageRequest, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateBranchOptions, type CreateDiskRequest, type CreateDiskResult, type CreateSandboxPortTokenOptions, type CreateSandboxRequest, type CreatedSandboxPortToken, 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 Image, ImageBuildError, type ImageFailureReason, type ImageStatus, Images, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListSandboxPortTokensOptions, type ListSandboxesOptions, 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 RegistryAuth, type RootAttrs, type S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxEgressPolicy, type SandboxEgressRule, type SandboxEgressTransform, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxMount, type SandboxMountSpec, type SandboxNetwork, type SandboxNetworkAction, SandboxPauseError, type SandboxPortToken, type SandboxPortTokenPage, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStartOptions, type SandboxStatus, type SandboxTerminalOptions, type SandboxTimeoutOptions, type SandboxWaitOptions, Sandboxes, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as S3Mount, 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 S3CompatibleMount, 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 RootAttrs, _ as MultipartUploadListing, a as DeleteObjectsResult, b as PartInfo, c as ExecResult, d as ListMultipartUploadsOptions, et as TokenUser, 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, nt as ApiClient, o as Disk, p as ListObjectsResult, q as MountConfig, r as DeleteObjectsError, rt as ArchilTlsOptions, s as DiskMultipart, t as AppendObjectOptions, tt as FileSystem, u as GrepResult, v as MultipartUploadSummary, w as PutObjectResult, x as PartListing, y as ObjectMetadata, z as DiskResponse } from "./disk-iq-QAbnz.mjs";
1
+ import { $ as RootAttrs, A as effectiveUploadPartSize, B as DiskMetrics, C as PosixCreateAttrs, D as ShareUrlOptions, E as S3Object, F as Branch, G as ExecRequest, H as DiskStatus, I as ConnectedClient, J as GrepStoppedReason, K as GCSMount, L as CreateApiTokenRequest, M as AuthorizedUser, N as AwsStsUser, O as ShareUrlResult, P as AzureBlobMount, Q as R2Mount, R as CreateDiskRequest, S as PartListing, T as PutObjectResult, U as DiskUser, V as DiskResponse, W as ExecDiskResult, X as MountConfigResponse, Y as MountConfig, Z as MountResponse, _ as MultipartUpload, a as DeleteObjectsOptions, at as ArchilTlsOptions, b as ObjectMetadata, c as DiskMultipart, d as GrepResult, et as S3CompatibleMount, f as ListMultipartUploadsOptions, g as MountOptions, h as ListPartsOptions, i as DeleteObjectsError, it as ApiClient, j as ApiTokenResponse, k as UploadPart, l as ExecResult, m as ListObjectsResult, n as CompletedMultipartUpload, nt as TokenUser, o as DeleteObjectsResult, p as ListObjectsOptions, q as GrepMatch, r as CreateBranchOptions, rt as FileSystem, s as Disk, t as AppendObjectOptions, tt as S3Mount, u as GrepOptions, v as MultipartUploadListing, w as PutObjectOptions, x as PartInfo, y as MultipartUploadSummary, z as Delegation } from "./disk-MmfqVyPo.mjs";
2
2
  import { components } from "@archildata/api-types";
3
3
 
4
4
  //#region src/disks.d.ts
@@ -263,9 +263,31 @@ type SandboxNetwork = Omit<components["schemas"]["SandboxNetwork"], "egress"> &
263
263
  egress?: SandboxEgressPolicy;
264
264
  };
265
265
  /** @internal */
266
- type SandboxWire = components["schemas"]["Sandbox"] & {
267
- idle_ttl_seconds?: number;
268
- };
266
+ type SandboxWire = components["schemas"]["Sandbox"];
267
+ /**
268
+ * One Archil disk to mount inside a sandbox. `path` is the absolute guest
269
+ * directory; it may be omitted only for a sole mount, which then lands at
270
+ * `/mnt/archil`. A plain mount is exclusive and `queueMs` bounds the wait for
271
+ * its root delegation; `readOnly` and `conditional` mounts never take it.
272
+ */
273
+ interface SandboxMountSpec extends Omit<ExecMountSpec, "checkoutPaths" | "queueMs"> {
274
+ path?: string;
275
+ /**
276
+ * Milliseconds a plain mount waits for the disk's exclusive root delegation
277
+ * before the boot fails. Cannot be combined with `readOnly` or `conditional`.
278
+ */
279
+ queueMs?: number;
280
+ }
281
+ /** An Archil disk mounted inside the sandbox, as currently configured. */
282
+ interface SandboxMount {
283
+ diskId: string;
284
+ /** Absolute guest directory the disk is mounted at. */
285
+ path: string;
286
+ subdirectory?: string;
287
+ readOnly: boolean;
288
+ conditional: boolean;
289
+ queueMs?: number;
290
+ }
269
291
  type SandboxStatus = components["schemas"]["SandboxState"];
270
292
  interface SandboxEndpoint {
271
293
  port: number;
@@ -311,6 +333,8 @@ interface SandboxResponse {
311
333
  /** Maximum concurrently attached process sessions. Detached processes and one-shot controls do not count. */
312
334
  maxConcurrentExecs: number;
313
335
  endpoints?: SandboxEndpoint[];
336
+ /** Disks mounted inside the guest on every boot. */
337
+ mounts: SandboxMount[];
314
338
  createdAt: Date;
315
339
  runningAt?: Date;
316
340
  finishedAt?: Date;
@@ -326,6 +350,14 @@ interface SandboxWaitOptions {
326
350
  */
327
351
  wait?: boolean;
328
352
  }
353
+ interface SandboxStartOptions extends SandboxWaitOptions {
354
+ /**
355
+ * Replace the sandbox's disk mounts for this and later sessions. Omit to
356
+ * keep the current ones. A cold start only: resume keeps the paused
357
+ * session's mounts.
358
+ */
359
+ mounts?: SandboxMountSpec[];
360
+ }
329
361
  interface SandboxForkOptions extends SandboxWaitOptions {
330
362
  /** Name for the fork. The server generates one when omitted. */
331
363
  name?: string;
@@ -349,6 +381,7 @@ declare class Sandbox {
349
381
  idleTtlSeconds: number;
350
382
  maxConcurrentExecs: number;
351
383
  endpoints?: SandboxEndpoint[];
384
+ mounts: SandboxMount[];
352
385
  createdAt: Date;
353
386
  runningAt?: Date;
354
387
  finishedAt?: Date;
@@ -376,7 +409,7 @@ declare class Sandbox {
376
409
  /** Re-fetch this sandbox. */
377
410
  refresh(): Promise<this>;
378
411
  /** Start this sandbox. */
379
- start(options?: SandboxWaitOptions): Promise<Sandbox | this>;
412
+ start(options?: SandboxStartOptions): Promise<Sandbox | this>;
380
413
  /** Stop this sandbox. */
381
414
  stop(options?: SandboxWaitOptions): Promise<Sandbox | this>;
382
415
  /** Pause this sandbox, preserving its CPU and memory state. */
@@ -449,6 +482,12 @@ interface CreateSandboxRequest {
449
482
  network?: SandboxNetwork;
450
483
  /** TCP ports to expose publicly, from 1 to 65535. */
451
484
  ports?: number[];
485
+ /**
486
+ * Disks mounted inside the guest for the first session; `sandbox.start()`
487
+ * can replace them later. A sandbox with mounts must be stopped before it
488
+ * is forked.
489
+ */
490
+ mounts?: SandboxMountSpec[];
452
491
  }
453
492
  interface ListSandboxesOptions {
454
493
  /** Only return sandboxes that mount this disk. */
@@ -717,4 +756,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
717
756
  */
718
757
  declare function workspace(mounts: Record<string, ExecMount>): Workspace;
719
758
  //#endregion
720
- export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type ArchilTlsOptions, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type BuildImageOptions, type BuildImageRequest, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type CreateSandboxPortTokenOptions, type CreateSandboxRequest, type CreatedSandboxPortToken, 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 Image, ImageBuildError, type ImageFailureReason, type ImageStatus, Images, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListSandboxPortTokensOptions, type ListSandboxesOptions, 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 RegistryAuth, type RootAttrs, type S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxEgressPolicy, type SandboxEgressRule, type SandboxEgressTransform, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxNetwork, type SandboxNetworkAction, SandboxPauseError, type SandboxPortToken, type SandboxPortTokenPage, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStatus, type SandboxTerminalOptions, type SandboxTimeoutOptions, type SandboxWaitOptions, Sandboxes, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
759
+ export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type ArchilTlsOptions, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type Branch, type BuildImageOptions, type BuildImageRequest, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateBranchOptions, type CreateDiskRequest, type CreateDiskResult, type CreateSandboxPortTokenOptions, type CreateSandboxRequest, type CreatedSandboxPortToken, 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 Image, ImageBuildError, type ImageFailureReason, type ImageStatus, Images, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListSandboxPortTokensOptions, type ListSandboxesOptions, 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 RegistryAuth, type RootAttrs, type S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxEgressPolicy, type SandboxEgressRule, type SandboxEgressTransform, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxMount, type SandboxMountSpec, type SandboxNetwork, type SandboxNetworkAction, SandboxPauseError, type SandboxPortToken, type SandboxPortTokenPage, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStartOptions, type SandboxStatus, type SandboxTerminalOptions, type SandboxTimeoutOptions, type SandboxWaitOptions, Sandboxes, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { A as ArchilError, C as Disk, D as VERSION, E as USER_AGENT, M as ImageBuildError, N as SandboxFileTransferError, P as SandboxPauseError, S as Disks, T as effectiveUploadPartSize, _ as Sandbox, a as deleteApiKey, b as SandboxProcesses, c as getSandbox, d as listSandboxes, f as workspace, g as Sandboxes, h as Tokens, i as createSandbox, j as ArchilS3Error, k as ArchilApiError, l as listApiKeys, m as Workspace, n as createApiKey, o as exec, p as Archil, r as createDisk, s as getDisk, t as configure, u as listDisks, v as SandboxFiles, w as DiskMultipart, x as Images, y as SandboxProcess } from "./src-CXTEUmMV.mjs";
1
+ import { A as ArchilError, C as Disk, D as VERSION, E as USER_AGENT, M as ImageBuildError, N as SandboxFileTransferError, P as SandboxPauseError, S as Disks, T as effectiveUploadPartSize, _ as Sandbox, a as deleteApiKey, b as SandboxProcesses, c as getSandbox, d as listSandboxes, f as workspace, g as Sandboxes, h as Tokens, i as createSandbox, j as ArchilS3Error, k as ArchilApiError, l as listApiKeys, m as Workspace, n as createApiKey, o as exec, p as Archil, r as createDisk, s as getDisk, t as configure, u as listDisks, v as SandboxFiles, w as DiskMultipart, x as Images, y as SandboxProcess } from "./src-vpVe_Scb.mjs";
2
2
  export { Archil, ArchilApiError, ArchilError, ArchilS3Error, Disk, DiskMultipart, Disks, ImageBuildError, Images, Sandbox, SandboxFileTransferError, SandboxFiles, SandboxPauseError, SandboxProcess, SandboxProcesses, Sandboxes, Tokens, USER_AGENT, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
@@ -1,4 +1,4 @@
1
- import { tt as FileSystem } from "../disk-iq-QAbnz.cjs";
1
+ import { rt as FileSystem } from "../disk-MmfqVyPo.cjs";
2
2
  import { ZodType, z } from "zod";
3
3
 
4
4
  //#region src/internal/tools.d.ts
@@ -1,4 +1,4 @@
1
- import { tt as FileSystem } from "../disk-iq-QAbnz.mjs";
1
+ import { rt as FileSystem } from "../disk-MmfqVyPo.mjs";
2
2
  import { ZodType, z } from "zod";
3
3
 
4
4
  //#region src/internal/tools.d.ts
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { k as ArchilApiError, p as Archil } from "./src-CXTEUmMV.mjs";
3
- import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-BkH4aHPf.mjs";
2
+ import { k as ArchilApiError, p as Archil } from "./src-vpVe_Scb.mjs";
3
+ import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-Dl6NSqjY.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { Command } from "commander";
6
6
  import { spinner } from "@clack/prompts";
@@ -140,7 +140,7 @@ function deriveS3BaseUrl(controlBaseUrl) {
140
140
  }
141
141
  //#endregion
142
142
  //#region src/version.ts
143
- const VERSION = "1.7.0";
143
+ const VERSION = "1.9.0";
144
144
  const USER_AGENT = `archil-js/${VERSION}`;
145
145
  //#endregion
146
146
  //#region src/client.ts
@@ -476,6 +476,38 @@ var Disk = class {
476
476
  }
477
477
  }), "connect"));
478
478
  }
479
+ /**
480
+ * Create a branch: an independent, writable fork of this disk that starts
481
+ * from a committed checkpoint. Writes on the branch don't affect its source.
482
+ *
483
+ * Fails with a 409 if a branch with this name already exists or the
484
+ * checkpoint is not yet committed, and a 404 if the checkpoint or
485
+ * `fromBranch` doesn't exist.
486
+ */
487
+ async createBranch(options) {
488
+ const idempotencyKey = options.idempotencyKey ?? globalThis.crypto.randomUUID();
489
+ return unwrap(retryApiRequest(() => this._client.POST("/api/disks/{id}/branches", {
490
+ params: {
491
+ path: { id: this.id },
492
+ header: { "Idempotency-Key": idempotencyKey }
493
+ },
494
+ body: {
495
+ branch_name: options.name,
496
+ from_checkpoint_name: options.fromCheckpoint,
497
+ from_branch: options.fromBranch
498
+ }
499
+ }), "transient"));
500
+ }
501
+ /** List every branch of this disk, including branches of branches, in no particular order. */
502
+ async listBranches() {
503
+ return unwrap(retryApiRequest(() => this._client.GET("/api/disks/{id}/branches", { params: { path: { id: this.id } } }), "transient"));
504
+ }
505
+ async getBranch(name) {
506
+ return unwrap(retryApiRequest(() => this._client.GET("/api/disks/{id}/branches/{name}", { params: { path: {
507
+ id: this.id,
508
+ name
509
+ } } }), "transient"));
510
+ }
479
511
  async getAllowedIPs() {
480
512
  return (await unwrap(retryApiRequest(() => this._client.GET("/api/disks/{id}/allowed-ips", { params: { path: { id: this.id } } }), "transient"))).allowedIps;
481
513
  }
@@ -1883,6 +1915,29 @@ function toError(error) {
1883
1915
  }
1884
1916
  //#endregion
1885
1917
  //#region src/sandbox.ts
1918
+ /** @internal */
1919
+ function sandboxMountWire(mount) {
1920
+ const entry = {
1921
+ disk_id: typeof mount.disk === "string" ? mount.disk : mount.disk.id,
1922
+ read_only: mount.readOnly ?? false,
1923
+ conditional: mount.conditional ?? false
1924
+ };
1925
+ if (mount.path !== void 0) entry.path = mount.path;
1926
+ if (mount.subdirectory !== void 0) entry.subdirectory = mount.subdirectory;
1927
+ if (mount.queueMs !== void 0) entry.queue_ms = mount.queueMs;
1928
+ return entry;
1929
+ }
1930
+ function sandboxMountFromWire(mount) {
1931
+ const out = {
1932
+ diskId: mount.disk_id,
1933
+ path: mount.path,
1934
+ readOnly: mount.read_only ?? false,
1935
+ conditional: mount.conditional ?? false
1936
+ };
1937
+ if (mount.subdirectory !== void 0) out.subdirectory = mount.subdirectory;
1938
+ if (mount.queue_ms !== void 0) out.queueMs = mount.queue_ms;
1939
+ return out;
1940
+ }
1886
1941
  function portTokenFromWire(data) {
1887
1942
  return {
1888
1943
  id: data.id,
@@ -1908,6 +1963,7 @@ var Sandbox = class Sandbox {
1908
1963
  idleTtlSeconds;
1909
1964
  maxConcurrentExecs;
1910
1965
  endpoints;
1966
+ mounts;
1911
1967
  createdAt;
1912
1968
  runningAt;
1913
1969
  finishedAt;
@@ -1940,6 +1996,7 @@ var Sandbox = class Sandbox {
1940
1996
  this.idleTtlSeconds = data.idle_ttl_seconds ?? 0;
1941
1997
  this.maxConcurrentExecs = data.max_concurrent_execs;
1942
1998
  this.endpoints = data.endpoints?.map((endpoint) => ({ ...endpoint }));
1999
+ this.mounts = (data.mounts ?? []).map(sandboxMountFromWire);
1943
2000
  this.createdAt = new Date(data.created_at);
1944
2001
  this.runningAt = data.running_at ? new Date(data.running_at) : void 0;
1945
2002
  this.finishedAt = data.finished_at ? new Date(data.finished_at) : void 0;
@@ -1962,6 +2019,7 @@ var Sandbox = class Sandbox {
1962
2019
  idleTtlSeconds: this.idleTtlSeconds,
1963
2020
  maxConcurrentExecs: this.maxConcurrentExecs,
1964
2021
  endpoints: this.endpoints?.map((endpoint) => ({ ...endpoint })),
2022
+ mounts: this.mounts.map((mount) => ({ ...mount })),
1965
2023
  createdAt: this.createdAt,
1966
2024
  runningAt: this.runningAt,
1967
2025
  finishedAt: this.finishedAt,
@@ -2033,10 +2091,13 @@ var Sandbox = class Sandbox {
2033
2091
  }
2034
2092
  /** Start this sandbox. */
2035
2093
  async start(options = {}) {
2036
- const data = await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes/{sid}/start", { params: {
2037
- path: { sid: this.id },
2038
- query: { wait: options.wait ?? true }
2039
- } }), "transient"));
2094
+ const data = await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes/{sid}/start", {
2095
+ params: {
2096
+ path: { sid: this.id },
2097
+ query: { wait: options.wait ?? true }
2098
+ },
2099
+ ...options.mounts !== void 0 && { body: { mounts: options.mounts.map(sandboxMountWire) } }
2100
+ }), options.mounts === void 0 ? "transient" : "connect"));
2040
2101
  this._apply(data);
2041
2102
  return options.wait === false ? this : waitForSandboxStart(this);
2042
2103
  }
@@ -2247,7 +2308,8 @@ var Sandboxes = class {
2247
2308
  idle_ttl_seconds: request.idleTtlSeconds,
2248
2309
  max_concurrent_execs: request.maxConcurrentExecs,
2249
2310
  network: request.network,
2250
- ports: request.ports
2311
+ ports: request.ports,
2312
+ ...request.mounts !== void 0 && { mounts: request.mounts.map(sandboxMountWire) }
2251
2313
  };
2252
2314
  const sandbox = new Sandbox(await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes", {
2253
2315
  params: { query: { wait: options.wait ?? true } },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disk",
3
- "version": "1.7.0",
3
+ "version": "1.9.0",
4
4
  "description": "Pure-JS client and CLIs for Archil disks and sandboxes",
5
5
  "keywords": [
6
6
  "archil",
@@ -40,7 +40,7 @@
40
40
  "LICENSE"
41
41
  ],
42
42
  "dependencies": {
43
- "@archildata/api-types": "^0.0.49",
43
+ "@archildata/api-types": "^0.0.54",
44
44
  "@clack/prompts": "^1.7.0",
45
45
  "commander": "^14.0.3",
46
46
  "fast-xml-parser": "^5.7.0",