disk 1.0.0 → 1.1.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 +30 -0
- package/dist/cli.mjs +2 -2
- package/dist/{common-DQ7T-_Xl.mjs → common-CIf8wLtI.mjs} +1 -1
- package/dist/index.cjs +16 -2
- package/dist/index.d.cts +10 -1
- package/dist/index.d.mts +10 -1
- package/dist/index.mjs +1 -1
- package/dist/sandbox-cli.mjs +2 -2
- package/dist/{src-Cw7ldF_H.mjs → src-B_Vucedi.mjs} +16 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -151,6 +151,36 @@ const all = await client.sandboxes.list();
|
|
|
151
151
|
const usingDisk = await client.sandboxes.list({ disk: "dsk-abc123" });
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
+
Network egress can optionally be restricted when creating a sandbox:
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
const restricted = await client.sandboxes.create({
|
|
158
|
+
network: {
|
|
159
|
+
egress: {
|
|
160
|
+
default: "deny",
|
|
161
|
+
allow: ["github.com", "*.github.com", "140.82.112.0/20"],
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
An egress policy accepts IPv4 addresses, CIDR ranges, exact domains, and `*.`
|
|
168
|
+
wildcard domains. The `default` action applies when no target matches. `allow`
|
|
169
|
+
and `deny` can both be specified; deny matches take precedence. Domain matching
|
|
170
|
+
applies to HTTPS traffic and a wildcard such as `*.github.com` matches
|
|
171
|
+
subdomains, not `github.com` itself. Omit `network` for unrestricted egress. A
|
|
172
|
+
running sandbox's complete policy can be replaced without restarting it;
|
|
173
|
+
existing connections are not terminated:
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
const effective = await restricted.updateNetwork({
|
|
177
|
+
egress: { default: "deny", allow: ["api.github.com"] },
|
|
178
|
+
});
|
|
179
|
+
console.log(effective, await restricted.getNetwork());
|
|
180
|
+
|
|
181
|
+
await restricted.updateNetwork({}); // Restore unrestricted egress.
|
|
182
|
+
```
|
|
183
|
+
|
|
154
184
|
Sandboxes support 1–32 vCPUs and 256–65,536 MiB of memory. When omitted,
|
|
155
185
|
`vcpuCount` defaults to 1 and `memSizeMiB` defaults to 2,048 MiB.
|
|
156
186
|
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { O as ArchilApiError, a as deleteApiKey, l as listApiKeys, n as createApiKey, r as createDisk, s as getDisk, t as configure, u as listDisks } from "./src-
|
|
3
|
-
import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-
|
|
2
|
+
import { O as ArchilApiError, a as deleteApiKey, l as listApiKeys, n as createApiKey, r as createDisk, s as getDisk, t as configure, u as listDisks } from "./src-B_Vucedi.mjs";
|
|
3
|
+
import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-CIf8wLtI.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
//#region bin/cli.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as REGION_URLS, p as Archil } from "./src-
|
|
1
|
+
import { D as REGION_URLS, p as Archil } from "./src-B_Vucedi.mjs";
|
|
2
2
|
import { Option } from "commander";
|
|
3
3
|
import { isCancel, password, spinner } from "@clack/prompts";
|
|
4
4
|
import { chmod, mkdir, open, readFile, rename, rm, stat } from "node:fs/promises";
|
package/dist/index.cjs
CHANGED
|
@@ -145,7 +145,7 @@ function deriveS3BaseUrl(controlBaseUrl) {
|
|
|
145
145
|
}
|
|
146
146
|
//#endregion
|
|
147
147
|
//#region src/version.ts
|
|
148
|
-
const VERSION = "1.
|
|
148
|
+
const VERSION = "1.1.0";
|
|
149
149
|
const USER_AGENT = `archil-js/${VERSION}`;
|
|
150
150
|
//#endregion
|
|
151
151
|
//#region src/client.ts
|
|
@@ -1803,6 +1803,19 @@ var Sandbox = class Sandbox {
|
|
|
1803
1803
|
const fork = new Sandbox(data, this._client);
|
|
1804
1804
|
return options.wait === false ? fork : waitForSandboxStart(fork);
|
|
1805
1805
|
}
|
|
1806
|
+
/** Get this running sandbox's effective network policy. */
|
|
1807
|
+
async getNetwork() {
|
|
1808
|
+
const client = this._client;
|
|
1809
|
+
return unwrap(client.GET("/api/sandboxes/{sid}/network", { params: { path: { sid: this.id } } }));
|
|
1810
|
+
}
|
|
1811
|
+
/** Replace this running sandbox's complete network policy and return the effective policy. */
|
|
1812
|
+
async updateNetwork(network) {
|
|
1813
|
+
const client = this._client;
|
|
1814
|
+
return unwrap(client.PUT("/api/sandboxes/{sid}/network", {
|
|
1815
|
+
params: { path: { sid: this.id } },
|
|
1816
|
+
body: network
|
|
1817
|
+
}));
|
|
1818
|
+
}
|
|
1806
1819
|
/** Delete this sandbox and its backing disk. */
|
|
1807
1820
|
async delete() {
|
|
1808
1821
|
await unwrapEmpty(this._client.DELETE("/api/sandboxes/{sid}", { params: { path: { sid: this.id } } }));
|
|
@@ -1844,7 +1857,8 @@ var Sandboxes = class {
|
|
|
1844
1857
|
base_image: request.baseImage,
|
|
1845
1858
|
env: request.env,
|
|
1846
1859
|
max_ttl_seconds: request.maxTtlSeconds,
|
|
1847
|
-
max_concurrent_execs: request.maxConcurrentExecs
|
|
1860
|
+
max_concurrent_execs: request.maxConcurrentExecs,
|
|
1861
|
+
network: request.network
|
|
1848
1862
|
};
|
|
1849
1863
|
const sandbox = new Sandbox(await unwrap(this._client.POST("/api/sandboxes", {
|
|
1850
1864
|
params: { query: { wait: options.wait ?? true } },
|
package/dist/index.d.cts
CHANGED
|
@@ -189,6 +189,9 @@ declare class SandboxFiles {
|
|
|
189
189
|
}
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region src/sandbox.d.ts
|
|
192
|
+
type SandboxNetworkAction = components["schemas"]["SandboxNetworkAction"];
|
|
193
|
+
type SandboxEgressPolicy = components["schemas"]["SandboxEgressPolicy"];
|
|
194
|
+
type SandboxNetwork = components["schemas"]["SandboxNetwork"];
|
|
192
195
|
/** @internal */
|
|
193
196
|
type SandboxWire = components["schemas"]["Sandbox"];
|
|
194
197
|
type SandboxStatus = components["schemas"]["SandboxState"];
|
|
@@ -266,6 +269,10 @@ declare class Sandbox {
|
|
|
266
269
|
resume(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
267
270
|
/** Create an isolated writable branch from this sandbox's current state. */
|
|
268
271
|
fork(options?: SandboxForkOptions): Promise<Sandbox>;
|
|
272
|
+
/** Get this running sandbox's effective network policy. */
|
|
273
|
+
getNetwork(): Promise<SandboxNetwork>;
|
|
274
|
+
/** Replace this running sandbox's complete network policy and return the effective policy. */
|
|
275
|
+
updateNetwork(network: SandboxNetwork): Promise<SandboxNetwork>;
|
|
269
276
|
/** Delete this sandbox and its backing disk. */
|
|
270
277
|
delete(): Promise<void>;
|
|
271
278
|
}
|
|
@@ -292,6 +299,8 @@ interface CreateSandboxRequest {
|
|
|
292
299
|
maxTtlSeconds?: number;
|
|
293
300
|
/** Maximum concurrently attached exec sessions. Detached processes and one-shot controls do not count. */
|
|
294
301
|
maxConcurrentExecs?: number;
|
|
302
|
+
/** Creation-time network policy. Egress is unrestricted when omitted. */
|
|
303
|
+
network?: SandboxNetwork;
|
|
295
304
|
}
|
|
296
305
|
interface ListSandboxesOptions {
|
|
297
306
|
/** Only return sandboxes that mount this disk. */
|
|
@@ -548,4 +557,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
548
557
|
*/
|
|
549
558
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
550
559
|
//#endregion
|
|
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 };
|
|
560
|
+
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 SandboxEgressPolicy, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxNetwork, type SandboxNetworkAction, 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
|
@@ -189,6 +189,9 @@ declare class SandboxFiles {
|
|
|
189
189
|
}
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region src/sandbox.d.ts
|
|
192
|
+
type SandboxNetworkAction = components["schemas"]["SandboxNetworkAction"];
|
|
193
|
+
type SandboxEgressPolicy = components["schemas"]["SandboxEgressPolicy"];
|
|
194
|
+
type SandboxNetwork = components["schemas"]["SandboxNetwork"];
|
|
192
195
|
/** @internal */
|
|
193
196
|
type SandboxWire = components["schemas"]["Sandbox"];
|
|
194
197
|
type SandboxStatus = components["schemas"]["SandboxState"];
|
|
@@ -266,6 +269,10 @@ declare class Sandbox {
|
|
|
266
269
|
resume(options?: SandboxWaitOptions): Promise<Sandbox | this>;
|
|
267
270
|
/** Create an isolated writable branch from this sandbox's current state. */
|
|
268
271
|
fork(options?: SandboxForkOptions): Promise<Sandbox>;
|
|
272
|
+
/** Get this running sandbox's effective network policy. */
|
|
273
|
+
getNetwork(): Promise<SandboxNetwork>;
|
|
274
|
+
/** Replace this running sandbox's complete network policy and return the effective policy. */
|
|
275
|
+
updateNetwork(network: SandboxNetwork): Promise<SandboxNetwork>;
|
|
269
276
|
/** Delete this sandbox and its backing disk. */
|
|
270
277
|
delete(): Promise<void>;
|
|
271
278
|
}
|
|
@@ -292,6 +299,8 @@ interface CreateSandboxRequest {
|
|
|
292
299
|
maxTtlSeconds?: number;
|
|
293
300
|
/** Maximum concurrently attached exec sessions. Detached processes and one-shot controls do not count. */
|
|
294
301
|
maxConcurrentExecs?: number;
|
|
302
|
+
/** Creation-time network policy. Egress is unrestricted when omitted. */
|
|
303
|
+
network?: SandboxNetwork;
|
|
295
304
|
}
|
|
296
305
|
interface ListSandboxesOptions {
|
|
297
306
|
/** Only return sandboxes that mount this disk. */
|
|
@@ -548,4 +557,4 @@ declare function exec(opts: ExecOptions): Promise<ExecDiskResult>;
|
|
|
548
557
|
*/
|
|
549
558
|
declare function workspace(mounts: Record<string, ExecMount>): Workspace;
|
|
550
559
|
//#endregion
|
|
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 };
|
|
560
|
+
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 SandboxEgressPolicy, type SandboxEndpoint, type SandboxFileSource, SandboxFileTransferError, type SandboxFileUploadOptions, type SandboxFileWriter, SandboxFiles, type SandboxForkOptions, type SandboxNetwork, type SandboxNetworkAction, 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 { 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-
|
|
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-B_Vucedi.mjs";
|
|
2
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 };
|
package/dist/sandbox-cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { O as ArchilApiError, p as Archil } from "./src-
|
|
3
|
-
import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-
|
|
2
|
+
import { O as ArchilApiError, p as Archil } from "./src-B_Vucedi.mjs";
|
|
3
|
+
import { a as renderTable, i as resolveProgramCredentials, n as addProfileCommands, r as isProfileCommand, t as addGlobalOptions } from "./common-CIf8wLtI.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { spinner } from "@clack/prompts";
|
|
@@ -122,7 +122,7 @@ function deriveS3BaseUrl(controlBaseUrl) {
|
|
|
122
122
|
}
|
|
123
123
|
//#endregion
|
|
124
124
|
//#region src/version.ts
|
|
125
|
-
const VERSION = "1.
|
|
125
|
+
const VERSION = "1.1.0";
|
|
126
126
|
const USER_AGENT = `archil-js/${VERSION}`;
|
|
127
127
|
//#endregion
|
|
128
128
|
//#region src/client.ts
|
|
@@ -1780,6 +1780,19 @@ var Sandbox = class Sandbox {
|
|
|
1780
1780
|
const fork = new Sandbox(data, this._client);
|
|
1781
1781
|
return options.wait === false ? fork : waitForSandboxStart(fork);
|
|
1782
1782
|
}
|
|
1783
|
+
/** Get this running sandbox's effective network policy. */
|
|
1784
|
+
async getNetwork() {
|
|
1785
|
+
const client = this._client;
|
|
1786
|
+
return unwrap(client.GET("/api/sandboxes/{sid}/network", { params: { path: { sid: this.id } } }));
|
|
1787
|
+
}
|
|
1788
|
+
/** Replace this running sandbox's complete network policy and return the effective policy. */
|
|
1789
|
+
async updateNetwork(network) {
|
|
1790
|
+
const client = this._client;
|
|
1791
|
+
return unwrap(client.PUT("/api/sandboxes/{sid}/network", {
|
|
1792
|
+
params: { path: { sid: this.id } },
|
|
1793
|
+
body: network
|
|
1794
|
+
}));
|
|
1795
|
+
}
|
|
1783
1796
|
/** Delete this sandbox and its backing disk. */
|
|
1784
1797
|
async delete() {
|
|
1785
1798
|
await unwrapEmpty(this._client.DELETE("/api/sandboxes/{sid}", { params: { path: { sid: this.id } } }));
|
|
@@ -1821,7 +1834,8 @@ var Sandboxes = class {
|
|
|
1821
1834
|
base_image: request.baseImage,
|
|
1822
1835
|
env: request.env,
|
|
1823
1836
|
max_ttl_seconds: request.maxTtlSeconds,
|
|
1824
|
-
max_concurrent_execs: request.maxConcurrentExecs
|
|
1837
|
+
max_concurrent_execs: request.maxConcurrentExecs,
|
|
1838
|
+
network: request.network
|
|
1825
1839
|
};
|
|
1826
1840
|
const sandbox = new Sandbox(await unwrap(this._client.POST("/api/sandboxes", {
|
|
1827
1841
|
params: { query: { wait: options.wait ?? true } },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "disk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Pure-JS client and CLIs for Archil disks and sandboxes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"archil",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"LICENSE"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@archildata/api-types": "^0.0.
|
|
43
|
+
"@archildata/api-types": "^0.0.23",
|
|
44
44
|
"@clack/prompts": "^1.7.0",
|
|
45
45
|
"commander": "^14.0.3",
|
|
46
46
|
"fast-xml-parser": "^5.7.0",
|