@tensorlakeai/tensorlake 0.5.154 → 0.5.156
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 +151 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -23
- package/dist/index.d.ts +25 -23
- package/dist/index.js +151 -47
- 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
|
@@ -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.156"}.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.156"}.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.156";
|
|
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.156"}.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.156";
|
|
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.156"}.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.156";
|
|
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.156"}.v1`
|
|
516
516
|
);
|
|
517
517
|
runtimes = globalThis;
|
|
518
518
|
}
|
|
@@ -5719,10 +5719,11 @@ var init_image = __esm({
|
|
|
5719
5719
|
});
|
|
5720
5720
|
}
|
|
5721
5721
|
/**
|
|
5722
|
-
* Build this image as a sandbox
|
|
5722
|
+
* Build this image and register it as a CAS sandbox image (the default) or,
|
|
5723
|
+
* with `cas: false`, a legacy sandbox image.
|
|
5723
5724
|
*
|
|
5724
5725
|
* Materializes the image in a build sandbox, snapshots the filesystem,
|
|
5725
|
-
* and registers the snapshot
|
|
5726
|
+
* and registers the snapshot under the image's name.
|
|
5726
5727
|
*/
|
|
5727
5728
|
async build(options = {}) {
|
|
5728
5729
|
const { createSandboxImage: createSandboxImage2 } = await Promise.resolve().then(() => (init_sandbox_image(), sandbox_image_exports));
|
|
@@ -6002,14 +6003,14 @@ function rejectLegacyReference(buildId) {
|
|
|
6002
6003
|
if (buildId.startsWith("sandbox_template_")) {
|
|
6003
6004
|
throw new ImageBuildError({
|
|
6004
6005
|
code: "usage" /* USAGE */,
|
|
6005
|
-
message: `'${buildId}' is a legacy
|
|
6006
|
+
message: `'${buildId}' is a legacy image id; legacy images have no build operation to get, wait for or cancel`,
|
|
6006
6007
|
buildId
|
|
6007
6008
|
});
|
|
6008
6009
|
}
|
|
6009
6010
|
if (buildId.startsWith("image_")) {
|
|
6010
6011
|
throw new ImageBuildError({
|
|
6011
6012
|
code: "usage" /* USAGE */,
|
|
6012
|
-
message: `'${buildId}' is
|
|
6013
|
+
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
6014
|
buildId
|
|
6014
6015
|
});
|
|
6015
6016
|
}
|
|
@@ -6088,19 +6089,27 @@ async function startImageBuild(source, options = {}, deps = {}) {
|
|
|
6088
6089
|
let text = dockerfileContent(source);
|
|
6089
6090
|
if (!text.endsWith("\n")) text += "\n";
|
|
6090
6091
|
dockerfileText = text;
|
|
6091
|
-
name =
|
|
6092
|
+
name = __imageBuildInternals.registeredImageName(
|
|
6093
|
+
options.registeredName ?? source.name,
|
|
6094
|
+
void 0,
|
|
6095
|
+
true
|
|
6096
|
+
);
|
|
6092
6097
|
} else if (typeof source === "string") {
|
|
6093
6098
|
const resolved = import_node_path2.default.resolve(source);
|
|
6094
6099
|
if (!(0, import_node_fs.existsSync)(resolved)) throw new Error(`Dockerfile not found: ${source}`);
|
|
6095
6100
|
dockerfilePath = resolved;
|
|
6096
|
-
name =
|
|
6101
|
+
name = __imageBuildInternals.registeredImageName(
|
|
6102
|
+
options.registeredName,
|
|
6103
|
+
__imageBuildInternals.defaultRegisteredName(resolved),
|
|
6104
|
+
true
|
|
6105
|
+
);
|
|
6097
6106
|
} else {
|
|
6098
6107
|
throw new TypeError(`source must be an Image or a Dockerfile path, got ${typeof source}`);
|
|
6099
6108
|
}
|
|
6100
6109
|
try {
|
|
6101
6110
|
const credentials = credentialsFromEnv();
|
|
6102
6111
|
const binding = __imageBuildInternals.loadNativeBinding();
|
|
6103
|
-
emitter.emit({ type: "status", message: `Building image '${name}'...` });
|
|
6112
|
+
emitter.emit({ type: "status", message: `Building CAS image '${name}'...` });
|
|
6104
6113
|
const json = await __runWithInterrupt(
|
|
6105
6114
|
options.signal,
|
|
6106
6115
|
(interruptId) => binding.startImageBuild(
|
|
@@ -6136,11 +6145,16 @@ async function startImageImport(imageReference, options = {}, deps = {}) {
|
|
|
6136
6145
|
throw new Error("image reference to import must not be empty");
|
|
6137
6146
|
}
|
|
6138
6147
|
const reference = imageReference.trim();
|
|
6139
|
-
const name =
|
|
6148
|
+
const name = __imageBuildInternals.registeredImageName(
|
|
6149
|
+
options.registeredName,
|
|
6150
|
+
__imageBuildInternals.defaultRegisteredNameFromImage(reference),
|
|
6151
|
+
true,
|
|
6152
|
+
__imageBuildInternals.defaultImportedImageName
|
|
6153
|
+
);
|
|
6140
6154
|
const emitter = makeEmitter({ emit: deps.emit ?? options.emit, verbose: options.verbose });
|
|
6141
6155
|
const credentials = credentialsFromEnv();
|
|
6142
6156
|
const binding = __imageBuildInternals.loadNativeBinding();
|
|
6143
|
-
emitter.emit({ type: "status", message: `Importing
|
|
6157
|
+
emitter.emit({ type: "status", message: `Importing '${reference}' as CAS image '${name}'...` });
|
|
6144
6158
|
const json = await __runWithInterrupt(
|
|
6145
6159
|
options.signal,
|
|
6146
6160
|
(interruptId) => binding.startImageImport(
|
|
@@ -6476,16 +6490,58 @@ function defaultRegisteredName(dockerfilePath) {
|
|
|
6476
6490
|
const parsed = import_node_path3.default.parse(dockerfilePath);
|
|
6477
6491
|
if (parsed.name.toLowerCase() === "dockerfile") {
|
|
6478
6492
|
const parentName = import_node_path3.default.basename(import_node_path3.default.dirname(dockerfilePath)).trim();
|
|
6479
|
-
return parentName ||
|
|
6493
|
+
return parentName || DEFAULT_SANDBOX_IMAGE_NAME;
|
|
6480
6494
|
}
|
|
6481
|
-
return parsed.name ||
|
|
6495
|
+
return parsed.name || DEFAULT_SANDBOX_IMAGE_NAME;
|
|
6496
|
+
}
|
|
6497
|
+
function registeredImageName(explicit, generated, cas, fallback = DEFAULT_SANDBOX_IMAGE_NAME) {
|
|
6498
|
+
if (explicit || generated === void 0) {
|
|
6499
|
+
const name = explicit ?? "";
|
|
6500
|
+
return cas ? canonicalCasImageName(name) : name;
|
|
6501
|
+
}
|
|
6502
|
+
return cas ? casImageNameFrom(generated, fallback) : generated;
|
|
6503
|
+
}
|
|
6504
|
+
function canonicalCasImageName(name) {
|
|
6505
|
+
return name.replace(/[A-Z]/g, (c) => c.toLowerCase());
|
|
6506
|
+
}
|
|
6507
|
+
function casImageNameFrom(raw, fallback) {
|
|
6508
|
+
const lowered = canonicalCasImageName(raw);
|
|
6509
|
+
if (isAddressableCasImageName(lowered)) {
|
|
6510
|
+
return lowered;
|
|
6511
|
+
}
|
|
6512
|
+
let name = "";
|
|
6513
|
+
for (const original of lowered) {
|
|
6514
|
+
const ch = /^[a-z0-9._-]$/.test(original) ? original : "-";
|
|
6515
|
+
const previous = name[name.length - 1];
|
|
6516
|
+
if (CAS_NAME_SEPARATORS.includes(ch) && previous !== void 0 && CAS_NAME_SEPARATORS.includes(previous)) {
|
|
6517
|
+
continue;
|
|
6518
|
+
}
|
|
6519
|
+
name += ch;
|
|
6520
|
+
}
|
|
6521
|
+
name = name.replace(/^[._-]+|[._-]+$/g, "").slice(0, MAX_CAS_IMAGE_NAME_LENGTH).replace(/[._-]+$/, "");
|
|
6522
|
+
return isAddressableCasImageName(name) ? name : fallback;
|
|
6523
|
+
}
|
|
6524
|
+
function isAddressableCasImageName(name) {
|
|
6525
|
+
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)) {
|
|
6526
|
+
return false;
|
|
6527
|
+
}
|
|
6528
|
+
const colon = name.indexOf(":");
|
|
6529
|
+
const repository = colon === -1 ? name : name.slice(0, colon);
|
|
6530
|
+
if (!repository.split("/").every((component) => /^[a-z0-9]+(?:[._-][a-z0-9]+)*$/.test(component))) {
|
|
6531
|
+
return false;
|
|
6532
|
+
}
|
|
6533
|
+
if (colon === -1) {
|
|
6534
|
+
return true;
|
|
6535
|
+
}
|
|
6536
|
+
const tag = name.slice(colon + 1);
|
|
6537
|
+
return tag.length > 0 && tag.length <= 128 && /^[a-z0-9._-]+$/.test(tag) && !tag.startsWith(".") && !tag.startsWith("-");
|
|
6482
6538
|
}
|
|
6483
6539
|
function defaultRegisteredNameFromImage(imageReference) {
|
|
6484
6540
|
const withoutDigest = imageReference.split("@", 1)[0] ?? imageReference;
|
|
6485
6541
|
const lastSegment = withoutDigest.split("/").pop() ?? withoutDigest;
|
|
6486
6542
|
const colonIndex = lastSegment.lastIndexOf(":");
|
|
6487
6543
|
const name = colonIndex > 0 && colonIndex < lastSegment.length - 1 ? lastSegment.slice(0, colonIndex) : lastSegment;
|
|
6488
|
-
return name ||
|
|
6544
|
+
return name || DEFAULT_IMPORTED_IMAGE_NAME;
|
|
6489
6545
|
}
|
|
6490
6546
|
function noopEmit(_event) {
|
|
6491
6547
|
}
|
|
@@ -6588,7 +6644,11 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
6588
6644
|
if (!text.endsWith("\n")) text += "\n";
|
|
6589
6645
|
dockerfileText = text;
|
|
6590
6646
|
nativeContextDir = resolvedContext;
|
|
6591
|
-
effectiveName =
|
|
6647
|
+
effectiveName = registeredImageName(
|
|
6648
|
+
options.registeredName ?? source.name,
|
|
6649
|
+
void 0,
|
|
6650
|
+
options.cas ?? true
|
|
6651
|
+
);
|
|
6592
6652
|
} else if (typeof source === "string") {
|
|
6593
6653
|
const resolvedPath = import_node_path3.default.resolve(source);
|
|
6594
6654
|
if (!(0, import_node_fs2.existsSync)(resolvedPath)) {
|
|
@@ -6597,7 +6657,11 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
6597
6657
|
dockerfilePath = resolvedPath;
|
|
6598
6658
|
dockerfileText = void 0;
|
|
6599
6659
|
nativeContextDir = void 0;
|
|
6600
|
-
effectiveName =
|
|
6660
|
+
effectiveName = registeredImageName(
|
|
6661
|
+
options.registeredName,
|
|
6662
|
+
defaultRegisteredName(resolvedPath),
|
|
6663
|
+
options.cas ?? true
|
|
6664
|
+
);
|
|
6601
6665
|
} else {
|
|
6602
6666
|
throw new TypeError(
|
|
6603
6667
|
`source must be an Image or a Dockerfile path, got ${typeof source}`
|
|
@@ -6621,12 +6685,16 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
6621
6685
|
deps._allowPat ? "Missing TENSORLAKE_API_KEY or TENSORLAKE_PAT credentials." : "Missing TENSORLAKE_API_KEY credentials."
|
|
6622
6686
|
);
|
|
6623
6687
|
}
|
|
6624
|
-
|
|
6688
|
+
const cas = options.cas ?? true;
|
|
6689
|
+
if (options.signal !== void 0 && !cas) {
|
|
6625
6690
|
throw new Error(
|
|
6626
|
-
"signal is
|
|
6691
|
+
"signal is not supported for legacy image builds (cas: false): a legacy image build has no build operation to cancel"
|
|
6627
6692
|
);
|
|
6628
6693
|
}
|
|
6629
|
-
emit({
|
|
6694
|
+
emit({
|
|
6695
|
+
type: "status",
|
|
6696
|
+
message: `Building ${cas ? "CAS" : "legacy"} image '${effectiveName}'...`
|
|
6697
|
+
});
|
|
6630
6698
|
const binding = loadNativeBinding();
|
|
6631
6699
|
let emitError;
|
|
6632
6700
|
const nativeOptions = {
|
|
@@ -6648,7 +6716,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
6648
6716
|
dockerConfigJson: options.dockerConfigJson,
|
|
6649
6717
|
dockerfileText,
|
|
6650
6718
|
contextDir: nativeContextDir,
|
|
6651
|
-
cas
|
|
6719
|
+
cas,
|
|
6652
6720
|
buildArgs: options.buildArgs
|
|
6653
6721
|
};
|
|
6654
6722
|
const forward = (event) => {
|
|
@@ -6658,7 +6726,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
6658
6726
|
emitError ??= error;
|
|
6659
6727
|
}
|
|
6660
6728
|
};
|
|
6661
|
-
const resultJson =
|
|
6729
|
+
const resultJson = cas ? await __runWithInterrupt(
|
|
6662
6730
|
options.signal,
|
|
6663
6731
|
(interruptId) => binding.buildSandboxImage(nativeOptions, forward, interruptId)
|
|
6664
6732
|
) : await binding.buildSandboxImage(nativeOptions, forward);
|
|
@@ -6689,7 +6757,12 @@ async function importSandboxImage(imageReference, options = {}, deps = {}) {
|
|
|
6689
6757
|
}
|
|
6690
6758
|
const reference = imageReference.trim();
|
|
6691
6759
|
const context = buildContextFromEnv();
|
|
6692
|
-
const effectiveName =
|
|
6760
|
+
const effectiveName = registeredImageName(
|
|
6761
|
+
options.registeredName,
|
|
6762
|
+
defaultRegisteredNameFromImage(reference),
|
|
6763
|
+
options.cas ?? true,
|
|
6764
|
+
DEFAULT_IMPORTED_IMAGE_NAME
|
|
6765
|
+
);
|
|
6693
6766
|
if (effectiveName === DEFAULT_IMAGE_NAME2) {
|
|
6694
6767
|
console.warn(
|
|
6695
6768
|
`Importing sandbox image with the default name "${DEFAULT_IMAGE_NAME2}". Pass \`registeredName\` to avoid collisions with other default-named images in this project.`
|
|
@@ -6707,14 +6780,15 @@ async function importSandboxImage(imageReference, options = {}, deps = {}) {
|
|
|
6707
6780
|
deps._allowPat ? "Missing TENSORLAKE_API_KEY or TENSORLAKE_PAT credentials." : "Missing TENSORLAKE_API_KEY credentials."
|
|
6708
6781
|
);
|
|
6709
6782
|
}
|
|
6710
|
-
|
|
6783
|
+
const cas = options.cas ?? true;
|
|
6784
|
+
if (options.signal !== void 0 && !cas) {
|
|
6711
6785
|
throw new Error(
|
|
6712
|
-
"signal is
|
|
6786
|
+
"signal is not supported for legacy image imports (cas: false): a legacy image import has no build operation to cancel"
|
|
6713
6787
|
);
|
|
6714
6788
|
}
|
|
6715
6789
|
emit({
|
|
6716
6790
|
type: "status",
|
|
6717
|
-
message: `Importing
|
|
6791
|
+
message: `Importing '${reference}' as ${cas ? "CAS" : "legacy"} image '${effectiveName}'...`
|
|
6718
6792
|
});
|
|
6719
6793
|
const binding = loadNativeBinding();
|
|
6720
6794
|
let emitError;
|
|
@@ -6735,7 +6809,7 @@ async function importSandboxImage(imageReference, options = {}, deps = {}) {
|
|
|
6735
6809
|
userAgent: void 0,
|
|
6736
6810
|
dockerCompat: options.dockerCompat ?? false,
|
|
6737
6811
|
dockerConfigJson: options.dockerConfigJson,
|
|
6738
|
-
cas
|
|
6812
|
+
cas
|
|
6739
6813
|
};
|
|
6740
6814
|
const forward = (event) => {
|
|
6741
6815
|
try {
|
|
@@ -6744,7 +6818,7 @@ async function importSandboxImage(imageReference, options = {}, deps = {}) {
|
|
|
6744
6818
|
emitError ??= error;
|
|
6745
6819
|
}
|
|
6746
6820
|
};
|
|
6747
|
-
const resultJson =
|
|
6821
|
+
const resultJson = cas ? await __runWithInterrupt(
|
|
6748
6822
|
options.signal,
|
|
6749
6823
|
(interruptId) => binding.importSandboxImage(nativeOptions, forward, interruptId)
|
|
6750
6824
|
) : await binding.importSandboxImage(nativeOptions, forward);
|
|
@@ -6801,15 +6875,29 @@ async function deleteSandboxImage(imageName) {
|
|
|
6801
6875
|
if (typeof imageName !== "string" || imageName.length === 0) {
|
|
6802
6876
|
throw new TypeError("imageName must be a non-empty string");
|
|
6803
6877
|
}
|
|
6804
|
-
|
|
6878
|
+
warnIncompleteLegacyCleanup(
|
|
6879
|
+
await loadNativeBinding().deleteSandboxImage(catalogOptionsFromEnv(), imageName)
|
|
6880
|
+
);
|
|
6805
6881
|
}
|
|
6806
6882
|
async function deleteSandboxImageWithCredentials(credentials, imageName) {
|
|
6807
6883
|
if (typeof imageName !== "string" || imageName.length === 0) {
|
|
6808
6884
|
throw new TypeError("imageName must be a non-empty string");
|
|
6809
6885
|
}
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6886
|
+
warnIncompleteLegacyCleanup(
|
|
6887
|
+
await loadNativeBinding().deleteSandboxImage(
|
|
6888
|
+
catalogOptionsFromCredentials(credentials),
|
|
6889
|
+
imageName
|
|
6890
|
+
)
|
|
6891
|
+
);
|
|
6892
|
+
}
|
|
6893
|
+
function warnIncompleteLegacyCleanup(failure) {
|
|
6894
|
+
if (failure == null) {
|
|
6895
|
+
return;
|
|
6896
|
+
}
|
|
6897
|
+
const legacyImageId = failure.legacyImageId ?? void 0;
|
|
6898
|
+
const label = legacyImageId ? ` (${legacyImageId})` : "";
|
|
6899
|
+
console.warn(
|
|
6900
|
+
`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}").`
|
|
6813
6901
|
);
|
|
6814
6902
|
}
|
|
6815
6903
|
async function findSandboxImageByName(imageName) {
|
|
@@ -6853,13 +6941,14 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
6853
6941
|
disk_mb: { type: "string" },
|
|
6854
6942
|
builder_disk_mb: { type: "string" },
|
|
6855
6943
|
docker_compat: { type: "boolean", default: false },
|
|
6856
|
-
public: { type: "boolean", default: false }
|
|
6944
|
+
public: { type: "boolean", default: false },
|
|
6945
|
+
"no-cas": { type: "boolean", default: false }
|
|
6857
6946
|
}
|
|
6858
6947
|
});
|
|
6859
6948
|
const dockerfilePath = parsed.positionals[0];
|
|
6860
6949
|
if (!dockerfilePath) {
|
|
6861
6950
|
throw new Error(
|
|
6862
|
-
"Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MiB] [--disk_mb MiB] [--builder_disk_mb MiB] [--docker_compat] [--public]"
|
|
6951
|
+
"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]"
|
|
6863
6952
|
);
|
|
6864
6953
|
}
|
|
6865
6954
|
const cpus = parsed.values.cpus != null ? Number(parsed.values.cpus) : void 0;
|
|
@@ -6891,7 +6980,8 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
6891
6980
|
diskMb,
|
|
6892
6981
|
builderDiskMb,
|
|
6893
6982
|
dockerCompat: parsed.values.docker_compat,
|
|
6894
|
-
isPublic: parsed.values.public
|
|
6983
|
+
isPublic: parsed.values.public,
|
|
6984
|
+
cas: !parsed.values["no-cas"]
|
|
6895
6985
|
},
|
|
6896
6986
|
{ emit: ndjsonStdoutEmit, _allowPat: true }
|
|
6897
6987
|
);
|
|
@@ -6907,13 +6997,14 @@ async function runImportSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
6907
6997
|
disk_mb: { type: "string" },
|
|
6908
6998
|
builder_disk_mb: { type: "string" },
|
|
6909
6999
|
docker_compat: { type: "boolean", default: false },
|
|
6910
|
-
public: { type: "boolean", default: false }
|
|
7000
|
+
public: { type: "boolean", default: false },
|
|
7001
|
+
"no-cas": { type: "boolean", default: false }
|
|
6911
7002
|
}
|
|
6912
7003
|
});
|
|
6913
7004
|
const imageReference = parsed.positionals[0];
|
|
6914
7005
|
if (!imageReference) {
|
|
6915
7006
|
throw new Error(
|
|
6916
|
-
"Usage: tensorlake-import-sandbox-image <image_reference> [--name NAME] [--cpus N] [--memory MiB] [--disk_mb MiB] [--builder_disk_mb MiB] [--docker_compat] [--public]"
|
|
7007
|
+
"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]"
|
|
6917
7008
|
);
|
|
6918
7009
|
}
|
|
6919
7010
|
const cpus = parsed.values.cpus != null ? Number(parsed.values.cpus) : void 0;
|
|
@@ -6945,12 +7036,13 @@ async function runImportSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
6945
7036
|
diskMb,
|
|
6946
7037
|
builderDiskMb,
|
|
6947
7038
|
dockerCompat: parsed.values.docker_compat,
|
|
6948
|
-
isPublic: parsed.values.public
|
|
7039
|
+
isPublic: parsed.values.public,
|
|
7040
|
+
cas: !parsed.values["no-cas"]
|
|
6949
7041
|
},
|
|
6950
7042
|
{ emit: ndjsonStdoutEmit, _allowPat: true }
|
|
6951
7043
|
);
|
|
6952
7044
|
}
|
|
6953
|
-
var import_node_path3, import_node_os2, import_node_fs2, import_node_util, cachedNativeBinding, cachedNativeBindingError, DEFAULT_IMAGE_NAME2, __imageBuildInternals;
|
|
7045
|
+
var import_node_path3, import_node_os2, import_node_fs2, import_node_util, 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;
|
|
6954
7046
|
var init_sandbox_image = __esm({
|
|
6955
7047
|
"src/sandbox-image.ts"() {
|
|
6956
7048
|
"use strict";
|
|
@@ -6963,6 +7055,11 @@ var init_sandbox_image = __esm({
|
|
|
6963
7055
|
init_native_binding();
|
|
6964
7056
|
init_image_builds();
|
|
6965
7057
|
DEFAULT_IMAGE_NAME2 = "default";
|
|
7058
|
+
DEFAULT_SANDBOX_IMAGE_NAME = "sandbox-image";
|
|
7059
|
+
DEFAULT_IMPORTED_IMAGE_NAME = "imported-image";
|
|
7060
|
+
CAS_NAME_SEPARATORS = "._-";
|
|
7061
|
+
RESERVED_IMAGE_NAME_PREFIXES = ["sandbox_template_", "image_", "cas-v1:"];
|
|
7062
|
+
MAX_CAS_IMAGE_NAME_LENGTH = 255;
|
|
6966
7063
|
__imageBuildInternals = {
|
|
6967
7064
|
loadNativeBinding: () => loadNativeBinding(),
|
|
6968
7065
|
buildContextFromEnv: () => buildContextFromEnv(),
|
|
@@ -6971,7 +7068,12 @@ var init_sandbox_image = __esm({
|
|
|
6971
7068
|
eventToEmitDict: (event) => eventToEmitDict(event),
|
|
6972
7069
|
imageRequiresContext: (image) => imageRequiresContext(image),
|
|
6973
7070
|
defaultRegisteredName: (dockerfilePath) => defaultRegisteredName(dockerfilePath),
|
|
6974
|
-
defaultRegisteredNameFromImage: (reference) => defaultRegisteredNameFromImage(reference)
|
|
7071
|
+
defaultRegisteredNameFromImage: (reference) => defaultRegisteredNameFromImage(reference),
|
|
7072
|
+
registeredImageName: (explicit, generated, cas, fallback) => registeredImageName(explicit, generated, cas, fallback),
|
|
7073
|
+
casImageNameFrom: (raw, fallback) => casImageNameFrom(raw, fallback),
|
|
7074
|
+
canonicalCasImageName: (name) => canonicalCasImageName(name),
|
|
7075
|
+
isAddressableCasImageName: (name) => isAddressableCasImageName(name),
|
|
7076
|
+
defaultImportedImageName: DEFAULT_IMPORTED_IMAGE_NAME
|
|
6975
7077
|
};
|
|
6976
7078
|
}
|
|
6977
7079
|
});
|
|
@@ -7229,10 +7331,12 @@ var CloudClient = class _CloudClient {
|
|
|
7229
7331
|
);
|
|
7230
7332
|
}
|
|
7231
7333
|
/**
|
|
7232
|
-
* Delete a registered sandbox image by name or id through the
|
|
7233
|
-
* catalog, with this client's credentials: an `image_` id or a name
|
|
7234
|
-
*
|
|
7235
|
-
* name registered only in the
|
|
7334
|
+
* Delete a registered CAS or legacy sandbox image by name or id through the
|
|
7335
|
+
* merged catalog, with this client's credentials: an `image_` id or a name
|
|
7336
|
+
* the CAS image registry knows deletes a CAS image, a `sandbox_template_` id
|
|
7337
|
+
* or a name registered only in the legacy image registry deletes a legacy
|
|
7338
|
+
* image.
|
|
7339
|
+
* A name is deleted from both the CAS and the legacy image registries.
|
|
7236
7340
|
* Rejects when neither catalog knows the reference. The same semantics
|
|
7237
7341
|
* and accepted differences as the module-level `deleteSandboxImage`.
|
|
7238
7342
|
*/
|
|
@@ -7240,10 +7344,10 @@ var CloudClient = class _CloudClient {
|
|
|
7240
7344
|
await deleteSandboxImageWithCredentials(this.catalogCredentials(), imageName);
|
|
7241
7345
|
}
|
|
7242
7346
|
/**
|
|
7243
|
-
* Look up a registered sandbox image by name or id through
|
|
7244
|
-
* catalog, with this client's credentials. Returns the image in
|
|
7245
|
-
* sandbox-template shape, or `null` when neither the
|
|
7246
|
-
*
|
|
7347
|
+
* Look up a registered CAS or legacy sandbox image by name or id through
|
|
7348
|
+
* the merged catalog, with this client's credentials. Returns the image in
|
|
7349
|
+
* the sandbox-template shape, or `null` when neither the CAS nor the legacy
|
|
7350
|
+
* image registry knows the reference. An explicit organization/project
|
|
7247
7351
|
* scope (the client's, or the call's override) addresses that project's
|
|
7248
7352
|
* routes directly, as before; without one the key's own scope applies.
|
|
7249
7353
|
*/
|