@cloudflare/sandbox 0.7.21 → 0.8.1

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 CHANGED
@@ -1,5 +1,6 @@
1
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-DDDSuWA6.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
+ import { ContainerProxy } from "@cloudflare/containers";
3
4
 
4
5
  //#region src/errors/classes.d.ts
5
6
 
@@ -248,5 +249,5 @@ declare class InvalidMountConfigError extends BucketMountError {
248
249
  constructor(message: string);
249
250
  }
250
251
  //#endregion
251
- export { BackupClient, BackupCreateError, BackupExpiredError, BackupNotFoundError, type BackupOptions, BackupRestoreError, type BaseApiResponse, type BaseExecOptions, type BucketCredentials, BucketMountError, type BucketProvider, type ClickOptions, type CodeContext, CodeInterpreter, CommandClient, type ExecuteResponse as CommandExecuteResponse, type CommandsResponse, type ContainerStub, type CreateContextOptions, type CreateSessionRequest, type CreateSessionResponse, type CursorPositionResponse, type DeleteSessionRequest, type DeleteSessionResponse, type Desktop, DesktopClient, DesktopInvalidCoordinatesError, DesktopInvalidOptionsError, DesktopNotStartedError, DesktopProcessCrashedError, DesktopStartFailedError, type DesktopStartOptions, type DesktopStartResponse, type DesktopStatusResponse, type DesktopStopResponse, DesktopUnavailableError, type DirectoryBackup, type ErrorResponse, type ExecEvent, type ExecOptions, type ExecResult, type ExecuteRequest, type ExecutionCallbacks, type ExecutionResult, type ExecutionSession, type ExposePortRequest, type FileChunk, FileClient, type FileMetadata, type FileOperationRequest, type FileStreamEvent, type FileWatchSSEEvent, type GitCheckoutRequest, type GitCheckoutResult, GitClient, type ISandbox, type InterpreterClient, InvalidBackupConfigError, InvalidMountConfigError, type KeyInput, type ListFilesOptions, type LocalMountBucketOptions, type LogEvent, MissingCredentialsError, type MkdirRequest, type MountBucketOptions, type PingResponse, PortClient, type PortCloseResult, type PortExposeResult, type PortListResult, type Process, type ProcessCleanupResult, ProcessClient, ProcessExitedBeforeReadyError, type ProcessInfoResult, type ProcessKillResult, type ProcessListResult, type ProcessLogsResult, type ProcessOptions, ProcessReadyTimeoutError, type ProcessStartResult, type ProcessStatus, type PtyOptions, type ReadFileRequest, type RemoteMountBucketOptions, type RequestConfig, type ResponseHandler, type RestoreBackupResult, type RouteInfo, type RunCodeOptions, S3FSMountError, Sandbox, SandboxClient, type HttpClientOptions as SandboxClientOptions, type SandboxEnv, type SandboxOptions, type ScreenSizeResponse, type ScreenshotBytesResponse, type ScreenshotOptions, type ScreenshotRegion, type ScreenshotResponse, type ScrollDirection, type SessionOptions, type SessionRequest, type StartProcessRequest, type StreamOptions, type TypeOptions, type UnexposePortRequest, UtilityClient, type WaitForLogResult, type WaitForPortOptions, type WatchOptions, type WriteFileRequest, asyncIterableToSSEStream, collectFile, getSandbox, isExecResult, isProcess, isProcessStatus, parseSSEStream, proxyTerminal, proxyToSandbox, responseToAsyncIterable, streamFile };
252
+ export { BackupClient, BackupCreateError, BackupExpiredError, BackupNotFoundError, type BackupOptions, BackupRestoreError, type BaseApiResponse, type BaseExecOptions, type BucketCredentials, BucketMountError, type BucketProvider, type ClickOptions, type CodeContext, CodeInterpreter, CommandClient, type ExecuteResponse as CommandExecuteResponse, type CommandsResponse, ContainerProxy, type ContainerStub, type CreateContextOptions, type CreateSessionRequest, type CreateSessionResponse, type CursorPositionResponse, type DeleteSessionRequest, type DeleteSessionResponse, type Desktop, DesktopClient, DesktopInvalidCoordinatesError, DesktopInvalidOptionsError, DesktopNotStartedError, DesktopProcessCrashedError, DesktopStartFailedError, type DesktopStartOptions, type DesktopStartResponse, type DesktopStatusResponse, type DesktopStopResponse, DesktopUnavailableError, type DirectoryBackup, type ErrorResponse, type ExecEvent, type ExecOptions, type ExecResult, type ExecuteRequest, type ExecutionCallbacks, type ExecutionResult, type ExecutionSession, type ExposePortRequest, type FileChunk, FileClient, type FileMetadata, type FileOperationRequest, type FileStreamEvent, type FileWatchSSEEvent, type GitCheckoutRequest, type GitCheckoutResult, GitClient, type ISandbox, type InterpreterClient, InvalidBackupConfigError, InvalidMountConfigError, type KeyInput, type ListFilesOptions, type LocalMountBucketOptions, type LogEvent, MissingCredentialsError, type MkdirRequest, type MountBucketOptions, type PingResponse, PortClient, type PortCloseResult, type PortExposeResult, type PortListResult, type Process, type ProcessCleanupResult, ProcessClient, ProcessExitedBeforeReadyError, type ProcessInfoResult, type ProcessKillResult, type ProcessListResult, type ProcessLogsResult, type ProcessOptions, ProcessReadyTimeoutError, type ProcessStartResult, type ProcessStatus, type PtyOptions, type ReadFileRequest, type RemoteMountBucketOptions, type RequestConfig, type ResponseHandler, type RestoreBackupResult, type RouteInfo, type RunCodeOptions, S3FSMountError, Sandbox, SandboxClient, type HttpClientOptions as SandboxClientOptions, type SandboxEnv, type SandboxOptions, type ScreenSizeResponse, type ScreenshotBytesResponse, type ScreenshotOptions, type ScreenshotRegion, type ScreenshotResponse, type ScrollDirection, type SessionOptions, type SessionRequest, type StartProcessRequest, type StreamOptions, type TypeOptions, type UnexposePortRequest, UtilityClient, type WaitForLogResult, type WaitForPortOptions, type WatchOptions, type WriteFileRequest, asyncIterableToSSEStream, collectFile, getSandbox, isExecResult, isProcess, isProcessStatus, parseSSEStream, proxyTerminal, proxyToSandbox, responseToAsyncIterable, streamFile };
252
253
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/errors/classes.ts","../src/file-stream.ts","../src/interpreter.ts","../src/pty/proxy.ts","../src/request-handler.ts","../src/sse-parser.ts","../src/storage-mount/errors.ts"],"sourcesContent":[],"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B9D,WAAA,CAAA,OAAA,EAAA,MAAyB;;;;;AAAoB,cMpnB7C,uBAAA,SAAgC,gBAAA,CNonBa;EAwB7C,WAAA,CAAA,OAAA,EAAA,MAAA;;;;;AAAkD,cMloBlD,uBAAA,SAAgC,gBAAA,CNkoBkB;EA4BlD,WAAA,CAAA,OAAA,EAAA,MAAoB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/errors/classes.ts","../src/file-stream.ts","../src/interpreter.ts","../src/pty/proxy.ts","../src/request-handler.ts","../src/sse-parser.ts","../src/storage-mount/errors.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAgD0D,cAD7C,YAC6C,CAAA,WADrB,MACqB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,SADY,KAAA,CACZ;EAS7C,SAAA,aAAA,EATgC,eAShC,CAT8C,QAS9C,CAAA;EAAA,WAAA,CAAA,aAAA,EATgC,eAShC,CAT8C,QAS9C,CAAA;EAME,IAAA,IAAA,CAAA,CAAA,EAf2C,SAe3C;iBANF;;EAVyD,IAAA,SAAA,CAAA,CAAA,EAUzD,aAAA,GAVyD,SAAA;EAAK,IAAA,UAAA,CAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAwmB9D,IAAA,SAAA,CAAA,CAAA,EAAA,MAAA;EAA8C,IAAA,aAAA,CAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAChB,MAAA,CAAA,CAAA,EAAA;IAAd,IAAA,EAAA,MAAA;IADiB,OAAA,EAAA,MAAA;IAAY,IAAA,EAxlB3C,SAwlB2C;IAwB7C,OAAA,UAAA;IAAmD,UAAA,EAAA,MAAA;IACrB,SAAA,kBAAA,SAAA;IAAd,UAAA,EAAA,MAAA,GAAA,SAAA;IADsB,SAAA,EAAA,MAAA;IAAY,aAAA,EAAA,MAAA,GAAA,SAAA;IA4BlD,KAAA,EAAA,MAAA,GAAA,SAAoB;EAAqB,CAAA;;;;;cApDzC,wBAAA,SAAiC,aAAa;6BAC9B,gBAAc;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AAA,CAAA,EAAA,CAAA,KAAA,EKrhBlC,CLqhBkC,EAAA,GAAA,MAAA;AAwB1D,CAAA,CAAA,EK3iBG,cL2iBU,CK3iBK,UL2iBL,CAAA;;;;;;AA/nBgC,cMpChC,gBAAA,SAAyB,KAAA,CNoCO;EAAa,SAAA,IAAA,EMnClC,SNmCkC;EAS7C,WAAA,CAAA,OAAA,EAAA,MAAA,EAAA,IAAA,CAAA,EM1CwB,SN0CxB;;;;;AAVyD,cMtBzD,cAAA,SAAuB,gBAAA,CNsBkC;EAAK,WAAA,CAAA,OAAA,EAAA,MAAA;AAwmB3E;;;;AAA8C,cMpnBjC,uBAAA,SAAgC,gBAAA,CNonBC;EAAY,WAAA,CAAA,OAAA,EAAA,MAAA;AAwB1D;;;;AAAmD,cMloBtC,uBAAA,SAAgC,gBAAA,CNkoBM;EAAY,WAAA,CAAA,OAAA,EAAA,MAAA;AA4B/D"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { _ as extractRepoName, a as isExecResult, b as partitionEnvVars, c as parseSSEFrames, d as createNoOpLogger, f as TraceContext, g as GitLogger, h as ResultImpl, i as isWSStreamChunk, l as shellEscape, m as Execution, n as isWSError, o as isProcess, p as logCanonicalEvent, r as isWSResponse, s as isProcessStatus, t as generateRequestId, u as createLogger, v as filterEnvVars, y as getEnvString } from "./dist-CmfvOT-w.js";
2
2
  import { t as ErrorCode } from "./errors-CaSfB5Bm.js";
3
- import { Container, getContainer, switchPort } from "@cloudflare/containers";
3
+ import { Container, ContainerProxy, getContainer, switchPort } from "@cloudflare/containers";
4
4
  import { AwsClient } from "aws4fetch";
5
5
  import path from "node:path/posix";
6
6
 
@@ -737,6 +737,9 @@ var BaseTransport = class {
737
737
  setRetryTimeoutMs(ms) {
738
738
  this.retryTimeoutMs = ms;
739
739
  }
740
+ getRetryTimeoutMs() {
741
+ return this.retryTimeoutMs;
742
+ }
740
743
  /**
741
744
  * Fetch with automatic retry for 503 (container starting)
742
745
  *
@@ -841,6 +844,7 @@ var HttpTransport = class extends BaseTransport {
841
844
  const DEFAULT_REQUEST_TIMEOUT_MS = 12e4;
842
845
  const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 3e5;
843
846
  const DEFAULT_CONNECT_TIMEOUT_MS = 3e4;
847
+ const MIN_TIME_FOR_CONNECT_RETRY_MS = 15e3;
844
848
  /**
845
849
  * WebSocket transport implementation
846
850
  *
@@ -943,6 +947,26 @@ var WebSocketTransport = class extends BaseTransport {
943
947
  if (this.config.stub) await this.connectViaFetch();
944
948
  else await this.connectViaWebSocket();
945
949
  }
950
+ async fetchUpgradeWithRetry(attemptUpgrade) {
951
+ const retryTimeoutMs = this.getRetryTimeoutMs();
952
+ const startTime = Date.now();
953
+ let attempt = 0;
954
+ while (true) {
955
+ const response = await attemptUpgrade();
956
+ if (response.status !== 503) return response;
957
+ const remaining = retryTimeoutMs - (Date.now() - startTime);
958
+ if (remaining <= MIN_TIME_FOR_CONNECT_RETRY_MS) return response;
959
+ const delay = Math.min(3e3 * 2 ** attempt, 3e4);
960
+ this.logger.info("WebSocket container not ready, retrying", {
961
+ status: response.status,
962
+ attempt: attempt + 1,
963
+ delayMs: delay,
964
+ remainingSec: Math.floor(remaining / 1e3)
965
+ });
966
+ await this.sleep(delay);
967
+ attempt++;
968
+ }
969
+ }
946
970
  /**
947
971
  * Connect using fetch-based WebSocket (Cloudflare Workers style)
948
972
  * This is required when running inside a Durable Object.
@@ -952,20 +976,10 @@ var WebSocketTransport = class extends BaseTransport {
952
976
  */
953
977
  async connectViaFetch() {
954
978
  const timeoutMs = this.config.connectTimeoutMs ?? DEFAULT_CONNECT_TIMEOUT_MS;
955
- const controller = new AbortController();
956
- const timeout = setTimeout(() => controller.abort(), timeoutMs);
957
979
  try {
958
980
  const wsPath = new URL(this.config.wsUrl).pathname;
959
981
  const httpUrl = `http://localhost:${this.config.port || 3e3}${wsPath}`;
960
- const request = new Request(httpUrl, {
961
- headers: {
962
- Upgrade: "websocket",
963
- Connection: "Upgrade"
964
- },
965
- signal: controller.signal
966
- });
967
- const response = await this.config.stub.fetch(request);
968
- clearTimeout(timeout);
982
+ const response = await this.fetchUpgradeWithRetry(() => this.fetchUpgradeAttempt(httpUrl, timeoutMs));
969
983
  if (response.status !== 101) throw new Error(`WebSocket upgrade failed: ${response.status} ${response.statusText}`);
970
984
  const ws = response.webSocket;
971
985
  if (!ws) throw new Error("No WebSocket in upgrade response");
@@ -976,12 +990,27 @@ var WebSocketTransport = class extends BaseTransport {
976
990
  this.ws.addEventListener("message", this.boundHandleMessage);
977
991
  this.logger.debug("WebSocket connected via fetch", { url: this.config.wsUrl });
978
992
  } catch (error) {
979
- clearTimeout(timeout);
980
993
  this.state = "error";
981
994
  this.logger.error("WebSocket fetch connection failed", error instanceof Error ? error : new Error(String(error)));
982
995
  throw error;
983
996
  }
984
997
  }
998
+ async fetchUpgradeAttempt(httpUrl, timeoutMs) {
999
+ const controller = new AbortController();
1000
+ const timeout = setTimeout(() => controller.abort(), timeoutMs);
1001
+ try {
1002
+ const request = new Request(httpUrl, {
1003
+ headers: {
1004
+ Upgrade: "websocket",
1005
+ Connection: "Upgrade"
1006
+ },
1007
+ signal: controller.signal
1008
+ });
1009
+ return await this.config.stub.fetch(request);
1010
+ } finally {
1011
+ clearTimeout(timeout);
1012
+ }
1013
+ }
985
1014
  /**
986
1015
  * Connect using standard WebSocket API (browser/Node style)
987
1016
  */
@@ -3562,7 +3591,7 @@ function buildS3fsSource(bucket, prefix) {
3562
3591
  * This file is auto-updated by .github/changeset-version.ts during releases
3563
3592
  * DO NOT EDIT MANUALLY - Changes will be overwritten on the next version bump
3564
3593
  */
3565
- const SDK_VERSION = "0.7.21";
3594
+ const SDK_VERSION = "0.8.1";
3566
3595
 
3567
3596
  //#endregion
3568
3597
  //#region src/sandbox.ts
@@ -6082,5 +6111,5 @@ async function collectFile(stream) {
6082
6111
  }
6083
6112
 
6084
6113
  //#endregion
6085
- export { BackupClient, BackupCreateError, BackupExpiredError, BackupNotFoundError, BackupRestoreError, BucketMountError, CodeInterpreter, CommandClient, DesktopClient, DesktopInvalidCoordinatesError, DesktopInvalidOptionsError, DesktopNotStartedError, DesktopProcessCrashedError, DesktopStartFailedError, DesktopUnavailableError, FileClient, GitClient, InvalidBackupConfigError, InvalidMountConfigError, MissingCredentialsError, PortClient, ProcessClient, ProcessExitedBeforeReadyError, ProcessReadyTimeoutError, S3FSMountError, Sandbox, SandboxClient, UtilityClient, asyncIterableToSSEStream, collectFile, getSandbox, isExecResult, isProcess, isProcessStatus, parseSSEStream, proxyTerminal, proxyToSandbox, responseToAsyncIterable, streamFile };
6114
+ export { BackupClient, BackupCreateError, BackupExpiredError, BackupNotFoundError, BackupRestoreError, BucketMountError, CodeInterpreter, CommandClient, ContainerProxy, DesktopClient, DesktopInvalidCoordinatesError, DesktopInvalidOptionsError, DesktopNotStartedError, DesktopProcessCrashedError, DesktopStartFailedError, DesktopUnavailableError, FileClient, GitClient, InvalidBackupConfigError, InvalidMountConfigError, MissingCredentialsError, PortClient, ProcessClient, ProcessExitedBeforeReadyError, ProcessReadyTimeoutError, S3FSMountError, Sandbox, SandboxClient, UtilityClient, asyncIterableToSSEStream, collectFile, getSandbox, isExecResult, isProcess, isProcessStatus, parseSSEStream, proxyTerminal, proxyToSandbox, responseToAsyncIterable, streamFile };
6086
6115
  //# sourceMappingURL=index.js.map