@tensorlakeai/tensorlake 0.5.158 → 0.5.160
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 +25 -0
- package/dist/applications/index.cjs +12 -2
- package/dist/applications/index.cjs.map +1 -1
- package/dist/applications/index.js +12 -2
- package/dist/applications/index.js.map +1 -1
- package/dist/function-agent/main.cjs +1 -1
- package/dist/function-agent/main.cjs.map +1 -1
- package/dist/function-agent/main.js +1 -1
- package/dist/function-agent/main.js.map +1 -1
- package/dist/function-executor/main.cjs +2 -2
- package/dist/function-executor/main.cjs.map +1 -1
- package/dist/function-executor/main.js +2 -2
- package/dist/function-executor/main.js.map +1 -1
- package/dist/index.cjs +131 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -1
- package/dist/index.d.ts +164 -1
- package/dist/index.js +130 -29
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/runtime/function-executor/manifest.json +7 -7
- package/runtime/function-executor/package/dist/function-executor/main.js +2 -2
- package/runtime/function-executor/package/dist/function-executor/main.js.map +1 -1
- package/runtime/function-executor/package/npm-shrinkwrap.json +2 -2
- package/runtime/function-executor/package/package.json +1 -1
- package/runtime/typescript-function-runner/manifest.json +7 -7
- package/runtime/typescript-function-runner/package/dist/function-agent/main.js +1 -1
- package/runtime/typescript-function-runner/package/dist/function-agent/main.js.map +1 -1
- package/runtime/typescript-function-runner/package/npm-shrinkwrap.json +26 -26
- package/runtime/typescript-function-runner/package/package.json +7 -7
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.
|
|
2627
|
+
var SDK_VERSION = "0.5.160";
|
|
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 {
|
|
@@ -3423,6 +3428,11 @@ function createWorkerBinding(runtime) {
|
|
|
3423
3428
|
return runtime.handle("NativeRepositoryClient", args);
|
|
3424
3429
|
}
|
|
3425
3430
|
},
|
|
3431
|
+
NativeUsageClient: class {
|
|
3432
|
+
constructor(...args) {
|
|
3433
|
+
return runtime.handle("NativeUsageClient", args);
|
|
3434
|
+
}
|
|
3435
|
+
},
|
|
3426
3436
|
NativeTcpTunnel: class {
|
|
3427
3437
|
constructor() {
|
|
3428
3438
|
return runtime.handle("NativeTcpTunnel", []);
|
|
@@ -3432,7 +3442,7 @@ function createWorkerBinding(runtime) {
|
|
|
3432
3442
|
};
|
|
3433
3443
|
}
|
|
3434
3444
|
var runtimeKey = /* @__PURE__ */ Symbol.for(
|
|
3435
|
-
`tensorlake.native.worker.${false ? "source" : "0.5.
|
|
3445
|
+
`tensorlake.native.worker.${false ? "source" : "0.5.160"}.v1`
|
|
3436
3446
|
);
|
|
3437
3447
|
var runtimes = globalThis;
|
|
3438
3448
|
function workerBinding() {
|