disk 1.8.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
@@ -703,6 +703,38 @@ A delegation has no ID of its own — it is identified by the
703
703
  connected to the disk. `path` is resolved best-effort by the server and may be
704
704
  absent.
705
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
+
706
738
  A `Workspace` is a full filesystem in its own right — it has the same object API
707
739
  a `Disk` does (`getObject` / `putObject` / `deleteObject` / `listObjects` /
708
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-c7xI3gpo.mjs";
3
- import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-CCIBdgS1.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-c7xI3gpo.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.8.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
  }
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
@@ -756,4 +756,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
756
756
  */
757
757
  declare function workspace(mounts: Record<string, ExecMount>): Workspace;
758
758
  //#endregion
759
- 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 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 };
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
@@ -756,4 +756,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
756
756
  */
757
757
  declare function workspace(mounts: Record<string, ExecMount>): Workspace;
758
758
  //#endregion
759
- 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 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 };
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-c7xI3gpo.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-c7xI3gpo.mjs";
3
- import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-CCIBdgS1.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.8.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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disk",
3
- "version": "1.8.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",