disk 0.8.23 → 0.10.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 +94 -6
- package/dist/cli.mjs +3 -2
- package/dist/{disk-DEqV3mtA.d.cts → disk-DqGdJGsu.d.cts} +18 -6
- package/dist/{disk-DEqV3mtA.d.mts → disk-DqGdJGsu.d.mts} +18 -6
- package/dist/index.cjs +157 -110
- package/dist/index.d.cts +104 -60
- package/dist/index.d.mts +104 -60
- 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-DgL0HTS-.mjs → src-DyVzhbAB.mjs} +157 -109
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
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-DqGdJGsu.cjs";
|
|
2
2
|
import { components } from "@archildata/api-types";
|
|
3
3
|
|
|
4
4
|
//#region src/disks.d.ts
|
|
@@ -50,49 +50,15 @@ declare class Disks {
|
|
|
50
50
|
*
|
|
51
51
|
* Returns the Disk, the one-time token (save it — it cannot be retrieved
|
|
52
52
|
* again), and the token identifier for later management.
|
|
53
|
+
*
|
|
54
|
+
* `rootAttrs` sets the POSIX owner and mode of the disk's root directory
|
|
55
|
+
* (e.g. `{ uid: 1000, gid: 1000, mode: 0o755 }` so an unprivileged process
|
|
56
|
+
* can create entries under the mount root without a post-mount `chown`).
|
|
57
|
+
* Creation-time only.
|
|
53
58
|
*/
|
|
54
59
|
create(req: CreateDiskRequest): Promise<CreateDiskResult>;
|
|
55
60
|
}
|
|
56
61
|
//#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
62
|
//#region src/sandbox.d.ts
|
|
97
63
|
/** @internal */
|
|
98
64
|
type SandboxWire = components["schemas"]["Sandbox"];
|
|
@@ -106,9 +72,12 @@ interface SandboxEndpoint {
|
|
|
106
72
|
}
|
|
107
73
|
interface SandboxResponse {
|
|
108
74
|
id: string;
|
|
75
|
+
name: string;
|
|
109
76
|
status: SandboxStatus;
|
|
110
77
|
vcpuCount: number;
|
|
111
78
|
memSizeMiB: number;
|
|
79
|
+
baseImage: string;
|
|
80
|
+
platform?: "arm64" | "amd64";
|
|
112
81
|
maxTtlSeconds: number;
|
|
113
82
|
maxConcurrentExecs: number;
|
|
114
83
|
endpoints?: SandboxEndpoint[];
|
|
@@ -133,28 +102,34 @@ interface SandboxExecResponse {
|
|
|
133
102
|
finishedAt?: Date;
|
|
134
103
|
}
|
|
135
104
|
interface SandboxWaitOptions {
|
|
136
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Wait for the operation to finish. Defaults to true.
|
|
107
|
+
* The SDK polls if the server's wait budget expires first.
|
|
108
|
+
*/
|
|
109
|
+
wait?: boolean;
|
|
110
|
+
}
|
|
111
|
+
interface SandboxForkOptions extends SandboxWaitOptions {
|
|
112
|
+
/** Name for the fork. The server generates one when omitted. */
|
|
113
|
+
name?: string;
|
|
114
|
+
}
|
|
115
|
+
interface SandboxConnectionInfo {
|
|
116
|
+
url: string;
|
|
117
|
+
expiresAt: Date;
|
|
137
118
|
}
|
|
138
119
|
type SandboxExecOptions = {
|
|
139
120
|
commandTty?: boolean;
|
|
140
121
|
env?: Record<string, string>;
|
|
141
122
|
timeoutSeconds?: number;
|
|
142
123
|
} & SandboxWaitOptions;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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);
|
|
124
|
+
interface SandboxPtyOptions {
|
|
125
|
+
pty: true;
|
|
126
|
+
cols?: number;
|
|
127
|
+
rows?: number;
|
|
128
|
+
onData?: (data: string) => void;
|
|
153
129
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
constructor(sandbox: Sandbox);
|
|
130
|
+
interface SandboxPtyResult {
|
|
131
|
+
/** Unavailable when a runtime closes without reporting the process status. */
|
|
132
|
+
exitCode?: number;
|
|
158
133
|
}
|
|
159
134
|
declare class SandboxExec {
|
|
160
135
|
sandboxId: string;
|
|
@@ -180,11 +155,30 @@ declare class SandboxExec {
|
|
|
180
155
|
/** Cancel this exec and update it in place, returning the same object. */
|
|
181
156
|
cancel(): Promise<SandboxExec>;
|
|
182
157
|
}
|
|
158
|
+
declare class SandboxPty {
|
|
159
|
+
private readonly _socket;
|
|
160
|
+
private readonly _completion;
|
|
161
|
+
/** @internal */
|
|
162
|
+
constructor(socket: WebSocket, onData?: (data: string) => void);
|
|
163
|
+
/** @internal */
|
|
164
|
+
static connect(url: string, command: string, options: SandboxPtyOptions): Promise<SandboxPty>;
|
|
165
|
+
sendInput(data: string): Promise<void>;
|
|
166
|
+
resize(size: {
|
|
167
|
+
cols: number;
|
|
168
|
+
rows: number;
|
|
169
|
+
}): Promise<void>;
|
|
170
|
+
wait(): Promise<SandboxPtyResult>;
|
|
171
|
+
close(): void;
|
|
172
|
+
private _send;
|
|
173
|
+
}
|
|
183
174
|
declare class Sandbox {
|
|
184
175
|
id: string;
|
|
176
|
+
name: string;
|
|
185
177
|
status: SandboxStatus;
|
|
186
178
|
vcpuCount: number;
|
|
187
179
|
memSizeMiB: number;
|
|
180
|
+
baseImage: string;
|
|
181
|
+
platform?: "arm64" | "amd64";
|
|
188
182
|
maxTtlSeconds: number;
|
|
189
183
|
maxConcurrentExecs: number;
|
|
190
184
|
endpoints?: SandboxEndpoint[];
|
|
@@ -204,13 +198,20 @@ declare class Sandbox {
|
|
|
204
198
|
/** Re-fetch this sandbox. */
|
|
205
199
|
refresh(): Promise<this>;
|
|
206
200
|
/** Start this sandbox. */
|
|
207
|
-
start(options?: SandboxWaitOptions): Promise<Sandbox>;
|
|
201
|
+
start(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
208
202
|
/** Stop this sandbox. */
|
|
209
|
-
stop(options?: SandboxWaitOptions): Promise<this>;
|
|
203
|
+
stop(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
210
204
|
/** Pause this sandbox, preserving its CPU and memory state. */
|
|
211
|
-
pause(options?: SandboxWaitOptions): Promise<this>;
|
|
205
|
+
pause(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
212
206
|
/** Resume this sandbox from its preserved CPU and memory state. */
|
|
213
|
-
resume(options?: SandboxWaitOptions): Promise<this>;
|
|
207
|
+
resume(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
208
|
+
/** Create an isolated writable branch from this sandbox's current state. */
|
|
209
|
+
fork(options?: SandboxForkOptions): Promise<Sandbox>;
|
|
210
|
+
/** Create a short-lived signed WebSocket URL for an interactive shell. */
|
|
211
|
+
createConnection(): Promise<SandboxConnectionInfo>;
|
|
212
|
+
/** Delete this sandbox and its backing disk. */
|
|
213
|
+
delete(): Promise<void>;
|
|
214
|
+
exec(command: string, options: SandboxPtyOptions): Promise<SandboxPty>;
|
|
214
215
|
exec(command: string, options?: SandboxExecOptions): Promise<SandboxExec>;
|
|
215
216
|
listExecs(): Promise<SandboxExec[]>;
|
|
216
217
|
getExec(execId: string): Promise<SandboxExec>;
|
|
@@ -219,7 +220,11 @@ declare class Sandbox {
|
|
|
219
220
|
//#endregion
|
|
220
221
|
//#region src/sandboxes.d.ts
|
|
221
222
|
interface CreateSandboxRequest {
|
|
223
|
+
/** Name for the sandbox. The server generates one when omitted. */
|
|
224
|
+
name?: string;
|
|
225
|
+
/** Number of virtual CPUs allocated to the sandbox, from 1 to 32. Defaults to 1. */
|
|
222
226
|
vcpuCount?: number;
|
|
227
|
+
/** Memory allocated to the sandbox in MiB, from 256 to 65536. Defaults to 2048. */
|
|
223
228
|
memSizeMiB?: number;
|
|
224
229
|
/**
|
|
225
230
|
* Public Linux OCI image reference for the sandbox's root filesystem.
|
|
@@ -417,6 +422,45 @@ declare class Archil {
|
|
|
417
422
|
workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
418
423
|
}
|
|
419
424
|
//#endregion
|
|
425
|
+
//#region src/errors.d.ts
|
|
426
|
+
/**
|
|
427
|
+
* Base class for every error the SDK throws. Catch with `instanceof ArchilError`
|
|
428
|
+
* to handle control-plane and S3 failures uniformly; `status` is the HTTP status
|
|
429
|
+
* code and `code` a machine-readable error code when the server provided one.
|
|
430
|
+
*/
|
|
431
|
+
declare class ArchilError extends Error {
|
|
432
|
+
/** HTTP status code associated with the failure. */
|
|
433
|
+
readonly status: number;
|
|
434
|
+
/** Machine-readable error code (e.g. an S3 code like "NoSuchKey"), if known. */
|
|
435
|
+
readonly code?: string;
|
|
436
|
+
constructor(message: string, status: number, code?: string);
|
|
437
|
+
}
|
|
438
|
+
/** Error from the control-plane REST API. */
|
|
439
|
+
declare class ArchilApiError extends ArchilError {
|
|
440
|
+
constructor(message: string, status: number, code?: string);
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Error from the S3-compatible object API (getObject/putObject/deleteObject/
|
|
444
|
+
* headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
|
|
445
|
+
* this surfaces its parts as structured fields (`status`, `code`, `requestId`)
|
|
446
|
+
* rather than a raw blob, while keeping the full body on `raw` for debugging.
|
|
447
|
+
*/
|
|
448
|
+
declare class ArchilS3Error extends ArchilError {
|
|
449
|
+
/** S3 request id, if the gateway returned one. */
|
|
450
|
+
readonly requestId?: string;
|
|
451
|
+
/** Raw response body (the XML document), for debugging. */
|
|
452
|
+
readonly raw: string;
|
|
453
|
+
constructor(opts: {
|
|
454
|
+
operation: string;
|
|
455
|
+
statusCode: number;
|
|
456
|
+
statusText?: string;
|
|
457
|
+
code?: string;
|
|
458
|
+
message?: string;
|
|
459
|
+
requestId?: string;
|
|
460
|
+
raw: string;
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
//#endregion
|
|
420
464
|
//#region src/version.d.ts
|
|
421
465
|
declare const VERSION: string;
|
|
422
466
|
declare const USER_AGENT: string;
|
|
@@ -446,4 +490,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
446
490
|
*/
|
|
447
491
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
448
492
|
//#endregion
|
|
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
|
|
493
|
+
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 RootAttrs, type S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxConnectionInfo, type SandboxEndpoint, SandboxExec, type SandboxExecOptions, type SandboxExecResponse, type SandboxExecStatus, type SandboxForkOptions, SandboxPty, type SandboxPtyOptions, type SandboxPtyResult, type SandboxResponse, type SandboxStatus, 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
|
|
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-DqGdJGsu.mjs";
|
|
2
2
|
import { components } from "@archildata/api-types";
|
|
3
3
|
|
|
4
4
|
//#region src/disks.d.ts
|
|
@@ -50,49 +50,15 @@ declare class Disks {
|
|
|
50
50
|
*
|
|
51
51
|
* Returns the Disk, the one-time token (save it — it cannot be retrieved
|
|
52
52
|
* again), and the token identifier for later management.
|
|
53
|
+
*
|
|
54
|
+
* `rootAttrs` sets the POSIX owner and mode of the disk's root directory
|
|
55
|
+
* (e.g. `{ uid: 1000, gid: 1000, mode: 0o755 }` so an unprivileged process
|
|
56
|
+
* can create entries under the mount root without a post-mount `chown`).
|
|
57
|
+
* Creation-time only.
|
|
53
58
|
*/
|
|
54
59
|
create(req: CreateDiskRequest): Promise<CreateDiskResult>;
|
|
55
60
|
}
|
|
56
61
|
//#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
62
|
//#region src/sandbox.d.ts
|
|
97
63
|
/** @internal */
|
|
98
64
|
type SandboxWire = components["schemas"]["Sandbox"];
|
|
@@ -106,9 +72,12 @@ interface SandboxEndpoint {
|
|
|
106
72
|
}
|
|
107
73
|
interface SandboxResponse {
|
|
108
74
|
id: string;
|
|
75
|
+
name: string;
|
|
109
76
|
status: SandboxStatus;
|
|
110
77
|
vcpuCount: number;
|
|
111
78
|
memSizeMiB: number;
|
|
79
|
+
baseImage: string;
|
|
80
|
+
platform?: "arm64" | "amd64";
|
|
112
81
|
maxTtlSeconds: number;
|
|
113
82
|
maxConcurrentExecs: number;
|
|
114
83
|
endpoints?: SandboxEndpoint[];
|
|
@@ -133,28 +102,34 @@ interface SandboxExecResponse {
|
|
|
133
102
|
finishedAt?: Date;
|
|
134
103
|
}
|
|
135
104
|
interface SandboxWaitOptions {
|
|
136
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Wait for the operation to finish. Defaults to true.
|
|
107
|
+
* The SDK polls if the server's wait budget expires first.
|
|
108
|
+
*/
|
|
109
|
+
wait?: boolean;
|
|
110
|
+
}
|
|
111
|
+
interface SandboxForkOptions extends SandboxWaitOptions {
|
|
112
|
+
/** Name for the fork. The server generates one when omitted. */
|
|
113
|
+
name?: string;
|
|
114
|
+
}
|
|
115
|
+
interface SandboxConnectionInfo {
|
|
116
|
+
url: string;
|
|
117
|
+
expiresAt: Date;
|
|
137
118
|
}
|
|
138
119
|
type SandboxExecOptions = {
|
|
139
120
|
commandTty?: boolean;
|
|
140
121
|
env?: Record<string, string>;
|
|
141
122
|
timeoutSeconds?: number;
|
|
142
123
|
} & SandboxWaitOptions;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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);
|
|
124
|
+
interface SandboxPtyOptions {
|
|
125
|
+
pty: true;
|
|
126
|
+
cols?: number;
|
|
127
|
+
rows?: number;
|
|
128
|
+
onData?: (data: string) => void;
|
|
153
129
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
constructor(sandbox: Sandbox);
|
|
130
|
+
interface SandboxPtyResult {
|
|
131
|
+
/** Unavailable when a runtime closes without reporting the process status. */
|
|
132
|
+
exitCode?: number;
|
|
158
133
|
}
|
|
159
134
|
declare class SandboxExec {
|
|
160
135
|
sandboxId: string;
|
|
@@ -180,11 +155,30 @@ declare class SandboxExec {
|
|
|
180
155
|
/** Cancel this exec and update it in place, returning the same object. */
|
|
181
156
|
cancel(): Promise<SandboxExec>;
|
|
182
157
|
}
|
|
158
|
+
declare class SandboxPty {
|
|
159
|
+
private readonly _socket;
|
|
160
|
+
private readonly _completion;
|
|
161
|
+
/** @internal */
|
|
162
|
+
constructor(socket: WebSocket, onData?: (data: string) => void);
|
|
163
|
+
/** @internal */
|
|
164
|
+
static connect(url: string, command: string, options: SandboxPtyOptions): Promise<SandboxPty>;
|
|
165
|
+
sendInput(data: string): Promise<void>;
|
|
166
|
+
resize(size: {
|
|
167
|
+
cols: number;
|
|
168
|
+
rows: number;
|
|
169
|
+
}): Promise<void>;
|
|
170
|
+
wait(): Promise<SandboxPtyResult>;
|
|
171
|
+
close(): void;
|
|
172
|
+
private _send;
|
|
173
|
+
}
|
|
183
174
|
declare class Sandbox {
|
|
184
175
|
id: string;
|
|
176
|
+
name: string;
|
|
185
177
|
status: SandboxStatus;
|
|
186
178
|
vcpuCount: number;
|
|
187
179
|
memSizeMiB: number;
|
|
180
|
+
baseImage: string;
|
|
181
|
+
platform?: "arm64" | "amd64";
|
|
188
182
|
maxTtlSeconds: number;
|
|
189
183
|
maxConcurrentExecs: number;
|
|
190
184
|
endpoints?: SandboxEndpoint[];
|
|
@@ -204,13 +198,20 @@ declare class Sandbox {
|
|
|
204
198
|
/** Re-fetch this sandbox. */
|
|
205
199
|
refresh(): Promise<this>;
|
|
206
200
|
/** Start this sandbox. */
|
|
207
|
-
start(options?: SandboxWaitOptions): Promise<Sandbox>;
|
|
201
|
+
start(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
208
202
|
/** Stop this sandbox. */
|
|
209
|
-
stop(options?: SandboxWaitOptions): Promise<this>;
|
|
203
|
+
stop(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
210
204
|
/** Pause this sandbox, preserving its CPU and memory state. */
|
|
211
|
-
pause(options?: SandboxWaitOptions): Promise<this>;
|
|
205
|
+
pause(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
212
206
|
/** Resume this sandbox from its preserved CPU and memory state. */
|
|
213
|
-
resume(options?: SandboxWaitOptions): Promise<this>;
|
|
207
|
+
resume(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
208
|
+
/** Create an isolated writable branch from this sandbox's current state. */
|
|
209
|
+
fork(options?: SandboxForkOptions): Promise<Sandbox>;
|
|
210
|
+
/** Create a short-lived signed WebSocket URL for an interactive shell. */
|
|
211
|
+
createConnection(): Promise<SandboxConnectionInfo>;
|
|
212
|
+
/** Delete this sandbox and its backing disk. */
|
|
213
|
+
delete(): Promise<void>;
|
|
214
|
+
exec(command: string, options: SandboxPtyOptions): Promise<SandboxPty>;
|
|
214
215
|
exec(command: string, options?: SandboxExecOptions): Promise<SandboxExec>;
|
|
215
216
|
listExecs(): Promise<SandboxExec[]>;
|
|
216
217
|
getExec(execId: string): Promise<SandboxExec>;
|
|
@@ -219,7 +220,11 @@ declare class Sandbox {
|
|
|
219
220
|
//#endregion
|
|
220
221
|
//#region src/sandboxes.d.ts
|
|
221
222
|
interface CreateSandboxRequest {
|
|
223
|
+
/** Name for the sandbox. The server generates one when omitted. */
|
|
224
|
+
name?: string;
|
|
225
|
+
/** Number of virtual CPUs allocated to the sandbox, from 1 to 32. Defaults to 1. */
|
|
222
226
|
vcpuCount?: number;
|
|
227
|
+
/** Memory allocated to the sandbox in MiB, from 256 to 65536. Defaults to 2048. */
|
|
223
228
|
memSizeMiB?: number;
|
|
224
229
|
/**
|
|
225
230
|
* Public Linux OCI image reference for the sandbox's root filesystem.
|
|
@@ -417,6 +422,45 @@ declare class Archil {
|
|
|
417
422
|
workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
418
423
|
}
|
|
419
424
|
//#endregion
|
|
425
|
+
//#region src/errors.d.ts
|
|
426
|
+
/**
|
|
427
|
+
* Base class for every error the SDK throws. Catch with `instanceof ArchilError`
|
|
428
|
+
* to handle control-plane and S3 failures uniformly; `status` is the HTTP status
|
|
429
|
+
* code and `code` a machine-readable error code when the server provided one.
|
|
430
|
+
*/
|
|
431
|
+
declare class ArchilError extends Error {
|
|
432
|
+
/** HTTP status code associated with the failure. */
|
|
433
|
+
readonly status: number;
|
|
434
|
+
/** Machine-readable error code (e.g. an S3 code like "NoSuchKey"), if known. */
|
|
435
|
+
readonly code?: string;
|
|
436
|
+
constructor(message: string, status: number, code?: string);
|
|
437
|
+
}
|
|
438
|
+
/** Error from the control-plane REST API. */
|
|
439
|
+
declare class ArchilApiError extends ArchilError {
|
|
440
|
+
constructor(message: string, status: number, code?: string);
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Error from the S3-compatible object API (getObject/putObject/deleteObject/
|
|
444
|
+
* headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
|
|
445
|
+
* this surfaces its parts as structured fields (`status`, `code`, `requestId`)
|
|
446
|
+
* rather than a raw blob, while keeping the full body on `raw` for debugging.
|
|
447
|
+
*/
|
|
448
|
+
declare class ArchilS3Error extends ArchilError {
|
|
449
|
+
/** S3 request id, if the gateway returned one. */
|
|
450
|
+
readonly requestId?: string;
|
|
451
|
+
/** Raw response body (the XML document), for debugging. */
|
|
452
|
+
readonly raw: string;
|
|
453
|
+
constructor(opts: {
|
|
454
|
+
operation: string;
|
|
455
|
+
statusCode: number;
|
|
456
|
+
statusText?: string;
|
|
457
|
+
code?: string;
|
|
458
|
+
message?: string;
|
|
459
|
+
requestId?: string;
|
|
460
|
+
raw: string;
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
//#endregion
|
|
420
464
|
//#region src/version.d.ts
|
|
421
465
|
declare const VERSION: string;
|
|
422
466
|
declare const USER_AGENT: string;
|
|
@@ -446,4 +490,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
446
490
|
*/
|
|
447
491
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
448
492
|
//#endregion
|
|
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
|
|
493
|
+
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 RootAttrs, type S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxConnectionInfo, type SandboxEndpoint, SandboxExec, type SandboxExecOptions, type SandboxExecResponse, type SandboxExecStatus, type SandboxForkOptions, SandboxPty, type SandboxPtyOptions, type SandboxPtyResult, type SandboxResponse, type SandboxStatus, 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 { C as
|
|
2
|
-
export { Archil, ArchilApiError, ArchilError, ArchilS3Error, Disk, DiskMultipart, Disks, Sandbox, SandboxExec,
|
|
1
|
+
import { C as effectiveUploadPartSize, D as ArchilError, E as ArchilApiError, O as ArchilS3Error, S as DiskMultipart, T as VERSION, _ as Sandbox, a as deleteApiKey, b as Disks, c as getSandbox, d as listSandboxes, f as workspace, g as Sandboxes, h as Tokens, i as createSandbox, 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 USER_AGENT, x as Disk, y as SandboxPty } from "./src-DyVzhbAB.mjs";
|
|
2
|
+
export { Archil, ArchilApiError, ArchilError, ArchilS3Error, Disk, DiskMultipart, Disks, Sandbox, SandboxExec, SandboxPty, Sandboxes, Tokens, USER_AGENT, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
|