@tensorlakeai/tensorlake 0.5.145 → 0.5.148
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/applications/index.cjs +12 -3
- package/dist/applications/index.cjs.map +1 -1
- package/dist/applications/index.js +12 -3
- package/dist/applications/index.js.map +1 -1
- package/dist/function-agent/main.cjs +1 -1
- package/dist/function-agent/main.js +1 -1
- package/dist/function-executor/main.cjs +2 -2
- package/dist/function-executor/main.js +2 -2
- package/dist/index.cjs +51 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -7
- package/dist/index.d.ts +45 -7
- package/dist/index.js +50 -15
- package/dist/index.js.map +1 -1
- package/dist/sandbox-image.cjs +12 -3
- package/dist/sandbox-image.cjs.map +1 -1
- package/dist/sandbox-image.js +12 -3
- package/dist/sandbox-image.js.map +1 -1
- package/package.json +7 -7
- package/runtime/function-executor/manifest.json +5 -5
- package/runtime/function-executor/package/dist/function-executor/main.js +2 -2
- 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 +5 -5
- package/runtime/typescript-function-runner/package/dist/function-agent/main.js +1 -1
- package/runtime/typescript-function-runner/package/npm-shrinkwrap.json +26 -26
- package/runtime/typescript-function-runner/package/package.json +7 -7
|
@@ -402,7 +402,7 @@ var NativeWorkerClient = class {
|
|
|
402
402
|
}
|
|
403
403
|
};
|
|
404
404
|
var runtimeKey = /* @__PURE__ */ Symbol.for(
|
|
405
|
-
`tensorlake.native.worker.${false ? "source" : "0.5.
|
|
405
|
+
`tensorlake.native.worker.${false ? "source" : "0.5.148"}.v1`
|
|
406
406
|
);
|
|
407
407
|
var runtimes = globalThis;
|
|
408
408
|
function configureNativeWorker(workerPath) {
|
|
@@ -390,7 +390,7 @@ var NativeWorkerClient = class {
|
|
|
390
390
|
}
|
|
391
391
|
};
|
|
392
392
|
var runtimeKey = /* @__PURE__ */ Symbol.for(
|
|
393
|
-
`tensorlake.native.worker.${false ? "source" : "0.5.
|
|
393
|
+
`tensorlake.native.worker.${false ? "source" : "0.5.148"}.v1`
|
|
394
394
|
);
|
|
395
395
|
var runtimes = globalThis;
|
|
396
396
|
function configureNativeWorker(workerPath) {
|
|
@@ -51,7 +51,7 @@ var cancelNativeCall = /* @__PURE__ */ Symbol.for("tensorlake.native.cancel.v1")
|
|
|
51
51
|
var closeNativeHandle = /* @__PURE__ */ Symbol.for("tensorlake.native.close.v1");
|
|
52
52
|
|
|
53
53
|
// src/defaults.ts
|
|
54
|
-
var SDK_VERSION = "0.5.
|
|
54
|
+
var SDK_VERSION = "0.5.148";
|
|
55
55
|
var API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
|
|
56
56
|
var API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
|
|
57
57
|
var NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
|
|
@@ -247,7 +247,7 @@ var NativeWorkerClient = class {
|
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
249
|
var runtimeKey = /* @__PURE__ */ Symbol.for(
|
|
250
|
-
`tensorlake.native.worker.${false ? "source" : "0.5.
|
|
250
|
+
`tensorlake.native.worker.${false ? "source" : "0.5.148"}.v1`
|
|
251
251
|
);
|
|
252
252
|
var runtimes = globalThis;
|
|
253
253
|
function configureNativeWorker(workerPath) {
|
|
@@ -10,7 +10,7 @@ var cancelNativeCall = /* @__PURE__ */ Symbol.for("tensorlake.native.cancel.v1")
|
|
|
10
10
|
var closeNativeHandle = /* @__PURE__ */ Symbol.for("tensorlake.native.close.v1");
|
|
11
11
|
|
|
12
12
|
// src/defaults.ts
|
|
13
|
-
var SDK_VERSION = "0.5.
|
|
13
|
+
var SDK_VERSION = "0.5.148";
|
|
14
14
|
var API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
|
|
15
15
|
var API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
|
|
16
16
|
var NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
|
|
@@ -206,7 +206,7 @@ var NativeWorkerClient = class {
|
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
208
|
var runtimeKey = /* @__PURE__ */ Symbol.for(
|
|
209
|
-
`tensorlake.native.worker.${false ? "source" : "0.5.
|
|
209
|
+
`tensorlake.native.worker.${false ? "source" : "0.5.148"}.v1`
|
|
210
210
|
);
|
|
211
211
|
var runtimes = globalThis;
|
|
212
212
|
function configureNativeWorker(workerPath) {
|
package/dist/index.cjs
CHANGED
|
@@ -49,7 +49,7 @@ var init_defaults = __esm({
|
|
|
49
49
|
"src/defaults.ts"() {
|
|
50
50
|
"use strict";
|
|
51
51
|
init_cjs_shims();
|
|
52
|
-
SDK_VERSION = "0.5.
|
|
52
|
+
SDK_VERSION = "0.5.148";
|
|
53
53
|
API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
|
|
54
54
|
API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
|
|
55
55
|
NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
|
|
@@ -493,7 +493,7 @@ var init_native_worker_client = __esm({
|
|
|
493
493
|
}
|
|
494
494
|
};
|
|
495
495
|
runtimeKey = /* @__PURE__ */ Symbol.for(
|
|
496
|
-
`tensorlake.native.worker.${false ? "source" : "0.5.
|
|
496
|
+
`tensorlake.native.worker.${false ? "source" : "0.5.148"}.v1`
|
|
497
497
|
);
|
|
498
498
|
runtimes = globalThis;
|
|
499
499
|
}
|
|
@@ -559,7 +559,7 @@ function fromSnakeKeys(obj, idField) {
|
|
|
559
559
|
}
|
|
560
560
|
return obj;
|
|
561
561
|
}
|
|
562
|
-
var SandboxStatus, SandboxPendingReason, TERMINATION_REASON_NO_CAPACITY, TERMINATION_REASON_CANCELLED, SnapshotStatus, ProcessStatus, StdinMode, OutputMode, ContainerState, ResizeStatus, ResizeErrorReason, CAMEL_TO_SNAKE_RE;
|
|
562
|
+
var SandboxStatus, SandboxPendingReason, TERMINATION_REASON_NO_CAPACITY, TERMINATION_REASON_CANCELLED, SnapshotStatus, ProcessStatus, StdinMode, OutputMode, ContainerState, ResizeStatus, ResizeErrorReason, CommandExitReason, CAMEL_TO_SNAKE_RE;
|
|
563
563
|
var init_models = __esm({
|
|
564
564
|
"src/models.ts"() {
|
|
565
565
|
"use strict";
|
|
@@ -631,6 +631,13 @@ var init_models = __esm({
|
|
|
631
631
|
ResizeErrorReason2["INCOMPATIBLE_RESPONSE"] = "incompatible_response";
|
|
632
632
|
return ResizeErrorReason2;
|
|
633
633
|
})(ResizeErrorReason || {});
|
|
634
|
+
CommandExitReason = /* @__PURE__ */ ((CommandExitReason2) => {
|
|
635
|
+
CommandExitReason2["EXITED"] = "exited";
|
|
636
|
+
CommandExitReason2["SIGNALED"] = "signaled";
|
|
637
|
+
CommandExitReason2["OOM_KILLED"] = "oom_killed";
|
|
638
|
+
CommandExitReason2["TIMED_OUT"] = "timed_out";
|
|
639
|
+
return CommandExitReason2;
|
|
640
|
+
})(CommandExitReason || {});
|
|
634
641
|
CAMEL_TO_SNAKE_RE = /[A-Z]/g;
|
|
635
642
|
}
|
|
636
643
|
});
|
|
@@ -756,6 +763,7 @@ function assembleCommandResult(events) {
|
|
|
756
763
|
const stdoutLines = [];
|
|
757
764
|
const stderrLines = [];
|
|
758
765
|
let exitCode = -1;
|
|
766
|
+
let reason;
|
|
759
767
|
for (const eventJson of events) {
|
|
760
768
|
const raw = JSON.parse(eventJson);
|
|
761
769
|
if (typeof raw.line === "string") {
|
|
@@ -769,12 +777,23 @@ function assembleCommandResult(events) {
|
|
|
769
777
|
exitCode = raw.exit_code;
|
|
770
778
|
} else if (typeof raw.signal === "number") {
|
|
771
779
|
exitCode = -raw.signal;
|
|
780
|
+
} else {
|
|
781
|
+
continue;
|
|
772
782
|
}
|
|
783
|
+
reason = exitReason(raw);
|
|
773
784
|
}
|
|
774
785
|
}
|
|
775
|
-
return { exitCode, stdout: stdoutLines.join("\n"), stderr: stderrLines.join("\n") };
|
|
786
|
+
return { exitCode, stdout: stdoutLines.join("\n"), stderr: stderrLines.join("\n"), reason };
|
|
776
787
|
}
|
|
777
|
-
|
|
788
|
+
function exitReason(raw) {
|
|
789
|
+
if (typeof raw.reason === "string" && KNOWN_EXIT_REASONS.has(raw.reason)) {
|
|
790
|
+
return raw.reason;
|
|
791
|
+
}
|
|
792
|
+
if (raw.oom_killed === true) return "oom_killed" /* OOM_KILLED */;
|
|
793
|
+
if (typeof raw.exit_code === "number") return "exited" /* EXITED */;
|
|
794
|
+
return "signaled" /* SIGNALED */;
|
|
795
|
+
}
|
|
796
|
+
var cachedBinding, KNOWN_EXIT_REASONS;
|
|
778
797
|
var init_native_sandbox = __esm({
|
|
779
798
|
"src/native-sandbox.ts"() {
|
|
780
799
|
"use strict";
|
|
@@ -783,6 +802,7 @@ var init_native_sandbox = __esm({
|
|
|
783
802
|
init_errors();
|
|
784
803
|
init_native_worker_client();
|
|
785
804
|
init_native_worker_protocol();
|
|
805
|
+
KNOWN_EXIT_REASONS = new Set(Object.values(CommandExitReason));
|
|
786
806
|
}
|
|
787
807
|
});
|
|
788
808
|
|
|
@@ -4009,6 +4029,9 @@ var init_sandbox = __esm({
|
|
|
4009
4029
|
*
|
|
4010
4030
|
* Resource targets use create's cpus, memoryMb, and diskMb names. Resize
|
|
4011
4031
|
* waits by default; wait=false returns admission. Timeout does not cancel it.
|
|
4032
|
+
* CPU-only CAS sandboxes support CPU, memory, and root-disk resize; GPU CAS sandboxes
|
|
4033
|
+
* support only root-disk growth and reject CPU and memory changes.
|
|
4034
|
+
* Non-CAS sandboxes do not support live resize.
|
|
4012
4035
|
* Wait, timeout, and pollInterval are ignored on non-resource updates.
|
|
4013
4036
|
* A no-op returns current resources with absent or earlier resize metadata.
|
|
4014
4037
|
*
|
|
@@ -4236,15 +4259,17 @@ var init_sandbox = __esm({
|
|
|
4236
4259
|
() => proxy.runProcess(JSON.stringify(body)),
|
|
4237
4260
|
{ sandboxId: this.sandboxId }
|
|
4238
4261
|
);
|
|
4239
|
-
const { exitCode, stdout, stderr } = assembleCommandResult(events);
|
|
4262
|
+
const { exitCode, stdout, stderr, reason } = assembleCommandResult(events);
|
|
4240
4263
|
logSdkTiming("sandbox.run", "complete", opStart, {
|
|
4241
4264
|
sandbox_id: this.sandboxId,
|
|
4242
4265
|
server_trace_id: traceId,
|
|
4243
4266
|
command: sdkTimingPayloadsEnabled() ? command : void 0,
|
|
4244
4267
|
command_length: command.length,
|
|
4245
|
-
exit_code: exitCode
|
|
4268
|
+
exit_code: exitCode,
|
|
4269
|
+
exit_reason: reason
|
|
4246
4270
|
});
|
|
4247
|
-
|
|
4271
|
+
const timedOut = reason === "timed_out" /* TIMED_OUT */;
|
|
4272
|
+
return Object.assign({ exitCode, stdout, stderr, reason, timedOut }, { traceId });
|
|
4248
4273
|
}
|
|
4249
4274
|
// --- Process management ---
|
|
4250
4275
|
/**
|
|
@@ -4639,7 +4664,10 @@ function gpuRequest(gpu, gpus, gpuModel) {
|
|
|
4639
4664
|
gpus = gpu.count;
|
|
4640
4665
|
gpuModel = gpu.model;
|
|
4641
4666
|
}
|
|
4642
|
-
if (gpus == null)
|
|
4667
|
+
if (gpus == null) {
|
|
4668
|
+
if (gpuModel == null) return void 0;
|
|
4669
|
+
gpus = 1;
|
|
4670
|
+
}
|
|
4643
4671
|
if (!Number.isInteger(gpus) || gpus < 1) {
|
|
4644
4672
|
throw new SandboxError("gpus must be a positive integer");
|
|
4645
4673
|
}
|
|
@@ -5109,7 +5137,9 @@ var init_client = __esm({
|
|
|
5109
5137
|
});
|
|
5110
5138
|
}
|
|
5111
5139
|
/**
|
|
5112
|
-
* Update properties or resize a
|
|
5140
|
+
* Update properties or resize a running sandbox. CPU-only CAS sandboxes support
|
|
5141
|
+
* CPU, memory, and root-disk resize; GPU CAS sandboxes support only root-disk
|
|
5142
|
+
* growth. Non-CAS sandboxes do not support live resize.
|
|
5113
5143
|
* Resource names match create. Resize waits by default; wait=false returns
|
|
5114
5144
|
* admission. Timeout leaves the resize running and reports its generation.
|
|
5115
5145
|
* Wait, timeout, and pollInterval are ignored on non-resource updates.
|
|
@@ -5437,12 +5467,14 @@ var init_client = __esm({
|
|
|
5437
5467
|
// --- Pools ---
|
|
5438
5468
|
/** Create a new sandbox pool with warm pre-booted containers. */
|
|
5439
5469
|
async createPool(options) {
|
|
5470
|
+
const gpus = gpuRequest(options.gpu, options.gpus, options.gpuModel);
|
|
5440
5471
|
const body = {
|
|
5441
5472
|
image: options.image,
|
|
5442
5473
|
resources: {
|
|
5443
5474
|
cpus: options.cpus ?? 1,
|
|
5444
5475
|
memory_mb: options.memoryMb ?? 1024,
|
|
5445
|
-
...options.diskMb != null ? { disk_mb: options.diskMb } : {}
|
|
5476
|
+
...options.diskMb != null ? { disk_mb: options.diskMb } : {},
|
|
5477
|
+
...gpus != null ? { gpus } : {}
|
|
5446
5478
|
},
|
|
5447
5479
|
timeout_secs: options.timeoutSecs ?? 0
|
|
5448
5480
|
};
|
|
@@ -5479,18 +5511,20 @@ var init_client = __esm({
|
|
|
5479
5511
|
* network policy, set it to replace the policy, or pass `null` to remove the
|
|
5480
5512
|
* policy entirely. On a change the service recycles the pool's unclaimed
|
|
5481
5513
|
* warm containers onto the new policy, while containers already claimed by
|
|
5482
|
-
* sandboxes keep the policy they booted with. CPU, memory, disk,
|
|
5483
|
-
* entrypoint changes likewise recycle unclaimed warm
|
|
5484
|
-
* asynchronously. If suitable capacity is unavailable, stale warm
|
|
5514
|
+
* sandboxes keep the policy they booted with. CPU, memory, disk, GPU
|
|
5515
|
+
* allocation, image, and entrypoint changes likewise recycle unclaimed warm
|
|
5516
|
+
* containers asynchronously. If suitable capacity is unavailable, stale warm
|
|
5485
5517
|
* containers are not used as a fallback.
|
|
5486
5518
|
*/
|
|
5487
5519
|
async updatePool(poolId, options) {
|
|
5520
|
+
const gpus = gpuRequest(options.gpu, options.gpus, options.gpuModel);
|
|
5488
5521
|
const body = {
|
|
5489
5522
|
image: options.image,
|
|
5490
5523
|
resources: {
|
|
5491
5524
|
cpus: options.cpus ?? 1,
|
|
5492
5525
|
memory_mb: options.memoryMb ?? 1024,
|
|
5493
|
-
...options.diskMb != null ? { disk_mb: options.diskMb } : {}
|
|
5526
|
+
...options.diskMb != null ? { disk_mb: options.diskMb } : {},
|
|
5527
|
+
...gpus != null ? { gpus } : {}
|
|
5494
5528
|
},
|
|
5495
5529
|
timeout_secs: options.timeoutSecs ?? 0
|
|
5496
5530
|
};
|
|
@@ -7036,6 +7070,7 @@ __export(index_exports, {
|
|
|
7036
7070
|
APIClient: () => APIClient,
|
|
7037
7071
|
CliNotFoundError: () => CliNotFoundError,
|
|
7038
7072
|
CloudClient: () => CloudClient,
|
|
7073
|
+
CommandExitReason: () => CommandExitReason,
|
|
7039
7074
|
ContainerState: () => ContainerState,
|
|
7040
7075
|
Desktop: () => Desktop,
|
|
7041
7076
|
File: () => File,
|
|
@@ -10115,6 +10150,7 @@ init_models();
|
|
|
10115
10150
|
APIClient,
|
|
10116
10151
|
CliNotFoundError,
|
|
10117
10152
|
CloudClient,
|
|
10153
|
+
CommandExitReason,
|
|
10118
10154
|
ContainerState,
|
|
10119
10155
|
Desktop,
|
|
10120
10156
|
File,
|