@tensorlakeai/tensorlake 0.5.156 → 0.5.158
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 +2 -2
- package/dist/applications/index.cjs.map +1 -1
- package/dist/applications/index.js +2 -2
- 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 +75 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -7
- package/dist/index.d.ts +17 -7
- package/dist/index.js +75 -97
- package/dist/index.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.158"}.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.158"}.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.158";
|
|
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.158"}.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.158";
|
|
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.158"}.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.158";
|
|
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";
|
|
@@ -512,7 +512,7 @@ var init_native_worker_client = __esm({
|
|
|
512
512
|
}
|
|
513
513
|
};
|
|
514
514
|
runtimeKey = /* @__PURE__ */ Symbol.for(
|
|
515
|
-
`tensorlake.native.worker.${false ? "source" : "0.5.
|
|
515
|
+
`tensorlake.native.worker.${false ? "source" : "0.5.158"}.v1`
|
|
516
516
|
);
|
|
517
517
|
runtimes = globalThis;
|
|
518
518
|
}
|
|
@@ -4088,9 +4088,7 @@ var init_sandbox = __esm({
|
|
|
4088
4088
|
*/
|
|
4089
4089
|
async listSnapshots() {
|
|
4090
4090
|
const client = this.requireLifecycleClient("listSnapshots");
|
|
4091
|
-
|
|
4092
|
-
const filtered = all.filter((s) => s.sandboxId === this.lifecycleIdentifier);
|
|
4093
|
-
return Object.assign(filtered, { traceId: all.traceId });
|
|
4091
|
+
return client.listSandboxSnapshots(this.lifecycleIdentifier);
|
|
4094
4092
|
}
|
|
4095
4093
|
/** Close the proxy connection. The sandbox keeps running. */
|
|
4096
4094
|
close() {
|
|
@@ -4638,6 +4636,18 @@ function validateResizeWait(options) {
|
|
|
4638
4636
|
throw new SandboxError("pollInterval must be finite and positive");
|
|
4639
4637
|
}
|
|
4640
4638
|
}
|
|
4639
|
+
function parseSnapshotList({ traceId, json }) {
|
|
4640
|
+
const parsed = JSON.parse(json);
|
|
4641
|
+
if (parsed !== null && (typeof parsed !== "object" || Array.isArray(parsed))) {
|
|
4642
|
+
throw new SandboxError("Invalid snapshot list response: expected an object");
|
|
4643
|
+
}
|
|
4644
|
+
const records = parsed?.snapshots ?? [];
|
|
4645
|
+
if (!Array.isArray(records)) {
|
|
4646
|
+
throw new SandboxError("Invalid snapshot list response: snapshots must be an array");
|
|
4647
|
+
}
|
|
4648
|
+
const snapshots = records.map((s) => parseSnapshot(s));
|
|
4649
|
+
return Object.assign(snapshots, { traceId });
|
|
4650
|
+
}
|
|
4641
4651
|
var DEFAULT_WAIT_POLL_INTERVAL_SEC, GPU_MODELS, SandboxClient, RESERVED_SANDBOX_MANAGEMENT_PORT;
|
|
4642
4652
|
var init_client = __esm({
|
|
4643
4653
|
"src/client.ts"() {
|
|
@@ -5307,19 +5317,18 @@ var init_client = __esm({
|
|
|
5307
5317
|
}
|
|
5308
5318
|
/** List all snapshots in the namespace. */
|
|
5309
5319
|
async listSnapshots() {
|
|
5310
|
-
|
|
5311
|
-
() => this.native.listSnapshots()
|
|
5320
|
+
return parseSnapshotList(
|
|
5321
|
+
await callNative(() => this.native.listSnapshots())
|
|
5322
|
+
);
|
|
5323
|
+
}
|
|
5324
|
+
/**
|
|
5325
|
+
* List snapshots taken from one sandbox (its ID or name), from the
|
|
5326
|
+
* sandbox's own listing rather than the whole namespace's.
|
|
5327
|
+
*/
|
|
5328
|
+
async listSandboxSnapshots(sandboxId) {
|
|
5329
|
+
return parseSnapshotList(
|
|
5330
|
+
await callNative(() => this.native.listSandboxSnapshots(sandboxId))
|
|
5312
5331
|
);
|
|
5313
|
-
const parsed = JSON.parse(json);
|
|
5314
|
-
if (parsed !== null && (typeof parsed !== "object" || Array.isArray(parsed))) {
|
|
5315
|
-
throw new SandboxError("Invalid snapshot list response: expected an object");
|
|
5316
|
-
}
|
|
5317
|
-
const records = parsed?.snapshots ?? [];
|
|
5318
|
-
if (!Array.isArray(records)) {
|
|
5319
|
-
throw new SandboxError("Invalid snapshot list response: snapshots must be an array");
|
|
5320
|
-
}
|
|
5321
|
-
const snapshots = records.map((s) => parseSnapshot(s));
|
|
5322
|
-
return Object.assign(snapshots, { traceId });
|
|
5323
5332
|
}
|
|
5324
5333
|
/** Delete a snapshot by ID. */
|
|
5325
5334
|
async deleteSnapshot(snapshotId) {
|
|
@@ -5466,10 +5475,9 @@ var init_client = __esm({
|
|
|
5466
5475
|
/**
|
|
5467
5476
|
* Create a sandbox, wait for it to reach `Running`, and return a connected handle.
|
|
5468
5477
|
*
|
|
5469
|
-
*
|
|
5470
|
-
*
|
|
5471
|
-
*
|
|
5472
|
-
* `terminate()` is called.
|
|
5478
|
+
* The create waits on the server, which answers as soon as the sandbox
|
|
5479
|
+
* runs, with `requestTimeout` as the wait budget. The returned `Sandbox`
|
|
5480
|
+
* auto-terminates when `terminate()` is called.
|
|
5473
5481
|
*
|
|
5474
5482
|
* **When the wait runs out the sandbox is not deleted.** A `SandboxPending`
|
|
5475
5483
|
* is thrown with the sandbox id, and the sandbox keeps its place in the
|
|
@@ -5491,11 +5499,10 @@ var init_client = __esm({
|
|
|
5491
5499
|
pool_id: options?.poolId
|
|
5492
5500
|
});
|
|
5493
5501
|
const requestedName = options?.poolId != null ? null : options?.name ?? null;
|
|
5494
|
-
let sandboxId;
|
|
5495
|
-
let traceId;
|
|
5496
5502
|
const createStart = nowMs();
|
|
5503
|
+
let result;
|
|
5497
5504
|
if (options?.poolId != null) {
|
|
5498
|
-
|
|
5505
|
+
result = await requestClient.claim(options.poolId, {
|
|
5499
5506
|
fileSystems: options.fileSystems
|
|
5500
5507
|
});
|
|
5501
5508
|
logSdkTiming("sandbox.create", "claim_response", createStart, {
|
|
@@ -5503,84 +5510,55 @@ var init_client = __esm({
|
|
|
5503
5510
|
status: result.status,
|
|
5504
5511
|
server_trace_id: result.traceId
|
|
5505
5512
|
});
|
|
5506
|
-
if (result.status === "running" /* RUNNING */) {
|
|
5507
|
-
const explicitProxyUrl = options?.proxyUrl ?? explicitProxyUrlOverride() ?? void 0;
|
|
5508
|
-
const selectedProxyUrl = await this.native.selectSandboxProxyUrl(
|
|
5509
|
-
result.sandboxId,
|
|
5510
|
-
result.sandboxUrl ?? null,
|
|
5511
|
-
result.ingressEndpoint ?? null,
|
|
5512
|
-
explicitProxyUrl ?? null
|
|
5513
|
-
);
|
|
5514
|
-
const sandbox2 = requestClient.connect(
|
|
5515
|
-
result.sandboxId,
|
|
5516
|
-
selectedProxyUrl,
|
|
5517
|
-
result.routingHint,
|
|
5518
|
-
requestTimeout,
|
|
5519
|
-
explicitProxyUrl
|
|
5520
|
-
);
|
|
5521
|
-
sandbox2._setOwner(requestClient);
|
|
5522
|
-
sandbox2.traceId = result.traceId;
|
|
5523
|
-
sandbox2._setLifecycleIdentifier(result.sandboxId);
|
|
5524
|
-
sandbox2._setName(result.name ?? requestedName);
|
|
5525
|
-
logSdkTiming("sandbox.create", "complete", opStart, {
|
|
5526
|
-
sandbox_id: result.sandboxId,
|
|
5527
|
-
status: "running" /* RUNNING */,
|
|
5528
|
-
server_trace_id: result.traceId
|
|
5529
|
-
});
|
|
5530
|
-
return sandbox2;
|
|
5531
|
-
}
|
|
5532
|
-
if (result.status === "suspended" /* SUSPENDED */ || result.status === "terminated" /* TERMINATED */ || result.status === "failed" /* FAILED */) {
|
|
5533
|
-
throw startupFailure(result.sandboxId, result.status, {
|
|
5534
|
-
errorDetails: result.errorDetails,
|
|
5535
|
-
terminationReason: result.terminationReason ?? result.reason
|
|
5536
|
-
});
|
|
5537
|
-
}
|
|
5538
|
-
sandboxId = result.sandboxId;
|
|
5539
|
-
traceId = result.traceId;
|
|
5540
5513
|
} else {
|
|
5541
|
-
const
|
|
5542
|
-
|
|
5514
|
+
const body = _SandboxClient.buildCreateRequestBody({
|
|
5515
|
+
...options,
|
|
5516
|
+
wait: void 0
|
|
5543
5517
|
});
|
|
5518
|
+
result = await requestClient.tracedJson(
|
|
5519
|
+
() => requestClient.native.createSandboxAndWait(JSON.stringify(body)),
|
|
5520
|
+
"sandboxId"
|
|
5521
|
+
);
|
|
5544
5522
|
logSdkTiming("sandbox.create", "create_response", createStart, {
|
|
5545
|
-
sandbox_id:
|
|
5546
|
-
status:
|
|
5547
|
-
server_trace_id:
|
|
5523
|
+
sandbox_id: result.sandboxId,
|
|
5524
|
+
status: result.status,
|
|
5525
|
+
server_trace_id: result.traceId
|
|
5526
|
+
});
|
|
5527
|
+
}
|
|
5528
|
+
if (result.status === "running" /* RUNNING */) {
|
|
5529
|
+
const explicitProxyUrl = options?.proxyUrl ?? explicitProxyUrlOverride() ?? void 0;
|
|
5530
|
+
const selectedProxyUrl = await this.native.selectSandboxProxyUrl(
|
|
5531
|
+
result.sandboxId,
|
|
5532
|
+
result.sandboxUrl ?? null,
|
|
5533
|
+
result.ingressEndpoint ?? null,
|
|
5534
|
+
explicitProxyUrl ?? null
|
|
5535
|
+
);
|
|
5536
|
+
const sandbox2 = requestClient.connect(
|
|
5537
|
+
result.sandboxId,
|
|
5538
|
+
selectedProxyUrl,
|
|
5539
|
+
result.routingHint,
|
|
5540
|
+
requestTimeout,
|
|
5541
|
+
explicitProxyUrl
|
|
5542
|
+
);
|
|
5543
|
+
sandbox2._setOwner(requestClient);
|
|
5544
|
+
sandbox2.traceId = result.traceId;
|
|
5545
|
+
sandbox2._setLifecycleIdentifier(result.sandboxId);
|
|
5546
|
+
sandbox2._setName(result.name ?? requestedName);
|
|
5547
|
+
logSdkTiming("sandbox.create", "complete", opStart, {
|
|
5548
|
+
sandbox_id: result.sandboxId,
|
|
5549
|
+
status: "running" /* RUNNING */,
|
|
5550
|
+
server_trace_id: result.traceId
|
|
5551
|
+
});
|
|
5552
|
+
return sandbox2;
|
|
5553
|
+
}
|
|
5554
|
+
if (result.status === "suspended" /* SUSPENDED */ || result.status === "terminated" /* TERMINATED */ || result.status === "failed" /* FAILED */) {
|
|
5555
|
+
throw startupFailure(result.sandboxId, result.status, {
|
|
5556
|
+
errorDetails: result.errorDetails,
|
|
5557
|
+
terminationReason: result.terminationReason ?? result.reason
|
|
5548
5558
|
});
|
|
5549
|
-
sandboxId = pending.sandboxId;
|
|
5550
|
-
traceId = pending.traceId;
|
|
5551
|
-
if (pending.state === "running" /* RUNNING */) {
|
|
5552
|
-
const explicitProxyUrl = options?.proxyUrl ?? explicitProxyUrlOverride() ?? void 0;
|
|
5553
|
-
const selectedProxyUrl = await this.native.selectSandboxProxyUrl(
|
|
5554
|
-
sandboxId,
|
|
5555
|
-
pending.sandboxUrl ?? null,
|
|
5556
|
-
pending.ingressEndpoint ?? null,
|
|
5557
|
-
explicitProxyUrl ?? null
|
|
5558
|
-
);
|
|
5559
|
-
const sandbox2 = requestClient.connect(
|
|
5560
|
-
sandboxId,
|
|
5561
|
-
selectedProxyUrl,
|
|
5562
|
-
pending.routingHint,
|
|
5563
|
-
requestTimeout,
|
|
5564
|
-
explicitProxyUrl
|
|
5565
|
-
);
|
|
5566
|
-
sandbox2._setOwner(requestClient);
|
|
5567
|
-
sandbox2.traceId = traceId;
|
|
5568
|
-
sandbox2._setLifecycleIdentifier(sandboxId);
|
|
5569
|
-
sandbox2._setName(pending.name ?? requestedName);
|
|
5570
|
-
logSdkTiming("sandbox.create", "complete", opStart, {
|
|
5571
|
-
sandbox_id: sandboxId,
|
|
5572
|
-
status: "running" /* RUNNING */,
|
|
5573
|
-
server_trace_id: traceId
|
|
5574
|
-
});
|
|
5575
|
-
return sandbox2;
|
|
5576
|
-
}
|
|
5577
|
-
if (pending.state === "terminated" /* TERMINATED */ || pending.state === "failed" /* FAILED */) {
|
|
5578
|
-
throw startupFailure(sandboxId, pending.state, {
|
|
5579
|
-
errorDetails: pending.errorDetails,
|
|
5580
|
-
terminationReason: pending.terminationReason ?? pending.reason
|
|
5581
|
-
});
|
|
5582
|
-
}
|
|
5583
5559
|
}
|
|
5560
|
+
const sandboxId = result.sandboxId;
|
|
5561
|
+
const traceId = result.traceId;
|
|
5584
5562
|
const remaining = Math.max(0, (deadline - Date.now()) / 1e3);
|
|
5585
5563
|
const observed = await requestClient.waitForSandbox(
|
|
5586
5564
|
sandboxId,
|