disk 1.7.0 → 1.8.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
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-c7xI3gpo.mjs";
3
+ import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-CCIBdgS1.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-c7xI3gpo.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";
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.8.0";
167
167
  const USER_AGENT = `archil-js/${VERSION}`;
168
168
  //#endregion
169
169
  //#region src/client.ts
@@ -1906,6 +1906,29 @@ function toError(error) {
1906
1906
  }
1907
1907
  //#endregion
1908
1908
  //#region src/sandbox.ts
1909
+ /** @internal */
1910
+ function sandboxMountWire(mount) {
1911
+ const entry = {
1912
+ disk_id: typeof mount.disk === "string" ? mount.disk : mount.disk.id,
1913
+ read_only: mount.readOnly ?? false,
1914
+ conditional: mount.conditional ?? false
1915
+ };
1916
+ if (mount.path !== void 0) entry.path = mount.path;
1917
+ if (mount.subdirectory !== void 0) entry.subdirectory = mount.subdirectory;
1918
+ if (mount.queueMs !== void 0) entry.queue_ms = mount.queueMs;
1919
+ return entry;
1920
+ }
1921
+ function sandboxMountFromWire(mount) {
1922
+ const out = {
1923
+ diskId: mount.disk_id,
1924
+ path: mount.path,
1925
+ readOnly: mount.read_only ?? false,
1926
+ conditional: mount.conditional ?? false
1927
+ };
1928
+ if (mount.subdirectory !== void 0) out.subdirectory = mount.subdirectory;
1929
+ if (mount.queue_ms !== void 0) out.queueMs = mount.queue_ms;
1930
+ return out;
1931
+ }
1909
1932
  function portTokenFromWire(data) {
1910
1933
  return {
1911
1934
  id: data.id,
@@ -1931,6 +1954,7 @@ var Sandbox = class Sandbox {
1931
1954
  idleTtlSeconds;
1932
1955
  maxConcurrentExecs;
1933
1956
  endpoints;
1957
+ mounts;
1934
1958
  createdAt;
1935
1959
  runningAt;
1936
1960
  finishedAt;
@@ -1963,6 +1987,7 @@ var Sandbox = class Sandbox {
1963
1987
  this.idleTtlSeconds = data.idle_ttl_seconds ?? 0;
1964
1988
  this.maxConcurrentExecs = data.max_concurrent_execs;
1965
1989
  this.endpoints = data.endpoints?.map((endpoint) => ({ ...endpoint }));
1990
+ this.mounts = (data.mounts ?? []).map(sandboxMountFromWire);
1966
1991
  this.createdAt = new Date(data.created_at);
1967
1992
  this.runningAt = data.running_at ? new Date(data.running_at) : void 0;
1968
1993
  this.finishedAt = data.finished_at ? new Date(data.finished_at) : void 0;
@@ -1985,6 +2010,7 @@ var Sandbox = class Sandbox {
1985
2010
  idleTtlSeconds: this.idleTtlSeconds,
1986
2011
  maxConcurrentExecs: this.maxConcurrentExecs,
1987
2012
  endpoints: this.endpoints?.map((endpoint) => ({ ...endpoint })),
2013
+ mounts: this.mounts.map((mount) => ({ ...mount })),
1988
2014
  createdAt: this.createdAt,
1989
2015
  runningAt: this.runningAt,
1990
2016
  finishedAt: this.finishedAt,
@@ -2056,10 +2082,13 @@ var Sandbox = class Sandbox {
2056
2082
  }
2057
2083
  /** Start this sandbox. */
2058
2084
  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"));
2085
+ const data = await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes/{sid}/start", {
2086
+ params: {
2087
+ path: { sid: this.id },
2088
+ query: { wait: options.wait ?? true }
2089
+ },
2090
+ ...options.mounts !== void 0 && { body: { mounts: options.mounts.map(sandboxMountWire) } }
2091
+ }), options.mounts === void 0 ? "transient" : "connect"));
2063
2092
  this._apply(data);
2064
2093
  return options.wait === false ? this : waitForSandboxStart(this);
2065
2094
  }
@@ -2270,7 +2299,8 @@ var Sandboxes = class {
2270
2299
  idle_ttl_seconds: request.idleTtlSeconds,
2271
2300
  max_concurrent_execs: request.maxConcurrentExecs,
2272
2301
  network: request.network,
2273
- ports: request.ports
2302
+ ports: request.ports,
2303
+ ...request.mounts !== void 0 && { mounts: request.mounts.map(sandboxMountWire) }
2274
2304
  };
2275
2305
  const sandbox = new Sandbox(await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes", {
2276
2306
  params: { query: { wait: options.wait ?? true } },
package/dist/index.d.cts CHANGED
@@ -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 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 };
package/dist/index.d.mts CHANGED
@@ -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 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 };
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-c7xI3gpo.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,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-c7xI3gpo.mjs";
3
+ import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-CCIBdgS1.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.8.0";
144
144
  const USER_AGENT = `archil-js/${VERSION}`;
145
145
  //#endregion
146
146
  //#region src/client.ts
@@ -1883,6 +1883,29 @@ function toError(error) {
1883
1883
  }
1884
1884
  //#endregion
1885
1885
  //#region src/sandbox.ts
1886
+ /** @internal */
1887
+ function sandboxMountWire(mount) {
1888
+ const entry = {
1889
+ disk_id: typeof mount.disk === "string" ? mount.disk : mount.disk.id,
1890
+ read_only: mount.readOnly ?? false,
1891
+ conditional: mount.conditional ?? false
1892
+ };
1893
+ if (mount.path !== void 0) entry.path = mount.path;
1894
+ if (mount.subdirectory !== void 0) entry.subdirectory = mount.subdirectory;
1895
+ if (mount.queueMs !== void 0) entry.queue_ms = mount.queueMs;
1896
+ return entry;
1897
+ }
1898
+ function sandboxMountFromWire(mount) {
1899
+ const out = {
1900
+ diskId: mount.disk_id,
1901
+ path: mount.path,
1902
+ readOnly: mount.read_only ?? false,
1903
+ conditional: mount.conditional ?? false
1904
+ };
1905
+ if (mount.subdirectory !== void 0) out.subdirectory = mount.subdirectory;
1906
+ if (mount.queue_ms !== void 0) out.queueMs = mount.queue_ms;
1907
+ return out;
1908
+ }
1886
1909
  function portTokenFromWire(data) {
1887
1910
  return {
1888
1911
  id: data.id,
@@ -1908,6 +1931,7 @@ var Sandbox = class Sandbox {
1908
1931
  idleTtlSeconds;
1909
1932
  maxConcurrentExecs;
1910
1933
  endpoints;
1934
+ mounts;
1911
1935
  createdAt;
1912
1936
  runningAt;
1913
1937
  finishedAt;
@@ -1940,6 +1964,7 @@ var Sandbox = class Sandbox {
1940
1964
  this.idleTtlSeconds = data.idle_ttl_seconds ?? 0;
1941
1965
  this.maxConcurrentExecs = data.max_concurrent_execs;
1942
1966
  this.endpoints = data.endpoints?.map((endpoint) => ({ ...endpoint }));
1967
+ this.mounts = (data.mounts ?? []).map(sandboxMountFromWire);
1943
1968
  this.createdAt = new Date(data.created_at);
1944
1969
  this.runningAt = data.running_at ? new Date(data.running_at) : void 0;
1945
1970
  this.finishedAt = data.finished_at ? new Date(data.finished_at) : void 0;
@@ -1962,6 +1987,7 @@ var Sandbox = class Sandbox {
1962
1987
  idleTtlSeconds: this.idleTtlSeconds,
1963
1988
  maxConcurrentExecs: this.maxConcurrentExecs,
1964
1989
  endpoints: this.endpoints?.map((endpoint) => ({ ...endpoint })),
1990
+ mounts: this.mounts.map((mount) => ({ ...mount })),
1965
1991
  createdAt: this.createdAt,
1966
1992
  runningAt: this.runningAt,
1967
1993
  finishedAt: this.finishedAt,
@@ -2033,10 +2059,13 @@ var Sandbox = class Sandbox {
2033
2059
  }
2034
2060
  /** Start this sandbox. */
2035
2061
  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"));
2062
+ const data = await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes/{sid}/start", {
2063
+ params: {
2064
+ path: { sid: this.id },
2065
+ query: { wait: options.wait ?? true }
2066
+ },
2067
+ ...options.mounts !== void 0 && { body: { mounts: options.mounts.map(sandboxMountWire) } }
2068
+ }), options.mounts === void 0 ? "transient" : "connect"));
2040
2069
  this._apply(data);
2041
2070
  return options.wait === false ? this : waitForSandboxStart(this);
2042
2071
  }
@@ -2247,7 +2276,8 @@ var Sandboxes = class {
2247
2276
  idle_ttl_seconds: request.idleTtlSeconds,
2248
2277
  max_concurrent_execs: request.maxConcurrentExecs,
2249
2278
  network: request.network,
2250
- ports: request.ports
2279
+ ports: request.ports,
2280
+ ...request.mounts !== void 0 && { mounts: request.mounts.map(sandboxMountWire) }
2251
2281
  };
2252
2282
  const sandbox = new Sandbox(await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes", {
2253
2283
  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.8.0",
4
4
  "description": "Pure-JS client and CLIs for Archil disks and sandboxes",
5
5
  "keywords": [
6
6
  "archil",