ppio-sandbox 2.1.1-a5 → 2.1.1-a7

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.
@@ -9,7 +9,7 @@ import {
9
9
  __forAwait,
10
10
  __spreadProps,
11
11
  __spreadValues
12
- } from "./chunk-473VNTF7.mjs";
12
+ } from "./chunk-3FDSHOTR.mjs";
13
13
 
14
14
  // src/code-interpreter/messaging.ts
15
15
  async function extractError(res) {
@@ -465,4 +465,4 @@ Sandbox2.defaultTemplate = "code-interpreter-v1";
465
465
  export {
466
466
  Sandbox2 as Sandbox
467
467
  };
468
- //# sourceMappingURL=chunk-LNGBOKC5.mjs.map
468
+ //# sourceMappingURL=chunk-2JB7PIKB.mjs.map
@@ -60,7 +60,7 @@ import createClient from "openapi-fetch";
60
60
  import platform2 from "platform";
61
61
 
62
62
  // package.json
63
- var version = "2.1.1-a5";
63
+ var version = "2.1.1-a7";
64
64
 
65
65
  // src/core/utils.ts
66
66
  import platform from "platform";
@@ -122,6 +122,9 @@ function toBlob(data) {
122
122
  if (data instanceof Blob) {
123
123
  return data;
124
124
  }
125
+ if (data instanceof Uint8Array) {
126
+ return new Blob([new Uint8Array(data)]);
127
+ }
125
128
  if (typeof data === "string" || data instanceof ArrayBuffer) {
126
129
  return new Blob([data]);
127
130
  }
@@ -132,7 +135,7 @@ function shellQuote(s) {
132
135
  }
133
136
  async function toUploadBody(data, gzip) {
134
137
  if (gzip) {
135
- const stream = data instanceof ReadableStream ? data : data instanceof Blob ? data.stream() : new Blob([data]).stream();
138
+ const stream = data instanceof ReadableStream ? data : (await toBlob(data)).stream();
136
139
  const compressed = stream.pipeThrough(new CompressionStream("gzip"));
137
140
  return new Response(compressed).blob();
138
141
  }
@@ -3617,14 +3620,17 @@ var SandboxApi = class {
3617
3620
  static async createSandbox(template, timeoutMs, opts) {
3618
3621
  var _a3, _b, _c, _d, _e, _f, _g;
3619
3622
  const config = new ConnectionConfig(opts);
3623
+ const longRunning = ((_a3 = opts == null ? void 0 : opts.metadata) == null ? void 0 : _a3.long_running) === "true";
3624
+ const metadata = longRunning ? __spreadValues({}, opts == null ? void 0 : opts.metadata) : opts == null ? void 0 : opts.metadata;
3625
+ const timeout = longRunning ? void 0 : timeoutToSeconds(timeoutMs);
3620
3626
  const lifecycle = getLifecycle(opts);
3621
3627
  const autoPause = lifecycle.onTimeout === "pause";
3622
- const autoResumeEnabled = lifecycle.onTimeout === "pause" ? (_a3 = lifecycle.autoResume) != null ? _a3 : false : void 0;
3628
+ const autoResumeEnabled = lifecycle.onTimeout === "pause" ? (_b = lifecycle.autoResume) != null ? _b : false : void 0;
3623
3629
  if (config.isLegacyDomain) {
3624
3630
  if (opts == null ? void 0 : opts.mcp) {
3625
3631
  raiseIfLegacy(config, "Sandbox.create mcp", SandboxError);
3626
3632
  }
3627
- const unsupportedNetworkOptions = Object.keys((_b = opts == null ? void 0 : opts.network) != null ? _b : {}).filter(
3633
+ const unsupportedNetworkOptions = Object.keys((_c = opts == null ? void 0 : opts.network) != null ? _c : {}).filter(
3628
3634
  (key) => key !== "allowPublicTraffic"
3629
3635
  );
3630
3636
  if (unsupportedNetworkOptions.length > 0) {
@@ -3640,8 +3646,8 @@ var SandboxApi = class {
3640
3646
  }
3641
3647
  const body2 = __spreadValues(__spreadValues({
3642
3648
  templateID: template,
3643
- timeout: timeoutToSeconds(timeoutMs),
3644
- metadata: (_c = opts == null ? void 0 : opts.metadata) != null ? _c : {},
3649
+ timeout,
3650
+ metadata: metadata != null ? metadata : {},
3645
3651
  envVars: (_d = opts == null ? void 0 : opts.envs) != null ? _d : {},
3646
3652
  secure: (_e = opts == null ? void 0 : opts.secure) != null ? _e : false,
3647
3653
  autoPause: autoPause != null ? autoPause : false
@@ -3675,10 +3681,10 @@ var SandboxApi = class {
3675
3681
  const client = new ApiClient(config);
3676
3682
  const body = __spreadValues(__spreadValues(__spreadValues({
3677
3683
  templateID: template,
3678
- metadata: opts == null ? void 0 : opts.metadata,
3684
+ metadata,
3679
3685
  mcp: opts == null ? void 0 : opts.mcp,
3680
3686
  envVars: opts == null ? void 0 : opts.envs,
3681
- timeout: timeoutToSeconds(timeoutMs),
3687
+ timeout,
3682
3688
  secure: (_f = opts == null ? void 0 : opts.secure) != null ? _f : true,
3683
3689
  allow_internet_access: (_g = opts == null ? void 0 : opts.allowInternetAccess) != null ? _g : true,
3684
3690
  network: opts == null ? void 0 : opts.network
@@ -7923,12 +7929,12 @@ var PPIO = class {
7923
7929
  this.secret = new SecretNamespace(opts);
7924
7930
  this.codeInterpreter = new RuntimeSandboxNamespace(
7925
7931
  opts,
7926
- () => import("./sandbox-GD3E5T3C.mjs")
7932
+ () => import("./sandbox-YOWIOKTV.mjs")
7927
7933
  );
7928
7934
  this.code_interpreter = this.codeInterpreter;
7929
7935
  this.desktop = new RuntimeSandboxNamespace(
7930
7936
  opts,
7931
- () => import("./sandbox-U6WT7JIS.mjs")
7937
+ () => import("./sandbox-TEFWZI7X.mjs")
7932
7938
  );
7933
7939
  }
7934
7940
  async create(templateOrOpts, opts) {
@@ -8007,4 +8013,4 @@ export {
8007
8013
  ALL_TRAFFIC,
8008
8014
  core_default
8009
8015
  };
8010
- //# sourceMappingURL=chunk-473VNTF7.mjs.map
8016
+ //# sourceMappingURL=chunk-3FDSHOTR.mjs.map