disk 0.10.0 → 1.0.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/dist/index.d.cts CHANGED
@@ -59,13 +59,139 @@ 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"];
65
- /** @internal */
66
- type SandboxExecWire = components["schemas"]["SandboxExec"];
67
194
  type SandboxStatus = components["schemas"]["SandboxState"];
68
- type SandboxExecStatus = components["schemas"]["SandboxExecState"];
69
195
  interface SandboxEndpoint {
70
196
  port: number;
71
197
  hostname: string;
@@ -79,6 +205,7 @@ interface SandboxResponse {
79
205
  baseImage: string;
80
206
  platform?: "arm64" | "amd64";
81
207
  maxTtlSeconds: number;
208
+ /** Maximum concurrently attached process sessions. Detached processes and one-shot controls do not count. */
82
209
  maxConcurrentExecs: number;
83
210
  endpoints?: SandboxEndpoint[];
84
211
  createdAt: Date;
@@ -88,19 +215,6 @@ interface SandboxResponse {
88
215
  expiresAt?: Date;
89
216
  exitReason?: string;
90
217
  }
91
- interface SandboxExecResponse {
92
- sandboxId: string;
93
- id: string;
94
- command: string;
95
- status: SandboxExecStatus;
96
- exitCode?: number;
97
- stdout?: string;
98
- stderr?: string;
99
- exitReason?: string;
100
- executeTimeMs?: number;
101
- startedAt: Date;
102
- finishedAt?: Date;
103
- }
104
218
  interface SandboxWaitOptions {
105
219
  /**
106
220
  * Wait for the operation to finish. Defaults to true.
@@ -112,65 +226,6 @@ interface SandboxForkOptions extends SandboxWaitOptions {
112
226
  /** Name for the fork. The server generates one when omitted. */
113
227
  name?: string;
114
228
  }
115
- interface SandboxConnectionInfo {
116
- url: string;
117
- expiresAt: Date;
118
- }
119
- type SandboxExecOptions = {
120
- commandTty?: boolean;
121
- env?: Record<string, string>;
122
- timeoutSeconds?: number;
123
- } & 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
- declare class SandboxExec {
135
- sandboxId: string;
136
- id: string;
137
- command: string;
138
- status: SandboxExecStatus;
139
- exitCode?: number;
140
- stdout?: string;
141
- stderr?: string;
142
- exitReason?: string;
143
- executeTimeMs?: number;
144
- startedAt: Date;
145
- finishedAt?: Date;
146
- /** @internal */
147
- private readonly _client;
148
- /** @internal */
149
- constructor(data: SandboxExecWire, client: ApiClient);
150
- /** @internal Overwrite this exec's fields in place from a fresh wire snapshot. */
151
- private _apply;
152
- toJSON(): SandboxExecResponse;
153
- /** Re-fetch this exec and update it in place, returning the same object. */
154
- refresh(): Promise<SandboxExec>;
155
- /** Cancel this exec and update it in place, returning the same object. */
156
- cancel(): Promise<SandboxExec>;
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
- }
174
229
  declare class Sandbox {
175
230
  id: string;
176
231
  name: string;
@@ -188,6 +243,8 @@ declare class Sandbox {
188
243
  lastActiveAt: Date;
189
244
  expiresAt?: Date;
190
245
  exitReason?: string;
246
+ readonly processes: SandboxProcesses;
247
+ readonly files: SandboxFiles;
191
248
  /** @internal */
192
249
  private readonly _client;
193
250
  /** @internal */
@@ -195,6 +252,8 @@ declare class Sandbox {
195
252
  /** @internal Overwrite this sandbox's fields in place from a fresh wire snapshot. */
196
253
  private _apply;
197
254
  toJSON(): SandboxResponse;
255
+ /** Run a process and wait for it to exit. */
256
+ exec(command: string, options?: SandboxProcessStartOptions): Promise<SandboxProcessResult>;
198
257
  /** Re-fetch this sandbox. */
199
258
  refresh(): Promise<this>;
200
259
  /** Start this sandbox. */
@@ -207,15 +266,8 @@ declare class Sandbox {
207
266
  resume(options?: SandboxWaitOptions): Promise<Sandbox | this>;
208
267
  /** Create an isolated writable branch from this sandbox's current state. */
209
268
  fork(options?: SandboxForkOptions): Promise<Sandbox>;
210
- /** Create a short-lived signed WebSocket URL for an interactive shell. */
211
- createConnection(): Promise<SandboxConnectionInfo>;
212
269
  /** Delete this sandbox and its backing disk. */
213
270
  delete(): Promise<void>;
214
- exec(command: string, options: SandboxPtyOptions): Promise<SandboxPty>;
215
- exec(command: string, options?: SandboxExecOptions): Promise<SandboxExec>;
216
- listExecs(): Promise<SandboxExec[]>;
217
- getExec(execId: string): Promise<SandboxExec>;
218
- cancelExec(execId: string): Promise<SandboxExec>;
219
271
  }
220
272
  //#endregion
221
273
  //#region src/sandboxes.d.ts
@@ -238,6 +290,7 @@ interface CreateSandboxRequest {
238
290
  baseImage?: string;
239
291
  env?: Record<string, string>;
240
292
  maxTtlSeconds?: number;
293
+ /** Maximum concurrently attached exec sessions. Detached processes and one-shot controls do not count. */
241
294
  maxConcurrentExecs?: number;
242
295
  }
243
296
  interface ListSandboxesOptions {
@@ -439,6 +492,11 @@ declare class ArchilError extends Error {
439
492
  declare class ArchilApiError extends ArchilError {
440
493
  constructor(message: string, status: number, code?: string);
441
494
  }
495
+ declare class SandboxFileTransferError extends ArchilError {
496
+ readonly operation: "upload" | "download";
497
+ readonly path: string;
498
+ constructor(operation: "upload" | "download", path: string, cause: Error);
499
+ }
442
500
  /**
443
501
  * Error from the S3-compatible object API (getObject/putObject/deleteObject/
444
502
  * headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
@@ -490,4 +548,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
490
548
  */
491
549
  declare function workspace(mounts: Record<string, ExecMount>): Workspace;
492
550
  //#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, 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 };
551
+ 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 SandboxEndpoint, 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,13 +59,139 @@ 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"];
65
- /** @internal */
66
- type SandboxExecWire = components["schemas"]["SandboxExec"];
67
194
  type SandboxStatus = components["schemas"]["SandboxState"];
68
- type SandboxExecStatus = components["schemas"]["SandboxExecState"];
69
195
  interface SandboxEndpoint {
70
196
  port: number;
71
197
  hostname: string;
@@ -79,6 +205,7 @@ interface SandboxResponse {
79
205
  baseImage: string;
80
206
  platform?: "arm64" | "amd64";
81
207
  maxTtlSeconds: number;
208
+ /** Maximum concurrently attached process sessions. Detached processes and one-shot controls do not count. */
82
209
  maxConcurrentExecs: number;
83
210
  endpoints?: SandboxEndpoint[];
84
211
  createdAt: Date;
@@ -88,19 +215,6 @@ interface SandboxResponse {
88
215
  expiresAt?: Date;
89
216
  exitReason?: string;
90
217
  }
91
- interface SandboxExecResponse {
92
- sandboxId: string;
93
- id: string;
94
- command: string;
95
- status: SandboxExecStatus;
96
- exitCode?: number;
97
- stdout?: string;
98
- stderr?: string;
99
- exitReason?: string;
100
- executeTimeMs?: number;
101
- startedAt: Date;
102
- finishedAt?: Date;
103
- }
104
218
  interface SandboxWaitOptions {
105
219
  /**
106
220
  * Wait for the operation to finish. Defaults to true.
@@ -112,65 +226,6 @@ interface SandboxForkOptions extends SandboxWaitOptions {
112
226
  /** Name for the fork. The server generates one when omitted. */
113
227
  name?: string;
114
228
  }
115
- interface SandboxConnectionInfo {
116
- url: string;
117
- expiresAt: Date;
118
- }
119
- type SandboxExecOptions = {
120
- commandTty?: boolean;
121
- env?: Record<string, string>;
122
- timeoutSeconds?: number;
123
- } & 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
- declare class SandboxExec {
135
- sandboxId: string;
136
- id: string;
137
- command: string;
138
- status: SandboxExecStatus;
139
- exitCode?: number;
140
- stdout?: string;
141
- stderr?: string;
142
- exitReason?: string;
143
- executeTimeMs?: number;
144
- startedAt: Date;
145
- finishedAt?: Date;
146
- /** @internal */
147
- private readonly _client;
148
- /** @internal */
149
- constructor(data: SandboxExecWire, client: ApiClient);
150
- /** @internal Overwrite this exec's fields in place from a fresh wire snapshot. */
151
- private _apply;
152
- toJSON(): SandboxExecResponse;
153
- /** Re-fetch this exec and update it in place, returning the same object. */
154
- refresh(): Promise<SandboxExec>;
155
- /** Cancel this exec and update it in place, returning the same object. */
156
- cancel(): Promise<SandboxExec>;
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
- }
174
229
  declare class Sandbox {
175
230
  id: string;
176
231
  name: string;
@@ -188,6 +243,8 @@ declare class Sandbox {
188
243
  lastActiveAt: Date;
189
244
  expiresAt?: Date;
190
245
  exitReason?: string;
246
+ readonly processes: SandboxProcesses;
247
+ readonly files: SandboxFiles;
191
248
  /** @internal */
192
249
  private readonly _client;
193
250
  /** @internal */
@@ -195,6 +252,8 @@ declare class Sandbox {
195
252
  /** @internal Overwrite this sandbox's fields in place from a fresh wire snapshot. */
196
253
  private _apply;
197
254
  toJSON(): SandboxResponse;
255
+ /** Run a process and wait for it to exit. */
256
+ exec(command: string, options?: SandboxProcessStartOptions): Promise<SandboxProcessResult>;
198
257
  /** Re-fetch this sandbox. */
199
258
  refresh(): Promise<this>;
200
259
  /** Start this sandbox. */
@@ -207,15 +266,8 @@ declare class Sandbox {
207
266
  resume(options?: SandboxWaitOptions): Promise<Sandbox | this>;
208
267
  /** Create an isolated writable branch from this sandbox's current state. */
209
268
  fork(options?: SandboxForkOptions): Promise<Sandbox>;
210
- /** Create a short-lived signed WebSocket URL for an interactive shell. */
211
- createConnection(): Promise<SandboxConnectionInfo>;
212
269
  /** Delete this sandbox and its backing disk. */
213
270
  delete(): Promise<void>;
214
- exec(command: string, options: SandboxPtyOptions): Promise<SandboxPty>;
215
- exec(command: string, options?: SandboxExecOptions): Promise<SandboxExec>;
216
- listExecs(): Promise<SandboxExec[]>;
217
- getExec(execId: string): Promise<SandboxExec>;
218
- cancelExec(execId: string): Promise<SandboxExec>;
219
271
  }
220
272
  //#endregion
221
273
  //#region src/sandboxes.d.ts
@@ -238,6 +290,7 @@ interface CreateSandboxRequest {
238
290
  baseImage?: string;
239
291
  env?: Record<string, string>;
240
292
  maxTtlSeconds?: number;
293
+ /** Maximum concurrently attached exec sessions. Detached processes and one-shot controls do not count. */
241
294
  maxConcurrentExecs?: number;
242
295
  }
243
296
  interface ListSandboxesOptions {
@@ -439,6 +492,11 @@ declare class ArchilError extends Error {
439
492
  declare class ArchilApiError extends ArchilError {
440
493
  constructor(message: string, status: number, code?: string);
441
494
  }
495
+ declare class SandboxFileTransferError extends ArchilError {
496
+ readonly operation: "upload" | "download";
497
+ readonly path: string;
498
+ constructor(operation: "upload" | "download", path: string, cause: Error);
499
+ }
442
500
  /**
443
501
  * Error from the S3-compatible object API (getObject/putObject/deleteObject/
444
502
  * headObject/listObjects). The gateway returns an S3-style XML `<Error>` body;
@@ -490,4 +548,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
490
548
  */
491
549
  declare function workspace(mounts: Record<string, ExecMount>): Workspace;
492
550
  //#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, 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 };
551
+ 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 SandboxEndpoint, 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 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 };
1
+ import { A as ArchilS3Error, C as DiskMultipart, E as VERSION, O as ArchilApiError, S as Disk, T as USER_AGENT, _ as Sandbox, a as deleteApiKey, b as SandboxProcesses, c as getSandbox, d as listSandboxes, f as workspace, g as Sandboxes, h as Tokens, i as createSandbox, j as SandboxFileTransferError, k as ArchilError, l as listApiKeys, m as Workspace, n as createApiKey, o as exec, p as Archil, r as createDisk, s as getDisk, t as configure, u as listDisks, v as SandboxFiles, w as effectiveUploadPartSize, x as Disks, y as SandboxProcess } from "./src-Cw7ldF_H.mjs";
2
+ export { Archil, ArchilApiError, ArchilError, ArchilS3Error, Disk, DiskMultipart, Disks, Sandbox, SandboxFileTransferError, SandboxFiles, SandboxProcess, SandboxProcesses, Sandboxes, Tokens, USER_AGENT, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };