disk 1.3.0 → 1.5.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
@@ -105,6 +105,38 @@ await d.removeUser("token", user.identifier!);
105
105
  await d.delete();
106
106
  ```
107
107
 
108
+ ### Private certificate authorities (Node.js)
109
+
110
+ For BYOC endpoints signed by a private CA, configure trust on the client:
111
+
112
+ ```ts
113
+ import { readFileSync } from "node:fs";
114
+ import { getCACertificates } from "node:tls";
115
+ import { Archil } from "disk";
116
+
117
+ const client = new Archil({
118
+ apiKey: process.env.ARCHIL_API_KEY,
119
+ region: "aws-us-east-2",
120
+ baseUrl: "https://control.archil.example.internal",
121
+ s3BaseUrl: "https://s3.archil.example.internal",
122
+ tls: {
123
+ ca: [...getCACertificates(), readFileSync("archil-ca.pem")],
124
+ },
125
+ });
126
+ ```
127
+
128
+ `tls.ca` accepts a PEM string, a `Buffer`, or an array of either. As with Node's
129
+ TLS `ca` option, it **replaces** the default trust list. The example includes Node's
130
+ defaults as well as the private CA; `getCACertificates()` requires Node 22.15+.
131
+ Omitting `tls.ca` preserves Node's default trust behavior.
132
+
133
+ The configuration applies to this client's control-plane and S3-compatible requests,
134
+ with certificate and hostname verification enabled. It does not change Node's global
135
+ dispatcher or default trust. HTTP/2 pooling is preserved, and clients only share pools
136
+ when their endpoint, API key, and CA configuration match. CA arrays and buffers are
137
+ copied at construction; create a new client to change trust settings. Custom CAs are
138
+ not supported in browsers.
139
+
108
140
  ### Sandboxes
109
141
 
110
142
  Use `Archil.sandboxes` to manage persistent VMs:
@@ -665,3 +697,36 @@ Archil has two credential types, and the examples above use both:
665
697
  ## Support
666
698
 
667
699
  Questions, feature requests, or issues? Reach us at **support@archil.com**.
700
+
701
+
702
+ To finish selected model requests before pausing, opt in when creating the sandbox:
703
+
704
+ ```ts
705
+ const sandbox = await archil.sandboxes.create({
706
+ network: {
707
+ egress: {
708
+ default: "allow",
709
+ drain_on_pause: [
710
+ "*.anthropic.com",
711
+ "api.openai.com",
712
+ "bedrock-runtime.*.amazonaws.com",
713
+ ],
714
+ },
715
+ },
716
+ });
717
+ await sandbox.pause();
718
+ ```
719
+
720
+ Each entry is a lowercase hostname pattern without a scheme, port, or path.
721
+ `*` works anywhere; `"*"` selects every host. Leading `*.` excludes the apex domain.
722
+ All URL paths on a selected host count. Matching happens before forwarding. Selectors
723
+ do not grant network access. Pausing gates new matches and waits for active HTTP(S)
724
+ responses, including streams, to reach the guest. Requests to other hosts do not delay the drain.
725
+ The drain waits up to ten minutes by default, starting when pause begins. Request errors
726
+ stop counting; expiry proceeds with the snapshot. Requests have no added timeout during
727
+ normal operation.
728
+ HTTP ports 80 and 443 are supported. Clients must trust the sandbox egress CA for HTTPS
729
+ and retry stale connections after resume. Set selectors at creation to cover every
730
+ connection; live network updates cannot intercept existing passthrough connections.
731
+ A snapshot failure leaves the sandbox in `failed` with the failure reason and raises
732
+ `SandboxPauseError` when waiting; `error.latest` contains the resulting sandbox state.
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { O as ArchilApiError, a as deleteApiKey, l as listApiKeys, n as createApiKey, r as createDisk, s as getDisk, t as configure, u as listDisks } from "./src-CvTkHglv.mjs";
3
- import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-BFAzXgkJ.mjs";
2
+ import { O as ArchilApiError, a as deleteApiKey, l as listApiKeys, n as createApiKey, r as createDisk, s as getDisk, t as configure, u as listDisks } from "./src-r2oVqVK_.mjs";
3
+ import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-Bi2YnNf6.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 { D as REGION_URLS, p as Archil } from "./src-CvTkHglv.mjs";
1
+ import { D as REGION_URLS, p as Archil } from "./src-r2oVqVK_.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";
@@ -1,7 +1,17 @@
1
1
  import { Client } from "openapi-fetch";
2
2
  import { components, paths } from "@archildata/api-types";
3
+ import { ConnectionOptions } from "node:tls";
4
+
3
5
  //#region src/client.d.ts
4
6
  type ApiClient = Client<paths>;
7
+ interface ArchilTlsOptions {
8
+ /**
9
+ * Trusted PEM CA certificates for this client's control-plane and S3 requests
10
+ * (Node.js only). Replaces Node's default CA list; include those certificates
11
+ * explicitly to retain them. Certificate and hostname verification stay enabled.
12
+ */
13
+ ca?: ConnectionOptions["ca"];
14
+ }
5
15
  //#endregion
6
16
  //#region src/filesystem.d.ts
7
17
  /**
@@ -708,4 +718,4 @@ declare class DiskMultipart {
708
718
  */
709
719
  declare function effectiveUploadPartSize(totalBytes: number, requestedPartSize: number): number;
710
720
  //#endregion
711
- 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, 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 };
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 };
@@ -1,7 +1,17 @@
1
1
  import { Client } from "openapi-fetch";
2
2
  import { components, paths } from "@archildata/api-types";
3
+ import { ConnectionOptions } from "node:tls";
4
+
3
5
  //#region src/client.d.ts
4
6
  type ApiClient = Client<paths>;
7
+ interface ArchilTlsOptions {
8
+ /**
9
+ * Trusted PEM CA certificates for this client's control-plane and S3 requests
10
+ * (Node.js only). Replaces Node's default CA list; include those certificates
11
+ * explicitly to retain them. Certificate and hostname verification stay enabled.
12
+ */
13
+ ca?: ConnectionOptions["ca"];
14
+ }
5
15
  //#endregion
6
16
  //#region src/filesystem.d.ts
7
17
  /**
@@ -708,4 +718,4 @@ declare class DiskMultipart {
708
718
  */
709
719
  declare function effectiveUploadPartSize(totalBytes: number, requestedPartSize: number): number;
710
720
  //#endregion
711
- 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, 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 };
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 };
package/dist/index.cjs CHANGED
@@ -62,6 +62,14 @@ var ArchilApiError = class extends ArchilError {
62
62
  this.name = "ArchilApiError";
63
63
  }
64
64
  };
65
+ var SandboxPauseError = class extends ArchilError {
66
+ latest;
67
+ constructor(latest) {
68
+ super(`Sandbox entered ${latest.status} before it paused${latest.exitReason ? `: ${latest.exitReason}` : ""}`, 409, "SANDBOX_PAUSE_FAILED");
69
+ this.latest = latest;
70
+ this.name = "SandboxPauseError";
71
+ }
72
+ };
65
73
  var SandboxFileTransferError = class extends ArchilError {
66
74
  operation;
67
75
  path;
@@ -145,7 +153,7 @@ function deriveS3BaseUrl(controlBaseUrl) {
145
153
  }
146
154
  //#endregion
147
155
  //#region src/version.ts
148
- const VERSION = "1.3.0";
156
+ const VERSION = "1.5.0";
149
157
  const USER_AGENT = `archil-js/${VERSION}`;
150
158
  //#endregion
151
159
  //#region src/client.ts
@@ -198,11 +206,14 @@ const multiplexHttp2Requests = (dispatch) => (options, handler) => {
198
206
  return true;
199
207
  };
200
208
  const sharedDispatchers = /* @__PURE__ */ new Map();
201
- function dispatcherKey(baseUrl, apiKey) {
202
- return `${new URL(baseUrl).origin}\0${apiKey}`;
203
- }
204
- function getSharedDispatcher(baseUrl, apiKey) {
205
- const key = dispatcherKey(baseUrl, apiKey);
209
+ function dispatcherKey(baseUrl, apiKey, ca) {
210
+ return JSON.stringify([
211
+ new URL(baseUrl).origin,
212
+ apiKey,
213
+ ca?.map((cert) => cert.toString("base64"))
214
+ ]);
215
+ }
216
+ function getSharedDispatcher(key, ca) {
206
217
  const existing = sharedDispatchers.get(key);
207
218
  if (existing) return existing;
208
219
  const dispatcher = (async () => {
@@ -213,7 +224,8 @@ function getSharedDispatcher(baseUrl, apiKey) {
213
224
  connections: CONTROL_PLANE_CONNECTIONS,
214
225
  pipelining: CONTROL_PLANE_CONCURRENT_STREAMS,
215
226
  keepAliveTimeout: 6e4,
216
- keepAliveMaxTimeout: 6e5
227
+ keepAliveMaxTimeout: 6e5,
228
+ ...ca === void 0 ? {} : { connect: { ca } }
217
229
  }).compose(multiplexHttp2Requests);
218
230
  })();
219
231
  sharedDispatchers.set(key, dispatcher);
@@ -222,10 +234,15 @@ function getSharedDispatcher(baseUrl, apiKey) {
222
234
  });
223
235
  return dispatcher;
224
236
  }
225
- function createPooledFetch(baseUrl, apiKey) {
226
- if (!isNodeRuntime()) return void 0;
237
+ function createPooledFetch(baseUrl, apiKey, tls) {
238
+ if (!isNodeRuntime()) {
239
+ if (tls?.ca !== void 0) throw new Error("Custom TLS CAs require Node.js");
240
+ return;
241
+ }
242
+ const ca = tls?.ca === void 0 ? void 0 : (Array.isArray(tls.ca) ? tls.ca : [tls.ca]).map((cert) => Buffer.from(cert));
243
+ const key = dispatcherKey(baseUrl, apiKey, ca);
227
244
  return async (request) => {
228
- const dispatcher = await getSharedDispatcher(baseUrl, apiKey);
245
+ const dispatcher = await getSharedDispatcher(key, ca);
229
246
  return globalThis.fetch(request, { dispatcher });
230
247
  };
231
248
  }
@@ -234,7 +251,7 @@ function createApiClient(opts) {
234
251
  const apiKey = `key-${opts.apiKey.replace(/^key-/, "")}`;
235
252
  return createClient({
236
253
  baseUrl,
237
- fetch: createPooledFetch(baseUrl, apiKey),
254
+ fetch: createPooledFetch(baseUrl, apiKey, opts.tls),
238
255
  headers: {
239
256
  Authorization: apiKey,
240
257
  "User-Agent": USER_AGENT
@@ -1964,7 +1981,10 @@ var Sandbox = class Sandbox {
1964
1981
  async pause(options = {}) {
1965
1982
  const data = await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes/{sid}/pause", { params: { path: { sid: this.id } } }), "transient"));
1966
1983
  this._apply(data);
1967
- return options.wait === false ? this : waitWhileSandboxStatus(this, "pausing");
1984
+ if (options.wait === false) return this;
1985
+ await waitWhileSandboxStatus(this, "pausing");
1986
+ if (this.status !== "paused") throw new SandboxPauseError(this);
1987
+ return this;
1968
1988
  }
1969
1989
  /** Resume this sandbox from its preserved CPU and memory state. */
1970
1990
  async resume(options = {}) {
@@ -2461,7 +2481,8 @@ var Archil = class {
2461
2481
  const client = createApiClient({
2462
2482
  apiKey,
2463
2483
  region,
2464
- baseUrl: controlBaseUrl
2484
+ baseUrl: controlBaseUrl,
2485
+ tls: opts.tls
2465
2486
  });
2466
2487
  const s3BaseUrl = opts.s3BaseUrl ?? envVar("ARCHIL_S3_BASE_URL") ?? deriveS3BaseUrl(controlBaseUrl);
2467
2488
  this._client = client;
@@ -2568,6 +2589,7 @@ exports.Disks = Disks;
2568
2589
  exports.Sandbox = Sandbox;
2569
2590
  exports.SandboxFileTransferError = SandboxFileTransferError;
2570
2591
  exports.SandboxFiles = SandboxFiles;
2592
+ exports.SandboxPauseError = SandboxPauseError;
2571
2593
  exports.SandboxProcess = SandboxProcess;
2572
2594
  exports.SandboxProcesses = SandboxProcesses;
2573
2595
  exports.Sandboxes = Sandboxes;
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, 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-CiLNoFCd.cjs";
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";
2
2
  import { components } from "@archildata/api-types";
3
3
 
4
4
  //#region src/disks.d.ts
@@ -196,10 +196,14 @@ declare class SandboxFiles {
196
196
  //#endregion
197
197
  //#region src/sandbox.d.ts
198
198
  type SandboxNetworkAction = components["schemas"]["SandboxNetworkAction"];
199
- type SandboxEgressPolicy = components["schemas"]["SandboxEgressPolicy"];
199
+ type SandboxEgressPolicy = components["schemas"]["SandboxEgressPolicy"] & {
200
+ /** Host patterns supporting * anywhere. All paths count; selectors do not grant network access. */drain_on_pause?: string[];
201
+ };
200
202
  type SandboxEgressRule = components["schemas"]["SandboxEgressRule"];
201
203
  type SandboxEgressTransform = components["schemas"]["SandboxEgressTransform"];
202
- type SandboxNetwork = components["schemas"]["SandboxNetwork"];
204
+ type SandboxNetwork = Omit<components["schemas"]["SandboxNetwork"], "egress"> & {
205
+ egress?: SandboxEgressPolicy;
206
+ };
203
207
  /** @internal */
204
208
  type SandboxWire = components["schemas"]["Sandbox"] & {
205
209
  idle_ttl_seconds?: number;
@@ -307,7 +311,7 @@ declare class Sandbox {
307
311
  /** Stop this sandbox. */
308
312
  stop(options?: SandboxWaitOptions): Promise<Sandbox | this>;
309
313
  /** Pause this sandbox, preserving its CPU and memory state. */
310
- pause(options?: SandboxWaitOptions): Promise<Sandbox | this>;
314
+ pause(options?: SandboxWaitOptions): Promise<this>;
311
315
  /** Resume this sandbox from its preserved CPU and memory state. */
312
316
  resume(options?: SandboxWaitOptions): Promise<Sandbox | this>;
313
317
  /**
@@ -472,6 +476,8 @@ interface ArchilOptions {
472
476
  * control plane URL with its `control.` hostname prefix swapped for `s3.`.
473
477
  */
474
478
  s3BaseUrl?: string;
479
+ /** Per-client TLS trust for control-plane and S3 requests (Node.js only). */
480
+ tls?: ArchilTlsOptions;
475
481
  }
476
482
  /**
477
483
  * Options that apply to a single mounted disk in an exec request.
@@ -574,6 +580,10 @@ declare class ArchilError extends Error {
574
580
  declare class ArchilApiError extends ArchilError {
575
581
  constructor(message: string, status: number, code?: string);
576
582
  }
583
+ declare class SandboxPauseError extends ArchilError {
584
+ readonly latest: Sandbox;
585
+ constructor(latest: Sandbox);
586
+ }
577
587
  declare class SandboxFileTransferError extends ArchilError {
578
588
  readonly operation: "upload" | "download";
579
589
  readonly path: string;
@@ -630,4 +640,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
630
640
  */
631
641
  declare function workspace(mounts: Record<string, ExecMount>): Workspace;
632
642
  //#endregion
633
- export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type 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 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 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, 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 };
643
+ export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type ArchilTlsOptions, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, 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 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 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 };
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, 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-CiLNoFCd.mjs";
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";
2
2
  import { components } from "@archildata/api-types";
3
3
 
4
4
  //#region src/disks.d.ts
@@ -196,10 +196,14 @@ declare class SandboxFiles {
196
196
  //#endregion
197
197
  //#region src/sandbox.d.ts
198
198
  type SandboxNetworkAction = components["schemas"]["SandboxNetworkAction"];
199
- type SandboxEgressPolicy = components["schemas"]["SandboxEgressPolicy"];
199
+ type SandboxEgressPolicy = components["schemas"]["SandboxEgressPolicy"] & {
200
+ /** Host patterns supporting * anywhere. All paths count; selectors do not grant network access. */drain_on_pause?: string[];
201
+ };
200
202
  type SandboxEgressRule = components["schemas"]["SandboxEgressRule"];
201
203
  type SandboxEgressTransform = components["schemas"]["SandboxEgressTransform"];
202
- type SandboxNetwork = components["schemas"]["SandboxNetwork"];
204
+ type SandboxNetwork = Omit<components["schemas"]["SandboxNetwork"], "egress"> & {
205
+ egress?: SandboxEgressPolicy;
206
+ };
203
207
  /** @internal */
204
208
  type SandboxWire = components["schemas"]["Sandbox"] & {
205
209
  idle_ttl_seconds?: number;
@@ -307,7 +311,7 @@ declare class Sandbox {
307
311
  /** Stop this sandbox. */
308
312
  stop(options?: SandboxWaitOptions): Promise<Sandbox | this>;
309
313
  /** Pause this sandbox, preserving its CPU and memory state. */
310
- pause(options?: SandboxWaitOptions): Promise<Sandbox | this>;
314
+ pause(options?: SandboxWaitOptions): Promise<this>;
311
315
  /** Resume this sandbox from its preserved CPU and memory state. */
312
316
  resume(options?: SandboxWaitOptions): Promise<Sandbox | this>;
313
317
  /**
@@ -472,6 +476,8 @@ interface ArchilOptions {
472
476
  * control plane URL with its `control.` hostname prefix swapped for `s3.`.
473
477
  */
474
478
  s3BaseUrl?: string;
479
+ /** Per-client TLS trust for control-plane and S3 requests (Node.js only). */
480
+ tls?: ArchilTlsOptions;
475
481
  }
476
482
  /**
477
483
  * Options that apply to a single mounted disk in an exec request.
@@ -574,6 +580,10 @@ declare class ArchilError extends Error {
574
580
  declare class ArchilApiError extends ArchilError {
575
581
  constructor(message: string, status: number, code?: string);
576
582
  }
583
+ declare class SandboxPauseError extends ArchilError {
584
+ readonly latest: Sandbox;
585
+ constructor(latest: Sandbox);
586
+ }
577
587
  declare class SandboxFileTransferError extends ArchilError {
578
588
  readonly operation: "upload" | "download";
579
589
  readonly path: string;
@@ -630,4 +640,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
630
640
  */
631
641
  declare function workspace(mounts: Record<string, ExecMount>): Workspace;
632
642
  //#endregion
633
- export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type 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 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 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, 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 };
643
+ export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type ArchilTlsOptions, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, 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 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 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 };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { A as ArchilS3Error, C as DiskMultipart, E as VERSION, O as ArchilApiError, S as Disk, T as USER_AGENT, _ 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 SandboxFileTransferError, k as ArchilError, 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 effectiveUploadPartSize, x as Disks, y as SandboxProcess } from "./src-CvTkHglv.mjs";
2
- export { Archil, ArchilApiError, ArchilError, ArchilS3Error, Disk, DiskMultipart, Disks, Sandbox, SandboxFileTransferError, SandboxFiles, SandboxProcess, SandboxProcesses, Sandboxes, Tokens, USER_AGENT, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
1
+ import { A as ArchilS3Error, C as DiskMultipart, E as VERSION, M as SandboxPauseError, O as ArchilApiError, S as Disk, T as USER_AGENT, _ 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 SandboxFileTransferError, k as ArchilError, 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 effectiveUploadPartSize, x as Disks, y as SandboxProcess } from "./src-r2oVqVK_.mjs";
2
+ export { Archil, ArchilApiError, ArchilError, ArchilS3Error, Disk, DiskMultipart, Disks, 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-CiLNoFCd.cjs";
1
+ import { tt as FileSystem } from "../disk-iq-QAbnz.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-CiLNoFCd.mjs";
1
+ import { tt as FileSystem } from "../disk-iq-QAbnz.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 { O as ArchilApiError, p as Archil } from "./src-CvTkHglv.mjs";
3
- import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-BFAzXgkJ.mjs";
2
+ import { O as ArchilApiError, p as Archil } from "./src-r2oVqVK_.mjs";
3
+ import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-Bi2YnNf6.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { Command } from "commander";
6
6
  import { spinner } from "@clack/prompts";
@@ -39,6 +39,14 @@ var ArchilApiError = class extends ArchilError {
39
39
  this.name = "ArchilApiError";
40
40
  }
41
41
  };
42
+ var SandboxPauseError = class extends ArchilError {
43
+ latest;
44
+ constructor(latest) {
45
+ super(`Sandbox entered ${latest.status} before it paused${latest.exitReason ? `: ${latest.exitReason}` : ""}`, 409, "SANDBOX_PAUSE_FAILED");
46
+ this.latest = latest;
47
+ this.name = "SandboxPauseError";
48
+ }
49
+ };
42
50
  var SandboxFileTransferError = class extends ArchilError {
43
51
  operation;
44
52
  path;
@@ -122,7 +130,7 @@ function deriveS3BaseUrl(controlBaseUrl) {
122
130
  }
123
131
  //#endregion
124
132
  //#region src/version.ts
125
- const VERSION = "1.3.0";
133
+ const VERSION = "1.5.0";
126
134
  const USER_AGENT = `archil-js/${VERSION}`;
127
135
  //#endregion
128
136
  //#region src/client.ts
@@ -175,11 +183,14 @@ const multiplexHttp2Requests = (dispatch) => (options, handler) => {
175
183
  return true;
176
184
  };
177
185
  const sharedDispatchers = /* @__PURE__ */ new Map();
178
- function dispatcherKey(baseUrl, apiKey) {
179
- return `${new URL(baseUrl).origin}\0${apiKey}`;
180
- }
181
- function getSharedDispatcher(baseUrl, apiKey) {
182
- const key = dispatcherKey(baseUrl, apiKey);
186
+ function dispatcherKey(baseUrl, apiKey, ca) {
187
+ return JSON.stringify([
188
+ new URL(baseUrl).origin,
189
+ apiKey,
190
+ ca?.map((cert) => cert.toString("base64"))
191
+ ]);
192
+ }
193
+ function getSharedDispatcher(key, ca) {
183
194
  const existing = sharedDispatchers.get(key);
184
195
  if (existing) return existing;
185
196
  const dispatcher = (async () => {
@@ -190,7 +201,8 @@ function getSharedDispatcher(baseUrl, apiKey) {
190
201
  connections: CONTROL_PLANE_CONNECTIONS,
191
202
  pipelining: CONTROL_PLANE_CONCURRENT_STREAMS,
192
203
  keepAliveTimeout: 6e4,
193
- keepAliveMaxTimeout: 6e5
204
+ keepAliveMaxTimeout: 6e5,
205
+ ...ca === void 0 ? {} : { connect: { ca } }
194
206
  }).compose(multiplexHttp2Requests);
195
207
  })();
196
208
  sharedDispatchers.set(key, dispatcher);
@@ -199,10 +211,15 @@ function getSharedDispatcher(baseUrl, apiKey) {
199
211
  });
200
212
  return dispatcher;
201
213
  }
202
- function createPooledFetch(baseUrl, apiKey) {
203
- if (!isNodeRuntime()) return void 0;
214
+ function createPooledFetch(baseUrl, apiKey, tls) {
215
+ if (!isNodeRuntime()) {
216
+ if (tls?.ca !== void 0) throw new Error("Custom TLS CAs require Node.js");
217
+ return;
218
+ }
219
+ const ca = tls?.ca === void 0 ? void 0 : (Array.isArray(tls.ca) ? tls.ca : [tls.ca]).map((cert) => Buffer.from(cert));
220
+ const key = dispatcherKey(baseUrl, apiKey, ca);
204
221
  return async (request) => {
205
- const dispatcher = await getSharedDispatcher(baseUrl, apiKey);
222
+ const dispatcher = await getSharedDispatcher(key, ca);
206
223
  return globalThis.fetch(request, { dispatcher });
207
224
  };
208
225
  }
@@ -211,7 +228,7 @@ function createApiClient(opts) {
211
228
  const apiKey = `key-${opts.apiKey.replace(/^key-/, "")}`;
212
229
  return createClient({
213
230
  baseUrl,
214
- fetch: createPooledFetch(baseUrl, apiKey),
231
+ fetch: createPooledFetch(baseUrl, apiKey, opts.tls),
215
232
  headers: {
216
233
  Authorization: apiKey,
217
234
  "User-Agent": USER_AGENT
@@ -1941,7 +1958,10 @@ var Sandbox = class Sandbox {
1941
1958
  async pause(options = {}) {
1942
1959
  const data = await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes/{sid}/pause", { params: { path: { sid: this.id } } }), "transient"));
1943
1960
  this._apply(data);
1944
- return options.wait === false ? this : waitWhileSandboxStatus(this, "pausing");
1961
+ if (options.wait === false) return this;
1962
+ await waitWhileSandboxStatus(this, "pausing");
1963
+ if (this.status !== "paused") throw new SandboxPauseError(this);
1964
+ return this;
1945
1965
  }
1946
1966
  /** Resume this sandbox from its preserved CPU and memory state. */
1947
1967
  async resume(options = {}) {
@@ -2438,7 +2458,8 @@ var Archil = class {
2438
2458
  const client = createApiClient({
2439
2459
  apiKey,
2440
2460
  region,
2441
- baseUrl: controlBaseUrl
2461
+ baseUrl: controlBaseUrl,
2462
+ tls: opts.tls
2442
2463
  });
2443
2464
  const s3BaseUrl = opts.s3BaseUrl ?? envVar("ARCHIL_S3_BASE_URL") ?? deriveS3BaseUrl(controlBaseUrl);
2444
2465
  this._client = client;
@@ -2535,4 +2556,4 @@ function workspace(mounts) {
2535
2556
  return archil().workspace(mounts);
2536
2557
  }
2537
2558
  //#endregion
2538
- export { ArchilS3Error as A, DiskMultipart as C, REGION_URLS as D, VERSION as E, ArchilApiError as O, Disk as S, USER_AGENT as T, Sandbox as _, deleteApiKey as a, SandboxProcesses as b, getSandbox as c, listSandboxes as d, workspace as f, Sandboxes as g, Tokens as h, createSandbox as i, SandboxFileTransferError as j, ArchilError as k, listApiKeys as l, Workspace as m, createApiKey as n, exec as o, Archil as p, createDisk as r, getDisk as s, configure as t, listDisks as u, SandboxFiles as v, effectiveUploadPartSize as w, Disks as x, SandboxProcess as y };
2559
+ export { ArchilS3Error as A, DiskMultipart as C, REGION_URLS as D, VERSION as E, SandboxPauseError as M, ArchilApiError as O, Disk as S, USER_AGENT as T, Sandbox as _, deleteApiKey as a, SandboxProcesses as b, getSandbox as c, listSandboxes as d, workspace as f, Sandboxes as g, Tokens as h, createSandbox as i, SandboxFileTransferError as j, ArchilError as k, listApiKeys as l, Workspace as m, createApiKey as n, exec as o, Archil as p, createDisk as r, getDisk as s, configure as t, listDisks as u, SandboxFiles as v, effectiveUploadPartSize as w, Disks as x, SandboxProcess as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disk",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "Pure-JS client and CLIs for Archil disks and sandboxes",
5
5
  "keywords": [
6
6
  "archil",