ppio-sandbox 2.1.1-a3 → 2.1.1-a4

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.
@@ -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-a3";
63
+ var version = "2.1.1-a4";
64
64
 
65
65
  // src/core/utils.ts
66
66
  import platform from "platform";
@@ -102,12 +102,6 @@ async function sha256(data) {
102
102
  function timeoutToSeconds(timeout) {
103
103
  return Math.ceil(timeout / 1e3);
104
104
  }
105
- function dynamicRequire(module) {
106
- if (runtime === "browser") {
107
- throw new Error("Browser runtime is not supported for require");
108
- }
109
- return __require(module);
110
- }
111
105
  async function dynamicImport(module) {
112
106
  if (runtime === "browser") {
113
107
  throw new Error("Browser runtime is not supported for dynamic import");
@@ -3619,7 +3613,7 @@ var SandboxApi = class {
3619
3613
  return true;
3620
3614
  }
3621
3615
  static async createSandbox(template, timeoutMs, opts) {
3622
- var _a3, _b, _c, _d, _e, _f;
3616
+ var _a3, _b, _c, _d, _e, _f, _g;
3623
3617
  const config = new ConnectionConfig(opts);
3624
3618
  const lifecycle = getLifecycle(opts);
3625
3619
  const autoPause = lifecycle.onTimeout === "pause";
@@ -3628,8 +3622,13 @@ var SandboxApi = class {
3628
3622
  if (opts == null ? void 0 : opts.mcp) {
3629
3623
  raiseIfLegacy(config, "Sandbox.create mcp", SandboxError);
3630
3624
  }
3631
- if (opts == null ? void 0 : opts.network) {
3632
- raiseIfLegacy(config, "Sandbox.create network", SandboxError);
3625
+ const unsupportedNetworkOptions = Object.keys((_b = opts == null ? void 0 : opts.network) != null ? _b : {}).filter(
3626
+ (key) => key !== "allowPublicTraffic"
3627
+ );
3628
+ if (unsupportedNetworkOptions.length > 0) {
3629
+ throw new SandboxError(
3630
+ `Sandbox.create network only supports allowPublicTraffic on legacy domains; unsupported options: ${unsupportedNetworkOptions.join(", ")}`
3631
+ );
3633
3632
  }
3634
3633
  if (opts == null ? void 0 : opts.volumeMounts) {
3635
3634
  raiseIfLegacy(config, "Sandbox.create volumeMounts", SandboxError);
@@ -3637,14 +3636,14 @@ var SandboxApi = class {
3637
3636
  if (opts == null ? void 0 : opts.secretEnvs) {
3638
3637
  raiseIfLegacy(config, "Sandbox.create secretEnvs", SandboxError);
3639
3638
  }
3640
- const body2 = __spreadValues({
3639
+ const body2 = __spreadValues(__spreadValues({
3641
3640
  templateID: template,
3642
3641
  timeout: timeoutToSeconds(timeoutMs),
3643
- metadata: (_b = opts == null ? void 0 : opts.metadata) != null ? _b : {},
3644
- envVars: (_c = opts == null ? void 0 : opts.envs) != null ? _c : {},
3645
- secure: (_d = opts == null ? void 0 : opts.secure) != null ? _d : false,
3642
+ metadata: (_c = opts == null ? void 0 : opts.metadata) != null ? _c : {},
3643
+ envVars: (_d = opts == null ? void 0 : opts.envs) != null ? _d : {},
3644
+ secure: (_e = opts == null ? void 0 : opts.secure) != null ? _e : false,
3646
3645
  autoPause: autoPause != null ? autoPause : false
3647
- }, (opts == null ? void 0 : opts.nodeId) ? { nodeID: opts.nodeId } : {});
3646
+ }, (opts == null ? void 0 : opts.network) ? { network: opts.network } : {}), (opts == null ? void 0 : opts.nodeId) ? { nodeID: opts.nodeId } : {});
3648
3647
  const response = await fetch(`${config.apiUrl}/sandboxes`, {
3649
3648
  method: "POST",
3650
3649
  headers: getRawApiHeaders(config, {
@@ -3668,7 +3667,7 @@ var SandboxApi = class {
3668
3667
  sandboxDomain: data.domain || void 0,
3669
3668
  envdVersion: data.envdVersion,
3670
3669
  envdAccessToken: data.envdAccessToken,
3671
- trafficAccessToken: void 0
3670
+ trafficAccessToken: data.trafficAccessToken || void 0
3672
3671
  };
3673
3672
  }
3674
3673
  const client = new ApiClient(config);
@@ -3678,8 +3677,8 @@ var SandboxApi = class {
3678
3677
  mcp: opts == null ? void 0 : opts.mcp,
3679
3678
  envVars: opts == null ? void 0 : opts.envs,
3680
3679
  timeout: timeoutToSeconds(timeoutMs),
3681
- secure: (_e = opts == null ? void 0 : opts.secure) != null ? _e : true,
3682
- allow_internet_access: (_f = opts == null ? void 0 : opts.allowInternetAccess) != null ? _f : true,
3680
+ secure: (_f = opts == null ? void 0 : opts.secure) != null ? _f : true,
3681
+ allow_internet_access: (_g = opts == null ? void 0 : opts.allowInternetAccess) != null ? _g : true,
3683
3682
  network: opts == null ? void 0 : opts.network
3684
3683
  }, (opts == null ? void 0 : opts.nodeId) ? { nodeID: opts.nodeId } : {}), autoPause !== void 0 ? { autoPause } : {}), autoResumeEnabled !== void 0 ? { autoResume: { enabled: autoResumeEnabled } } : {});
3685
3684
  if (opts == null ? void 0 : opts.volumeMounts) {
@@ -3732,7 +3731,9 @@ var SandboxApi = class {
3732
3731
  headers: getRawApiHeaders(config, {
3733
3732
  "Content-Type": "application/json"
3734
3733
  }),
3735
- body: JSON.stringify({ timeout: timeoutToSeconds(timeoutMs) }),
3734
+ body: JSON.stringify(__spreadValues(__spreadValues(__spreadValues({
3735
+ timeout: timeoutToSeconds(timeoutMs)
3736
+ }, (opts == null ? void 0 : opts.secure) !== void 0 ? { secure: opts.secure } : {}), (opts == null ? void 0 : opts.allowPublicTraffic) !== void 0 ? { allowPublicTraffic: opts.allowPublicTraffic } : {}), (opts == null ? void 0 : opts.network) ? { network: opts.network } : {})),
3736
3737
  signal: config.getSignal(opts == null ? void 0 : opts.requestTimeoutMs)
3737
3738
  }
3738
3739
  );
@@ -3748,7 +3749,7 @@ var SandboxApi = class {
3748
3749
  sandboxDomain: data.domain || void 0,
3749
3750
  envdVersion: data.envdVersion || "0.0.0",
3750
3751
  envdAccessToken: data.envdAccessToken,
3751
- trafficAccessToken: void 0
3752
+ trafficAccessToken: data.trafficAccessToken || void 0
3752
3753
  };
3753
3754
  }
3754
3755
  const client = new ApiClient(config);
@@ -4858,6 +4859,7 @@ function defaultBuildLogger(options) {
4858
4859
  import crypto2 from "crypto";
4859
4860
  import fs from "fs";
4860
4861
  import path from "path";
4862
+ import { fileURLToPath } from "url";
4861
4863
 
4862
4864
  // src/core/template/consts.ts
4863
4865
  var FINALIZE_STEP_NAME = "finalize";
@@ -5021,8 +5023,7 @@ function getCallerDirectory(depth) {
5021
5023
  return void 0;
5022
5024
  }
5023
5025
  if (fileName.startsWith("file:")) {
5024
- const { fileURLToPath: fileURLToPath2 } = dynamicRequire("node:url");
5025
- fileName = fileURLToPath2(fileName);
5026
+ fileName = fileURLToPath(fileName);
5026
5027
  }
5027
5028
  return path.dirname(fileName);
5028
5029
  }
@@ -7362,7 +7363,7 @@ var Volume = class _Volume {
7362
7363
 
7363
7364
  // src/core/client.ts
7364
7365
  import path2 from "path";
7365
- import { fileURLToPath } from "url";
7366
+ import { fileURLToPath as fileURLToPath2 } from "url";
7366
7367
  function mergeConnectionOpts(base, next) {
7367
7368
  var _a3, _b;
7368
7369
  const baseHeaders = (_a3 = base.headers) != null ? _a3 : {};
@@ -7572,7 +7573,7 @@ var TemplateNamespace = class {
7572
7573
  for (const site of callsites(2)) {
7573
7574
  const fileName = site.getFileName();
7574
7575
  if (fileName && (!fileName.includes("/src/core/") || fileName.includes("/src/core/tests/")) && !fileName.includes("/node_modules/ppio-sandbox/")) {
7575
- callerContext = path2.dirname(fileName.startsWith("file:") ? fileURLToPath(fileName) : fileName);
7576
+ callerContext = path2.dirname(fileName.startsWith("file:") ? fileURLToPath2(fileName) : fileName);
7576
7577
  break;
7577
7578
  }
7578
7579
  }
@@ -7707,12 +7708,12 @@ var PPIO = class {
7707
7708
  this.secret = new SecretNamespace(opts);
7708
7709
  this.codeInterpreter = new RuntimeSandboxNamespace(
7709
7710
  opts,
7710
- () => import("./sandbox-SMDAOO7A.mjs")
7711
+ () => import("./sandbox-OAPKYDCZ.mjs")
7711
7712
  );
7712
7713
  this.code_interpreter = this.codeInterpreter;
7713
7714
  this.desktop = new RuntimeSandboxNamespace(
7714
7715
  opts,
7715
- () => import("./sandbox-TZ5BE2RX.mjs")
7716
+ () => import("./sandbox-IFBOTC7A.mjs")
7716
7717
  );
7717
7718
  }
7718
7719
  async create(templateOrOpts, opts) {
@@ -7790,4 +7791,4 @@ export {
7790
7791
  ALL_TRAFFIC,
7791
7792
  core_default
7792
7793
  };
7793
- //# sourceMappingURL=chunk-ALX77S7W.mjs.map
7794
+ //# sourceMappingURL=chunk-6PRE7JOS.mjs.map