@tensorlakeai/tensorlake 0.5.154 → 0.5.157
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 +131 -40
- package/dist/applications/index.cjs.map +1 -1
- package/dist/applications/index.d.cts +3 -3
- package/dist/applications/index.d.ts +3 -3
- package/dist/applications/index.js +131 -40
- 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 +175 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -23
- package/dist/index.d.ts +31 -23
- package/dist/index.js +175 -62
- package/dist/index.js.map +1 -1
- package/dist/{remote-B3vn4tt1.d.cts → remote-CEs4GFGP.d.cts} +1 -1
- package/dist/{remote-DqBUuciu.d.ts → remote-DYBXCTNC.d.ts} +1 -1
- package/dist/{sandbox-image-BMiFlzAs.d.cts → sandbox-image-C2GTVnx3.d.cts} +99 -52
- package/dist/{sandbox-image-BMiFlzAs.d.ts → sandbox-image-C2GTVnx3.d.ts} +99 -52
- package/dist/sandbox-image.cjs +119 -30
- package/dist/sandbox-image.cjs.map +1 -1
- package/dist/sandbox-image.d.cts +1 -1
- package/dist/sandbox-image.d.ts +1 -1
- package/dist/sandbox-image.js +119 -30
- 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
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ var init_defaults = __esm({
|
|
|
46
46
|
"src/defaults.ts"() {
|
|
47
47
|
"use strict";
|
|
48
48
|
init_esm_shims();
|
|
49
|
-
SDK_VERSION = "0.5.
|
|
49
|
+
SDK_VERSION = "0.5.157";
|
|
50
50
|
API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
|
|
51
51
|
API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
|
|
52
52
|
NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
|
|
@@ -509,7 +509,7 @@ var init_native_worker_client = __esm({
|
|
|
509
509
|
}
|
|
510
510
|
};
|
|
511
511
|
runtimeKey = /* @__PURE__ */ Symbol.for(
|
|
512
|
-
`tensorlake.native.worker.${false ? "source" : "0.5.
|
|
512
|
+
`tensorlake.native.worker.${false ? "source" : "0.5.157"}.v1`
|
|
513
513
|
);
|
|
514
514
|
runtimes = globalThis;
|
|
515
515
|
}
|
|
@@ -4085,9 +4085,7 @@ var init_sandbox = __esm({
|
|
|
4085
4085
|
*/
|
|
4086
4086
|
async listSnapshots() {
|
|
4087
4087
|
const client = this.requireLifecycleClient("listSnapshots");
|
|
4088
|
-
|
|
4089
|
-
const filtered = all.filter((s) => s.sandboxId === this.lifecycleIdentifier);
|
|
4090
|
-
return Object.assign(filtered, { traceId: all.traceId });
|
|
4088
|
+
return client.listSandboxSnapshots(this.lifecycleIdentifier);
|
|
4091
4089
|
}
|
|
4092
4090
|
/** Close the proxy connection. The sandbox keeps running. */
|
|
4093
4091
|
close() {
|
|
@@ -4635,6 +4633,18 @@ function validateResizeWait(options) {
|
|
|
4635
4633
|
throw new SandboxError("pollInterval must be finite and positive");
|
|
4636
4634
|
}
|
|
4637
4635
|
}
|
|
4636
|
+
function parseSnapshotList({ traceId, json }) {
|
|
4637
|
+
const parsed = JSON.parse(json);
|
|
4638
|
+
if (parsed !== null && (typeof parsed !== "object" || Array.isArray(parsed))) {
|
|
4639
|
+
throw new SandboxError("Invalid snapshot list response: expected an object");
|
|
4640
|
+
}
|
|
4641
|
+
const records = parsed?.snapshots ?? [];
|
|
4642
|
+
if (!Array.isArray(records)) {
|
|
4643
|
+
throw new SandboxError("Invalid snapshot list response: snapshots must be an array");
|
|
4644
|
+
}
|
|
4645
|
+
const snapshots = records.map((s) => parseSnapshot(s));
|
|
4646
|
+
return Object.assign(snapshots, { traceId });
|
|
4647
|
+
}
|
|
4638
4648
|
var DEFAULT_WAIT_POLL_INTERVAL_SEC, GPU_MODELS, SandboxClient, RESERVED_SANDBOX_MANAGEMENT_PORT;
|
|
4639
4649
|
var init_client = __esm({
|
|
4640
4650
|
"src/client.ts"() {
|
|
@@ -5304,19 +5314,18 @@ var init_client = __esm({
|
|
|
5304
5314
|
}
|
|
5305
5315
|
/** List all snapshots in the namespace. */
|
|
5306
5316
|
async listSnapshots() {
|
|
5307
|
-
|
|
5308
|
-
() => this.native.listSnapshots()
|
|
5317
|
+
return parseSnapshotList(
|
|
5318
|
+
await callNative(() => this.native.listSnapshots())
|
|
5319
|
+
);
|
|
5320
|
+
}
|
|
5321
|
+
/**
|
|
5322
|
+
* List snapshots taken from one sandbox (its ID or name), from the
|
|
5323
|
+
* sandbox's own listing rather than the whole namespace's.
|
|
5324
|
+
*/
|
|
5325
|
+
async listSandboxSnapshots(sandboxId) {
|
|
5326
|
+
return parseSnapshotList(
|
|
5327
|
+
await callNative(() => this.native.listSandboxSnapshots(sandboxId))
|
|
5309
5328
|
);
|
|
5310
|
-
const parsed = JSON.parse(json);
|
|
5311
|
-
if (parsed !== null && (typeof parsed !== "object" || Array.isArray(parsed))) {
|
|
5312
|
-
throw new SandboxError("Invalid snapshot list response: expected an object");
|
|
5313
|
-
}
|
|
5314
|
-
const records = parsed?.snapshots ?? [];
|
|
5315
|
-
if (!Array.isArray(records)) {
|
|
5316
|
-
throw new SandboxError("Invalid snapshot list response: snapshots must be an array");
|
|
5317
|
-
}
|
|
5318
|
-
const snapshots = records.map((s) => parseSnapshot(s));
|
|
5319
|
-
return Object.assign(snapshots, { traceId });
|
|
5320
5329
|
}
|
|
5321
5330
|
/** Delete a snapshot by ID. */
|
|
5322
5331
|
async deleteSnapshot(snapshotId) {
|
|
@@ -5716,10 +5725,11 @@ var init_image = __esm({
|
|
|
5716
5725
|
});
|
|
5717
5726
|
}
|
|
5718
5727
|
/**
|
|
5719
|
-
* Build this image as a sandbox
|
|
5728
|
+
* Build this image and register it as a CAS sandbox image (the default) or,
|
|
5729
|
+
* with `cas: false`, a legacy sandbox image.
|
|
5720
5730
|
*
|
|
5721
5731
|
* Materializes the image in a build sandbox, snapshots the filesystem,
|
|
5722
|
-
* and registers the snapshot
|
|
5732
|
+
* and registers the snapshot under the image's name.
|
|
5723
5733
|
*/
|
|
5724
5734
|
async build(options = {}) {
|
|
5725
5735
|
const { createSandboxImage: createSandboxImage2 } = await Promise.resolve().then(() => (init_sandbox_image(), sandbox_image_exports));
|
|
@@ -6002,14 +6012,14 @@ function rejectLegacyReference(buildId) {
|
|
|
6002
6012
|
if (buildId.startsWith("sandbox_template_")) {
|
|
6003
6013
|
throw new ImageBuildError({
|
|
6004
6014
|
code: "usage" /* USAGE */,
|
|
6005
|
-
message: `'${buildId}' is a legacy
|
|
6015
|
+
message: `'${buildId}' is a legacy image id; legacy images have no build operation to get, wait for or cancel`,
|
|
6006
6016
|
buildId
|
|
6007
6017
|
});
|
|
6008
6018
|
}
|
|
6009
6019
|
if (buildId.startsWith("image_")) {
|
|
6010
6020
|
throw new ImageBuildError({
|
|
6011
6021
|
code: "usage" /* USAGE */,
|
|
6012
|
-
message: `'${buildId}' is
|
|
6022
|
+
message: `'${buildId}' is a CAS image id, not a build id; look the CAS image up with findSandboxImageByName or use the build id admission returned`,
|
|
6013
6023
|
buildId
|
|
6014
6024
|
});
|
|
6015
6025
|
}
|
|
@@ -6088,19 +6098,27 @@ async function startImageBuild(source, options = {}, deps = {}) {
|
|
|
6088
6098
|
let text = dockerfileContent(source);
|
|
6089
6099
|
if (!text.endsWith("\n")) text += "\n";
|
|
6090
6100
|
dockerfileText = text;
|
|
6091
|
-
name =
|
|
6101
|
+
name = __imageBuildInternals.registeredImageName(
|
|
6102
|
+
options.registeredName ?? source.name,
|
|
6103
|
+
void 0,
|
|
6104
|
+
true
|
|
6105
|
+
);
|
|
6092
6106
|
} else if (typeof source === "string") {
|
|
6093
6107
|
const resolved = path3.resolve(source);
|
|
6094
6108
|
if (!existsSync2(resolved)) throw new Error(`Dockerfile not found: ${source}`);
|
|
6095
6109
|
dockerfilePath = resolved;
|
|
6096
|
-
name =
|
|
6110
|
+
name = __imageBuildInternals.registeredImageName(
|
|
6111
|
+
options.registeredName,
|
|
6112
|
+
__imageBuildInternals.defaultRegisteredName(resolved),
|
|
6113
|
+
true
|
|
6114
|
+
);
|
|
6097
6115
|
} else {
|
|
6098
6116
|
throw new TypeError(`source must be an Image or a Dockerfile path, got ${typeof source}`);
|
|
6099
6117
|
}
|
|
6100
6118
|
try {
|
|
6101
6119
|
const credentials = credentialsFromEnv();
|
|
6102
6120
|
const binding = __imageBuildInternals.loadNativeBinding();
|
|
6103
|
-
emitter.emit({ type: "status", message: `Building image '${name}'...` });
|
|
6121
|
+
emitter.emit({ type: "status", message: `Building CAS image '${name}'...` });
|
|
6104
6122
|
const json = await __runWithInterrupt(
|
|
6105
6123
|
options.signal,
|
|
6106
6124
|
(interruptId) => binding.startImageBuild(
|
|
@@ -6136,11 +6154,16 @@ async function startImageImport(imageReference, options = {}, deps = {}) {
|
|
|
6136
6154
|
throw new Error("image reference to import must not be empty");
|
|
6137
6155
|
}
|
|
6138
6156
|
const reference = imageReference.trim();
|
|
6139
|
-
const name =
|
|
6157
|
+
const name = __imageBuildInternals.registeredImageName(
|
|
6158
|
+
options.registeredName,
|
|
6159
|
+
__imageBuildInternals.defaultRegisteredNameFromImage(reference),
|
|
6160
|
+
true,
|
|
6161
|
+
__imageBuildInternals.defaultImportedImageName
|
|
6162
|
+
);
|
|
6140
6163
|
const emitter = makeEmitter({ emit: deps.emit ?? options.emit, verbose: options.verbose });
|
|
6141
6164
|
const credentials = credentialsFromEnv();
|
|
6142
6165
|
const binding = __imageBuildInternals.loadNativeBinding();
|
|
6143
|
-
emitter.emit({ type: "status", message: `Importing
|
|
6166
|
+
emitter.emit({ type: "status", message: `Importing '${reference}' as CAS image '${name}'...` });
|
|
6144
6167
|
const json = await __runWithInterrupt(
|
|
6145
6168
|
options.signal,
|
|
6146
6169
|
(interruptId) => binding.startImageImport(
|
|
@@ -6477,16 +6500,58 @@ function defaultRegisteredName(dockerfilePath) {
|
|
|
6477
6500
|
const parsed = path4.parse(dockerfilePath);
|
|
6478
6501
|
if (parsed.name.toLowerCase() === "dockerfile") {
|
|
6479
6502
|
const parentName = path4.basename(path4.dirname(dockerfilePath)).trim();
|
|
6480
|
-
return parentName ||
|
|
6503
|
+
return parentName || DEFAULT_SANDBOX_IMAGE_NAME;
|
|
6504
|
+
}
|
|
6505
|
+
return parsed.name || DEFAULT_SANDBOX_IMAGE_NAME;
|
|
6506
|
+
}
|
|
6507
|
+
function registeredImageName(explicit, generated, cas, fallback = DEFAULT_SANDBOX_IMAGE_NAME) {
|
|
6508
|
+
if (explicit || generated === void 0) {
|
|
6509
|
+
const name = explicit ?? "";
|
|
6510
|
+
return cas ? canonicalCasImageName(name) : name;
|
|
6511
|
+
}
|
|
6512
|
+
return cas ? casImageNameFrom(generated, fallback) : generated;
|
|
6513
|
+
}
|
|
6514
|
+
function canonicalCasImageName(name) {
|
|
6515
|
+
return name.replace(/[A-Z]/g, (c) => c.toLowerCase());
|
|
6516
|
+
}
|
|
6517
|
+
function casImageNameFrom(raw, fallback) {
|
|
6518
|
+
const lowered = canonicalCasImageName(raw);
|
|
6519
|
+
if (isAddressableCasImageName(lowered)) {
|
|
6520
|
+
return lowered;
|
|
6521
|
+
}
|
|
6522
|
+
let name = "";
|
|
6523
|
+
for (const original of lowered) {
|
|
6524
|
+
const ch = /^[a-z0-9._-]$/.test(original) ? original : "-";
|
|
6525
|
+
const previous = name[name.length - 1];
|
|
6526
|
+
if (CAS_NAME_SEPARATORS.includes(ch) && previous !== void 0 && CAS_NAME_SEPARATORS.includes(previous)) {
|
|
6527
|
+
continue;
|
|
6528
|
+
}
|
|
6529
|
+
name += ch;
|
|
6481
6530
|
}
|
|
6482
|
-
|
|
6531
|
+
name = name.replace(/^[._-]+|[._-]+$/g, "").slice(0, MAX_CAS_IMAGE_NAME_LENGTH).replace(/[._-]+$/, "");
|
|
6532
|
+
return isAddressableCasImageName(name) ? name : fallback;
|
|
6533
|
+
}
|
|
6534
|
+
function isAddressableCasImageName(name) {
|
|
6535
|
+
if (name.length === 0 || name.length > MAX_CAS_IMAGE_NAME_LENGTH || RESERVED_IMAGE_NAME_PREFIXES.some((prefix) => name.startsWith(prefix)) || /^[0-9a-f]{64}$/.test(name)) {
|
|
6536
|
+
return false;
|
|
6537
|
+
}
|
|
6538
|
+
const colon = name.indexOf(":");
|
|
6539
|
+
const repository = colon === -1 ? name : name.slice(0, colon);
|
|
6540
|
+
if (!repository.split("/").every((component) => /^[a-z0-9]+(?:[._-][a-z0-9]+)*$/.test(component))) {
|
|
6541
|
+
return false;
|
|
6542
|
+
}
|
|
6543
|
+
if (colon === -1) {
|
|
6544
|
+
return true;
|
|
6545
|
+
}
|
|
6546
|
+
const tag = name.slice(colon + 1);
|
|
6547
|
+
return tag.length > 0 && tag.length <= 128 && /^[a-z0-9._-]+$/.test(tag) && !tag.startsWith(".") && !tag.startsWith("-");
|
|
6483
6548
|
}
|
|
6484
6549
|
function defaultRegisteredNameFromImage(imageReference) {
|
|
6485
6550
|
const withoutDigest = imageReference.split("@", 1)[0] ?? imageReference;
|
|
6486
6551
|
const lastSegment = withoutDigest.split("/").pop() ?? withoutDigest;
|
|
6487
6552
|
const colonIndex = lastSegment.lastIndexOf(":");
|
|
6488
6553
|
const name = colonIndex > 0 && colonIndex < lastSegment.length - 1 ? lastSegment.slice(0, colonIndex) : lastSegment;
|
|
6489
|
-
return name ||
|
|
6554
|
+
return name || DEFAULT_IMPORTED_IMAGE_NAME;
|
|
6490
6555
|
}
|
|
6491
6556
|
function noopEmit(_event) {
|
|
6492
6557
|
}
|
|
@@ -6589,7 +6654,11 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
6589
6654
|
if (!text.endsWith("\n")) text += "\n";
|
|
6590
6655
|
dockerfileText = text;
|
|
6591
6656
|
nativeContextDir = resolvedContext;
|
|
6592
|
-
effectiveName =
|
|
6657
|
+
effectiveName = registeredImageName(
|
|
6658
|
+
options.registeredName ?? source.name,
|
|
6659
|
+
void 0,
|
|
6660
|
+
options.cas ?? true
|
|
6661
|
+
);
|
|
6593
6662
|
} else if (typeof source === "string") {
|
|
6594
6663
|
const resolvedPath = path4.resolve(source);
|
|
6595
6664
|
if (!existsSync3(resolvedPath)) {
|
|
@@ -6598,7 +6667,11 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
6598
6667
|
dockerfilePath = resolvedPath;
|
|
6599
6668
|
dockerfileText = void 0;
|
|
6600
6669
|
nativeContextDir = void 0;
|
|
6601
|
-
effectiveName =
|
|
6670
|
+
effectiveName = registeredImageName(
|
|
6671
|
+
options.registeredName,
|
|
6672
|
+
defaultRegisteredName(resolvedPath),
|
|
6673
|
+
options.cas ?? true
|
|
6674
|
+
);
|
|
6602
6675
|
} else {
|
|
6603
6676
|
throw new TypeError(
|
|
6604
6677
|
`source must be an Image or a Dockerfile path, got ${typeof source}`
|
|
@@ -6622,12 +6695,16 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
6622
6695
|
deps._allowPat ? "Missing TENSORLAKE_API_KEY or TENSORLAKE_PAT credentials." : "Missing TENSORLAKE_API_KEY credentials."
|
|
6623
6696
|
);
|
|
6624
6697
|
}
|
|
6625
|
-
|
|
6698
|
+
const cas = options.cas ?? true;
|
|
6699
|
+
if (options.signal !== void 0 && !cas) {
|
|
6626
6700
|
throw new Error(
|
|
6627
|
-
"signal is
|
|
6701
|
+
"signal is not supported for legacy image builds (cas: false): a legacy image build has no build operation to cancel"
|
|
6628
6702
|
);
|
|
6629
6703
|
}
|
|
6630
|
-
emit({
|
|
6704
|
+
emit({
|
|
6705
|
+
type: "status",
|
|
6706
|
+
message: `Building ${cas ? "CAS" : "legacy"} image '${effectiveName}'...`
|
|
6707
|
+
});
|
|
6631
6708
|
const binding = loadNativeBinding();
|
|
6632
6709
|
let emitError;
|
|
6633
6710
|
const nativeOptions = {
|
|
@@ -6649,7 +6726,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
6649
6726
|
dockerConfigJson: options.dockerConfigJson,
|
|
6650
6727
|
dockerfileText,
|
|
6651
6728
|
contextDir: nativeContextDir,
|
|
6652
|
-
cas
|
|
6729
|
+
cas,
|
|
6653
6730
|
buildArgs: options.buildArgs
|
|
6654
6731
|
};
|
|
6655
6732
|
const forward = (event) => {
|
|
@@ -6659,7 +6736,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
6659
6736
|
emitError ??= error;
|
|
6660
6737
|
}
|
|
6661
6738
|
};
|
|
6662
|
-
const resultJson =
|
|
6739
|
+
const resultJson = cas ? await __runWithInterrupt(
|
|
6663
6740
|
options.signal,
|
|
6664
6741
|
(interruptId) => binding.buildSandboxImage(nativeOptions, forward, interruptId)
|
|
6665
6742
|
) : await binding.buildSandboxImage(nativeOptions, forward);
|
|
@@ -6690,7 +6767,12 @@ async function importSandboxImage(imageReference, options = {}, deps = {}) {
|
|
|
6690
6767
|
}
|
|
6691
6768
|
const reference = imageReference.trim();
|
|
6692
6769
|
const context = buildContextFromEnv();
|
|
6693
|
-
const effectiveName =
|
|
6770
|
+
const effectiveName = registeredImageName(
|
|
6771
|
+
options.registeredName,
|
|
6772
|
+
defaultRegisteredNameFromImage(reference),
|
|
6773
|
+
options.cas ?? true,
|
|
6774
|
+
DEFAULT_IMPORTED_IMAGE_NAME
|
|
6775
|
+
);
|
|
6694
6776
|
if (effectiveName === DEFAULT_IMAGE_NAME2) {
|
|
6695
6777
|
console.warn(
|
|
6696
6778
|
`Importing sandbox image with the default name "${DEFAULT_IMAGE_NAME2}". Pass \`registeredName\` to avoid collisions with other default-named images in this project.`
|
|
@@ -6708,14 +6790,15 @@ async function importSandboxImage(imageReference, options = {}, deps = {}) {
|
|
|
6708
6790
|
deps._allowPat ? "Missing TENSORLAKE_API_KEY or TENSORLAKE_PAT credentials." : "Missing TENSORLAKE_API_KEY credentials."
|
|
6709
6791
|
);
|
|
6710
6792
|
}
|
|
6711
|
-
|
|
6793
|
+
const cas = options.cas ?? true;
|
|
6794
|
+
if (options.signal !== void 0 && !cas) {
|
|
6712
6795
|
throw new Error(
|
|
6713
|
-
"signal is
|
|
6796
|
+
"signal is not supported for legacy image imports (cas: false): a legacy image import has no build operation to cancel"
|
|
6714
6797
|
);
|
|
6715
6798
|
}
|
|
6716
6799
|
emit({
|
|
6717
6800
|
type: "status",
|
|
6718
|
-
message: `Importing
|
|
6801
|
+
message: `Importing '${reference}' as ${cas ? "CAS" : "legacy"} image '${effectiveName}'...`
|
|
6719
6802
|
});
|
|
6720
6803
|
const binding = loadNativeBinding();
|
|
6721
6804
|
let emitError;
|
|
@@ -6736,7 +6819,7 @@ async function importSandboxImage(imageReference, options = {}, deps = {}) {
|
|
|
6736
6819
|
userAgent: void 0,
|
|
6737
6820
|
dockerCompat: options.dockerCompat ?? false,
|
|
6738
6821
|
dockerConfigJson: options.dockerConfigJson,
|
|
6739
|
-
cas
|
|
6822
|
+
cas
|
|
6740
6823
|
};
|
|
6741
6824
|
const forward = (event) => {
|
|
6742
6825
|
try {
|
|
@@ -6745,7 +6828,7 @@ async function importSandboxImage(imageReference, options = {}, deps = {}) {
|
|
|
6745
6828
|
emitError ??= error;
|
|
6746
6829
|
}
|
|
6747
6830
|
};
|
|
6748
|
-
const resultJson =
|
|
6831
|
+
const resultJson = cas ? await __runWithInterrupt(
|
|
6749
6832
|
options.signal,
|
|
6750
6833
|
(interruptId) => binding.importSandboxImage(nativeOptions, forward, interruptId)
|
|
6751
6834
|
) : await binding.importSandboxImage(nativeOptions, forward);
|
|
@@ -6802,15 +6885,29 @@ async function deleteSandboxImage(imageName) {
|
|
|
6802
6885
|
if (typeof imageName !== "string" || imageName.length === 0) {
|
|
6803
6886
|
throw new TypeError("imageName must be a non-empty string");
|
|
6804
6887
|
}
|
|
6805
|
-
|
|
6888
|
+
warnIncompleteLegacyCleanup(
|
|
6889
|
+
await loadNativeBinding().deleteSandboxImage(catalogOptionsFromEnv(), imageName)
|
|
6890
|
+
);
|
|
6806
6891
|
}
|
|
6807
6892
|
async function deleteSandboxImageWithCredentials(credentials, imageName) {
|
|
6808
6893
|
if (typeof imageName !== "string" || imageName.length === 0) {
|
|
6809
6894
|
throw new TypeError("imageName must be a non-empty string");
|
|
6810
6895
|
}
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6896
|
+
warnIncompleteLegacyCleanup(
|
|
6897
|
+
await loadNativeBinding().deleteSandboxImage(
|
|
6898
|
+
catalogOptionsFromCredentials(credentials),
|
|
6899
|
+
imageName
|
|
6900
|
+
)
|
|
6901
|
+
);
|
|
6902
|
+
}
|
|
6903
|
+
function warnIncompleteLegacyCleanup(failure) {
|
|
6904
|
+
if (failure == null) {
|
|
6905
|
+
return;
|
|
6906
|
+
}
|
|
6907
|
+
const legacyImageId = failure.legacyImageId ?? void 0;
|
|
6908
|
+
const label = legacyImageId ? ` (${legacyImageId})` : "";
|
|
6909
|
+
console.warn(
|
|
6910
|
+
`Deleted CAS image '${failure.legacyImageName}', but could not delete the legacy image of the same name${label}, which can no longer start sandboxes: ${failure.error}. Delete it with deleteSandboxImage("${legacyImageId ?? failure.legacyImageName}").`
|
|
6814
6911
|
);
|
|
6815
6912
|
}
|
|
6816
6913
|
async function findSandboxImageByName(imageName) {
|
|
@@ -6854,13 +6951,14 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
6854
6951
|
disk_mb: { type: "string" },
|
|
6855
6952
|
builder_disk_mb: { type: "string" },
|
|
6856
6953
|
docker_compat: { type: "boolean", default: false },
|
|
6857
|
-
public: { type: "boolean", default: false }
|
|
6954
|
+
public: { type: "boolean", default: false },
|
|
6955
|
+
"no-cas": { type: "boolean", default: false }
|
|
6858
6956
|
}
|
|
6859
6957
|
});
|
|
6860
6958
|
const dockerfilePath = parsed.positionals[0];
|
|
6861
6959
|
if (!dockerfilePath) {
|
|
6862
6960
|
throw new Error(
|
|
6863
|
-
"Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MiB] [--disk_mb MiB] [--builder_disk_mb MiB] [--docker_compat] [--public]"
|
|
6961
|
+
"Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MiB] [--disk_mb MiB] [--builder_disk_mb MiB] [--docker_compat] [--public] [--no-cas]"
|
|
6864
6962
|
);
|
|
6865
6963
|
}
|
|
6866
6964
|
const cpus = parsed.values.cpus != null ? Number(parsed.values.cpus) : void 0;
|
|
@@ -6892,7 +6990,8 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
6892
6990
|
diskMb,
|
|
6893
6991
|
builderDiskMb,
|
|
6894
6992
|
dockerCompat: parsed.values.docker_compat,
|
|
6895
|
-
isPublic: parsed.values.public
|
|
6993
|
+
isPublic: parsed.values.public,
|
|
6994
|
+
cas: !parsed.values["no-cas"]
|
|
6896
6995
|
},
|
|
6897
6996
|
{ emit: ndjsonStdoutEmit, _allowPat: true }
|
|
6898
6997
|
);
|
|
@@ -6908,13 +7007,14 @@ async function runImportSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
6908
7007
|
disk_mb: { type: "string" },
|
|
6909
7008
|
builder_disk_mb: { type: "string" },
|
|
6910
7009
|
docker_compat: { type: "boolean", default: false },
|
|
6911
|
-
public: { type: "boolean", default: false }
|
|
7010
|
+
public: { type: "boolean", default: false },
|
|
7011
|
+
"no-cas": { type: "boolean", default: false }
|
|
6912
7012
|
}
|
|
6913
7013
|
});
|
|
6914
7014
|
const imageReference = parsed.positionals[0];
|
|
6915
7015
|
if (!imageReference) {
|
|
6916
7016
|
throw new Error(
|
|
6917
|
-
"Usage: tensorlake-import-sandbox-image <image_reference> [--name NAME] [--cpus N] [--memory MiB] [--disk_mb MiB] [--builder_disk_mb MiB] [--docker_compat] [--public]"
|
|
7017
|
+
"Usage: tensorlake-import-sandbox-image <image_reference> [--name NAME] [--cpus N] [--memory MiB] [--disk_mb MiB] [--builder_disk_mb MiB] [--docker_compat] [--public] [--no-cas]"
|
|
6918
7018
|
);
|
|
6919
7019
|
}
|
|
6920
7020
|
const cpus = parsed.values.cpus != null ? Number(parsed.values.cpus) : void 0;
|
|
@@ -6946,12 +7046,13 @@ async function runImportSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
6946
7046
|
diskMb,
|
|
6947
7047
|
builderDiskMb,
|
|
6948
7048
|
dockerCompat: parsed.values.docker_compat,
|
|
6949
|
-
isPublic: parsed.values.public
|
|
7049
|
+
isPublic: parsed.values.public,
|
|
7050
|
+
cas: !parsed.values["no-cas"]
|
|
6950
7051
|
},
|
|
6951
7052
|
{ emit: ndjsonStdoutEmit, _allowPat: true }
|
|
6952
7053
|
);
|
|
6953
7054
|
}
|
|
6954
|
-
var cachedNativeBinding, cachedNativeBindingError, DEFAULT_IMAGE_NAME2, __imageBuildInternals;
|
|
7055
|
+
var cachedNativeBinding, cachedNativeBindingError, DEFAULT_IMAGE_NAME2, DEFAULT_SANDBOX_IMAGE_NAME, DEFAULT_IMPORTED_IMAGE_NAME, CAS_NAME_SEPARATORS, RESERVED_IMAGE_NAME_PREFIXES, MAX_CAS_IMAGE_NAME_LENGTH, __imageBuildInternals;
|
|
6955
7056
|
var init_sandbox_image = __esm({
|
|
6956
7057
|
"src/sandbox-image.ts"() {
|
|
6957
7058
|
"use strict";
|
|
@@ -6960,6 +7061,11 @@ var init_sandbox_image = __esm({
|
|
|
6960
7061
|
init_native_binding();
|
|
6961
7062
|
init_image_builds();
|
|
6962
7063
|
DEFAULT_IMAGE_NAME2 = "default";
|
|
7064
|
+
DEFAULT_SANDBOX_IMAGE_NAME = "sandbox-image";
|
|
7065
|
+
DEFAULT_IMPORTED_IMAGE_NAME = "imported-image";
|
|
7066
|
+
CAS_NAME_SEPARATORS = "._-";
|
|
7067
|
+
RESERVED_IMAGE_NAME_PREFIXES = ["sandbox_template_", "image_", "cas-v1:"];
|
|
7068
|
+
MAX_CAS_IMAGE_NAME_LENGTH = 255;
|
|
6963
7069
|
__imageBuildInternals = {
|
|
6964
7070
|
loadNativeBinding: () => loadNativeBinding(),
|
|
6965
7071
|
buildContextFromEnv: () => buildContextFromEnv(),
|
|
@@ -6968,7 +7074,12 @@ var init_sandbox_image = __esm({
|
|
|
6968
7074
|
eventToEmitDict: (event) => eventToEmitDict(event),
|
|
6969
7075
|
imageRequiresContext: (image) => imageRequiresContext(image),
|
|
6970
7076
|
defaultRegisteredName: (dockerfilePath) => defaultRegisteredName(dockerfilePath),
|
|
6971
|
-
defaultRegisteredNameFromImage: (reference) => defaultRegisteredNameFromImage(reference)
|
|
7077
|
+
defaultRegisteredNameFromImage: (reference) => defaultRegisteredNameFromImage(reference),
|
|
7078
|
+
registeredImageName: (explicit, generated, cas, fallback) => registeredImageName(explicit, generated, cas, fallback),
|
|
7079
|
+
casImageNameFrom: (raw, fallback) => casImageNameFrom(raw, fallback),
|
|
7080
|
+
canonicalCasImageName: (name) => canonicalCasImageName(name),
|
|
7081
|
+
isAddressableCasImageName: (name) => isAddressableCasImageName(name),
|
|
7082
|
+
defaultImportedImageName: DEFAULT_IMPORTED_IMAGE_NAME
|
|
6972
7083
|
};
|
|
6973
7084
|
}
|
|
6974
7085
|
});
|
|
@@ -7135,10 +7246,12 @@ var CloudClient = class _CloudClient {
|
|
|
7135
7246
|
);
|
|
7136
7247
|
}
|
|
7137
7248
|
/**
|
|
7138
|
-
* Delete a registered sandbox image by name or id through the
|
|
7139
|
-
* catalog, with this client's credentials: an `image_` id or a name
|
|
7140
|
-
*
|
|
7141
|
-
* name registered only in the
|
|
7249
|
+
* Delete a registered CAS or legacy sandbox image by name or id through the
|
|
7250
|
+
* merged catalog, with this client's credentials: an `image_` id or a name
|
|
7251
|
+
* the CAS image registry knows deletes a CAS image, a `sandbox_template_` id
|
|
7252
|
+
* or a name registered only in the legacy image registry deletes a legacy
|
|
7253
|
+
* image.
|
|
7254
|
+
* A name is deleted from both the CAS and the legacy image registries.
|
|
7142
7255
|
* Rejects when neither catalog knows the reference. The same semantics
|
|
7143
7256
|
* and accepted differences as the module-level `deleteSandboxImage`.
|
|
7144
7257
|
*/
|
|
@@ -7146,10 +7259,10 @@ var CloudClient = class _CloudClient {
|
|
|
7146
7259
|
await deleteSandboxImageWithCredentials(this.catalogCredentials(), imageName);
|
|
7147
7260
|
}
|
|
7148
7261
|
/**
|
|
7149
|
-
* Look up a registered sandbox image by name or id through
|
|
7150
|
-
* catalog, with this client's credentials. Returns the image in
|
|
7151
|
-
* sandbox-template shape, or `null` when neither the
|
|
7152
|
-
*
|
|
7262
|
+
* Look up a registered CAS or legacy sandbox image by name or id through
|
|
7263
|
+
* the merged catalog, with this client's credentials. Returns the image in
|
|
7264
|
+
* the sandbox-template shape, or `null` when neither the CAS nor the legacy
|
|
7265
|
+
* image registry knows the reference. An explicit organization/project
|
|
7153
7266
|
* scope (the client's, or the call's override) addresses that project's
|
|
7154
7267
|
* routes directly, as before; without one the key's own scope applies.
|
|
7155
7268
|
*/
|