computesdk 2.1.2 → 2.2.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.mjs CHANGED
@@ -2067,6 +2067,12 @@ function isCommandExitError(error) {
2067
2067
 
2068
2068
  // src/client/index.ts
2069
2069
  var MAX_TUNNEL_TIMEOUT_SECONDS = 300;
2070
+ function encodeFilePath(path) {
2071
+ const isAbsolute = path.startsWith("/");
2072
+ const segments = path.split("/").filter((s) => s !== "");
2073
+ const encoded = segments.map((s) => encodeURIComponent(s)).join("/");
2074
+ return isAbsolute ? "/" + encoded : encoded;
2075
+ }
2070
2076
  var Sandbox = class {
2071
2077
  constructor(config) {
2072
2078
  this._token = null;
@@ -2605,16 +2611,7 @@ API request failed (${response.status}): ${error}`
2605
2611
  * Get file metadata (without content)
2606
2612
  */
2607
2613
  async getFile(path) {
2608
- return this.request(`/files/${this.encodeFilePath(path)}`);
2609
- }
2610
- /**
2611
- * Encode a file path for use in URLs
2612
- * Strips leading slash and encodes each segment separately to preserve path structure
2613
- */
2614
- encodeFilePath(path) {
2615
- const pathWithoutLeadingSlash = path.startsWith("/") ? path.slice(1) : path;
2616
- const segments = pathWithoutLeadingSlash.split("/");
2617
- return segments.map((s) => encodeURIComponent(s)).join("/");
2614
+ return this.request(`/files/${encodeFilePath(path)}`);
2618
2615
  }
2619
2616
  /**
2620
2617
  * Read file content
@@ -2622,7 +2619,7 @@ API request failed (${response.status}): ${error}`
2622
2619
  async readFile(path) {
2623
2620
  const params = new URLSearchParams({ content: "true" });
2624
2621
  const response = await this.request(
2625
- `/files/${this.encodeFilePath(path)}?${params}`
2622
+ `/files/${encodeFilePath(path)}?${params}`
2626
2623
  );
2627
2624
  return response.data.content || "";
2628
2625
  }
@@ -2639,7 +2636,7 @@ API request failed (${response.status}): ${error}`
2639
2636
  * Delete a file or directory
2640
2637
  */
2641
2638
  async deleteFile(path) {
2642
- return this.request(`/files/${this.encodeFilePath(path)}`, {
2639
+ return this.request(`/files/${encodeFilePath(path)}`, {
2643
2640
  method: "DELETE"
2644
2641
  });
2645
2642
  }
@@ -2658,7 +2655,7 @@ API request failed (${response.status}): ${error}`
2658
2655
  headers["Authorization"] = `Bearer ${this._token}`;
2659
2656
  }
2660
2657
  const response = await fetch(
2661
- `${this.config.sandboxUrl}/files/${this.encodeFilePath(path)}`,
2658
+ `${this.config.sandboxUrl}/files/${encodeFilePath(path)}`,
2662
2659
  {
2663
2660
  method: "HEAD",
2664
2661
  headers,
@@ -3913,6 +3910,14 @@ function getProviderHeaders(provider) {
3913
3910
  headers["X-HOPX-API-Key"] = process.env.HOPX_API_KEY;
3914
3911
  }
3915
3912
  break;
3913
+ case "render":
3914
+ if (process.env.RENDER_API_KEY) {
3915
+ headers["X-Render-API-Key"] = process.env.RENDER_API_KEY;
3916
+ }
3917
+ if (process.env.RENDER_OWNER_ID) {
3918
+ headers["X-Render-Owner-ID"] = process.env.RENDER_OWNER_ID;
3919
+ }
3920
+ break;
3916
3921
  }
3917
3922
  return headers;
3918
3923
  }
@@ -3951,9 +3956,10 @@ To fix this, set one of the following:
3951
3956
  Blaxel: export BL_API_KEY=xxx BL_WORKSPACE=xxx
3952
3957
  Namespace: export NSC_TOKEN=xxx
3953
3958
  HopX: export HOPX_API_KEY=xxx
3959
+ Render: export RENDER_API_KEY=xxx RENDER_OWNER_ID=xxx
3954
3960
 
3955
3961
  Or set COMPUTESDK_PROVIDER to specify explicitly:
3956
- export COMPUTESDK_PROVIDER=e2b
3962
+ export COMPUTESDK_PROVIDER=<provider>
3957
3963
 
3958
3964
  Docs: https://computesdk.com/docs/quickstart`
3959
3965
  );