@tensorlakeai/tensorlake 0.5.158 → 0.5.159

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/README.md CHANGED
@@ -29,6 +29,31 @@ without generating diagnostic reports. For a nonstandard or statically linked No
29
29
  executable, set `TENSORLAKE_NODE_LIBC=gnu` or `TENSORLAKE_NODE_LIBC=musl` before using
30
30
  the SDK.
31
31
 
32
+ ## Expose ports when creating a sandbox
33
+
34
+ Set `exposedPorts` in the creation options to configure HTTP access through the
35
+ sandbox proxy in the initial request:
36
+
37
+ ```ts
38
+ import { Sandbox } from "@tensorlakeai/tensorlake";
39
+
40
+ const sandbox = await Sandbox.create({
41
+ exposedPorts: [3000, 8080],
42
+ allowUnauthenticatedAccess: true,
43
+ });
44
+ ```
45
+
46
+ Set `allowUnauthenticatedAccess: true` only when the ports should be publicly
47
+ accessible. Omitting it keeps authentication required for a fresh sandbox.
48
+ Ports must be integers from 1 to 65535, excluding management port 9501;
49
+ duplicates are removed. These options also work with `SandboxClient.create()`,
50
+ `createAndConnect()`, and `wait: false`, without a follow-up update request.
51
+ Snapshot restores inherit both settings when omitted. Pass `exposedPorts: []`
52
+ to clear inherited ports, or `allowUnauthenticatedAccess: false` to require
53
+ authentication.
54
+
55
+ ## Applications
56
+
32
57
  ```ts
33
58
  import { registerApplication, registerFunction } from "@tensorlakeai/tensorlake/applications";
34
59
 
@@ -2624,7 +2624,7 @@ init_image();
2624
2624
 
2625
2625
  // src/defaults.ts
2626
2626
  init_cjs_shims();
2627
- var SDK_VERSION = "0.5.158";
2627
+ var SDK_VERSION = "0.5.159";
2628
2628
  var API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
2629
2629
  var API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
2630
2630
  var NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
@@ -3142,13 +3142,17 @@ var RemoteAPIError = class extends SandboxError {
3142
3142
  statusCode;
3143
3143
  /** Original response body, retained for compatibility and diagnostics. */
3144
3144
  responseMessage;
3145
+ /** Machine-readable API error code, including proxy policy failures. */
3146
+ code;
3145
3147
  errorDetails;
3146
3148
  constructor(statusCode, message) {
3147
3149
  let failure;
3150
+ let code;
3148
3151
  try {
3149
3152
  const payload = JSON.parse(message);
3150
3153
  if (payload && typeof payload === "object" && !Array.isArray(payload)) {
3151
3154
  const record = payload;
3155
+ if (typeof record.code === "string") code = record.code;
3152
3156
  if (typeof record.sandbox_id === "string" && record.sandbox_id.trim() && (record.status === "failed" || record.status === "terminated"))
3153
3157
  failure = record;
3154
3158
  }
@@ -3174,6 +3178,7 @@ var RemoteAPIError = class extends SandboxError {
3174
3178
  this.name = "RemoteAPIError";
3175
3179
  this.statusCode = statusCode;
3176
3180
  this.responseMessage = message;
3181
+ this.code = code;
3177
3182
  }
3178
3183
  };
3179
3184
  var RequestNotFinishedError = class extends Error {
@@ -3432,7 +3437,7 @@ function createWorkerBinding(runtime) {
3432
3437
  };
3433
3438
  }
3434
3439
  var runtimeKey = /* @__PURE__ */ Symbol.for(
3435
- `tensorlake.native.worker.${false ? "source" : "0.5.158"}.v1`
3440
+ `tensorlake.native.worker.${false ? "source" : "0.5.159"}.v1`
3436
3441
  );
3437
3442
  var runtimes = globalThis;
3438
3443
  function workerBinding() {