@cloudflare/sandbox 0.7.16 → 0.7.17
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.ts +1 -1
- package/dist/index.js +23 -5
- package/dist/index.js.map +1 -1
- package/dist/openai/index.d.ts +1 -1
- package/dist/opencode/index.d.ts +1 -1
- package/dist/{sandbox-DKzgVy6K.d.ts → sandbox-DBTljwwc.d.ts} +17 -2
- package/dist/sandbox-DBTljwwc.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/sandbox-DKzgVy6K.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as DirectoryBackup, A as DesktopStopResponse, At as WaitForPortOptions, B as ExecuteResponse, Bt as CreateContextOptions, C as ClickOptions, Ct as ProcessStartResult, D as DesktopStartOptions, Dt as SessionOptions, E as DesktopClient, Et as SandboxOptions, F as ScreenshotRegion, Ft as ExecuteRequest, G as HttpClientOptions, H as BaseApiResponse, Ht as ExecutionResult, I as ScreenshotResponse, It as ExposePortRequest, J as SessionRequest, K as RequestConfig, L as ScrollDirection, Lt as StartProcessRequest, M as ScreenSizeResponse, Mt as isExecResult, N as ScreenshotBytesResponse, Nt as isProcess, O as DesktopStartResponse, Ot as StreamOptions, P as ScreenshotOptions, Pt as isProcessStatus, Q as BucketProvider, R as TypeOptions, Rt as PtyOptions, S as WriteFileRequest, St as ProcessOptions, T as Desktop, Tt as RestoreBackupResult, U as ContainerStub, Ut as RunCodeOptions, V as BackupClient, Vt as Execution, W as ErrorResponse, X as BaseExecOptions, Y as BackupOptions, Z as BucketCredentials, _ as GitClient, _t as ProcessCleanupResult, a as CreateSessionRequest, at as FileMetadata, b as MkdirRequest, bt as ProcessListResult, c as DeleteSessionResponse, ct as GitCheckoutResult, d as ProcessClient, dt as LogEvent, et as ExecEvent, f as PortClient, ft as MountBucketOptions, g as GitCheckoutRequest, gt as Process, h as InterpreterClient, ht as PortListResult, i as CommandsResponse, it as FileChunk, j as KeyInput, jt as WatchOptions, k as DesktopStatusResponse, kt as WaitForLogResult, l as PingResponse, lt as ISandbox, m as ExecutionCallbacks, mt as PortExposeResult, n as getSandbox, nt as ExecResult, o as CreateSessionResponse, ot as FileStreamEvent, p as UnexposePortRequest, pt as PortCloseResult, q as ResponseHandler, r as SandboxClient, rt as ExecutionSession, s as DeleteSessionRequest, st as FileWatchSSEEvent, t as Sandbox, tt as ExecOptions, u as UtilityClient, ut as ListFilesOptions, v as FileClient, vt as ProcessInfoResult, w as CursorPositionResponse, wt as ProcessStatus, x as ReadFileRequest, xt as ProcessLogsResult, y as FileOperationRequest, yt as ProcessKillResult, z as CommandClient, zt as CodeContext } from "./sandbox-
|
|
1
|
+
import { $ as DirectoryBackup, A as DesktopStopResponse, At as WaitForPortOptions, B as ExecuteResponse, Bt as CreateContextOptions, C as ClickOptions, Ct as ProcessStartResult, D as DesktopStartOptions, Dt as SessionOptions, E as DesktopClient, Et as SandboxOptions, F as ScreenshotRegion, Ft as ExecuteRequest, G as HttpClientOptions, H as BaseApiResponse, Ht as ExecutionResult, I as ScreenshotResponse, It as ExposePortRequest, J as SessionRequest, K as RequestConfig, L as ScrollDirection, Lt as StartProcessRequest, M as ScreenSizeResponse, Mt as isExecResult, N as ScreenshotBytesResponse, Nt as isProcess, O as DesktopStartResponse, Ot as StreamOptions, P as ScreenshotOptions, Pt as isProcessStatus, Q as BucketProvider, R as TypeOptions, Rt as PtyOptions, S as WriteFileRequest, St as ProcessOptions, T as Desktop, Tt as RestoreBackupResult, U as ContainerStub, Ut as RunCodeOptions, V as BackupClient, Vt as Execution, W as ErrorResponse, X as BaseExecOptions, Y as BackupOptions, Z as BucketCredentials, _ as GitClient, _t as ProcessCleanupResult, a as CreateSessionRequest, at as FileMetadata, b as MkdirRequest, bt as ProcessListResult, c as DeleteSessionResponse, ct as GitCheckoutResult, d as ProcessClient, dt as LogEvent, et as ExecEvent, f as PortClient, ft as MountBucketOptions, g as GitCheckoutRequest, gt as Process, h as InterpreterClient, ht as PortListResult, i as CommandsResponse, it as FileChunk, j as KeyInput, jt as WatchOptions, k as DesktopStatusResponse, kt as WaitForLogResult, l as PingResponse, lt as ISandbox, m as ExecutionCallbacks, mt as PortExposeResult, n as getSandbox, nt as ExecResult, o as CreateSessionResponse, ot as FileStreamEvent, p as UnexposePortRequest, pt as PortCloseResult, q as ResponseHandler, r as SandboxClient, rt as ExecutionSession, s as DeleteSessionRequest, st as FileWatchSSEEvent, t as Sandbox, tt as ExecOptions, u as UtilityClient, ut as ListFilesOptions, v as FileClient, vt as ProcessInfoResult, w as CursorPositionResponse, wt as ProcessStatus, x as ReadFileRequest, xt as ProcessLogsResult, y as FileOperationRequest, yt as ProcessKillResult, z as CommandClient, zt as CodeContext } from "./sandbox-DBTljwwc.js";
|
|
2
2
|
import { a as DesktopCoordinateErrorContext, d as ErrorResponse$1, f as OperationType, i as BackupRestoreContext, l as ProcessExitedBeforeReadyContext, n as BackupExpiredContext, o as DesktopErrorContext, p as ErrorCode, r as BackupNotFoundContext, s as InvalidBackupConfigContext, t as BackupCreateContext, u as ProcessReadyTimeoutContext } from "./contexts-CeQR115r.js";
|
|
3
3
|
|
|
4
4
|
//#region src/errors/classes.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1531,11 +1531,13 @@ var BackupClient = class extends BaseHttpClient {
|
|
|
1531
1531
|
* @param archivePath - Where the container should write the archive
|
|
1532
1532
|
* @param sessionId - Session context
|
|
1533
1533
|
*/
|
|
1534
|
-
async createArchive(dir, archivePath, sessionId) {
|
|
1534
|
+
async createArchive(dir, archivePath, sessionId, gitignore = false, excludes = []) {
|
|
1535
1535
|
try {
|
|
1536
1536
|
const data = {
|
|
1537
1537
|
dir,
|
|
1538
1538
|
archivePath,
|
|
1539
|
+
gitignore,
|
|
1540
|
+
excludes,
|
|
1539
1541
|
sessionId
|
|
1540
1542
|
};
|
|
1541
1543
|
const response = await this.post("/api/backup/create", data);
|
|
@@ -3388,7 +3390,7 @@ function buildS3fsSource(bucket, prefix) {
|
|
|
3388
3390
|
* This file is auto-updated by .github/changeset-version.ts during releases
|
|
3389
3391
|
* DO NOT EDIT MANUALLY - Changes will be overwritten on the next version bump
|
|
3390
3392
|
*/
|
|
3391
|
-
const SDK_VERSION = "0.7.
|
|
3393
|
+
const SDK_VERSION = "0.7.17";
|
|
3392
3394
|
|
|
3393
3395
|
//#endregion
|
|
3394
3396
|
//#region src/sandbox.ts
|
|
@@ -5259,7 +5261,7 @@ var Sandbox = class Sandbox extends Container {
|
|
|
5259
5261
|
this.requirePresignedUrlSupport();
|
|
5260
5262
|
const DEFAULT_TTL_SECONDS = 259200;
|
|
5261
5263
|
const MAX_NAME_LENGTH = 256;
|
|
5262
|
-
const { dir, name, ttl = DEFAULT_TTL_SECONDS } = options;
|
|
5264
|
+
const { dir, name, ttl = DEFAULT_TTL_SECONDS, gitignore = false, excludes = [] } = options;
|
|
5263
5265
|
Sandbox.validateBackupDir(dir, "BackupOptions.dir");
|
|
5264
5266
|
if (name !== void 0) {
|
|
5265
5267
|
if (typeof name !== "string" || name.length > MAX_NAME_LENGTH) throw new InvalidBackupConfigError({
|
|
@@ -5284,15 +5286,31 @@ var Sandbox = class Sandbox extends Container {
|
|
|
5284
5286
|
context: { reason: "ttl must be a positive number of seconds" },
|
|
5285
5287
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
5286
5288
|
});
|
|
5289
|
+
if (typeof gitignore !== "boolean") throw new InvalidBackupConfigError({
|
|
5290
|
+
message: "BackupOptions.gitignore must be a boolean",
|
|
5291
|
+
code: ErrorCode.INVALID_BACKUP_CONFIG,
|
|
5292
|
+
httpStatus: 400,
|
|
5293
|
+
context: { reason: "gitignore must be a boolean" },
|
|
5294
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
5295
|
+
});
|
|
5296
|
+
if (!Array.isArray(excludes) || !excludes.every((e) => typeof e === "string")) throw new InvalidBackupConfigError({
|
|
5297
|
+
message: "BackupOptions.excludes must be an array of strings",
|
|
5298
|
+
code: ErrorCode.INVALID_BACKUP_CONFIG,
|
|
5299
|
+
httpStatus: 400,
|
|
5300
|
+
context: { reason: "excludes must be an array of strings" },
|
|
5301
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
5302
|
+
});
|
|
5287
5303
|
const backupSession = await this.ensureBackupSession();
|
|
5288
5304
|
const backupId = crypto.randomUUID();
|
|
5289
5305
|
const archivePath = `/var/backups/${backupId}.sqsh`;
|
|
5290
5306
|
this.logger.info("Creating backup", {
|
|
5291
5307
|
backupId,
|
|
5292
5308
|
dir,
|
|
5293
|
-
name
|
|
5309
|
+
name,
|
|
5310
|
+
gitignore,
|
|
5311
|
+
excludes
|
|
5294
5312
|
});
|
|
5295
|
-
const createResult = await this.client.backup.createArchive(dir, archivePath, backupSession);
|
|
5313
|
+
const createResult = await this.client.backup.createArchive(dir, archivePath, backupSession, gitignore, excludes);
|
|
5296
5314
|
if (!createResult.success) throw new BackupCreateError({
|
|
5297
5315
|
message: "Container failed to create backup archive",
|
|
5298
5316
|
code: ErrorCode.BACKUP_CREATE_FAILED,
|