disk 0.10.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 +58 -6
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +511 -68
- package/dist/index.d.cts +140 -29
- package/dist/index.d.mts +140 -29
- package/dist/index.mjs +2 -2
- package/dist/{src-DyVzhbAB.mjs → src-Cpv1TIWC.mjs} +508 -68
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -59,6 +59,135 @@ declare class Disks {
|
|
|
59
59
|
create(req: CreateDiskRequest): Promise<CreateDiskResult>;
|
|
60
60
|
}
|
|
61
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
|
|
62
191
|
//#region src/sandbox.d.ts
|
|
63
192
|
/** @internal */
|
|
64
193
|
type SandboxWire = components["schemas"]["Sandbox"];
|
|
@@ -79,6 +208,7 @@ interface SandboxResponse {
|
|
|
79
208
|
baseImage: string;
|
|
80
209
|
platform?: "arm64" | "amd64";
|
|
81
210
|
maxTtlSeconds: number;
|
|
211
|
+
/** Maximum concurrently attached exec sessions. Detached processes and one-shot controls do not count. */
|
|
82
212
|
maxConcurrentExecs: number;
|
|
83
213
|
endpoints?: SandboxEndpoint[];
|
|
84
214
|
createdAt: Date;
|
|
@@ -121,16 +251,6 @@ type SandboxExecOptions = {
|
|
|
121
251
|
env?: Record<string, string>;
|
|
122
252
|
timeoutSeconds?: number;
|
|
123
253
|
} & SandboxWaitOptions;
|
|
124
|
-
interface SandboxPtyOptions {
|
|
125
|
-
pty: true;
|
|
126
|
-
cols?: number;
|
|
127
|
-
rows?: number;
|
|
128
|
-
onData?: (data: string) => void;
|
|
129
|
-
}
|
|
130
|
-
interface SandboxPtyResult {
|
|
131
|
-
/** Unavailable when a runtime closes without reporting the process status. */
|
|
132
|
-
exitCode?: number;
|
|
133
|
-
}
|
|
134
254
|
declare class SandboxExec {
|
|
135
255
|
sandboxId: string;
|
|
136
256
|
id: string;
|
|
@@ -155,22 +275,6 @@ declare class SandboxExec {
|
|
|
155
275
|
/** Cancel this exec and update it in place, returning the same object. */
|
|
156
276
|
cancel(): Promise<SandboxExec>;
|
|
157
277
|
}
|
|
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
|
-
}
|
|
174
278
|
declare class Sandbox {
|
|
175
279
|
id: string;
|
|
176
280
|
name: string;
|
|
@@ -188,6 +292,8 @@ declare class Sandbox {
|
|
|
188
292
|
lastActiveAt: Date;
|
|
189
293
|
expiresAt?: Date;
|
|
190
294
|
exitReason?: string;
|
|
295
|
+
readonly processes: SandboxProcesses;
|
|
296
|
+
readonly files: SandboxFiles;
|
|
191
297
|
/** @internal */
|
|
192
298
|
private readonly _client;
|
|
193
299
|
/** @internal */
|
|
@@ -207,11 +313,10 @@ declare class Sandbox {
|
|
|
207
313
|
resume(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
208
314
|
/** Create an isolated writable branch from this sandbox's current state. */
|
|
209
315
|
fork(options?: SandboxForkOptions): Promise<Sandbox>;
|
|
210
|
-
/** Create a short-lived signed WebSocket URL for
|
|
316
|
+
/** Create a short-lived signed WebSocket URL for a sandbox process connection. */
|
|
211
317
|
createConnection(): Promise<SandboxConnectionInfo>;
|
|
212
318
|
/** Delete this sandbox and its backing disk. */
|
|
213
319
|
delete(): Promise<void>;
|
|
214
|
-
exec(command: string, options: SandboxPtyOptions): Promise<SandboxPty>;
|
|
215
320
|
exec(command: string, options?: SandboxExecOptions): Promise<SandboxExec>;
|
|
216
321
|
listExecs(): Promise<SandboxExec[]>;
|
|
217
322
|
getExec(execId: string): Promise<SandboxExec>;
|
|
@@ -238,6 +343,7 @@ interface CreateSandboxRequest {
|
|
|
238
343
|
baseImage?: string;
|
|
239
344
|
env?: Record<string, string>;
|
|
240
345
|
maxTtlSeconds?: number;
|
|
346
|
+
/** Maximum concurrently attached exec sessions. Detached processes and one-shot controls do not count. */
|
|
241
347
|
maxConcurrentExecs?: number;
|
|
242
348
|
}
|
|
243
349
|
interface ListSandboxesOptions {
|
|
@@ -439,6 +545,11 @@ declare class ArchilError extends Error {
|
|
|
439
545
|
declare class ArchilApiError extends ArchilError {
|
|
440
546
|
constructor(message: string, status: number, code?: string);
|
|
441
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
|
+
}
|
|
442
553
|
/**
|
|
443
554
|
* Error from the S3-compatible object API (getObject/putObject/deleteObject/
|
|
444
555
|
* headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
|
|
@@ -490,4 +601,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
490
601
|
*/
|
|
491
602
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
492
603
|
//#endregion
|
|
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,
|
|
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
|
@@ -59,6 +59,135 @@ declare class Disks {
|
|
|
59
59
|
create(req: CreateDiskRequest): Promise<CreateDiskResult>;
|
|
60
60
|
}
|
|
61
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
|
|
62
191
|
//#region src/sandbox.d.ts
|
|
63
192
|
/** @internal */
|
|
64
193
|
type SandboxWire = components["schemas"]["Sandbox"];
|
|
@@ -79,6 +208,7 @@ interface SandboxResponse {
|
|
|
79
208
|
baseImage: string;
|
|
80
209
|
platform?: "arm64" | "amd64";
|
|
81
210
|
maxTtlSeconds: number;
|
|
211
|
+
/** Maximum concurrently attached exec sessions. Detached processes and one-shot controls do not count. */
|
|
82
212
|
maxConcurrentExecs: number;
|
|
83
213
|
endpoints?: SandboxEndpoint[];
|
|
84
214
|
createdAt: Date;
|
|
@@ -121,16 +251,6 @@ type SandboxExecOptions = {
|
|
|
121
251
|
env?: Record<string, string>;
|
|
122
252
|
timeoutSeconds?: number;
|
|
123
253
|
} & SandboxWaitOptions;
|
|
124
|
-
interface SandboxPtyOptions {
|
|
125
|
-
pty: true;
|
|
126
|
-
cols?: number;
|
|
127
|
-
rows?: number;
|
|
128
|
-
onData?: (data: string) => void;
|
|
129
|
-
}
|
|
130
|
-
interface SandboxPtyResult {
|
|
131
|
-
/** Unavailable when a runtime closes without reporting the process status. */
|
|
132
|
-
exitCode?: number;
|
|
133
|
-
}
|
|
134
254
|
declare class SandboxExec {
|
|
135
255
|
sandboxId: string;
|
|
136
256
|
id: string;
|
|
@@ -155,22 +275,6 @@ declare class SandboxExec {
|
|
|
155
275
|
/** Cancel this exec and update it in place, returning the same object. */
|
|
156
276
|
cancel(): Promise<SandboxExec>;
|
|
157
277
|
}
|
|
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
|
-
}
|
|
174
278
|
declare class Sandbox {
|
|
175
279
|
id: string;
|
|
176
280
|
name: string;
|
|
@@ -188,6 +292,8 @@ declare class Sandbox {
|
|
|
188
292
|
lastActiveAt: Date;
|
|
189
293
|
expiresAt?: Date;
|
|
190
294
|
exitReason?: string;
|
|
295
|
+
readonly processes: SandboxProcesses;
|
|
296
|
+
readonly files: SandboxFiles;
|
|
191
297
|
/** @internal */
|
|
192
298
|
private readonly _client;
|
|
193
299
|
/** @internal */
|
|
@@ -207,11 +313,10 @@ declare class Sandbox {
|
|
|
207
313
|
resume(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
208
314
|
/** Create an isolated writable branch from this sandbox's current state. */
|
|
209
315
|
fork(options?: SandboxForkOptions): Promise<Sandbox>;
|
|
210
|
-
/** Create a short-lived signed WebSocket URL for
|
|
316
|
+
/** Create a short-lived signed WebSocket URL for a sandbox process connection. */
|
|
211
317
|
createConnection(): Promise<SandboxConnectionInfo>;
|
|
212
318
|
/** Delete this sandbox and its backing disk. */
|
|
213
319
|
delete(): Promise<void>;
|
|
214
|
-
exec(command: string, options: SandboxPtyOptions): Promise<SandboxPty>;
|
|
215
320
|
exec(command: string, options?: SandboxExecOptions): Promise<SandboxExec>;
|
|
216
321
|
listExecs(): Promise<SandboxExec[]>;
|
|
217
322
|
getExec(execId: string): Promise<SandboxExec>;
|
|
@@ -238,6 +343,7 @@ interface CreateSandboxRequest {
|
|
|
238
343
|
baseImage?: string;
|
|
239
344
|
env?: Record<string, string>;
|
|
240
345
|
maxTtlSeconds?: number;
|
|
346
|
+
/** Maximum concurrently attached exec sessions. Detached processes and one-shot controls do not count. */
|
|
241
347
|
maxConcurrentExecs?: number;
|
|
242
348
|
}
|
|
243
349
|
interface ListSandboxesOptions {
|
|
@@ -439,6 +545,11 @@ declare class ArchilError extends Error {
|
|
|
439
545
|
declare class ArchilApiError extends ArchilError {
|
|
440
546
|
constructor(message: string, status: number, code?: string);
|
|
441
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
|
+
}
|
|
442
553
|
/**
|
|
443
554
|
* Error from the S3-compatible object API (getObject/putObject/deleteObject/
|
|
444
555
|
* headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
|
|
@@ -490,4 +601,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
490
601
|
*/
|
|
491
602
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
492
603
|
//#endregion
|
|
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,
|
|
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 };
|