disk 0.9.0 → 0.11.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 +88 -6
- package/dist/cli.mjs +1 -1
- package/dist/{disk-DseHuBL7.d.cts → disk-DqGdJGsu.d.cts} +4 -1
- package/dist/{disk-DseHuBL7.d.mts → disk-DqGdJGsu.d.mts} +4 -1
- package/dist/index.cjs +521 -69
- package/dist/index.d.cts +146 -30
- package/dist/index.d.mts +146 -30
- 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-CR3Ksi_s.mjs → src-Cpv1TIWC.mjs} +518 -69
- 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,10 +50,144 @@ 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
|
|
62
|
+
//#region src/sandbox-process.d.ts
|
|
63
|
+
type SandboxProcessStatus = "running" | "completed" | "failed" | "cancelled" | "timed_out";
|
|
64
|
+
type SandboxProcessStream = "stdout" | "stderr";
|
|
65
|
+
interface SandboxProcessOutput {
|
|
66
|
+
stream: SandboxProcessStream;
|
|
67
|
+
offset: number;
|
|
68
|
+
data: Uint8Array;
|
|
69
|
+
}
|
|
70
|
+
type SandboxProcessOutputHandler = (output: SandboxProcessOutput) => void;
|
|
71
|
+
interface SandboxTerminalOptions {
|
|
72
|
+
cols?: number;
|
|
73
|
+
rows?: number;
|
|
74
|
+
}
|
|
75
|
+
interface SandboxProcessConnectOptions {
|
|
76
|
+
offset?: number;
|
|
77
|
+
onOutput?: SandboxProcessOutputHandler;
|
|
78
|
+
/** Retain decoded stdout and stderr on the handle and result. Defaults to true. */
|
|
79
|
+
collectOutput?: boolean;
|
|
80
|
+
}
|
|
81
|
+
interface SandboxProcessStartOptions {
|
|
82
|
+
/** Enables a PTY. PTY output is merged into stdout and stderr remains empty. */
|
|
83
|
+
terminal?: boolean | SandboxTerminalOptions;
|
|
84
|
+
env?: Record<string, string>;
|
|
85
|
+
timeoutSeconds?: number;
|
|
86
|
+
onOutput?: SandboxProcessOutputHandler;
|
|
87
|
+
/** Retain decoded stdout and stderr on the handle and result. Defaults to true. */
|
|
88
|
+
collectOutput?: boolean;
|
|
89
|
+
}
|
|
90
|
+
interface SandboxProcessResult {
|
|
91
|
+
status: Exclude<SandboxProcessStatus, "running">;
|
|
92
|
+
exitCode?: number;
|
|
93
|
+
exitReason?: string;
|
|
94
|
+
stdout: string;
|
|
95
|
+
stderr: string;
|
|
96
|
+
}
|
|
97
|
+
type ProcessConnectionRequest = {
|
|
98
|
+
type: "start";
|
|
99
|
+
command: string;
|
|
100
|
+
terminal?: boolean | {
|
|
101
|
+
cols: number;
|
|
102
|
+
rows: number;
|
|
103
|
+
};
|
|
104
|
+
env: Record<string, string>;
|
|
105
|
+
timeout_seconds?: number;
|
|
106
|
+
} | {
|
|
107
|
+
type: "attach";
|
|
108
|
+
process_id: string;
|
|
109
|
+
offset: number;
|
|
110
|
+
};
|
|
111
|
+
type ProcessControlRequest = {
|
|
112
|
+
type: "kill";
|
|
113
|
+
process_id: string;
|
|
114
|
+
} | {
|
|
115
|
+
type: "resize";
|
|
116
|
+
process_id: string;
|
|
117
|
+
cols: number;
|
|
118
|
+
rows: number;
|
|
119
|
+
};
|
|
120
|
+
declare class SandboxProcesses {
|
|
121
|
+
private readonly _sandboxId;
|
|
122
|
+
private readonly _client;
|
|
123
|
+
/** @internal */
|
|
124
|
+
constructor(sandboxId: string, client: ApiClient);
|
|
125
|
+
start(command: string, options?: SandboxProcessStartOptions): Promise<SandboxProcess>;
|
|
126
|
+
connect(processId: string, options?: SandboxProcessConnectOptions): Promise<SandboxProcess>;
|
|
127
|
+
private _connectionUrl;
|
|
128
|
+
private _control;
|
|
129
|
+
}
|
|
130
|
+
declare class SandboxProcess {
|
|
131
|
+
status: SandboxProcessStatus;
|
|
132
|
+
stdout: string;
|
|
133
|
+
stderr: string;
|
|
134
|
+
private _id;
|
|
135
|
+
private _cursor;
|
|
136
|
+
private readonly _onOutput?;
|
|
137
|
+
private readonly _collectOutput;
|
|
138
|
+
private readonly _connectionUrl;
|
|
139
|
+
private readonly _controlProcess;
|
|
140
|
+
private readonly _stdoutDecoder;
|
|
141
|
+
private readonly _stderrDecoder;
|
|
142
|
+
private readonly _terminal;
|
|
143
|
+
private _resolveTerminal;
|
|
144
|
+
private _result?;
|
|
145
|
+
private _socket?;
|
|
146
|
+
private _connectionClosed?;
|
|
147
|
+
private _connectionError?;
|
|
148
|
+
private _stdinClosed;
|
|
149
|
+
/** @internal */
|
|
150
|
+
constructor(processId: string, cursor: number, onOutput: SandboxProcessOutputHandler | undefined, collectOutput: boolean, connectionUrl: () => Promise<string>, controlProcess: (request: ProcessControlRequest) => Promise<void>);
|
|
151
|
+
get id(): string;
|
|
152
|
+
get cursor(): number;
|
|
153
|
+
get connected(): boolean;
|
|
154
|
+
sendInput(data: string | Uint8Array): Promise<void>;
|
|
155
|
+
resize(size: {
|
|
156
|
+
cols: number;
|
|
157
|
+
rows: number;
|
|
158
|
+
}): Promise<void>;
|
|
159
|
+
/** Close stdin. Piped processes only. */
|
|
160
|
+
closeStdin(): Promise<void>;
|
|
161
|
+
/** Close this client connection without terminating the process. */
|
|
162
|
+
disconnect(): Promise<void>;
|
|
163
|
+
wait(): Promise<SandboxProcessResult>;
|
|
164
|
+
kill(): Promise<void>;
|
|
165
|
+
/** @internal */
|
|
166
|
+
_connect(request: ProcessConnectionRequest): Promise<void>;
|
|
167
|
+
private _openSocket;
|
|
168
|
+
private _sendControl;
|
|
169
|
+
private _sendInput;
|
|
170
|
+
private _handleMessage;
|
|
171
|
+
private _handleOutput;
|
|
172
|
+
private _appendText;
|
|
173
|
+
private _flushDecoders;
|
|
174
|
+
private _finish;
|
|
175
|
+
}
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/sandbox-files.d.ts
|
|
178
|
+
type SandboxFileSource = Uint8Array | ArrayBuffer | Blob | AsyncIterable<Uint8Array> | ReadableStream<Uint8Array>;
|
|
179
|
+
type SandboxFileWriter = (chunk: Uint8Array) => void | Promise<void>;
|
|
180
|
+
interface SandboxFileUploadOptions {
|
|
181
|
+
mode?: number;
|
|
182
|
+
}
|
|
183
|
+
declare class SandboxFiles {
|
|
184
|
+
private readonly _processes;
|
|
185
|
+
/** @internal */
|
|
186
|
+
constructor(processes: SandboxProcesses);
|
|
187
|
+
uploadFile(source: SandboxFileSource, remotePath: string, options?: SandboxFileUploadOptions): Promise<void>;
|
|
188
|
+
downloadFile(remotePath: string, write: SandboxFileWriter): Promise<void>;
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
57
191
|
//#region src/sandbox.d.ts
|
|
58
192
|
/** @internal */
|
|
59
193
|
type SandboxWire = components["schemas"]["Sandbox"];
|
|
@@ -74,6 +208,7 @@ interface SandboxResponse {
|
|
|
74
208
|
baseImage: string;
|
|
75
209
|
platform?: "arm64" | "amd64";
|
|
76
210
|
maxTtlSeconds: number;
|
|
211
|
+
/** Maximum concurrently attached exec sessions. Detached processes and one-shot controls do not count. */
|
|
77
212
|
maxConcurrentExecs: number;
|
|
78
213
|
endpoints?: SandboxEndpoint[];
|
|
79
214
|
createdAt: Date;
|
|
@@ -116,16 +251,6 @@ type SandboxExecOptions = {
|
|
|
116
251
|
env?: Record<string, string>;
|
|
117
252
|
timeoutSeconds?: number;
|
|
118
253
|
} & SandboxWaitOptions;
|
|
119
|
-
interface SandboxPtyOptions {
|
|
120
|
-
pty: true;
|
|
121
|
-
cols?: number;
|
|
122
|
-
rows?: number;
|
|
123
|
-
onData?: (data: string) => void;
|
|
124
|
-
}
|
|
125
|
-
interface SandboxPtyResult {
|
|
126
|
-
/** Unavailable when a runtime closes without reporting the process status. */
|
|
127
|
-
exitCode?: number;
|
|
128
|
-
}
|
|
129
254
|
declare class SandboxExec {
|
|
130
255
|
sandboxId: string;
|
|
131
256
|
id: string;
|
|
@@ -150,22 +275,6 @@ declare class SandboxExec {
|
|
|
150
275
|
/** Cancel this exec and update it in place, returning the same object. */
|
|
151
276
|
cancel(): Promise<SandboxExec>;
|
|
152
277
|
}
|
|
153
|
-
declare class SandboxPty {
|
|
154
|
-
private readonly _socket;
|
|
155
|
-
private readonly _completion;
|
|
156
|
-
/** @internal */
|
|
157
|
-
constructor(socket: WebSocket, onData?: (data: string) => void);
|
|
158
|
-
/** @internal */
|
|
159
|
-
static connect(url: string, command: string, options: SandboxPtyOptions): Promise<SandboxPty>;
|
|
160
|
-
sendInput(data: string): Promise<void>;
|
|
161
|
-
resize(size: {
|
|
162
|
-
cols: number;
|
|
163
|
-
rows: number;
|
|
164
|
-
}): Promise<void>;
|
|
165
|
-
wait(): Promise<SandboxPtyResult>;
|
|
166
|
-
close(): void;
|
|
167
|
-
private _send;
|
|
168
|
-
}
|
|
169
278
|
declare class Sandbox {
|
|
170
279
|
id: string;
|
|
171
280
|
name: string;
|
|
@@ -183,6 +292,8 @@ declare class Sandbox {
|
|
|
183
292
|
lastActiveAt: Date;
|
|
184
293
|
expiresAt?: Date;
|
|
185
294
|
exitReason?: string;
|
|
295
|
+
readonly processes: SandboxProcesses;
|
|
296
|
+
readonly files: SandboxFiles;
|
|
186
297
|
/** @internal */
|
|
187
298
|
private readonly _client;
|
|
188
299
|
/** @internal */
|
|
@@ -202,11 +313,10 @@ declare class Sandbox {
|
|
|
202
313
|
resume(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
203
314
|
/** Create an isolated writable branch from this sandbox's current state. */
|
|
204
315
|
fork(options?: SandboxForkOptions): Promise<Sandbox>;
|
|
205
|
-
/** Create a short-lived signed WebSocket URL for
|
|
316
|
+
/** Create a short-lived signed WebSocket URL for a sandbox process connection. */
|
|
206
317
|
createConnection(): Promise<SandboxConnectionInfo>;
|
|
207
318
|
/** Delete this sandbox and its backing disk. */
|
|
208
319
|
delete(): Promise<void>;
|
|
209
|
-
exec(command: string, options: SandboxPtyOptions): Promise<SandboxPty>;
|
|
210
320
|
exec(command: string, options?: SandboxExecOptions): Promise<SandboxExec>;
|
|
211
321
|
listExecs(): Promise<SandboxExec[]>;
|
|
212
322
|
getExec(execId: string): Promise<SandboxExec>;
|
|
@@ -233,6 +343,7 @@ interface CreateSandboxRequest {
|
|
|
233
343
|
baseImage?: string;
|
|
234
344
|
env?: Record<string, string>;
|
|
235
345
|
maxTtlSeconds?: number;
|
|
346
|
+
/** Maximum concurrently attached exec sessions. Detached processes and one-shot controls do not count. */
|
|
236
347
|
maxConcurrentExecs?: number;
|
|
237
348
|
}
|
|
238
349
|
interface ListSandboxesOptions {
|
|
@@ -434,6 +545,11 @@ declare class ArchilError extends Error {
|
|
|
434
545
|
declare class ArchilApiError extends ArchilError {
|
|
435
546
|
constructor(message: string, status: number, code?: string);
|
|
436
547
|
}
|
|
548
|
+
declare class SandboxFileTransferError extends ArchilError {
|
|
549
|
+
readonly operation: "upload" | "download";
|
|
550
|
+
readonly path: string;
|
|
551
|
+
constructor(operation: "upload" | "download", path: string, cause: Error);
|
|
552
|
+
}
|
|
437
553
|
/**
|
|
438
554
|
* Error from the S3-compatible object API (getObject/putObject/deleteObject/
|
|
439
555
|
* headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
|
|
@@ -485,4 +601,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
485
601
|
*/
|
|
486
602
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
487
603
|
//#endregion
|
|
488
|
-
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 SandboxConnectionInfo, type SandboxEndpoint, SandboxExec, type SandboxExecOptions, type SandboxExecResponse, type SandboxExecStatus, type SandboxForkOptions,
|
|
604
|
+
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 SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStatus, type SandboxTerminalOptions, 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,10 +50,144 @@ 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
|
|
62
|
+
//#region src/sandbox-process.d.ts
|
|
63
|
+
type SandboxProcessStatus = "running" | "completed" | "failed" | "cancelled" | "timed_out";
|
|
64
|
+
type SandboxProcessStream = "stdout" | "stderr";
|
|
65
|
+
interface SandboxProcessOutput {
|
|
66
|
+
stream: SandboxProcessStream;
|
|
67
|
+
offset: number;
|
|
68
|
+
data: Uint8Array;
|
|
69
|
+
}
|
|
70
|
+
type SandboxProcessOutputHandler = (output: SandboxProcessOutput) => void;
|
|
71
|
+
interface SandboxTerminalOptions {
|
|
72
|
+
cols?: number;
|
|
73
|
+
rows?: number;
|
|
74
|
+
}
|
|
75
|
+
interface SandboxProcessConnectOptions {
|
|
76
|
+
offset?: number;
|
|
77
|
+
onOutput?: SandboxProcessOutputHandler;
|
|
78
|
+
/** Retain decoded stdout and stderr on the handle and result. Defaults to true. */
|
|
79
|
+
collectOutput?: boolean;
|
|
80
|
+
}
|
|
81
|
+
interface SandboxProcessStartOptions {
|
|
82
|
+
/** Enables a PTY. PTY output is merged into stdout and stderr remains empty. */
|
|
83
|
+
terminal?: boolean | SandboxTerminalOptions;
|
|
84
|
+
env?: Record<string, string>;
|
|
85
|
+
timeoutSeconds?: number;
|
|
86
|
+
onOutput?: SandboxProcessOutputHandler;
|
|
87
|
+
/** Retain decoded stdout and stderr on the handle and result. Defaults to true. */
|
|
88
|
+
collectOutput?: boolean;
|
|
89
|
+
}
|
|
90
|
+
interface SandboxProcessResult {
|
|
91
|
+
status: Exclude<SandboxProcessStatus, "running">;
|
|
92
|
+
exitCode?: number;
|
|
93
|
+
exitReason?: string;
|
|
94
|
+
stdout: string;
|
|
95
|
+
stderr: string;
|
|
96
|
+
}
|
|
97
|
+
type ProcessConnectionRequest = {
|
|
98
|
+
type: "start";
|
|
99
|
+
command: string;
|
|
100
|
+
terminal?: boolean | {
|
|
101
|
+
cols: number;
|
|
102
|
+
rows: number;
|
|
103
|
+
};
|
|
104
|
+
env: Record<string, string>;
|
|
105
|
+
timeout_seconds?: number;
|
|
106
|
+
} | {
|
|
107
|
+
type: "attach";
|
|
108
|
+
process_id: string;
|
|
109
|
+
offset: number;
|
|
110
|
+
};
|
|
111
|
+
type ProcessControlRequest = {
|
|
112
|
+
type: "kill";
|
|
113
|
+
process_id: string;
|
|
114
|
+
} | {
|
|
115
|
+
type: "resize";
|
|
116
|
+
process_id: string;
|
|
117
|
+
cols: number;
|
|
118
|
+
rows: number;
|
|
119
|
+
};
|
|
120
|
+
declare class SandboxProcesses {
|
|
121
|
+
private readonly _sandboxId;
|
|
122
|
+
private readonly _client;
|
|
123
|
+
/** @internal */
|
|
124
|
+
constructor(sandboxId: string, client: ApiClient);
|
|
125
|
+
start(command: string, options?: SandboxProcessStartOptions): Promise<SandboxProcess>;
|
|
126
|
+
connect(processId: string, options?: SandboxProcessConnectOptions): Promise<SandboxProcess>;
|
|
127
|
+
private _connectionUrl;
|
|
128
|
+
private _control;
|
|
129
|
+
}
|
|
130
|
+
declare class SandboxProcess {
|
|
131
|
+
status: SandboxProcessStatus;
|
|
132
|
+
stdout: string;
|
|
133
|
+
stderr: string;
|
|
134
|
+
private _id;
|
|
135
|
+
private _cursor;
|
|
136
|
+
private readonly _onOutput?;
|
|
137
|
+
private readonly _collectOutput;
|
|
138
|
+
private readonly _connectionUrl;
|
|
139
|
+
private readonly _controlProcess;
|
|
140
|
+
private readonly _stdoutDecoder;
|
|
141
|
+
private readonly _stderrDecoder;
|
|
142
|
+
private readonly _terminal;
|
|
143
|
+
private _resolveTerminal;
|
|
144
|
+
private _result?;
|
|
145
|
+
private _socket?;
|
|
146
|
+
private _connectionClosed?;
|
|
147
|
+
private _connectionError?;
|
|
148
|
+
private _stdinClosed;
|
|
149
|
+
/** @internal */
|
|
150
|
+
constructor(processId: string, cursor: number, onOutput: SandboxProcessOutputHandler | undefined, collectOutput: boolean, connectionUrl: () => Promise<string>, controlProcess: (request: ProcessControlRequest) => Promise<void>);
|
|
151
|
+
get id(): string;
|
|
152
|
+
get cursor(): number;
|
|
153
|
+
get connected(): boolean;
|
|
154
|
+
sendInput(data: string | Uint8Array): Promise<void>;
|
|
155
|
+
resize(size: {
|
|
156
|
+
cols: number;
|
|
157
|
+
rows: number;
|
|
158
|
+
}): Promise<void>;
|
|
159
|
+
/** Close stdin. Piped processes only. */
|
|
160
|
+
closeStdin(): Promise<void>;
|
|
161
|
+
/** Close this client connection without terminating the process. */
|
|
162
|
+
disconnect(): Promise<void>;
|
|
163
|
+
wait(): Promise<SandboxProcessResult>;
|
|
164
|
+
kill(): Promise<void>;
|
|
165
|
+
/** @internal */
|
|
166
|
+
_connect(request: ProcessConnectionRequest): Promise<void>;
|
|
167
|
+
private _openSocket;
|
|
168
|
+
private _sendControl;
|
|
169
|
+
private _sendInput;
|
|
170
|
+
private _handleMessage;
|
|
171
|
+
private _handleOutput;
|
|
172
|
+
private _appendText;
|
|
173
|
+
private _flushDecoders;
|
|
174
|
+
private _finish;
|
|
175
|
+
}
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/sandbox-files.d.ts
|
|
178
|
+
type SandboxFileSource = Uint8Array | ArrayBuffer | Blob | AsyncIterable<Uint8Array> | ReadableStream<Uint8Array>;
|
|
179
|
+
type SandboxFileWriter = (chunk: Uint8Array) => void | Promise<void>;
|
|
180
|
+
interface SandboxFileUploadOptions {
|
|
181
|
+
mode?: number;
|
|
182
|
+
}
|
|
183
|
+
declare class SandboxFiles {
|
|
184
|
+
private readonly _processes;
|
|
185
|
+
/** @internal */
|
|
186
|
+
constructor(processes: SandboxProcesses);
|
|
187
|
+
uploadFile(source: SandboxFileSource, remotePath: string, options?: SandboxFileUploadOptions): Promise<void>;
|
|
188
|
+
downloadFile(remotePath: string, write: SandboxFileWriter): Promise<void>;
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
57
191
|
//#region src/sandbox.d.ts
|
|
58
192
|
/** @internal */
|
|
59
193
|
type SandboxWire = components["schemas"]["Sandbox"];
|
|
@@ -74,6 +208,7 @@ interface SandboxResponse {
|
|
|
74
208
|
baseImage: string;
|
|
75
209
|
platform?: "arm64" | "amd64";
|
|
76
210
|
maxTtlSeconds: number;
|
|
211
|
+
/** Maximum concurrently attached exec sessions. Detached processes and one-shot controls do not count. */
|
|
77
212
|
maxConcurrentExecs: number;
|
|
78
213
|
endpoints?: SandboxEndpoint[];
|
|
79
214
|
createdAt: Date;
|
|
@@ -116,16 +251,6 @@ type SandboxExecOptions = {
|
|
|
116
251
|
env?: Record<string, string>;
|
|
117
252
|
timeoutSeconds?: number;
|
|
118
253
|
} & SandboxWaitOptions;
|
|
119
|
-
interface SandboxPtyOptions {
|
|
120
|
-
pty: true;
|
|
121
|
-
cols?: number;
|
|
122
|
-
rows?: number;
|
|
123
|
-
onData?: (data: string) => void;
|
|
124
|
-
}
|
|
125
|
-
interface SandboxPtyResult {
|
|
126
|
-
/** Unavailable when a runtime closes without reporting the process status. */
|
|
127
|
-
exitCode?: number;
|
|
128
|
-
}
|
|
129
254
|
declare class SandboxExec {
|
|
130
255
|
sandboxId: string;
|
|
131
256
|
id: string;
|
|
@@ -150,22 +275,6 @@ declare class SandboxExec {
|
|
|
150
275
|
/** Cancel this exec and update it in place, returning the same object. */
|
|
151
276
|
cancel(): Promise<SandboxExec>;
|
|
152
277
|
}
|
|
153
|
-
declare class SandboxPty {
|
|
154
|
-
private readonly _socket;
|
|
155
|
-
private readonly _completion;
|
|
156
|
-
/** @internal */
|
|
157
|
-
constructor(socket: WebSocket, onData?: (data: string) => void);
|
|
158
|
-
/** @internal */
|
|
159
|
-
static connect(url: string, command: string, options: SandboxPtyOptions): Promise<SandboxPty>;
|
|
160
|
-
sendInput(data: string): Promise<void>;
|
|
161
|
-
resize(size: {
|
|
162
|
-
cols: number;
|
|
163
|
-
rows: number;
|
|
164
|
-
}): Promise<void>;
|
|
165
|
-
wait(): Promise<SandboxPtyResult>;
|
|
166
|
-
close(): void;
|
|
167
|
-
private _send;
|
|
168
|
-
}
|
|
169
278
|
declare class Sandbox {
|
|
170
279
|
id: string;
|
|
171
280
|
name: string;
|
|
@@ -183,6 +292,8 @@ declare class Sandbox {
|
|
|
183
292
|
lastActiveAt: Date;
|
|
184
293
|
expiresAt?: Date;
|
|
185
294
|
exitReason?: string;
|
|
295
|
+
readonly processes: SandboxProcesses;
|
|
296
|
+
readonly files: SandboxFiles;
|
|
186
297
|
/** @internal */
|
|
187
298
|
private readonly _client;
|
|
188
299
|
/** @internal */
|
|
@@ -202,11 +313,10 @@ declare class Sandbox {
|
|
|
202
313
|
resume(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
203
314
|
/** Create an isolated writable branch from this sandbox's current state. */
|
|
204
315
|
fork(options?: SandboxForkOptions): Promise<Sandbox>;
|
|
205
|
-
/** Create a short-lived signed WebSocket URL for
|
|
316
|
+
/** Create a short-lived signed WebSocket URL for a sandbox process connection. */
|
|
206
317
|
createConnection(): Promise<SandboxConnectionInfo>;
|
|
207
318
|
/** Delete this sandbox and its backing disk. */
|
|
208
319
|
delete(): Promise<void>;
|
|
209
|
-
exec(command: string, options: SandboxPtyOptions): Promise<SandboxPty>;
|
|
210
320
|
exec(command: string, options?: SandboxExecOptions): Promise<SandboxExec>;
|
|
211
321
|
listExecs(): Promise<SandboxExec[]>;
|
|
212
322
|
getExec(execId: string): Promise<SandboxExec>;
|
|
@@ -233,6 +343,7 @@ interface CreateSandboxRequest {
|
|
|
233
343
|
baseImage?: string;
|
|
234
344
|
env?: Record<string, string>;
|
|
235
345
|
maxTtlSeconds?: number;
|
|
346
|
+
/** Maximum concurrently attached exec sessions. Detached processes and one-shot controls do not count. */
|
|
236
347
|
maxConcurrentExecs?: number;
|
|
237
348
|
}
|
|
238
349
|
interface ListSandboxesOptions {
|
|
@@ -434,6 +545,11 @@ declare class ArchilError extends Error {
|
|
|
434
545
|
declare class ArchilApiError extends ArchilError {
|
|
435
546
|
constructor(message: string, status: number, code?: string);
|
|
436
547
|
}
|
|
548
|
+
declare class SandboxFileTransferError extends ArchilError {
|
|
549
|
+
readonly operation: "upload" | "download";
|
|
550
|
+
readonly path: string;
|
|
551
|
+
constructor(operation: "upload" | "download", path: string, cause: Error);
|
|
552
|
+
}
|
|
437
553
|
/**
|
|
438
554
|
* Error from the S3-compatible object API (getObject/putObject/deleteObject/
|
|
439
555
|
* headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
|
|
@@ -485,4 +601,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
485
601
|
*/
|
|
486
602
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
487
603
|
//#endregion
|
|
488
|
-
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 SandboxConnectionInfo, type SandboxEndpoint, SandboxExec, type SandboxExecOptions, type SandboxExecResponse, type SandboxExecStatus, type SandboxForkOptions,
|
|
604
|
+
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 SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStatus, type SandboxTerminalOptions, 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 { A as ArchilS3Error, C as Disk, D as VERSION, E as USER_AGENT, O as ArchilApiError, S as Disks, T as effectiveUploadPartSize, _ as Sandbox, a as deleteApiKey, b as SandboxProcess, 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 SandboxExec, w as DiskMultipart, x as SandboxProcesses, y as SandboxFiles } from "./src-Cpv1TIWC.mjs";
|
|
2
|
+
export { Archil, ArchilApiError, ArchilError, ArchilS3Error, Disk, DiskMultipart, Disks, Sandbox, SandboxExec, SandboxFileTransferError, SandboxFiles, SandboxProcess, SandboxProcesses, Sandboxes, Tokens, USER_AGENT, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
|