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.d.mts CHANGED
@@ -3279,11 +3279,6 @@ declare class Sandbox {
3279
3279
  * Get file metadata (without content)
3280
3280
  */
3281
3281
  getFile(path: string): Promise<FileResponse>;
3282
- /**
3283
- * Encode a file path for use in URLs
3284
- * Strips leading slash and encodes each segment separately to preserve path structure
3285
- */
3286
- private encodeFilePath;
3287
3282
  /**
3288
3283
  * Read file content
3289
3284
  */
package/dist/index.d.ts CHANGED
@@ -3279,11 +3279,6 @@ declare class Sandbox {
3279
3279
  * Get file metadata (without content)
3280
3280
  */
3281
3281
  getFile(path: string): Promise<FileResponse>;
3282
- /**
3283
- * Encode a file path for use in URLs
3284
- * Strips leading slash and encodes each segment separately to preserve path structure
3285
- */
3286
- private encodeFilePath;
3287
3282
  /**
3288
3283
  * Read file content
3289
3284
  */
package/dist/index.js CHANGED
@@ -2122,6 +2122,12 @@ function isCommandExitError(error) {
2122
2122
 
2123
2123
  // src/client/index.ts
2124
2124
  var MAX_TUNNEL_TIMEOUT_SECONDS = 300;
2125
+ function encodeFilePath(path) {
2126
+ const isAbsolute = path.startsWith("/");
2127
+ const segments = path.split("/").filter((s) => s !== "");
2128
+ const encoded = segments.map((s) => encodeURIComponent(s)).join("/");
2129
+ return isAbsolute ? "/" + encoded : encoded;
2130
+ }
2125
2131
  var Sandbox = class {
2126
2132
  constructor(config) {
2127
2133
  this._token = null;
@@ -2660,16 +2666,7 @@ API request failed (${response.status}): ${error}`
2660
2666
  * Get file metadata (without content)
2661
2667
  */
2662
2668
  async getFile(path) {
2663
- return this.request(`/files/${this.encodeFilePath(path)}`);
2664
- }
2665
- /**
2666
- * Encode a file path for use in URLs
2667
- * Strips leading slash and encodes each segment separately to preserve path structure
2668
- */
2669
- encodeFilePath(path) {
2670
- const pathWithoutLeadingSlash = path.startsWith("/") ? path.slice(1) : path;
2671
- const segments = pathWithoutLeadingSlash.split("/");
2672
- return segments.map((s) => encodeURIComponent(s)).join("/");
2669
+ return this.request(`/files/${encodeFilePath(path)}`);
2673
2670
  }
2674
2671
  /**
2675
2672
  * Read file content
@@ -2677,7 +2674,7 @@ API request failed (${response.status}): ${error}`
2677
2674
  async readFile(path) {
2678
2675
  const params = new URLSearchParams({ content: "true" });
2679
2676
  const response = await this.request(
2680
- `/files/${this.encodeFilePath(path)}?${params}`
2677
+ `/files/${encodeFilePath(path)}?${params}`
2681
2678
  );
2682
2679
  return response.data.content || "";
2683
2680
  }
@@ -2694,7 +2691,7 @@ API request failed (${response.status}): ${error}`
2694
2691
  * Delete a file or directory
2695
2692
  */
2696
2693
  async deleteFile(path) {
2697
- return this.request(`/files/${this.encodeFilePath(path)}`, {
2694
+ return this.request(`/files/${encodeFilePath(path)}`, {
2698
2695
  method: "DELETE"
2699
2696
  });
2700
2697
  }
@@ -2713,7 +2710,7 @@ API request failed (${response.status}): ${error}`
2713
2710
  headers["Authorization"] = `Bearer ${this._token}`;
2714
2711
  }
2715
2712
  const response = await fetch(
2716
- `${this.config.sandboxUrl}/files/${this.encodeFilePath(path)}`,
2713
+ `${this.config.sandboxUrl}/files/${encodeFilePath(path)}`,
2717
2714
  {
2718
2715
  method: "HEAD",
2719
2716
  headers,
@@ -3968,6 +3965,14 @@ function getProviderHeaders(provider) {
3968
3965
  headers["X-HOPX-API-Key"] = process.env.HOPX_API_KEY;
3969
3966
  }
3970
3967
  break;
3968
+ case "render":
3969
+ if (process.env.RENDER_API_KEY) {
3970
+ headers["X-Render-API-Key"] = process.env.RENDER_API_KEY;
3971
+ }
3972
+ if (process.env.RENDER_OWNER_ID) {
3973
+ headers["X-Render-Owner-ID"] = process.env.RENDER_OWNER_ID;
3974
+ }
3975
+ break;
3971
3976
  }
3972
3977
  return headers;
3973
3978
  }
@@ -4006,9 +4011,10 @@ To fix this, set one of the following:
4006
4011
  Blaxel: export BL_API_KEY=xxx BL_WORKSPACE=xxx
4007
4012
  Namespace: export NSC_TOKEN=xxx
4008
4013
  HopX: export HOPX_API_KEY=xxx
4014
+ Render: export RENDER_API_KEY=xxx RENDER_OWNER_ID=xxx
4009
4015
 
4010
4016
  Or set COMPUTESDK_PROVIDER to specify explicitly:
4011
- export COMPUTESDK_PROVIDER=e2b
4017
+ export COMPUTESDK_PROVIDER=<provider>
4012
4018
 
4013
4019
  Docs: https://computesdk.com/docs/quickstart`
4014
4020
  );