disk 1.5.0 → 1.7.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 +42 -9
- package/dist/cli.mjs +2 -2
- package/dist/{common-Bi2YnNf6.mjs → common-BkH4aHPf.mjs} +1 -1
- package/dist/index.cjs +235 -138
- package/dist/index.d.cts +85 -8
- package/dist/index.d.mts +85 -8
- package/dist/index.mjs +2 -2
- package/dist/sandbox-cli.mjs +4 -4
- package/dist/{src-r2oVqVK_.mjs → src-CXTEUmMV.mjs} +234 -139
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -65,6 +65,61 @@ declare class Disks {
|
|
|
65
65
|
exec(id: string, command: string): Promise<ExecResult>;
|
|
66
66
|
}
|
|
67
67
|
//#endregion
|
|
68
|
+
//#region src/images.d.ts
|
|
69
|
+
type ImageWire = components["schemas"]["Image"];
|
|
70
|
+
type ImageStatus = components["schemas"]["ImageState"];
|
|
71
|
+
/**
|
|
72
|
+
* Why a build failed. `invalid_source`: the registry reported the image missing
|
|
73
|
+
* or denied access, so retrying won't help. `interrupted`: the build did not
|
|
74
|
+
* finish; requesting it again starts a new build.
|
|
75
|
+
*/
|
|
76
|
+
type ImageFailureReason = NonNullable<ImageWire["failure_reason"]>;
|
|
77
|
+
interface Image {
|
|
78
|
+
/** 64-character hex id; pass it to `sandboxes.create({ imageId })`. */
|
|
79
|
+
imageId: string;
|
|
80
|
+
/** Normalized OCI reference. */
|
|
81
|
+
source: string;
|
|
82
|
+
private: boolean;
|
|
83
|
+
status: ImageStatus;
|
|
84
|
+
/** `sha256:` digest of the last successful build, kept while a tag rebuilds. */
|
|
85
|
+
digest?: string;
|
|
86
|
+
/** `repo@sha256:` reference of the last successful build. */
|
|
87
|
+
canonicalSource?: string;
|
|
88
|
+
/** Present only when `status` is `failed`. */
|
|
89
|
+
failureReason?: ImageFailureReason;
|
|
90
|
+
createdAt: Date;
|
|
91
|
+
updatedAt: Date;
|
|
92
|
+
}
|
|
93
|
+
/** Registry credentials for a private image. Archil never stores them. */
|
|
94
|
+
type RegistryAuth = components["schemas"]["RegistryAuth"];
|
|
95
|
+
interface BuildImageRequest {
|
|
96
|
+
/** OCI image reference, such as `node:24-bookworm` or `ghcr.io/owner/app@sha256:<digest>`. */
|
|
97
|
+
source: string;
|
|
98
|
+
/** Required for private images on every build request; without it `source` names the public image. */
|
|
99
|
+
registryAuth?: RegistryAuth;
|
|
100
|
+
}
|
|
101
|
+
interface BuildImageOptions {
|
|
102
|
+
/** Seconds to wait for the build. Defaults to 1800 (30 minutes). */
|
|
103
|
+
timeoutSeconds?: number;
|
|
104
|
+
}
|
|
105
|
+
declare class Images {
|
|
106
|
+
/** @internal */
|
|
107
|
+
private readonly _client;
|
|
108
|
+
/** @internal */
|
|
109
|
+
constructor(client: ApiClient);
|
|
110
|
+
get(imageId: string): Promise<Image>;
|
|
111
|
+
/**
|
|
112
|
+
* Build a sandbox image from an OCI reference and wait until it is ready.
|
|
113
|
+
* Returns at once when the image is already built from a digest reference
|
|
114
|
+
* and joins a build that is already running. A tag is rebuilt on each call
|
|
115
|
+
* in case it moved, so call this once and reuse `imageId`. Interrupted
|
|
116
|
+
* builds are requested again up to three times; other failures throw
|
|
117
|
+
* {@link ImageBuildError}.
|
|
118
|
+
*/
|
|
119
|
+
build(request: BuildImageRequest, options?: BuildImageOptions): Promise<Image>;
|
|
120
|
+
private _request;
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
68
123
|
//#region src/sandbox-process.d.ts
|
|
69
124
|
type SandboxProcessStatus = "running" | "completed" | "failed" | "cancelled" | "timed_out";
|
|
70
125
|
type SandboxProcessStream = "stdout" | "stderr";
|
|
@@ -85,6 +140,8 @@ interface SandboxProcessConnectOptions {
|
|
|
85
140
|
collectOutput?: boolean;
|
|
86
141
|
}
|
|
87
142
|
interface SandboxProcessStartOptions {
|
|
143
|
+
/** Absolute working directory inside the sandbox. */
|
|
144
|
+
cwd?: string;
|
|
88
145
|
/** Enables a PTY. PTY output is merged into stdout and stderr remains empty. */
|
|
89
146
|
terminal?: boolean | SandboxTerminalOptions;
|
|
90
147
|
env?: Record<string, string>;
|
|
@@ -103,6 +160,7 @@ interface SandboxProcessResult {
|
|
|
103
160
|
type ProcessConnectionRequest = {
|
|
104
161
|
type: "start";
|
|
105
162
|
command: string;
|
|
163
|
+
cwd?: string;
|
|
106
164
|
terminal?: boolean | {
|
|
107
165
|
cols: number;
|
|
108
166
|
rows: number;
|
|
@@ -123,15 +181,15 @@ type ProcessControlRequest = {
|
|
|
123
181
|
cols: number;
|
|
124
182
|
rows: number;
|
|
125
183
|
};
|
|
184
|
+
/** @deprecated Use Sandbox.run() and Sandbox.attach(). Removed in the next version. */
|
|
126
185
|
declare class SandboxProcesses {
|
|
127
|
-
private readonly
|
|
128
|
-
private readonly _client;
|
|
186
|
+
private readonly _sandbox;
|
|
129
187
|
/** @internal */
|
|
130
|
-
constructor(
|
|
188
|
+
constructor(_sandbox: Pick<Sandbox, "run" | "attach">);
|
|
189
|
+
/** @deprecated Use sandbox.run(). Removed in the next version. */
|
|
131
190
|
start(command: string, options?: SandboxProcessStartOptions): Promise<SandboxProcess>;
|
|
191
|
+
/** @deprecated Use sandbox.attach(). Removed in the next version. */
|
|
132
192
|
connect(processId: string, options?: SandboxProcessConnectOptions): Promise<SandboxProcess>;
|
|
133
|
-
private _connectionUrl;
|
|
134
|
-
private _control;
|
|
135
193
|
}
|
|
136
194
|
declare class SandboxProcess {
|
|
137
195
|
status: SandboxProcessStatus;
|
|
@@ -187,9 +245,9 @@ interface SandboxFileUploadOptions {
|
|
|
187
245
|
mode?: number;
|
|
188
246
|
}
|
|
189
247
|
declare class SandboxFiles {
|
|
190
|
-
private readonly
|
|
248
|
+
private readonly _sandbox;
|
|
191
249
|
/** @internal */
|
|
192
|
-
constructor(
|
|
250
|
+
constructor(sandbox: Pick<Sandbox, "run">);
|
|
193
251
|
uploadFile(source: SandboxFileSource, remotePath: string, options?: SandboxFileUploadOptions): Promise<void>;
|
|
194
252
|
downloadFile(remotePath: string, write: SandboxFileWriter): Promise<void>;
|
|
195
253
|
}
|
|
@@ -243,7 +301,10 @@ interface SandboxResponse {
|
|
|
243
301
|
status: SandboxStatus;
|
|
244
302
|
vcpuCount: number;
|
|
245
303
|
memSizeMiB: number;
|
|
304
|
+
/** Empty for sandboxes created from `imageId`. */
|
|
246
305
|
baseImage: string;
|
|
306
|
+
/** Digest of the image the sandbox was created from; may be empty. */
|
|
307
|
+
imageDigest: string;
|
|
247
308
|
platform?: "arm64" | "amd64";
|
|
248
309
|
maxTtlSeconds: number;
|
|
249
310
|
idleTtlSeconds: number;
|
|
@@ -282,6 +343,7 @@ declare class Sandbox {
|
|
|
282
343
|
vcpuCount: number;
|
|
283
344
|
memSizeMiB: number;
|
|
284
345
|
baseImage: string;
|
|
346
|
+
imageDigest: string;
|
|
285
347
|
platform?: "arm64" | "amd64";
|
|
286
348
|
maxTtlSeconds: number;
|
|
287
349
|
idleTtlSeconds: number;
|
|
@@ -293,6 +355,7 @@ declare class Sandbox {
|
|
|
293
355
|
lastActiveAt: Date;
|
|
294
356
|
exitReason?: string;
|
|
295
357
|
checkpoint?: string;
|
|
358
|
+
/** @deprecated Use run() and attach(). Removed in the next version. */
|
|
296
359
|
readonly processes: SandboxProcesses;
|
|
297
360
|
readonly files: SandboxFiles;
|
|
298
361
|
/** @internal */
|
|
@@ -302,6 +365,12 @@ declare class Sandbox {
|
|
|
302
365
|
/** @internal Overwrite this sandbox's fields in place from a fresh wire snapshot. */
|
|
303
366
|
private _apply;
|
|
304
367
|
toJSON(): SandboxResponse;
|
|
368
|
+
/** Start a process and return its handle without waiting for exit. */
|
|
369
|
+
run(command: string, options?: SandboxProcessStartOptions): Promise<SandboxProcess>;
|
|
370
|
+
/** Reattach to a process, optionally resuming output from a cursor. */
|
|
371
|
+
attach(processId: string, options?: SandboxProcessConnectOptions): Promise<SandboxProcess>;
|
|
372
|
+
private _connectionUrl;
|
|
373
|
+
private _control;
|
|
305
374
|
/** Run a process and wait for it to exit. */
|
|
306
375
|
exec(command: string, options?: SandboxProcessStartOptions): Promise<SandboxProcessResult>;
|
|
307
376
|
/** Re-fetch this sandbox. */
|
|
@@ -368,6 +437,8 @@ interface CreateSandboxRequest {
|
|
|
368
437
|
* `alpine@sha256:<digest>`.
|
|
369
438
|
*/
|
|
370
439
|
baseImage?: string;
|
|
440
|
+
/** Ready image from `images.build()`. Cannot be combined with `baseImage`. */
|
|
441
|
+
imageId?: string;
|
|
371
442
|
env?: Record<string, string>;
|
|
372
443
|
maxTtlSeconds?: number;
|
|
373
444
|
/** Seconds without a direct process connection before pausing. Omitted or zero disables idle expiry. */
|
|
@@ -542,6 +613,7 @@ interface ExecOptions {
|
|
|
542
613
|
}
|
|
543
614
|
declare class Archil {
|
|
544
615
|
readonly disks: Disks;
|
|
616
|
+
readonly images: Images;
|
|
545
617
|
readonly sandboxes: Sandboxes;
|
|
546
618
|
readonly tokens: Tokens;
|
|
547
619
|
/** @internal */
|
|
@@ -584,6 +656,11 @@ declare class SandboxPauseError extends ArchilError {
|
|
|
584
656
|
readonly latest: Sandbox;
|
|
585
657
|
constructor(latest: Sandbox);
|
|
586
658
|
}
|
|
659
|
+
declare class ImageBuildError extends ArchilError {
|
|
660
|
+
readonly latest: Image;
|
|
661
|
+
readonly reason?: ImageFailureReason;
|
|
662
|
+
constructor(latest: Image);
|
|
663
|
+
}
|
|
587
664
|
declare class SandboxFileTransferError extends ArchilError {
|
|
588
665
|
readonly operation: "upload" | "download";
|
|
589
666
|
readonly path: string;
|
|
@@ -640,4 +717,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
640
717
|
*/
|
|
641
718
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
642
719
|
//#endregion
|
|
643
|
-
export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type ArchilTlsOptions, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type CreateSandboxPortTokenOptions, type CreateSandboxRequest, type CreatedSandboxPortToken, 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 ListSandboxPortTokensOptions, 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 SandboxEgressPolicy, type SandboxEgressRule, type SandboxEgressTransform, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxNetwork, type SandboxNetworkAction, SandboxPauseError, type SandboxPortToken, type SandboxPortTokenPage, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStatus, type SandboxTerminalOptions, type SandboxTimeoutOptions, 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 };
|
|
720
|
+
export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type ArchilTlsOptions, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type BuildImageOptions, type BuildImageRequest, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type CreateSandboxPortTokenOptions, type CreateSandboxRequest, type CreatedSandboxPortToken, 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 Image, ImageBuildError, type ImageFailureReason, type ImageStatus, Images, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListSandboxPortTokensOptions, 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 RegistryAuth, type RootAttrs, type S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxEgressPolicy, type SandboxEgressRule, type SandboxEgressTransform, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxNetwork, type SandboxNetworkAction, SandboxPauseError, type SandboxPortToken, type SandboxPortTokenPage, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStatus, type SandboxTerminalOptions, type SandboxTimeoutOptions, 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
|
@@ -65,6 +65,61 @@ declare class Disks {
|
|
|
65
65
|
exec(id: string, command: string): Promise<ExecResult>;
|
|
66
66
|
}
|
|
67
67
|
//#endregion
|
|
68
|
+
//#region src/images.d.ts
|
|
69
|
+
type ImageWire = components["schemas"]["Image"];
|
|
70
|
+
type ImageStatus = components["schemas"]["ImageState"];
|
|
71
|
+
/**
|
|
72
|
+
* Why a build failed. `invalid_source`: the registry reported the image missing
|
|
73
|
+
* or denied access, so retrying won't help. `interrupted`: the build did not
|
|
74
|
+
* finish; requesting it again starts a new build.
|
|
75
|
+
*/
|
|
76
|
+
type ImageFailureReason = NonNullable<ImageWire["failure_reason"]>;
|
|
77
|
+
interface Image {
|
|
78
|
+
/** 64-character hex id; pass it to `sandboxes.create({ imageId })`. */
|
|
79
|
+
imageId: string;
|
|
80
|
+
/** Normalized OCI reference. */
|
|
81
|
+
source: string;
|
|
82
|
+
private: boolean;
|
|
83
|
+
status: ImageStatus;
|
|
84
|
+
/** `sha256:` digest of the last successful build, kept while a tag rebuilds. */
|
|
85
|
+
digest?: string;
|
|
86
|
+
/** `repo@sha256:` reference of the last successful build. */
|
|
87
|
+
canonicalSource?: string;
|
|
88
|
+
/** Present only when `status` is `failed`. */
|
|
89
|
+
failureReason?: ImageFailureReason;
|
|
90
|
+
createdAt: Date;
|
|
91
|
+
updatedAt: Date;
|
|
92
|
+
}
|
|
93
|
+
/** Registry credentials for a private image. Archil never stores them. */
|
|
94
|
+
type RegistryAuth = components["schemas"]["RegistryAuth"];
|
|
95
|
+
interface BuildImageRequest {
|
|
96
|
+
/** OCI image reference, such as `node:24-bookworm` or `ghcr.io/owner/app@sha256:<digest>`. */
|
|
97
|
+
source: string;
|
|
98
|
+
/** Required for private images on every build request; without it `source` names the public image. */
|
|
99
|
+
registryAuth?: RegistryAuth;
|
|
100
|
+
}
|
|
101
|
+
interface BuildImageOptions {
|
|
102
|
+
/** Seconds to wait for the build. Defaults to 1800 (30 minutes). */
|
|
103
|
+
timeoutSeconds?: number;
|
|
104
|
+
}
|
|
105
|
+
declare class Images {
|
|
106
|
+
/** @internal */
|
|
107
|
+
private readonly _client;
|
|
108
|
+
/** @internal */
|
|
109
|
+
constructor(client: ApiClient);
|
|
110
|
+
get(imageId: string): Promise<Image>;
|
|
111
|
+
/**
|
|
112
|
+
* Build a sandbox image from an OCI reference and wait until it is ready.
|
|
113
|
+
* Returns at once when the image is already built from a digest reference
|
|
114
|
+
* and joins a build that is already running. A tag is rebuilt on each call
|
|
115
|
+
* in case it moved, so call this once and reuse `imageId`. Interrupted
|
|
116
|
+
* builds are requested again up to three times; other failures throw
|
|
117
|
+
* {@link ImageBuildError}.
|
|
118
|
+
*/
|
|
119
|
+
build(request: BuildImageRequest, options?: BuildImageOptions): Promise<Image>;
|
|
120
|
+
private _request;
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
68
123
|
//#region src/sandbox-process.d.ts
|
|
69
124
|
type SandboxProcessStatus = "running" | "completed" | "failed" | "cancelled" | "timed_out";
|
|
70
125
|
type SandboxProcessStream = "stdout" | "stderr";
|
|
@@ -85,6 +140,8 @@ interface SandboxProcessConnectOptions {
|
|
|
85
140
|
collectOutput?: boolean;
|
|
86
141
|
}
|
|
87
142
|
interface SandboxProcessStartOptions {
|
|
143
|
+
/** Absolute working directory inside the sandbox. */
|
|
144
|
+
cwd?: string;
|
|
88
145
|
/** Enables a PTY. PTY output is merged into stdout and stderr remains empty. */
|
|
89
146
|
terminal?: boolean | SandboxTerminalOptions;
|
|
90
147
|
env?: Record<string, string>;
|
|
@@ -103,6 +160,7 @@ interface SandboxProcessResult {
|
|
|
103
160
|
type ProcessConnectionRequest = {
|
|
104
161
|
type: "start";
|
|
105
162
|
command: string;
|
|
163
|
+
cwd?: string;
|
|
106
164
|
terminal?: boolean | {
|
|
107
165
|
cols: number;
|
|
108
166
|
rows: number;
|
|
@@ -123,15 +181,15 @@ type ProcessControlRequest = {
|
|
|
123
181
|
cols: number;
|
|
124
182
|
rows: number;
|
|
125
183
|
};
|
|
184
|
+
/** @deprecated Use Sandbox.run() and Sandbox.attach(). Removed in the next version. */
|
|
126
185
|
declare class SandboxProcesses {
|
|
127
|
-
private readonly
|
|
128
|
-
private readonly _client;
|
|
186
|
+
private readonly _sandbox;
|
|
129
187
|
/** @internal */
|
|
130
|
-
constructor(
|
|
188
|
+
constructor(_sandbox: Pick<Sandbox, "run" | "attach">);
|
|
189
|
+
/** @deprecated Use sandbox.run(). Removed in the next version. */
|
|
131
190
|
start(command: string, options?: SandboxProcessStartOptions): Promise<SandboxProcess>;
|
|
191
|
+
/** @deprecated Use sandbox.attach(). Removed in the next version. */
|
|
132
192
|
connect(processId: string, options?: SandboxProcessConnectOptions): Promise<SandboxProcess>;
|
|
133
|
-
private _connectionUrl;
|
|
134
|
-
private _control;
|
|
135
193
|
}
|
|
136
194
|
declare class SandboxProcess {
|
|
137
195
|
status: SandboxProcessStatus;
|
|
@@ -187,9 +245,9 @@ interface SandboxFileUploadOptions {
|
|
|
187
245
|
mode?: number;
|
|
188
246
|
}
|
|
189
247
|
declare class SandboxFiles {
|
|
190
|
-
private readonly
|
|
248
|
+
private readonly _sandbox;
|
|
191
249
|
/** @internal */
|
|
192
|
-
constructor(
|
|
250
|
+
constructor(sandbox: Pick<Sandbox, "run">);
|
|
193
251
|
uploadFile(source: SandboxFileSource, remotePath: string, options?: SandboxFileUploadOptions): Promise<void>;
|
|
194
252
|
downloadFile(remotePath: string, write: SandboxFileWriter): Promise<void>;
|
|
195
253
|
}
|
|
@@ -243,7 +301,10 @@ interface SandboxResponse {
|
|
|
243
301
|
status: SandboxStatus;
|
|
244
302
|
vcpuCount: number;
|
|
245
303
|
memSizeMiB: number;
|
|
304
|
+
/** Empty for sandboxes created from `imageId`. */
|
|
246
305
|
baseImage: string;
|
|
306
|
+
/** Digest of the image the sandbox was created from; may be empty. */
|
|
307
|
+
imageDigest: string;
|
|
247
308
|
platform?: "arm64" | "amd64";
|
|
248
309
|
maxTtlSeconds: number;
|
|
249
310
|
idleTtlSeconds: number;
|
|
@@ -282,6 +343,7 @@ declare class Sandbox {
|
|
|
282
343
|
vcpuCount: number;
|
|
283
344
|
memSizeMiB: number;
|
|
284
345
|
baseImage: string;
|
|
346
|
+
imageDigest: string;
|
|
285
347
|
platform?: "arm64" | "amd64";
|
|
286
348
|
maxTtlSeconds: number;
|
|
287
349
|
idleTtlSeconds: number;
|
|
@@ -293,6 +355,7 @@ declare class Sandbox {
|
|
|
293
355
|
lastActiveAt: Date;
|
|
294
356
|
exitReason?: string;
|
|
295
357
|
checkpoint?: string;
|
|
358
|
+
/** @deprecated Use run() and attach(). Removed in the next version. */
|
|
296
359
|
readonly processes: SandboxProcesses;
|
|
297
360
|
readonly files: SandboxFiles;
|
|
298
361
|
/** @internal */
|
|
@@ -302,6 +365,12 @@ declare class Sandbox {
|
|
|
302
365
|
/** @internal Overwrite this sandbox's fields in place from a fresh wire snapshot. */
|
|
303
366
|
private _apply;
|
|
304
367
|
toJSON(): SandboxResponse;
|
|
368
|
+
/** Start a process and return its handle without waiting for exit. */
|
|
369
|
+
run(command: string, options?: SandboxProcessStartOptions): Promise<SandboxProcess>;
|
|
370
|
+
/** Reattach to a process, optionally resuming output from a cursor. */
|
|
371
|
+
attach(processId: string, options?: SandboxProcessConnectOptions): Promise<SandboxProcess>;
|
|
372
|
+
private _connectionUrl;
|
|
373
|
+
private _control;
|
|
305
374
|
/** Run a process and wait for it to exit. */
|
|
306
375
|
exec(command: string, options?: SandboxProcessStartOptions): Promise<SandboxProcessResult>;
|
|
307
376
|
/** Re-fetch this sandbox. */
|
|
@@ -368,6 +437,8 @@ interface CreateSandboxRequest {
|
|
|
368
437
|
* `alpine@sha256:<digest>`.
|
|
369
438
|
*/
|
|
370
439
|
baseImage?: string;
|
|
440
|
+
/** Ready image from `images.build()`. Cannot be combined with `baseImage`. */
|
|
441
|
+
imageId?: string;
|
|
371
442
|
env?: Record<string, string>;
|
|
372
443
|
maxTtlSeconds?: number;
|
|
373
444
|
/** Seconds without a direct process connection before pausing. Omitted or zero disables idle expiry. */
|
|
@@ -542,6 +613,7 @@ interface ExecOptions {
|
|
|
542
613
|
}
|
|
543
614
|
declare class Archil {
|
|
544
615
|
readonly disks: Disks;
|
|
616
|
+
readonly images: Images;
|
|
545
617
|
readonly sandboxes: Sandboxes;
|
|
546
618
|
readonly tokens: Tokens;
|
|
547
619
|
/** @internal */
|
|
@@ -584,6 +656,11 @@ declare class SandboxPauseError extends ArchilError {
|
|
|
584
656
|
readonly latest: Sandbox;
|
|
585
657
|
constructor(latest: Sandbox);
|
|
586
658
|
}
|
|
659
|
+
declare class ImageBuildError extends ArchilError {
|
|
660
|
+
readonly latest: Image;
|
|
661
|
+
readonly reason?: ImageFailureReason;
|
|
662
|
+
constructor(latest: Image);
|
|
663
|
+
}
|
|
587
664
|
declare class SandboxFileTransferError extends ArchilError {
|
|
588
665
|
readonly operation: "upload" | "download";
|
|
589
666
|
readonly path: string;
|
|
@@ -640,4 +717,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
640
717
|
*/
|
|
641
718
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
642
719
|
//#endregion
|
|
643
|
-
export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type ArchilTlsOptions, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type CreateSandboxPortTokenOptions, type CreateSandboxRequest, type CreatedSandboxPortToken, 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 ListSandboxPortTokensOptions, 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 SandboxEgressPolicy, type SandboxEgressRule, type SandboxEgressTransform, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxNetwork, type SandboxNetworkAction, SandboxPauseError, type SandboxPortToken, type SandboxPortTokenPage, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStatus, type SandboxTerminalOptions, type SandboxTimeoutOptions, 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 };
|
|
720
|
+
export { type ApiTokenResponse, type AppendObjectOptions, Archil, ArchilApiError, ArchilError, type ArchilOptions, ArchilS3Error, type ArchilTlsOptions, type AuthorizedUser, type AwsStsUser, type AzureBlobMount, type BuildImageOptions, type BuildImageRequest, type CompletedMultipartUpload, type ConnectedClient, type CreateApiTokenRequest, type CreateDiskRequest, type CreateDiskResult, type CreateSandboxPortTokenOptions, type CreateSandboxRequest, type CreatedSandboxPortToken, 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 Image, ImageBuildError, type ImageFailureReason, type ImageStatus, Images, type ListDisksOptions, type ListMultipartUploadsOptions, type ListObjectsOptions, type ListObjectsResult, type ListPartsOptions, type ListSandboxPortTokensOptions, 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 RegistryAuth, type RootAttrs, type S3CompatibleMount, type S3Mount, type S3Object, Sandbox, type SandboxEgressPolicy, type SandboxEgressRule, type SandboxEgressTransform, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxNetwork, type SandboxNetworkAction, SandboxPauseError, type SandboxPortToken, type SandboxPortTokenPage, SandboxProcess, type SandboxProcessConnectOptions, type SandboxProcessOutput, type SandboxProcessOutputHandler, type SandboxProcessResult, type SandboxProcessStartOptions, type SandboxProcessStatus, type SandboxProcessStream, SandboxProcesses, type SandboxResponse, type SandboxStatus, type SandboxTerminalOptions, type SandboxTimeoutOptions, 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 { A as
|
|
2
|
-
export { Archil, ArchilApiError, ArchilError, ArchilS3Error, Disk, DiskMultipart, Disks, Sandbox, SandboxFileTransferError, SandboxFiles, SandboxPauseError, SandboxProcess, SandboxProcesses, Sandboxes, Tokens, USER_AGENT, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
|
|
1
|
+
import { A as ArchilError, C as Disk, D as VERSION, E as USER_AGENT, M as ImageBuildError, N as SandboxFileTransferError, P as SandboxPauseError, S as Disks, T as effectiveUploadPartSize, _ 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 ArchilS3Error, k as ArchilApiError, 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 DiskMultipart, x as Images, y as SandboxProcess } from "./src-CXTEUmMV.mjs";
|
|
2
|
+
export { Archil, ArchilApiError, ArchilError, ArchilS3Error, Disk, DiskMultipart, Disks, ImageBuildError, Images, Sandbox, SandboxFileTransferError, SandboxFiles, SandboxPauseError, SandboxProcess, SandboxProcesses, Sandboxes, Tokens, USER_AGENT, VERSION, Workspace, configure, createApiKey, createDisk, createSandbox, deleteApiKey, effectiveUploadPartSize, exec, getDisk, getSandbox, listApiKeys, listDisks, listSandboxes, workspace };
|
package/dist/sandbox-cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-
|
|
2
|
+
import { k as ArchilApiError, p as Archil } from "./src-CXTEUmMV.mjs";
|
|
3
|
+
import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-BkH4aHPf.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { spinner } from "@clack/prompts";
|
|
@@ -193,7 +193,7 @@ async function runSandboxShell(options) {
|
|
|
193
193
|
const onSighup = () => requestTermination("terminated by local signal", "SIGHUP");
|
|
194
194
|
const priorRaw = stdin.isRaw ?? false;
|
|
195
195
|
try {
|
|
196
|
-
remote = await options.sandbox.
|
|
196
|
+
remote = await options.sandbox.run("/bin/sh -l", {
|
|
197
197
|
terminal: {
|
|
198
198
|
cols: stdout.columns ?? 80,
|
|
199
199
|
rows: stdout.rows ?? 24
|
|
@@ -457,7 +457,7 @@ Use -- before the command so its flags are not parsed as sandbox options.
|
|
|
457
457
|
const onSighup = () => onSignal("SIGHUP");
|
|
458
458
|
try {
|
|
459
459
|
const shellCommand = command.map((argument) => argument === "" ? "''" : `'${argument.replaceAll("'", `'"'"'`)}'`).join(" ");
|
|
460
|
-
remote = await sandbox.
|
|
460
|
+
remote = await sandbox.run(shellCommand, {
|
|
461
461
|
...runOptions,
|
|
462
462
|
collectOutput: options.output === "json",
|
|
463
463
|
onOutput: options.output === "json" ? void 0 : ({ stream, data }) => {
|