disk 0.8.21 → 0.8.23
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 +50 -0
- package/dist/cli.mjs +1 -1
- package/dist/{disk-BhRejJas.d.cts → disk-DEqV3mtA.d.cts} +26 -1
- package/dist/{disk-BhRejJas.d.mts → disk-DEqV3mtA.d.mts} +26 -1
- package/dist/index.cjs +368 -1
- package/dist/index.d.cts +203 -41
- package/dist/index.d.mts +203 -41
- package/dist/index.mjs +2 -2
- package/dist/internal/tools.d.cts +1 -1
- package/dist/internal/tools.d.mts +1 -1
- package/dist/{src-CrK7pSLW.mjs → src-DgL0HTS-.mjs} +361 -2
- package/package.json +13 -9
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as TokenUser, A as ApiTokenResponse, B as DiskStatus, C as PutObjectOptions, D as ShareUrlResult, E as ShareUrlOptions, F as CreateApiTokenRequest, G as GrepMatch, H as ExecDiskResult, I as CreateDiskRequest, J as MountConfigResponse, K as GrepStoppedReason, L as Delegation, M as AwsStsUser, N as AzureBlobMount, O as UploadPart, P as ConnectedClient, Q as S3Mount, R as DiskMetrics, S as PosixCreateAttrs, T as S3Object, U as ExecRequest, V as DiskUser, W as GCSMount, X as R2Mount, Y as MountResponse, Z as S3CompatibleMount, _ as MultipartUploadListing, a as DeleteObjectsResult, b as PartInfo, c as ExecResult, d as ListMultipartUploadsOptions, et as FileSystem, f as ListObjectsOptions, g as MultipartUpload, h as MountOptions, i as DeleteObjectsOptions, j as AuthorizedUser, k as effectiveUploadPartSize, l as GrepOptions, m as ListPartsOptions, n as CompletedMultipartUpload, o as Disk, p as ListObjectsResult, q as MountConfig, r as DeleteObjectsError, s as DiskMultipart, t as AppendObjectOptions, tt as ApiClient, u as GrepResult, v as MultipartUploadSummary, w as PutObjectResult, x as PartListing, y as ObjectMetadata, z as DiskResponse } from "./disk-DEqV3mtA.cjs";
|
|
2
|
+
import { components } from "@archildata/api-types";
|
|
2
3
|
|
|
3
4
|
//#region src/disks.d.ts
|
|
4
5
|
interface ListDisksOptions {
|
|
@@ -53,6 +54,202 @@ declare class Disks {
|
|
|
53
54
|
create(req: CreateDiskRequest): Promise<CreateDiskResult>;
|
|
54
55
|
}
|
|
55
56
|
//#endregion
|
|
57
|
+
//#region src/errors.d.ts
|
|
58
|
+
/**
|
|
59
|
+
* Base class for every error the SDK throws. Catch with `instanceof ArchilError`
|
|
60
|
+
* to handle control-plane and S3 failures uniformly; `status` is the HTTP status
|
|
61
|
+
* code and `code` a machine-readable error code when the server provided one.
|
|
62
|
+
*/
|
|
63
|
+
declare class ArchilError extends Error {
|
|
64
|
+
/** HTTP status code associated with the failure. */
|
|
65
|
+
readonly status: number;
|
|
66
|
+
/** Machine-readable error code (e.g. an S3 code like "NoSuchKey"), if known. */
|
|
67
|
+
readonly code?: string;
|
|
68
|
+
constructor(message: string, status: number, code?: string);
|
|
69
|
+
}
|
|
70
|
+
/** Error from the control-plane REST API. */
|
|
71
|
+
declare class ArchilApiError extends ArchilError {
|
|
72
|
+
constructor(message: string, status: number, code?: string);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Error from the S3-compatible object API (getObject/putObject/deleteObject/
|
|
76
|
+
* headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
|
|
77
|
+
* this surfaces its parts as structured fields (`status`, `code`, `requestId`)
|
|
78
|
+
* rather than a raw blob, while keeping the full body on `raw` for debugging.
|
|
79
|
+
*/
|
|
80
|
+
declare class ArchilS3Error extends ArchilError {
|
|
81
|
+
/** S3 request id, if the gateway returned one. */
|
|
82
|
+
readonly requestId?: string;
|
|
83
|
+
/** Raw response body (the XML document), for debugging. */
|
|
84
|
+
readonly raw: string;
|
|
85
|
+
constructor(opts: {
|
|
86
|
+
operation: string;
|
|
87
|
+
statusCode: number;
|
|
88
|
+
statusText?: string;
|
|
89
|
+
code?: string;
|
|
90
|
+
message?: string;
|
|
91
|
+
requestId?: string;
|
|
92
|
+
raw: string;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/sandbox.d.ts
|
|
97
|
+
/** @internal */
|
|
98
|
+
type SandboxWire = components["schemas"]["Sandbox"];
|
|
99
|
+
/** @internal */
|
|
100
|
+
type SandboxExecWire = components["schemas"]["SandboxExec"];
|
|
101
|
+
type SandboxStatus = components["schemas"]["SandboxState"];
|
|
102
|
+
type SandboxExecStatus = components["schemas"]["SandboxExecState"];
|
|
103
|
+
interface SandboxEndpoint {
|
|
104
|
+
port: number;
|
|
105
|
+
hostname: string;
|
|
106
|
+
}
|
|
107
|
+
interface SandboxResponse {
|
|
108
|
+
id: string;
|
|
109
|
+
status: SandboxStatus;
|
|
110
|
+
vcpuCount: number;
|
|
111
|
+
memSizeMiB: number;
|
|
112
|
+
maxTtlSeconds: number;
|
|
113
|
+
maxConcurrentExecs: number;
|
|
114
|
+
endpoints?: SandboxEndpoint[];
|
|
115
|
+
createdAt: Date;
|
|
116
|
+
runningAt?: Date;
|
|
117
|
+
finishedAt?: Date;
|
|
118
|
+
lastActiveAt: Date;
|
|
119
|
+
expiresAt?: Date;
|
|
120
|
+
exitReason?: string;
|
|
121
|
+
}
|
|
122
|
+
interface SandboxExecResponse {
|
|
123
|
+
sandboxId: string;
|
|
124
|
+
id: string;
|
|
125
|
+
command: string;
|
|
126
|
+
status: SandboxExecStatus;
|
|
127
|
+
exitCode?: number;
|
|
128
|
+
stdout?: string;
|
|
129
|
+
stderr?: string;
|
|
130
|
+
exitReason?: string;
|
|
131
|
+
executeTimeMs?: number;
|
|
132
|
+
startedAt: Date;
|
|
133
|
+
finishedAt?: Date;
|
|
134
|
+
}
|
|
135
|
+
interface SandboxWaitOptions {
|
|
136
|
+
timeoutMs?: number;
|
|
137
|
+
}
|
|
138
|
+
type SandboxExecOptions = {
|
|
139
|
+
commandTty?: boolean;
|
|
140
|
+
env?: Record<string, string>;
|
|
141
|
+
timeoutSeconds?: number;
|
|
142
|
+
} & SandboxWaitOptions;
|
|
143
|
+
/**
|
|
144
|
+
* The requested SDK-side wait expired. The remote sandbox operation continues;
|
|
145
|
+
* `latest` is the same `Sandbox`/`SandboxExec` the operation was called on,
|
|
146
|
+
* updated in place to the last state observed before the deadline.
|
|
147
|
+
*/
|
|
148
|
+
declare class SandboxWaitTimeoutError extends ArchilError {
|
|
149
|
+
readonly operation: "start" | "stop" | "pause" | "resume" | "exec";
|
|
150
|
+
readonly timeoutMs: number;
|
|
151
|
+
readonly latest: Sandbox | SandboxExec;
|
|
152
|
+
constructor(operation: "start" | "stop" | "pause" | "resume" | "exec", timeoutMs: number, latest: Sandbox | SandboxExec);
|
|
153
|
+
}
|
|
154
|
+
/** The sandbox entered an inactive state before startup completed. */
|
|
155
|
+
declare class SandboxStartError extends ArchilError {
|
|
156
|
+
readonly latest: Sandbox;
|
|
157
|
+
constructor(sandbox: Sandbox);
|
|
158
|
+
}
|
|
159
|
+
declare class SandboxExec {
|
|
160
|
+
sandboxId: string;
|
|
161
|
+
id: string;
|
|
162
|
+
command: string;
|
|
163
|
+
status: SandboxExecStatus;
|
|
164
|
+
exitCode?: number;
|
|
165
|
+
stdout?: string;
|
|
166
|
+
stderr?: string;
|
|
167
|
+
exitReason?: string;
|
|
168
|
+
executeTimeMs?: number;
|
|
169
|
+
startedAt: Date;
|
|
170
|
+
finishedAt?: Date;
|
|
171
|
+
/** @internal */
|
|
172
|
+
private readonly _client;
|
|
173
|
+
/** @internal */
|
|
174
|
+
constructor(data: SandboxExecWire, client: ApiClient);
|
|
175
|
+
/** @internal Overwrite this exec's fields in place from a fresh wire snapshot. */
|
|
176
|
+
private _apply;
|
|
177
|
+
toJSON(): SandboxExecResponse;
|
|
178
|
+
/** Re-fetch this exec and update it in place, returning the same object. */
|
|
179
|
+
refresh(): Promise<SandboxExec>;
|
|
180
|
+
/** Cancel this exec and update it in place, returning the same object. */
|
|
181
|
+
cancel(): Promise<SandboxExec>;
|
|
182
|
+
}
|
|
183
|
+
declare class Sandbox {
|
|
184
|
+
id: string;
|
|
185
|
+
status: SandboxStatus;
|
|
186
|
+
vcpuCount: number;
|
|
187
|
+
memSizeMiB: number;
|
|
188
|
+
maxTtlSeconds: number;
|
|
189
|
+
maxConcurrentExecs: number;
|
|
190
|
+
endpoints?: SandboxEndpoint[];
|
|
191
|
+
createdAt: Date;
|
|
192
|
+
runningAt?: Date;
|
|
193
|
+
finishedAt?: Date;
|
|
194
|
+
lastActiveAt: Date;
|
|
195
|
+
expiresAt?: Date;
|
|
196
|
+
exitReason?: string;
|
|
197
|
+
/** @internal */
|
|
198
|
+
private readonly _client;
|
|
199
|
+
/** @internal */
|
|
200
|
+
constructor(data: SandboxWire, client: ApiClient);
|
|
201
|
+
/** @internal Overwrite this sandbox's fields in place from a fresh wire snapshot. */
|
|
202
|
+
private _apply;
|
|
203
|
+
toJSON(): SandboxResponse;
|
|
204
|
+
/** Re-fetch this sandbox. */
|
|
205
|
+
refresh(): Promise<this>;
|
|
206
|
+
/** Start this sandbox. */
|
|
207
|
+
start(options?: SandboxWaitOptions): Promise<Sandbox>;
|
|
208
|
+
/** Stop this sandbox. */
|
|
209
|
+
stop(options?: SandboxWaitOptions): Promise<this>;
|
|
210
|
+
/** Pause this sandbox, preserving its CPU and memory state. */
|
|
211
|
+
pause(options?: SandboxWaitOptions): Promise<this>;
|
|
212
|
+
/** Resume this sandbox from its preserved CPU and memory state. */
|
|
213
|
+
resume(options?: SandboxWaitOptions): Promise<this>;
|
|
214
|
+
exec(command: string, options?: SandboxExecOptions): Promise<SandboxExec>;
|
|
215
|
+
listExecs(): Promise<SandboxExec[]>;
|
|
216
|
+
getExec(execId: string): Promise<SandboxExec>;
|
|
217
|
+
cancelExec(execId: string): Promise<SandboxExec>;
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/sandboxes.d.ts
|
|
221
|
+
interface CreateSandboxRequest {
|
|
222
|
+
vcpuCount?: number;
|
|
223
|
+
memSizeMiB?: number;
|
|
224
|
+
/**
|
|
225
|
+
* Public Linux OCI image reference for the sandbox's root filesystem.
|
|
226
|
+
* Docker Hub shorthand and any public registry are accepted; the tag
|
|
227
|
+
* defaults to `latest`, and mutable tags are pinned to immutable digests
|
|
228
|
+
* when the sandbox is created. Defaults to `ubuntu:26.04`.
|
|
229
|
+
*
|
|
230
|
+
* Examples: `ubuntu`, `node:24-bookworm`, `ghcr.io/owner/app:v2`,
|
|
231
|
+
* `alpine@sha256:<digest>`.
|
|
232
|
+
*/
|
|
233
|
+
baseImage?: string;
|
|
234
|
+
env?: Record<string, string>;
|
|
235
|
+
maxTtlSeconds?: number;
|
|
236
|
+
maxConcurrentExecs?: number;
|
|
237
|
+
}
|
|
238
|
+
interface ListSandboxesOptions {
|
|
239
|
+
/** Only return sandboxes that mount this disk. */
|
|
240
|
+
disk?: Disk | string;
|
|
241
|
+
}
|
|
242
|
+
declare class Sandboxes {
|
|
243
|
+
/** @internal */
|
|
244
|
+
private readonly _client;
|
|
245
|
+
/** @internal */
|
|
246
|
+
constructor(client: ApiClient);
|
|
247
|
+
/** List the account's sandboxes, oldest first. */
|
|
248
|
+
list(options?: ListSandboxesOptions): Promise<Sandbox[]>;
|
|
249
|
+
get(id: string): Promise<Sandbox>;
|
|
250
|
+
create(request?: CreateSandboxRequest, options?: SandboxWaitOptions): Promise<Sandbox>;
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
56
253
|
//#region src/tokens.d.ts
|
|
57
254
|
interface ListTokensOptions {
|
|
58
255
|
limit?: number;
|
|
@@ -199,6 +396,7 @@ interface ExecOptions {
|
|
|
199
396
|
}
|
|
200
397
|
declare class Archil {
|
|
201
398
|
readonly disks: Disks;
|
|
399
|
+
readonly sandboxes: Sandboxes;
|
|
202
400
|
readonly tokens: Tokens;
|
|
203
401
|
/** @internal */
|
|
204
402
|
private readonly _client;
|
|
@@ -219,45 +417,6 @@ declare class Archil {
|
|
|
219
417
|
workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
220
418
|
}
|
|
221
419
|
//#endregion
|
|
222
|
-
//#region src/errors.d.ts
|
|
223
|
-
/**
|
|
224
|
-
* Base class for every error the SDK throws. Catch with `instanceof ArchilError`
|
|
225
|
-
* to handle control-plane and S3 failures uniformly; `status` is the HTTP status
|
|
226
|
-
* code and `code` a machine-readable error code when the server provided one.
|
|
227
|
-
*/
|
|
228
|
-
declare class ArchilError extends Error {
|
|
229
|
-
/** HTTP status code associated with the failure. */
|
|
230
|
-
readonly status: number;
|
|
231
|
-
/** Machine-readable error code (e.g. an S3 code like "NoSuchKey"), if known. */
|
|
232
|
-
readonly code?: string;
|
|
233
|
-
constructor(message: string, status: number, code?: string);
|
|
234
|
-
}
|
|
235
|
-
/** Error from the control-plane REST API. */
|
|
236
|
-
declare class ArchilApiError extends ArchilError {
|
|
237
|
-
constructor(message: string, status: number, code?: string);
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Error from the S3-compatible object API (getObject/putObject/deleteObject/
|
|
241
|
-
* headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
|
|
242
|
-
* this surfaces its parts as structured fields (`status`, `code`, `requestId`)
|
|
243
|
-
* rather than a raw blob, while keeping the full body on `raw` for debugging.
|
|
244
|
-
*/
|
|
245
|
-
declare class ArchilS3Error extends ArchilError {
|
|
246
|
-
/** S3 request id, if the gateway returned one. */
|
|
247
|
-
readonly requestId?: string;
|
|
248
|
-
/** Raw response body (the XML document), for debugging. */
|
|
249
|
-
readonly raw: string;
|
|
250
|
-
constructor(opts: {
|
|
251
|
-
operation: string;
|
|
252
|
-
statusCode: number;
|
|
253
|
-
statusText?: string;
|
|
254
|
-
code?: string;
|
|
255
|
-
message?: string;
|
|
256
|
-
requestId?: string;
|
|
257
|
-
raw: string;
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
//#endregion
|
|
261
420
|
//#region src/version.d.ts
|
|
262
421
|
declare const VERSION: string;
|
|
263
422
|
declare const USER_AGENT: string;
|
|
@@ -267,6 +426,9 @@ declare function configure(options: ArchilOptions): void;
|
|
|
267
426
|
declare function createDisk(req: CreateDiskRequest): Promise<CreateDiskResult>;
|
|
268
427
|
declare function listDisks(opts?: ListDisksOptions): Promise<Disk[]>;
|
|
269
428
|
declare function getDisk(id: string): Promise<Disk>;
|
|
429
|
+
declare function createSandbox(req?: CreateSandboxRequest, opts?: SandboxWaitOptions): Promise<Sandbox>;
|
|
430
|
+
declare function listSandboxes(opts?: ListSandboxesOptions): Promise<Sandbox[]>;
|
|
431
|
+
declare function getSandbox(id: string): Promise<Sandbox>;
|
|
270
432
|
declare function listApiKeys(opts?: ListTokensOptions): Promise<ApiTokenResponse[]>;
|
|
271
433
|
declare function createApiKey(req: CreateApiTokenRequest): Promise<ApiTokenResponse & {
|
|
272
434
|
token?: string;
|
|
@@ -284,4 +446,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
284
446
|
*/
|
|
285
447
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
286
448
|
//#endregion
|
|
287
|
-
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 DeleteObjectsError, type DeleteObjectsOptions, type DeleteObjectsResult, Disk, type DiskListPage, type DiskMetrics, DiskMultipart, type DiskResponse, type DiskStatus, type DiskUser, Disks, type ExecMount, type ExecMountSpec, type ExecOptions, type ExecRequest, type ExecResult, type FileSystem, type GCSMount, type GrepMatch, type GrepOptions, type GrepResult, type GrepStoppedReason, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListTokensOptions, type MountConfig, type MountConfigResponse, type MountOptions, type MountResponse, type MultipartUpload, type MultipartUploadListing, type MultipartUploadSummary, type ObjectMetadata, type PartInfo, type PartListing, type PosixCreateAttrs, type PutObjectOptions, type PutObjectResult, type R2Mount, type S3CompatibleMount, type S3Mount, type S3Object, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, deleteApiKey, effectiveUploadPartSize, exec, getDisk, listApiKeys, listDisks, workspace };
|
|
449
|
+
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 CreateSandboxRequest, 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 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 S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxEndpoint, SandboxExec, type SandboxExecOptions, type SandboxExecResponse, type SandboxExecStatus, type SandboxResponse, SandboxStartError, type SandboxStatus, type SandboxWaitOptions, SandboxWaitTimeoutError, 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,5 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as TokenUser, A as ApiTokenResponse, B as DiskStatus, C as PutObjectOptions, D as ShareUrlResult, E as ShareUrlOptions, F as CreateApiTokenRequest, G as GrepMatch, H as ExecDiskResult, I as CreateDiskRequest, J as MountConfigResponse, K as GrepStoppedReason, L as Delegation, M as AwsStsUser, N as AzureBlobMount, O as UploadPart, P as ConnectedClient, Q as S3Mount, R as DiskMetrics, S as PosixCreateAttrs, T as S3Object, U as ExecRequest, V as DiskUser, W as GCSMount, X as R2Mount, Y as MountResponse, Z as S3CompatibleMount, _ as MultipartUploadListing, a as DeleteObjectsResult, b as PartInfo, c as ExecResult, d as ListMultipartUploadsOptions, et as FileSystem, f as ListObjectsOptions, g as MultipartUpload, h as MountOptions, i as DeleteObjectsOptions, j as AuthorizedUser, k as effectiveUploadPartSize, l as GrepOptions, m as ListPartsOptions, n as CompletedMultipartUpload, o as Disk, p as ListObjectsResult, q as MountConfig, r as DeleteObjectsError, s as DiskMultipart, t as AppendObjectOptions, tt as ApiClient, u as GrepResult, v as MultipartUploadSummary, w as PutObjectResult, x as PartListing, y as ObjectMetadata, z as DiskResponse } from "./disk-DEqV3mtA.mjs";
|
|
2
|
+
import { components } from "@archildata/api-types";
|
|
2
3
|
|
|
3
4
|
//#region src/disks.d.ts
|
|
4
5
|
interface ListDisksOptions {
|
|
@@ -53,6 +54,202 @@ declare class Disks {
|
|
|
53
54
|
create(req: CreateDiskRequest): Promise<CreateDiskResult>;
|
|
54
55
|
}
|
|
55
56
|
//#endregion
|
|
57
|
+
//#region src/errors.d.ts
|
|
58
|
+
/**
|
|
59
|
+
* Base class for every error the SDK throws. Catch with `instanceof ArchilError`
|
|
60
|
+
* to handle control-plane and S3 failures uniformly; `status` is the HTTP status
|
|
61
|
+
* code and `code` a machine-readable error code when the server provided one.
|
|
62
|
+
*/
|
|
63
|
+
declare class ArchilError extends Error {
|
|
64
|
+
/** HTTP status code associated with the failure. */
|
|
65
|
+
readonly status: number;
|
|
66
|
+
/** Machine-readable error code (e.g. an S3 code like "NoSuchKey"), if known. */
|
|
67
|
+
readonly code?: string;
|
|
68
|
+
constructor(message: string, status: number, code?: string);
|
|
69
|
+
}
|
|
70
|
+
/** Error from the control-plane REST API. */
|
|
71
|
+
declare class ArchilApiError extends ArchilError {
|
|
72
|
+
constructor(message: string, status: number, code?: string);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Error from the S3-compatible object API (getObject/putObject/deleteObject/
|
|
76
|
+
* headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
|
|
77
|
+
* this surfaces its parts as structured fields (`status`, `code`, `requestId`)
|
|
78
|
+
* rather than a raw blob, while keeping the full body on `raw` for debugging.
|
|
79
|
+
*/
|
|
80
|
+
declare class ArchilS3Error extends ArchilError {
|
|
81
|
+
/** S3 request id, if the gateway returned one. */
|
|
82
|
+
readonly requestId?: string;
|
|
83
|
+
/** Raw response body (the XML document), for debugging. */
|
|
84
|
+
readonly raw: string;
|
|
85
|
+
constructor(opts: {
|
|
86
|
+
operation: string;
|
|
87
|
+
statusCode: number;
|
|
88
|
+
statusText?: string;
|
|
89
|
+
code?: string;
|
|
90
|
+
message?: string;
|
|
91
|
+
requestId?: string;
|
|
92
|
+
raw: string;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/sandbox.d.ts
|
|
97
|
+
/** @internal */
|
|
98
|
+
type SandboxWire = components["schemas"]["Sandbox"];
|
|
99
|
+
/** @internal */
|
|
100
|
+
type SandboxExecWire = components["schemas"]["SandboxExec"];
|
|
101
|
+
type SandboxStatus = components["schemas"]["SandboxState"];
|
|
102
|
+
type SandboxExecStatus = components["schemas"]["SandboxExecState"];
|
|
103
|
+
interface SandboxEndpoint {
|
|
104
|
+
port: number;
|
|
105
|
+
hostname: string;
|
|
106
|
+
}
|
|
107
|
+
interface SandboxResponse {
|
|
108
|
+
id: string;
|
|
109
|
+
status: SandboxStatus;
|
|
110
|
+
vcpuCount: number;
|
|
111
|
+
memSizeMiB: number;
|
|
112
|
+
maxTtlSeconds: number;
|
|
113
|
+
maxConcurrentExecs: number;
|
|
114
|
+
endpoints?: SandboxEndpoint[];
|
|
115
|
+
createdAt: Date;
|
|
116
|
+
runningAt?: Date;
|
|
117
|
+
finishedAt?: Date;
|
|
118
|
+
lastActiveAt: Date;
|
|
119
|
+
expiresAt?: Date;
|
|
120
|
+
exitReason?: string;
|
|
121
|
+
}
|
|
122
|
+
interface SandboxExecResponse {
|
|
123
|
+
sandboxId: string;
|
|
124
|
+
id: string;
|
|
125
|
+
command: string;
|
|
126
|
+
status: SandboxExecStatus;
|
|
127
|
+
exitCode?: number;
|
|
128
|
+
stdout?: string;
|
|
129
|
+
stderr?: string;
|
|
130
|
+
exitReason?: string;
|
|
131
|
+
executeTimeMs?: number;
|
|
132
|
+
startedAt: Date;
|
|
133
|
+
finishedAt?: Date;
|
|
134
|
+
}
|
|
135
|
+
interface SandboxWaitOptions {
|
|
136
|
+
timeoutMs?: number;
|
|
137
|
+
}
|
|
138
|
+
type SandboxExecOptions = {
|
|
139
|
+
commandTty?: boolean;
|
|
140
|
+
env?: Record<string, string>;
|
|
141
|
+
timeoutSeconds?: number;
|
|
142
|
+
} & SandboxWaitOptions;
|
|
143
|
+
/**
|
|
144
|
+
* The requested SDK-side wait expired. The remote sandbox operation continues;
|
|
145
|
+
* `latest` is the same `Sandbox`/`SandboxExec` the operation was called on,
|
|
146
|
+
* updated in place to the last state observed before the deadline.
|
|
147
|
+
*/
|
|
148
|
+
declare class SandboxWaitTimeoutError extends ArchilError {
|
|
149
|
+
readonly operation: "start" | "stop" | "pause" | "resume" | "exec";
|
|
150
|
+
readonly timeoutMs: number;
|
|
151
|
+
readonly latest: Sandbox | SandboxExec;
|
|
152
|
+
constructor(operation: "start" | "stop" | "pause" | "resume" | "exec", timeoutMs: number, latest: Sandbox | SandboxExec);
|
|
153
|
+
}
|
|
154
|
+
/** The sandbox entered an inactive state before startup completed. */
|
|
155
|
+
declare class SandboxStartError extends ArchilError {
|
|
156
|
+
readonly latest: Sandbox;
|
|
157
|
+
constructor(sandbox: Sandbox);
|
|
158
|
+
}
|
|
159
|
+
declare class SandboxExec {
|
|
160
|
+
sandboxId: string;
|
|
161
|
+
id: string;
|
|
162
|
+
command: string;
|
|
163
|
+
status: SandboxExecStatus;
|
|
164
|
+
exitCode?: number;
|
|
165
|
+
stdout?: string;
|
|
166
|
+
stderr?: string;
|
|
167
|
+
exitReason?: string;
|
|
168
|
+
executeTimeMs?: number;
|
|
169
|
+
startedAt: Date;
|
|
170
|
+
finishedAt?: Date;
|
|
171
|
+
/** @internal */
|
|
172
|
+
private readonly _client;
|
|
173
|
+
/** @internal */
|
|
174
|
+
constructor(data: SandboxExecWire, client: ApiClient);
|
|
175
|
+
/** @internal Overwrite this exec's fields in place from a fresh wire snapshot. */
|
|
176
|
+
private _apply;
|
|
177
|
+
toJSON(): SandboxExecResponse;
|
|
178
|
+
/** Re-fetch this exec and update it in place, returning the same object. */
|
|
179
|
+
refresh(): Promise<SandboxExec>;
|
|
180
|
+
/** Cancel this exec and update it in place, returning the same object. */
|
|
181
|
+
cancel(): Promise<SandboxExec>;
|
|
182
|
+
}
|
|
183
|
+
declare class Sandbox {
|
|
184
|
+
id: string;
|
|
185
|
+
status: SandboxStatus;
|
|
186
|
+
vcpuCount: number;
|
|
187
|
+
memSizeMiB: number;
|
|
188
|
+
maxTtlSeconds: number;
|
|
189
|
+
maxConcurrentExecs: number;
|
|
190
|
+
endpoints?: SandboxEndpoint[];
|
|
191
|
+
createdAt: Date;
|
|
192
|
+
runningAt?: Date;
|
|
193
|
+
finishedAt?: Date;
|
|
194
|
+
lastActiveAt: Date;
|
|
195
|
+
expiresAt?: Date;
|
|
196
|
+
exitReason?: string;
|
|
197
|
+
/** @internal */
|
|
198
|
+
private readonly _client;
|
|
199
|
+
/** @internal */
|
|
200
|
+
constructor(data: SandboxWire, client: ApiClient);
|
|
201
|
+
/** @internal Overwrite this sandbox's fields in place from a fresh wire snapshot. */
|
|
202
|
+
private _apply;
|
|
203
|
+
toJSON(): SandboxResponse;
|
|
204
|
+
/** Re-fetch this sandbox. */
|
|
205
|
+
refresh(): Promise<this>;
|
|
206
|
+
/** Start this sandbox. */
|
|
207
|
+
start(options?: SandboxWaitOptions): Promise<Sandbox>;
|
|
208
|
+
/** Stop this sandbox. */
|
|
209
|
+
stop(options?: SandboxWaitOptions): Promise<this>;
|
|
210
|
+
/** Pause this sandbox, preserving its CPU and memory state. */
|
|
211
|
+
pause(options?: SandboxWaitOptions): Promise<this>;
|
|
212
|
+
/** Resume this sandbox from its preserved CPU and memory state. */
|
|
213
|
+
resume(options?: SandboxWaitOptions): Promise<this>;
|
|
214
|
+
exec(command: string, options?: SandboxExecOptions): Promise<SandboxExec>;
|
|
215
|
+
listExecs(): Promise<SandboxExec[]>;
|
|
216
|
+
getExec(execId: string): Promise<SandboxExec>;
|
|
217
|
+
cancelExec(execId: string): Promise<SandboxExec>;
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/sandboxes.d.ts
|
|
221
|
+
interface CreateSandboxRequest {
|
|
222
|
+
vcpuCount?: number;
|
|
223
|
+
memSizeMiB?: number;
|
|
224
|
+
/**
|
|
225
|
+
* Public Linux OCI image reference for the sandbox's root filesystem.
|
|
226
|
+
* Docker Hub shorthand and any public registry are accepted; the tag
|
|
227
|
+
* defaults to `latest`, and mutable tags are pinned to immutable digests
|
|
228
|
+
* when the sandbox is created. Defaults to `ubuntu:26.04`.
|
|
229
|
+
*
|
|
230
|
+
* Examples: `ubuntu`, `node:24-bookworm`, `ghcr.io/owner/app:v2`,
|
|
231
|
+
* `alpine@sha256:<digest>`.
|
|
232
|
+
*/
|
|
233
|
+
baseImage?: string;
|
|
234
|
+
env?: Record<string, string>;
|
|
235
|
+
maxTtlSeconds?: number;
|
|
236
|
+
maxConcurrentExecs?: number;
|
|
237
|
+
}
|
|
238
|
+
interface ListSandboxesOptions {
|
|
239
|
+
/** Only return sandboxes that mount this disk. */
|
|
240
|
+
disk?: Disk | string;
|
|
241
|
+
}
|
|
242
|
+
declare class Sandboxes {
|
|
243
|
+
/** @internal */
|
|
244
|
+
private readonly _client;
|
|
245
|
+
/** @internal */
|
|
246
|
+
constructor(client: ApiClient);
|
|
247
|
+
/** List the account's sandboxes, oldest first. */
|
|
248
|
+
list(options?: ListSandboxesOptions): Promise<Sandbox[]>;
|
|
249
|
+
get(id: string): Promise<Sandbox>;
|
|
250
|
+
create(request?: CreateSandboxRequest, options?: SandboxWaitOptions): Promise<Sandbox>;
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
56
253
|
//#region src/tokens.d.ts
|
|
57
254
|
interface ListTokensOptions {
|
|
58
255
|
limit?: number;
|
|
@@ -199,6 +396,7 @@ interface ExecOptions {
|
|
|
199
396
|
}
|
|
200
397
|
declare class Archil {
|
|
201
398
|
readonly disks: Disks;
|
|
399
|
+
readonly sandboxes: Sandboxes;
|
|
202
400
|
readonly tokens: Tokens;
|
|
203
401
|
/** @internal */
|
|
204
402
|
private readonly _client;
|
|
@@ -219,45 +417,6 @@ declare class Archil {
|
|
|
219
417
|
workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
220
418
|
}
|
|
221
419
|
//#endregion
|
|
222
|
-
//#region src/errors.d.ts
|
|
223
|
-
/**
|
|
224
|
-
* Base class for every error the SDK throws. Catch with `instanceof ArchilError`
|
|
225
|
-
* to handle control-plane and S3 failures uniformly; `status` is the HTTP status
|
|
226
|
-
* code and `code` a machine-readable error code when the server provided one.
|
|
227
|
-
*/
|
|
228
|
-
declare class ArchilError extends Error {
|
|
229
|
-
/** HTTP status code associated with the failure. */
|
|
230
|
-
readonly status: number;
|
|
231
|
-
/** Machine-readable error code (e.g. an S3 code like "NoSuchKey"), if known. */
|
|
232
|
-
readonly code?: string;
|
|
233
|
-
constructor(message: string, status: number, code?: string);
|
|
234
|
-
}
|
|
235
|
-
/** Error from the control-plane REST API. */
|
|
236
|
-
declare class ArchilApiError extends ArchilError {
|
|
237
|
-
constructor(message: string, status: number, code?: string);
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Error from the S3-compatible object API (getObject/putObject/deleteObject/
|
|
241
|
-
* headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
|
|
242
|
-
* this surfaces its parts as structured fields (`status`, `code`, `requestId`)
|
|
243
|
-
* rather than a raw blob, while keeping the full body on `raw` for debugging.
|
|
244
|
-
*/
|
|
245
|
-
declare class ArchilS3Error extends ArchilError {
|
|
246
|
-
/** S3 request id, if the gateway returned one. */
|
|
247
|
-
readonly requestId?: string;
|
|
248
|
-
/** Raw response body (the XML document), for debugging. */
|
|
249
|
-
readonly raw: string;
|
|
250
|
-
constructor(opts: {
|
|
251
|
-
operation: string;
|
|
252
|
-
statusCode: number;
|
|
253
|
-
statusText?: string;
|
|
254
|
-
code?: string;
|
|
255
|
-
message?: string;
|
|
256
|
-
requestId?: string;
|
|
257
|
-
raw: string;
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
//#endregion
|
|
261
420
|
//#region src/version.d.ts
|
|
262
421
|
declare const VERSION: string;
|
|
263
422
|
declare const USER_AGENT: string;
|
|
@@ -267,6 +426,9 @@ declare function configure(options: ArchilOptions): void;
|
|
|
267
426
|
declare function createDisk(req: CreateDiskRequest): Promise<CreateDiskResult>;
|
|
268
427
|
declare function listDisks(opts?: ListDisksOptions): Promise<Disk[]>;
|
|
269
428
|
declare function getDisk(id: string): Promise<Disk>;
|
|
429
|
+
declare function createSandbox(req?: CreateSandboxRequest, opts?: SandboxWaitOptions): Promise<Sandbox>;
|
|
430
|
+
declare function listSandboxes(opts?: ListSandboxesOptions): Promise<Sandbox[]>;
|
|
431
|
+
declare function getSandbox(id: string): Promise<Sandbox>;
|
|
270
432
|
declare function listApiKeys(opts?: ListTokensOptions): Promise<ApiTokenResponse[]>;
|
|
271
433
|
declare function createApiKey(req: CreateApiTokenRequest): Promise<ApiTokenResponse & {
|
|
272
434
|
token?: string;
|
|
@@ -284,4 +446,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
284
446
|
*/
|
|
285
447
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
286
448
|
//#endregion
|
|
287
|
-
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 DeleteObjectsError, type DeleteObjectsOptions, type DeleteObjectsResult, Disk, type DiskListPage, type DiskMetrics, DiskMultipart, type DiskResponse, type DiskStatus, type DiskUser, Disks, type ExecMount, type ExecMountSpec, type ExecOptions, type ExecRequest, type ExecResult, type FileSystem, type GCSMount, type GrepMatch, type GrepOptions, type GrepResult, type GrepStoppedReason, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListTokensOptions, type MountConfig, type MountConfigResponse, type MountOptions, type MountResponse, type MultipartUpload, type MultipartUploadListing, type MultipartUploadSummary, type ObjectMetadata, type PartInfo, type PartListing, type PosixCreateAttrs, type PutObjectOptions, type PutObjectResult, type R2Mount, type S3CompatibleMount, type S3Mount, type S3Object, type ShareUrlOptions, type ShareUrlResult, type TokenUser, Tokens, USER_AGENT, type UploadPart, VERSION, Workspace, configure, createApiKey, createDisk, deleteApiKey, effectiveUploadPartSize, exec, getDisk, listApiKeys, listDisks, workspace };
|
|
449
|
+
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 CreateSandboxRequest, 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 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 S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxEndpoint, SandboxExec, type SandboxExecOptions, type SandboxExecResponse, type SandboxExecStatus, type SandboxResponse, SandboxStartError, type SandboxStatus, type SandboxWaitOptions, SandboxWaitTimeoutError, 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 {
|
|
2
|
-
export { Archil, ArchilApiError, ArchilError, ArchilS3Error, Disk, DiskMultipart, Disks, Tokens, USER_AGENT, VERSION, Workspace, configure, createApiKey, createDisk, deleteApiKey, effectiveUploadPartSize, exec, getDisk, listApiKeys, listDisks, workspace };
|
|
1
|
+
import { C as DiskMultipart, D as ArchilApiError, E as VERSION, O as ArchilError, S as Disk, T as USER_AGENT, _ as Sandbox, a as deleteApiKey, b as SandboxWaitTimeoutError, c as getSandbox, d as listSandboxes, f as workspace, g as Sandboxes, h as Tokens, i as createSandbox, k as ArchilS3Error, 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 SandboxExec, w as effectiveUploadPartSize, x as Disks, y as SandboxStartError } from "./src-DgL0HTS-.mjs";
|
|
2
|
+
export { Archil, ArchilApiError, ArchilError, ArchilS3Error, Disk, DiskMultipart, Disks, Sandbox, SandboxExec, SandboxStartError, SandboxWaitTimeoutError, Sandboxes, Tokens, USER_AGENT, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
|