@cloudflare/sandbox 0.7.18 → 0.7.20
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 +30 -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/opencode/index.d.ts.map +1 -1
- package/dist/{sandbox-CTUXe5eK.d.ts → sandbox-raa8coh3.d.ts} +2 -2
- package/dist/sandbox-raa8coh3.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/sandbox-CTUXe5eK.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as DirectoryBackup, A as DesktopStopResponse, At as StreamOptions, B as ExecuteResponse, Bt as PtyOptions, C as ClickOptions, Ct as ProcessOptions, D as DesktopStartOptions, Dt as RestoreBackupResult, E as DesktopClient, Et as RemoteMountBucketOptions, F as ScreenshotRegion, Ft as isProcess, G as HttpClientOptions, Gt as RunCodeOptions, H as BaseApiResponse, Ht as CreateContextOptions, I as ScreenshotResponse, It as isProcessStatus, J as SessionRequest, K as RequestConfig, L as ScrollDirection, Lt as ExecuteRequest, M as ScreenSizeResponse, Mt as WaitForPortOptions, N as ScreenshotBytesResponse, Nt as WatchOptions, O as DesktopStartResponse, Ot as SandboxOptions, P as ScreenshotOptions, Pt as isExecResult, Q as BucketProvider, R as TypeOptions, Rt as ExposePortRequest, S as WriteFileRequest, St as ProcessLogsResult, T as Desktop, Tt as ProcessStatus, U as ContainerStub, Ut as Execution, V as BackupClient, Vt as CodeContext, W as ErrorResponse, Wt as ExecutionResult, X as BaseExecOptions, Y as BackupOptions, Z as BucketCredentials, _ as GitClient, _t as Process, a as CreateSessionRequest, at as FileMetadata, b as MkdirRequest, bt as ProcessKillResult, c as DeleteSessionResponse, ct as GitCheckoutResult, d as ProcessClient, dt as LocalMountBucketOptions, et as ExecEvent, f as PortClient, ft as LogEvent, g as GitCheckoutRequest, gt as PortListResult, h as InterpreterClient, ht as PortExposeResult, i as CommandsResponse, it as FileChunk, j as KeyInput, jt as WaitForLogResult, k as DesktopStatusResponse, kt as SessionOptions, l as PingResponse, lt as ISandbox, m as ExecutionCallbacks, mt as PortCloseResult, n as getSandbox, nt as ExecResult, o as CreateSessionResponse, ot as FileStreamEvent, p as UnexposePortRequest, pt as MountBucketOptions, 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 ProcessCleanupResult, w as CursorPositionResponse, wt as ProcessStartResult, x as ReadFileRequest, xt as ProcessListResult, y as FileOperationRequest, yt as ProcessInfoResult, z as CommandClient, zt as StartProcessRequest } from "./sandbox-
|
|
1
|
+
import { $ as DirectoryBackup, A as DesktopStopResponse, At as StreamOptions, B as ExecuteResponse, Bt as PtyOptions, C as ClickOptions, Ct as ProcessOptions, D as DesktopStartOptions, Dt as RestoreBackupResult, E as DesktopClient, Et as RemoteMountBucketOptions, F as ScreenshotRegion, Ft as isProcess, G as HttpClientOptions, Gt as RunCodeOptions, H as BaseApiResponse, Ht as CreateContextOptions, I as ScreenshotResponse, It as isProcessStatus, J as SessionRequest, K as RequestConfig, L as ScrollDirection, Lt as ExecuteRequest, M as ScreenSizeResponse, Mt as WaitForPortOptions, N as ScreenshotBytesResponse, Nt as WatchOptions, O as DesktopStartResponse, Ot as SandboxOptions, P as ScreenshotOptions, Pt as isExecResult, Q as BucketProvider, R as TypeOptions, Rt as ExposePortRequest, S as WriteFileRequest, St as ProcessLogsResult, T as Desktop, Tt as ProcessStatus, U as ContainerStub, Ut as Execution, V as BackupClient, Vt as CodeContext, W as ErrorResponse, Wt as ExecutionResult, X as BaseExecOptions, Y as BackupOptions, Z as BucketCredentials, _ as GitClient, _t as Process, a as CreateSessionRequest, at as FileMetadata, b as MkdirRequest, bt as ProcessKillResult, c as DeleteSessionResponse, ct as GitCheckoutResult, d as ProcessClient, dt as LocalMountBucketOptions, et as ExecEvent, f as PortClient, ft as LogEvent, g as GitCheckoutRequest, gt as PortListResult, h as InterpreterClient, ht as PortExposeResult, i as CommandsResponse, it as FileChunk, j as KeyInput, jt as WaitForLogResult, k as DesktopStatusResponse, kt as SessionOptions, l as PingResponse, lt as ISandbox, m as ExecutionCallbacks, mt as PortCloseResult, n as getSandbox, nt as ExecResult, o as CreateSessionResponse, ot as FileStreamEvent, p as UnexposePortRequest, pt as MountBucketOptions, 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 ProcessCleanupResult, w as CursorPositionResponse, wt as ProcessStartResult, x as ReadFileRequest, xt as ProcessListResult, y as FileOperationRequest, yt as ProcessInfoResult, z as CommandClient, zt as StartProcessRequest } from "./sandbox-raa8coh3.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
|
@@ -3591,7 +3591,8 @@ var InvalidMountConfigError = class extends BucketMountError {
|
|
|
3591
3591
|
* Priority order:
|
|
3592
3592
|
* 1. Explicit options.credentials
|
|
3593
3593
|
* 2. Standard AWS env vars: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
|
|
3594
|
-
* 3.
|
|
3594
|
+
* 3. Standard R2 env vars: R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY
|
|
3595
|
+
* 4. Error: no credentials found
|
|
3595
3596
|
*
|
|
3596
3597
|
* @param options - Mount options
|
|
3597
3598
|
* @param envVars - Environment variables
|
|
@@ -3606,7 +3607,18 @@ function detectCredentials(options, envVars) {
|
|
|
3606
3607
|
accessKeyId: awsAccessKeyId,
|
|
3607
3608
|
secretAccessKey: awsSecretAccessKey
|
|
3608
3609
|
};
|
|
3609
|
-
|
|
3610
|
+
/**
|
|
3611
|
+
* Priority 3: Standard R2 env vars
|
|
3612
|
+
*
|
|
3613
|
+
* AWS vars still take precedence over R2 vars in case both are set
|
|
3614
|
+
*/
|
|
3615
|
+
const r2AccessKeyId = envVars.R2_ACCESS_KEY_ID;
|
|
3616
|
+
const r2SecretAccessKey = envVars.R2_SECRET_ACCESS_KEY;
|
|
3617
|
+
if (r2AccessKeyId && r2SecretAccessKey) return {
|
|
3618
|
+
accessKeyId: r2AccessKeyId,
|
|
3619
|
+
secretAccessKey: r2SecretAccessKey
|
|
3620
|
+
};
|
|
3621
|
+
throw new MissingCredentialsError("No credentials found. Set R2_ACCESS_KEY_ID and R2_SECRET_ACCESS_KEY or AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, or pass explicit credentials in options.");
|
|
3610
3622
|
}
|
|
3611
3623
|
|
|
3612
3624
|
//#endregion
|
|
@@ -3686,7 +3698,7 @@ function buildS3fsSource(bucket, prefix) {
|
|
|
3686
3698
|
* This file is auto-updated by .github/changeset-version.ts during releases
|
|
3687
3699
|
* DO NOT EDIT MANUALLY - Changes will be overwritten on the next version bump
|
|
3688
3700
|
*/
|
|
3689
|
-
const SDK_VERSION = "0.7.
|
|
3701
|
+
const SDK_VERSION = "0.7.20";
|
|
3690
3702
|
|
|
3691
3703
|
//#endregion
|
|
3692
3704
|
//#region src/sandbox.ts
|
|
@@ -3839,7 +3851,7 @@ var Sandbox = class Sandbox extends Container {
|
|
|
3839
3851
|
DEFAULT_CONTAINER_TIMEOUTS = {
|
|
3840
3852
|
instanceGetTimeoutMS: 3e4,
|
|
3841
3853
|
portReadyTimeoutMS: 9e4,
|
|
3842
|
-
waitIntervalMS:
|
|
3854
|
+
waitIntervalMS: 300
|
|
3843
3855
|
};
|
|
3844
3856
|
/**
|
|
3845
3857
|
* Active container timeout configuration
|
|
@@ -3962,6 +3974,11 @@ var Sandbox = class Sandbox extends Container {
|
|
|
3962
3974
|
};
|
|
3963
3975
|
this.client.setRetryTimeoutMs(this.computeRetryTimeoutMs());
|
|
3964
3976
|
}
|
|
3977
|
+
const storedSleepAfter = await this.ctx.storage.get("sleepAfter");
|
|
3978
|
+
if (storedSleepAfter !== void 0) {
|
|
3979
|
+
this.sleepAfter = storedSleepAfter;
|
|
3980
|
+
this.renewActivityTimeout();
|
|
3981
|
+
}
|
|
3965
3982
|
});
|
|
3966
3983
|
}
|
|
3967
3984
|
async setSandboxName(name, normalizeId) {
|
|
@@ -3987,6 +4004,7 @@ var Sandbox = class Sandbox extends Container {
|
|
|
3987
4004
|
}
|
|
3988
4005
|
async setSleepAfter(sleepAfter) {
|
|
3989
4006
|
this.sleepAfter = sleepAfter;
|
|
4007
|
+
await this.ctx.storage.put("sleepAfter", sleepAfter);
|
|
3990
4008
|
this.renewActivityTimeout();
|
|
3991
4009
|
}
|
|
3992
4010
|
async setKeepAlive(keepAlive) {
|
|
@@ -4133,7 +4151,14 @@ var Sandbox = class Sandbox extends Container {
|
|
|
4133
4151
|
explicitProvider: options.provider,
|
|
4134
4152
|
prefix
|
|
4135
4153
|
});
|
|
4136
|
-
const
|
|
4154
|
+
const envObj = this.env;
|
|
4155
|
+
const credentials = detectCredentials(options, {
|
|
4156
|
+
AWS_ACCESS_KEY_ID: getEnvString(envObj, "AWS_ACCESS_KEY_ID"),
|
|
4157
|
+
AWS_SECRET_ACCESS_KEY: getEnvString(envObj, "AWS_SECRET_ACCESS_KEY"),
|
|
4158
|
+
R2_ACCESS_KEY_ID: this.r2AccessKeyId || void 0,
|
|
4159
|
+
R2_SECRET_ACCESS_KEY: this.r2SecretAccessKey || void 0,
|
|
4160
|
+
...this.envVars
|
|
4161
|
+
});
|
|
4137
4162
|
const passwordFilePath = this.generatePasswordFilePath();
|
|
4138
4163
|
const mountInfo = {
|
|
4139
4164
|
mountType: "fuse",
|