@tensorlakeai/tensorlake 0.5.153 → 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.
Files changed (35) hide show
  1. package/dist/applications/index.cjs +260 -71
  2. package/dist/applications/index.cjs.map +1 -1
  3. package/dist/applications/index.d.cts +3 -3
  4. package/dist/applications/index.d.ts +3 -3
  5. package/dist/applications/index.js +260 -71
  6. package/dist/applications/index.js.map +1 -1
  7. package/dist/function-agent/main.cjs +1 -1
  8. package/dist/function-agent/main.js +1 -1
  9. package/dist/function-executor/main.cjs +2 -2
  10. package/dist/function-executor/main.js +2 -2
  11. package/dist/index.cjs +344 -106
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +95 -38
  14. package/dist/index.d.ts +95 -38
  15. package/dist/index.js +339 -106
  16. package/dist/index.js.map +1 -1
  17. package/dist/{remote-B3vn4tt1.d.cts → remote-CEs4GFGP.d.cts} +1 -1
  18. package/dist/{remote-DqBUuciu.d.ts → remote-DYBXCTNC.d.ts} +1 -1
  19. package/dist/{sandbox-image-BMiFlzAs.d.cts → sandbox-image-C2GTVnx3.d.cts} +99 -52
  20. package/dist/{sandbox-image-BMiFlzAs.d.ts → sandbox-image-C2GTVnx3.d.ts} +99 -52
  21. package/dist/sandbox-image.cjs +248 -61
  22. package/dist/sandbox-image.cjs.map +1 -1
  23. package/dist/sandbox-image.d.cts +1 -1
  24. package/dist/sandbox-image.d.ts +1 -1
  25. package/dist/sandbox-image.js +248 -61
  26. package/dist/sandbox-image.js.map +1 -1
  27. package/package.json +7 -7
  28. package/runtime/function-executor/manifest.json +5 -5
  29. package/runtime/function-executor/package/dist/function-executor/main.js +2 -2
  30. package/runtime/function-executor/package/npm-shrinkwrap.json +2 -2
  31. package/runtime/function-executor/package/package.json +1 -1
  32. package/runtime/typescript-function-runner/manifest.json +5 -5
  33. package/runtime/typescript-function-runner/package/dist/function-agent/main.js +1 -1
  34. package/runtime/typescript-function-runner/package/npm-shrinkwrap.json +26 -26
  35. 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.153";
49
+ SDK_VERSION = "0.5.156";
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";
@@ -57,6 +57,20 @@ var init_defaults = __esm({
57
57
  }
58
58
  });
59
59
 
60
+ // src/enum.ts
61
+ function enumValue(values, value) {
62
+ return typeof value === "string" && Object.values(values).includes(value) ? value : values.UNKNOWN;
63
+ }
64
+ function withRaw(value, raw) {
65
+ return Object.defineProperty(value, "raw", { value: raw, enumerable: false, configurable: true });
66
+ }
67
+ var init_enum = __esm({
68
+ "src/enum.ts"() {
69
+ "use strict";
70
+ init_esm_shims();
71
+ }
72
+ });
73
+
60
74
  // src/errors.ts
61
75
  function formatErrorDetails(errorDetails) {
62
76
  if (errorDetails == null) return void 0;
@@ -495,7 +509,7 @@ var init_native_worker_client = __esm({
495
509
  }
496
510
  };
497
511
  runtimeKey = /* @__PURE__ */ Symbol.for(
498
- `tensorlake.native.worker.${false ? "source" : "0.5.153"}.v1`
512
+ `tensorlake.native.worker.${false ? "source" : "0.5.156"}.v1`
499
513
  );
500
514
  runtimes = globalThis;
501
515
  }
@@ -597,6 +611,7 @@ var init_models = __esm({
597
611
  SnapshotStatus2["FAILED"] = "failed";
598
612
  SnapshotStatus2["DELETING"] = "deleting";
599
613
  SnapshotStatus2["REPLICATING"] = "replicating";
614
+ SnapshotStatus2["UNKNOWN"] = "unknown";
600
615
  return SnapshotStatus2;
601
616
  })(SnapshotStatus || {});
602
617
  ProcessStatus = /* @__PURE__ */ ((ProcessStatus2) => {
@@ -4493,6 +4508,18 @@ __export(client_exports, {
4493
4508
  DEFAULT_WAIT_POLL_INTERVAL_SEC: () => DEFAULT_WAIT_POLL_INTERVAL_SEC,
4494
4509
  SandboxClient: () => SandboxClient
4495
4510
  });
4511
+ function parseSnapshot(raw) {
4512
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
4513
+ throw new SandboxError("Invalid snapshot response: expected an object");
4514
+ }
4515
+ if (raw.status == null) {
4516
+ throw new SandboxError("Invalid snapshot response: missing status");
4517
+ }
4518
+ return withRaw({
4519
+ ...fromSnakeKeys(raw, "snapshotId"),
4520
+ status: enumValue(SnapshotStatus, raw.status)
4521
+ }, raw);
4522
+ }
4496
4523
  function requireReadOnlySnapshotPin(fileSystemId, mountPath, readOnly, snapshotId) {
4497
4524
  if (snapshotId != null && readOnly !== true) {
4498
4525
  throw new SandboxError(
@@ -4614,6 +4641,7 @@ var init_client = __esm({
4614
4641
  "use strict";
4615
4642
  init_esm_shims();
4616
4643
  init_defaults();
4644
+ init_enum();
4617
4645
  init_errors();
4618
4646
  init_native_worker_client();
4619
4647
  init_native_sandbox();
@@ -5261,18 +5289,18 @@ var init_client = __esm({
5261
5289
  * block automatically.
5262
5290
  */
5263
5291
  async snapshot(sandboxId, options) {
5264
- return this.plainJson(
5292
+ const { json } = await callNative(
5265
5293
  () => this.native.createSnapshot(sandboxId, options?.snapshotType ?? null),
5266
- "snapshotId",
5267
5294
  { sandboxId, notFoundKind: "sandbox" }
5268
5295
  );
5296
+ return parseSnapshot(JSON.parse(json));
5269
5297
  }
5270
5298
  /** Get current status and metadata for a snapshot by ID. */
5271
5299
  async getSnapshot(snapshotId) {
5272
- return this.tracedJson(
5273
- () => this.native.getSnapshot(snapshotId),
5274
- "snapshotId"
5300
+ const { traceId, json } = await callNative(
5301
+ () => this.native.getSnapshot(snapshotId)
5275
5302
  );
5303
+ return Object.assign(parseSnapshot(JSON.parse(json)), { traceId });
5276
5304
  }
5277
5305
  /** List all snapshots in the namespace. */
5278
5306
  async listSnapshots() {
@@ -5280,9 +5308,14 @@ var init_client = __esm({
5280
5308
  () => this.native.listSnapshots()
5281
5309
  );
5282
5310
  const parsed = JSON.parse(json);
5283
- const snapshots = (parsed.snapshots ?? []).map(
5284
- (s) => fromSnakeKeys(s, "snapshotId")
5285
- );
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));
5286
5319
  return Object.assign(snapshots, { traceId });
5287
5320
  }
5288
5321
  /** Delete a snapshot by ID. */
@@ -5683,10 +5716,11 @@ var init_image = __esm({
5683
5716
  });
5684
5717
  }
5685
5718
  /**
5686
- * Build this image as a sandbox template and register it.
5719
+ * Build this image and register it as a CAS sandbox image (the default) or,
5720
+ * with `cas: false`, a legacy sandbox image.
5687
5721
  *
5688
5722
  * Materializes the image in a build sandbox, snapshots the filesystem,
5689
- * and registers the snapshot as a named sandbox template.
5723
+ * and registers the snapshot under the image's name.
5690
5724
  */
5691
5725
  async build(options = {}) {
5692
5726
  const { createSandboxImage: createSandboxImage2 } = await Promise.resolve().then(() => (init_sandbox_image(), sandbox_image_exports));
@@ -5850,6 +5884,9 @@ var init_native_binding = __esm({
5850
5884
  import path3 from "path";
5851
5885
  import os from "os";
5852
5886
  import { existsSync as existsSync2, mkdtempSync, rmSync } from "fs";
5887
+ function isConfirmedCancellation(outcome) {
5888
+ return outcome === "cancelled" /* CANCELLED */ || outcome === "already_cancelled" /* ALREADY_CANCELLED */ || outcome === "already_failed" /* ALREADY_FAILED */;
5889
+ }
5853
5890
  function camelize(key) {
5854
5891
  return key.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
5855
5892
  }
@@ -5867,62 +5904,87 @@ function toImageBuildError(error) {
5867
5904
  if (key === "category") continue;
5868
5905
  details[camelize(key)] = value;
5869
5906
  }
5907
+ details.code = enumValue(ImageBuildErrorCode, details.code || "internal" /* INTERNAL */);
5908
+ if ("activeKind" in details) details.activeKind = details.activeKind ? enumValue(ImageBuildKind, details.activeKind) : null;
5909
+ if ("activeStatus" in details) details.activeStatus = details.activeStatus ? enumValue(ImageBuildStatus, details.activeStatus) : null;
5910
+ if ("outcome" in details) details.outcome = details.outcome ? enumValue(ImageBuildCancellationOutcome, details.outcome) : null;
5911
+ if ("info" in details) details.info = buildInfoOrNull(details.info);
5870
5912
  const typed = details;
5871
- switch (typed.code) {
5872
- case "not_found":
5873
- return new ImageBuildNotFoundError(typed);
5874
- case "image_build_in_progress":
5875
- return new ImageBuildInProgressError(typed);
5876
- case "failed":
5877
- return new ImageBuildFailedError(typed);
5878
- case "cancelled":
5879
- return new ImageBuildCancelledError(typed);
5880
- case "timeout":
5881
- return new ImageBuildTimeoutError(typed);
5882
- case "interrupted":
5883
- return new ImageBuildInterruptedError(typed);
5884
- default:
5885
- return new ImageBuildError(typed);
5886
- }
5913
+ const errors = {
5914
+ not_found: ImageBuildNotFoundError,
5915
+ image_build_in_progress: ImageBuildInProgressError,
5916
+ failed: ImageBuildFailedError,
5917
+ cancelled: ImageBuildCancelledError,
5918
+ timeout: ImageBuildTimeoutError,
5919
+ interrupted: ImageBuildInterruptedError
5920
+ };
5921
+ const ErrorClass = errors[typed.code] ?? ImageBuildError;
5922
+ return withRaw(new ErrorClass(typed), payload);
5887
5923
  }
5888
5924
  function camelizeRecord(value) {
5889
5925
  const out = {};
5890
5926
  for (const [key, inner] of Object.entries(value)) out[camelize(key)] = inner;
5891
5927
  return out;
5892
5928
  }
5893
- function parseBuildInfo(raw) {
5929
+ function buildInfoOrNull(value) {
5930
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
5931
+ try {
5932
+ return parseBuildInfo(value);
5933
+ } catch (error) {
5934
+ if (error instanceof ImageBuildError) return null;
5935
+ throw error;
5936
+ }
5937
+ }
5938
+ function decodeResponse(value) {
5939
+ try {
5940
+ const raw = typeof value === "string" ? JSON.parse(value) : value;
5941
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) throw new TypeError("expected a response object");
5942
+ return raw;
5943
+ } catch (error) {
5944
+ throw withRaw(new ImageBuildError({ code: "service" /* SERVICE */, message: `Invalid image-build response: ${String(error)}` }), { response: value });
5945
+ }
5946
+ }
5947
+ function parseBuildInfo(value) {
5948
+ const raw = decodeResponse(value);
5949
+ if (raw.status == null) {
5950
+ throw withRaw(new ImageBuildError({ code: "service" /* SERVICE */, message: "Invalid image-build response: missing status" }), { response: value });
5951
+ }
5952
+ const attempt = raw.attempt_no ?? 0;
5953
+ const attemptNo = Number(attempt);
5954
+ if (typeof attempt !== "number" && typeof attempt !== "string" || typeof attempt === "string" && attempt.trim() === "" || !Number.isSafeInteger(attemptNo)) {
5955
+ throw withRaw(new ImageBuildError({ code: "service" /* SERVICE */, message: "Invalid image-build attempt_no" }), { response: value });
5956
+ }
5894
5957
  const camel = camelizeRecord(raw);
5895
5958
  const result = raw.result && typeof raw.result === "object" ? camelizeRecord(raw.result) : null;
5896
- return {
5959
+ return withRaw({
5897
5960
  buildId: String(raw.build_id ?? ""),
5898
5961
  clientRequestId: camel.clientRequestId ?? null,
5899
- kind: String(raw.kind ?? ""),
5962
+ kind: raw.kind ? enumValue(ImageBuildKind, raw.kind) : null,
5900
5963
  name: raw.name ?? null,
5901
- status: String(raw.status ?? ""),
5902
- phase: raw.phase ?? null,
5903
- attemptNo: Number(raw.attempt_no ?? 0),
5964
+ status: enumValue(ImageBuildStatus, raw.status),
5965
+ phase: raw.phase ? enumValue(ImageBuildPhase, raw.phase) : null,
5966
+ attemptNo,
5904
5967
  builderSandboxId: camel.builderSandboxId ?? null,
5905
5968
  error: raw.error ?? null,
5906
5969
  result,
5907
5970
  operationDeadlineMs: camel.operationDeadlineMs ?? null,
5908
5971
  createdAtMs: camel.createdAtMs ?? null,
5909
- updatedAtMs: camel.updatedAtMs ?? null,
5910
- raw
5911
- };
5972
+ updatedAtMs: camel.updatedAtMs ?? null
5973
+ }, raw);
5912
5974
  }
5913
5975
  function parseResult(json) {
5914
- return camelizeRecord(JSON.parse(json));
5976
+ return camelizeRecord(decodeResponse(json));
5915
5977
  }
5916
5978
  function credentialsFromEnv() {
5917
5979
  const context = __imageBuildInternals.buildContextFromEnv();
5918
5980
  if (!context.apiKey) {
5919
5981
  if (context.personalAccessToken) {
5920
5982
  throw new ImageBuildError({
5921
- code: "auth",
5983
+ code: "auth" /* AUTH */,
5922
5984
  message: "Sandbox image SDKs require TENSORLAKE_API_KEY. Personal access tokens are CLI-only."
5923
5985
  });
5924
5986
  }
5925
- throw new ImageBuildError({ code: "auth", message: "Missing TENSORLAKE_API_KEY credentials." });
5987
+ throw new ImageBuildError({ code: "auth" /* AUTH */, message: "Missing TENSORLAKE_API_KEY credentials." });
5926
5988
  }
5927
5989
  return { apiUrl: context.apiUrl, bearerToken: context.apiKey, namespace: context.namespace };
5928
5990
  }
@@ -5936,19 +5998,19 @@ function clientOptions(credentials) {
5936
5998
  }
5937
5999
  function rejectLegacyReference(buildId) {
5938
6000
  if (typeof buildId !== "string" || buildId.trim().length === 0) {
5939
- throw new ImageBuildError({ code: "usage", message: "buildId must be a non-empty string" });
6001
+ throw new ImageBuildError({ code: "usage" /* USAGE */, message: "buildId must be a non-empty string" });
5940
6002
  }
5941
6003
  if (buildId.startsWith("sandbox_template_")) {
5942
6004
  throw new ImageBuildError({
5943
- code: "usage",
5944
- message: `'${buildId}' is a legacy sandbox template id; legacy images have no build operation to get, wait for or cancel`,
6005
+ code: "usage" /* USAGE */,
6006
+ message: `'${buildId}' is a legacy image id; legacy images have no build operation to get, wait for or cancel`,
5945
6007
  buildId
5946
6008
  });
5947
6009
  }
5948
6010
  if (buildId.startsWith("image_")) {
5949
6011
  throw new ImageBuildError({
5950
- code: "usage",
5951
- message: `'${buildId}' is an image id, not a build id; look the image up with findSandboxImageByName or use the build id admission returned`,
6012
+ code: "usage" /* USAGE */,
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`,
5952
6014
  buildId
5953
6015
  });
5954
6016
  }
@@ -5994,8 +6056,15 @@ function makeEmitter(options) {
5994
6056
  };
5995
6057
  }
5996
6058
  function decodeStarted(json, credentials) {
5997
- const payload = JSON.parse(json);
5998
- return new ImageBuildHandle(parseBuildInfo(payload.build ?? {}), credentials, payload.client_request_id);
6059
+ const payload = decodeResponse(json);
6060
+ const build = payload.build;
6061
+ if (!build || typeof build !== "object" || Array.isArray(build) || typeof build.build_id !== "string" || !build.build_id.trim()) {
6062
+ throw withRaw(new ImageBuildError({
6063
+ code: "service" /* SERVICE */,
6064
+ message: "Invalid image-build admission: expected a build with a non-empty build_id"
6065
+ }), { response: payload });
6066
+ }
6067
+ return new ImageBuildHandle(parseBuildInfo(build), credentials, payload.client_request_id);
5999
6068
  }
6000
6069
  async function startImageBuild(source, options = {}, deps = {}) {
6001
6070
  const emitter = makeEmitter({ emit: deps.emit ?? options.emit, verbose: options.verbose });
@@ -6020,19 +6089,27 @@ async function startImageBuild(source, options = {}, deps = {}) {
6020
6089
  let text = dockerfileContent(source);
6021
6090
  if (!text.endsWith("\n")) text += "\n";
6022
6091
  dockerfileText = text;
6023
- name = options.registeredName ?? source.name;
6092
+ name = __imageBuildInternals.registeredImageName(
6093
+ options.registeredName ?? source.name,
6094
+ void 0,
6095
+ true
6096
+ );
6024
6097
  } else if (typeof source === "string") {
6025
6098
  const resolved = path3.resolve(source);
6026
6099
  if (!existsSync2(resolved)) throw new Error(`Dockerfile not found: ${source}`);
6027
6100
  dockerfilePath = resolved;
6028
- name = options.registeredName ?? __imageBuildInternals.defaultRegisteredName(resolved);
6101
+ name = __imageBuildInternals.registeredImageName(
6102
+ options.registeredName,
6103
+ __imageBuildInternals.defaultRegisteredName(resolved),
6104
+ true
6105
+ );
6029
6106
  } else {
6030
6107
  throw new TypeError(`source must be an Image or a Dockerfile path, got ${typeof source}`);
6031
6108
  }
6032
6109
  try {
6033
6110
  const credentials = credentialsFromEnv();
6034
6111
  const binding = __imageBuildInternals.loadNativeBinding();
6035
- emitter.emit({ type: "status", message: `Building image '${name}'...` });
6112
+ emitter.emit({ type: "status", message: `Building CAS image '${name}'...` });
6036
6113
  const json = await __runWithInterrupt(
6037
6114
  options.signal,
6038
6115
  (interruptId) => binding.startImageBuild(
@@ -6068,11 +6145,16 @@ async function startImageImport(imageReference, options = {}, deps = {}) {
6068
6145
  throw new Error("image reference to import must not be empty");
6069
6146
  }
6070
6147
  const reference = imageReference.trim();
6071
- const name = options.registeredName ?? __imageBuildInternals.defaultRegisteredNameFromImage(reference);
6148
+ const name = __imageBuildInternals.registeredImageName(
6149
+ options.registeredName,
6150
+ __imageBuildInternals.defaultRegisteredNameFromImage(reference),
6151
+ true,
6152
+ __imageBuildInternals.defaultImportedImageName
6153
+ );
6072
6154
  const emitter = makeEmitter({ emit: deps.emit ?? options.emit, verbose: options.verbose });
6073
6155
  const credentials = credentialsFromEnv();
6074
6156
  const binding = __imageBuildInternals.loadNativeBinding();
6075
- emitter.emit({ type: "status", message: `Importing image '${reference}' as '${name}'...` });
6157
+ emitter.emit({ type: "status", message: `Importing '${reference}' as CAS image '${name}'...` });
6076
6158
  const json = await __runWithInterrupt(
6077
6159
  options.signal,
6078
6160
  (interruptId) => binding.startImageImport(
@@ -6107,7 +6189,7 @@ async function getImageBuild(buildId) {
6107
6189
  } catch (error) {
6108
6190
  throw toImageBuildError(error);
6109
6191
  }
6110
- return new ImageBuildHandle(parseBuildInfo(JSON.parse(json)), credentials);
6192
+ return new ImageBuildHandle(parseBuildInfo(json), credentials);
6111
6193
  }
6112
6194
  async function waitImageBuild(buildId, options = {}) {
6113
6195
  rejectLegacyReference(buildId);
@@ -6138,33 +6220,81 @@ async function cancelImageBuildWith(credentials, selector) {
6138
6220
  } catch (error) {
6139
6221
  throw toImageBuildError(error);
6140
6222
  }
6141
- const payload = JSON.parse(json);
6142
- const outcome = String(payload.outcome ?? "");
6143
- return {
6144
- outcome,
6145
- build: payload.build ? parseBuildInfo(payload.build) : null,
6146
- confirmed: ["cancelled", "already_cancelled", "already_failed"].includes(outcome)
6147
- };
6223
+ const payload = decodeResponse(json);
6224
+ const outcome = enumValue(ImageBuildCancellationOutcome, payload.outcome);
6225
+ return withRaw({ outcome, build: buildInfoOrNull(payload.build), confirmed: isConfirmedCancellation(outcome) }, payload);
6148
6226
  }
6149
6227
  async function cancelImageBuild(selector) {
6150
6228
  const hasBuild = selector.buildId != null;
6151
6229
  const hasRequest = selector.clientRequestId != null;
6152
6230
  if (hasBuild === hasRequest) {
6153
6231
  throw new ImageBuildError({
6154
- code: "usage",
6232
+ code: "usage" /* USAGE */,
6155
6233
  message: "pass exactly one of buildId or clientRequestId"
6156
6234
  });
6157
6235
  }
6158
6236
  if (selector.buildId != null) rejectLegacyReference(selector.buildId);
6159
6237
  return cancelImageBuildWith(credentialsFromEnv(), selector);
6160
6238
  }
6161
- var ImageBuildError, ImageBuildNotFoundError, ImageBuildInProgressError, ImageBuildFailedError, ImageBuildCancelledError, ImageBuildTimeoutError, ImageBuildInterruptedError, ImageBuildHandle;
6239
+ var ImageBuildStatus, ImageBuildPhase, ImageBuildKind, ImageBuildCancellationOutcome, ImageBuildErrorCode, ImageBuildError, ImageBuildNotFoundError, ImageBuildInProgressError, ImageBuildFailedError, ImageBuildCancelledError, ImageBuildTimeoutError, ImageBuildInterruptedError, ImageBuildHandle;
6162
6240
  var init_image_builds = __esm({
6163
6241
  "src/image-builds.ts"() {
6164
6242
  "use strict";
6165
6243
  init_esm_shims();
6244
+ init_enum();
6166
6245
  init_image();
6167
6246
  init_sandbox_image();
6247
+ ImageBuildStatus = /* @__PURE__ */ ((ImageBuildStatus2) => {
6248
+ ImageBuildStatus2["PENDING"] = "pending";
6249
+ ImageBuildStatus2["RUNNING"] = "running";
6250
+ ImageBuildStatus2["SUCCEEDED"] = "succeeded";
6251
+ ImageBuildStatus2["FAILED"] = "failed";
6252
+ ImageBuildStatus2["CANCELLED"] = "cancelled";
6253
+ ImageBuildStatus2["UNKNOWN"] = "unknown";
6254
+ return ImageBuildStatus2;
6255
+ })(ImageBuildStatus || {});
6256
+ ImageBuildPhase = /* @__PURE__ */ ((ImageBuildPhase2) => {
6257
+ ImageBuildPhase2["AWAITING_CONTEXT"] = "awaiting_context";
6258
+ ImageBuildPhase2["STARTING_BUILDER"] = "starting_builder";
6259
+ ImageBuildPhase2["EXECUTING"] = "executing";
6260
+ ImageBuildPhase2["SNAPSHOTTING"] = "snapshotting";
6261
+ ImageBuildPhase2["PUBLISHING"] = "publishing";
6262
+ ImageBuildPhase2["FINISHED"] = "finished";
6263
+ ImageBuildPhase2["UNKNOWN"] = "unknown";
6264
+ return ImageBuildPhase2;
6265
+ })(ImageBuildPhase || {});
6266
+ ImageBuildKind = /* @__PURE__ */ ((ImageBuildKind2) => {
6267
+ ImageBuildKind2["DOCKERFILE"] = "dockerfile";
6268
+ ImageBuildKind2["IMPORT"] = "import";
6269
+ ImageBuildKind2["DIRECT"] = "direct";
6270
+ ImageBuildKind2["UNKNOWN"] = "unknown";
6271
+ return ImageBuildKind2;
6272
+ })(ImageBuildKind || {});
6273
+ ImageBuildCancellationOutcome = /* @__PURE__ */ ((ImageBuildCancellationOutcome2) => {
6274
+ ImageBuildCancellationOutcome2["CANCELLED"] = "cancelled";
6275
+ ImageBuildCancellationOutcome2["ALREADY_CANCELLED"] = "already_cancelled";
6276
+ ImageBuildCancellationOutcome2["ALREADY_COMPLETED"] = "already_completed";
6277
+ ImageBuildCancellationOutcome2["ALREADY_FAILED"] = "already_failed";
6278
+ ImageBuildCancellationOutcome2["NOT_ADMITTED"] = "not_admitted";
6279
+ ImageBuildCancellationOutcome2["UNCONFIRMED"] = "unconfirmed";
6280
+ ImageBuildCancellationOutcome2["UNKNOWN"] = "unknown";
6281
+ return ImageBuildCancellationOutcome2;
6282
+ })(ImageBuildCancellationOutcome || {});
6283
+ ImageBuildErrorCode = /* @__PURE__ */ ((ImageBuildErrorCode2) => {
6284
+ ImageBuildErrorCode2["USAGE"] = "usage";
6285
+ ImageBuildErrorCode2["AUTH"] = "auth";
6286
+ ImageBuildErrorCode2["NOT_FOUND"] = "not_found";
6287
+ ImageBuildErrorCode2["IMAGE_BUILD_IN_PROGRESS"] = "image_build_in_progress";
6288
+ ImageBuildErrorCode2["CLIENT_REQUEST_ID_MISMATCH"] = "client_request_id_mismatch";
6289
+ ImageBuildErrorCode2["FAILED"] = "failed";
6290
+ ImageBuildErrorCode2["CANCELLED"] = "cancelled";
6291
+ ImageBuildErrorCode2["TIMEOUT"] = "timeout";
6292
+ ImageBuildErrorCode2["INTERRUPTED"] = "interrupted";
6293
+ ImageBuildErrorCode2["SERVICE"] = "service";
6294
+ ImageBuildErrorCode2["INTERNAL"] = "internal";
6295
+ ImageBuildErrorCode2["UNKNOWN"] = "unknown";
6296
+ return ImageBuildErrorCode2;
6297
+ })(ImageBuildErrorCode || {});
6168
6298
  ImageBuildError = class extends Error {
6169
6299
  code;
6170
6300
  buildId;
@@ -6174,7 +6304,11 @@ var init_image_builds = __esm({
6174
6304
  super(details.message);
6175
6305
  this.name = "ImageBuildError";
6176
6306
  this.code = details.code;
6177
- this.details = details;
6307
+ this.details = { ...details };
6308
+ withRaw(this, {});
6309
+ if ("confirmed" in details) {
6310
+ this.details.confirmed = details.confirmed === true && isConfirmedCancellation(details.outcome);
6311
+ }
6178
6312
  if (details.buildId) this.buildId = details.buildId;
6179
6313
  if (details.clientRequestId) this.clientRequestId = details.clientRequestId;
6180
6314
  }
@@ -6206,7 +6340,7 @@ var init_image_builds = __esm({
6206
6340
  super(details);
6207
6341
  this.name = "ImageBuildFailedError";
6208
6342
  this.error = details.error ?? "no error recorded";
6209
- if (details.info) this.info = parseBuildInfo(details.info);
6343
+ if (details.info) this.info = details.info;
6210
6344
  }
6211
6345
  };
6212
6346
  ImageBuildCancelledError = class extends ImageBuildError {
@@ -6214,7 +6348,7 @@ var init_image_builds = __esm({
6214
6348
  constructor(details) {
6215
6349
  super(details);
6216
6350
  this.name = "ImageBuildCancelledError";
6217
- if (details.info) this.info = parseBuildInfo(details.info);
6351
+ if (details.info) this.info = details.info;
6218
6352
  }
6219
6353
  };
6220
6354
  ImageBuildTimeoutError = class extends ImageBuildError {
@@ -6230,8 +6364,8 @@ var init_image_builds = __esm({
6230
6364
  constructor(details) {
6231
6365
  super(details);
6232
6366
  this.name = "ImageBuildInterruptedError";
6233
- this.outcome = details.outcome ?? "unconfirmed";
6234
- this.confirmed = details.confirmed === true;
6367
+ this.outcome = details.outcome ?? "unconfirmed" /* UNCONFIRMED */;
6368
+ this.confirmed = this.details.confirmed === true;
6235
6369
  if (details.result) this.result = details.result;
6236
6370
  }
6237
6371
  };
@@ -6264,7 +6398,7 @@ var init_image_builds = __esm({
6264
6398
  } catch (error) {
6265
6399
  throw toImageBuildError(error);
6266
6400
  }
6267
- this.#info = parseBuildInfo(JSON.parse(json));
6401
+ this.#info = parseBuildInfo(json);
6268
6402
  return this.#info;
6269
6403
  }
6270
6404
  /**
@@ -6285,8 +6419,12 @@ var init_image_builds = __esm({
6285
6419
  )
6286
6420
  );
6287
6421
  emitter.rethrow();
6288
- const result = parseResult(json);
6289
- this.#info = { ...this.#info, status: "succeeded", result };
6422
+ const raw = decodeResponse(json);
6423
+ const result = camelizeRecord(raw);
6424
+ this.#info = withRaw(
6425
+ { ...this.#info, status: "succeeded" /* SUCCEEDED */, result },
6426
+ { ...this.#info.raw, status: "succeeded", result: raw }
6427
+ );
6290
6428
  return result;
6291
6429
  }
6292
6430
  /** Cancel this build by its id (the sufficient selector). */
@@ -6353,16 +6491,58 @@ function defaultRegisteredName(dockerfilePath) {
6353
6491
  const parsed = path4.parse(dockerfilePath);
6354
6492
  if (parsed.name.toLowerCase() === "dockerfile") {
6355
6493
  const parentName = path4.basename(path4.dirname(dockerfilePath)).trim();
6356
- return parentName || "sandbox-image";
6494
+ return parentName || DEFAULT_SANDBOX_IMAGE_NAME;
6495
+ }
6496
+ return parsed.name || DEFAULT_SANDBOX_IMAGE_NAME;
6497
+ }
6498
+ function registeredImageName(explicit, generated, cas, fallback = DEFAULT_SANDBOX_IMAGE_NAME) {
6499
+ if (explicit || generated === void 0) {
6500
+ const name = explicit ?? "";
6501
+ return cas ? canonicalCasImageName(name) : name;
6357
6502
  }
6358
- return parsed.name || "sandbox-image";
6503
+ return cas ? casImageNameFrom(generated, fallback) : generated;
6504
+ }
6505
+ function canonicalCasImageName(name) {
6506
+ return name.replace(/[A-Z]/g, (c) => c.toLowerCase());
6507
+ }
6508
+ function casImageNameFrom(raw, fallback) {
6509
+ const lowered = canonicalCasImageName(raw);
6510
+ if (isAddressableCasImageName(lowered)) {
6511
+ return lowered;
6512
+ }
6513
+ let name = "";
6514
+ for (const original of lowered) {
6515
+ const ch = /^[a-z0-9._-]$/.test(original) ? original : "-";
6516
+ const previous = name[name.length - 1];
6517
+ if (CAS_NAME_SEPARATORS.includes(ch) && previous !== void 0 && CAS_NAME_SEPARATORS.includes(previous)) {
6518
+ continue;
6519
+ }
6520
+ name += ch;
6521
+ }
6522
+ name = name.replace(/^[._-]+|[._-]+$/g, "").slice(0, MAX_CAS_IMAGE_NAME_LENGTH).replace(/[._-]+$/, "");
6523
+ return isAddressableCasImageName(name) ? name : fallback;
6524
+ }
6525
+ function isAddressableCasImageName(name) {
6526
+ 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)) {
6527
+ return false;
6528
+ }
6529
+ const colon = name.indexOf(":");
6530
+ const repository = colon === -1 ? name : name.slice(0, colon);
6531
+ if (!repository.split("/").every((component) => /^[a-z0-9]+(?:[._-][a-z0-9]+)*$/.test(component))) {
6532
+ return false;
6533
+ }
6534
+ if (colon === -1) {
6535
+ return true;
6536
+ }
6537
+ const tag = name.slice(colon + 1);
6538
+ return tag.length > 0 && tag.length <= 128 && /^[a-z0-9._-]+$/.test(tag) && !tag.startsWith(".") && !tag.startsWith("-");
6359
6539
  }
6360
6540
  function defaultRegisteredNameFromImage(imageReference) {
6361
6541
  const withoutDigest = imageReference.split("@", 1)[0] ?? imageReference;
6362
6542
  const lastSegment = withoutDigest.split("/").pop() ?? withoutDigest;
6363
6543
  const colonIndex = lastSegment.lastIndexOf(":");
6364
6544
  const name = colonIndex > 0 && colonIndex < lastSegment.length - 1 ? lastSegment.slice(0, colonIndex) : lastSegment;
6365
- return name || "imported-image";
6545
+ return name || DEFAULT_IMPORTED_IMAGE_NAME;
6366
6546
  }
6367
6547
  function noopEmit(_event) {
6368
6548
  }
@@ -6465,7 +6645,11 @@ async function createSandboxImage(source, options = {}, deps = {}) {
6465
6645
  if (!text.endsWith("\n")) text += "\n";
6466
6646
  dockerfileText = text;
6467
6647
  nativeContextDir = resolvedContext;
6468
- effectiveName = options.registeredName ?? source.name;
6648
+ effectiveName = registeredImageName(
6649
+ options.registeredName ?? source.name,
6650
+ void 0,
6651
+ options.cas ?? true
6652
+ );
6469
6653
  } else if (typeof source === "string") {
6470
6654
  const resolvedPath = path4.resolve(source);
6471
6655
  if (!existsSync3(resolvedPath)) {
@@ -6474,7 +6658,11 @@ async function createSandboxImage(source, options = {}, deps = {}) {
6474
6658
  dockerfilePath = resolvedPath;
6475
6659
  dockerfileText = void 0;
6476
6660
  nativeContextDir = void 0;
6477
- effectiveName = options.registeredName ?? defaultRegisteredName(resolvedPath);
6661
+ effectiveName = registeredImageName(
6662
+ options.registeredName,
6663
+ defaultRegisteredName(resolvedPath),
6664
+ options.cas ?? true
6665
+ );
6478
6666
  } else {
6479
6667
  throw new TypeError(
6480
6668
  `source must be an Image or a Dockerfile path, got ${typeof source}`
@@ -6498,12 +6686,16 @@ async function createSandboxImage(source, options = {}, deps = {}) {
6498
6686
  deps._allowPat ? "Missing TENSORLAKE_API_KEY or TENSORLAKE_PAT credentials." : "Missing TENSORLAKE_API_KEY credentials."
6499
6687
  );
6500
6688
  }
6501
- if (options.signal !== void 0 && !options.cas) {
6689
+ const cas = options.cas ?? true;
6690
+ if (options.signal !== void 0 && !cas) {
6502
6691
  throw new Error(
6503
- "signal is only supported for CAS image builds (cas: true); a legacy build has no Image Service build operation to cancel"
6692
+ "signal is not supported for legacy image builds (cas: false): a legacy image build has no build operation to cancel"
6504
6693
  );
6505
6694
  }
6506
- emit({ type: "status", message: `Building image '${effectiveName}'...` });
6695
+ emit({
6696
+ type: "status",
6697
+ message: `Building ${cas ? "CAS" : "legacy"} image '${effectiveName}'...`
6698
+ });
6507
6699
  const binding = loadNativeBinding();
6508
6700
  let emitError;
6509
6701
  const nativeOptions = {
@@ -6525,7 +6717,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
6525
6717
  dockerConfigJson: options.dockerConfigJson,
6526
6718
  dockerfileText,
6527
6719
  contextDir: nativeContextDir,
6528
- cas: options.cas ?? false,
6720
+ cas,
6529
6721
  buildArgs: options.buildArgs
6530
6722
  };
6531
6723
  const forward = (event) => {
@@ -6535,7 +6727,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
6535
6727
  emitError ??= error;
6536
6728
  }
6537
6729
  };
6538
- const resultJson = options.cas ? await __runWithInterrupt(
6730
+ const resultJson = cas ? await __runWithInterrupt(
6539
6731
  options.signal,
6540
6732
  (interruptId) => binding.buildSandboxImage(nativeOptions, forward, interruptId)
6541
6733
  ) : await binding.buildSandboxImage(nativeOptions, forward);
@@ -6566,7 +6758,12 @@ async function importSandboxImage(imageReference, options = {}, deps = {}) {
6566
6758
  }
6567
6759
  const reference = imageReference.trim();
6568
6760
  const context = buildContextFromEnv();
6569
- const effectiveName = options.registeredName ?? defaultRegisteredNameFromImage(reference);
6761
+ const effectiveName = registeredImageName(
6762
+ options.registeredName,
6763
+ defaultRegisteredNameFromImage(reference),
6764
+ options.cas ?? true,
6765
+ DEFAULT_IMPORTED_IMAGE_NAME
6766
+ );
6570
6767
  if (effectiveName === DEFAULT_IMAGE_NAME2) {
6571
6768
  console.warn(
6572
6769
  `Importing sandbox image with the default name "${DEFAULT_IMAGE_NAME2}". Pass \`registeredName\` to avoid collisions with other default-named images in this project.`
@@ -6584,14 +6781,15 @@ async function importSandboxImage(imageReference, options = {}, deps = {}) {
6584
6781
  deps._allowPat ? "Missing TENSORLAKE_API_KEY or TENSORLAKE_PAT credentials." : "Missing TENSORLAKE_API_KEY credentials."
6585
6782
  );
6586
6783
  }
6587
- if (options.signal !== void 0 && !options.cas) {
6784
+ const cas = options.cas ?? true;
6785
+ if (options.signal !== void 0 && !cas) {
6588
6786
  throw new Error(
6589
- "signal is only supported for CAS image imports (cas: true); a legacy import has no Image Service build operation to cancel"
6787
+ "signal is not supported for legacy image imports (cas: false): a legacy image import has no build operation to cancel"
6590
6788
  );
6591
6789
  }
6592
6790
  emit({
6593
6791
  type: "status",
6594
- message: `Importing image '${reference}' as '${effectiveName}'...`
6792
+ message: `Importing '${reference}' as ${cas ? "CAS" : "legacy"} image '${effectiveName}'...`
6595
6793
  });
6596
6794
  const binding = loadNativeBinding();
6597
6795
  let emitError;
@@ -6612,7 +6810,7 @@ async function importSandboxImage(imageReference, options = {}, deps = {}) {
6612
6810
  userAgent: void 0,
6613
6811
  dockerCompat: options.dockerCompat ?? false,
6614
6812
  dockerConfigJson: options.dockerConfigJson,
6615
- cas: options.cas ?? false
6813
+ cas
6616
6814
  };
6617
6815
  const forward = (event) => {
6618
6816
  try {
@@ -6621,7 +6819,7 @@ async function importSandboxImage(imageReference, options = {}, deps = {}) {
6621
6819
  emitError ??= error;
6622
6820
  }
6623
6821
  };
6624
- const resultJson = options.cas ? await __runWithInterrupt(
6822
+ const resultJson = cas ? await __runWithInterrupt(
6625
6823
  options.signal,
6626
6824
  (interruptId) => binding.importSandboxImage(nativeOptions, forward, interruptId)
6627
6825
  ) : await binding.importSandboxImage(nativeOptions, forward);
@@ -6678,15 +6876,29 @@ async function deleteSandboxImage(imageName) {
6678
6876
  if (typeof imageName !== "string" || imageName.length === 0) {
6679
6877
  throw new TypeError("imageName must be a non-empty string");
6680
6878
  }
6681
- await loadNativeBinding().deleteSandboxImage(catalogOptionsFromEnv(), imageName);
6879
+ warnIncompleteLegacyCleanup(
6880
+ await loadNativeBinding().deleteSandboxImage(catalogOptionsFromEnv(), imageName)
6881
+ );
6682
6882
  }
6683
6883
  async function deleteSandboxImageWithCredentials(credentials, imageName) {
6684
6884
  if (typeof imageName !== "string" || imageName.length === 0) {
6685
6885
  throw new TypeError("imageName must be a non-empty string");
6686
6886
  }
6687
- await loadNativeBinding().deleteSandboxImage(
6688
- catalogOptionsFromCredentials(credentials),
6689
- imageName
6887
+ warnIncompleteLegacyCleanup(
6888
+ await loadNativeBinding().deleteSandboxImage(
6889
+ catalogOptionsFromCredentials(credentials),
6890
+ imageName
6891
+ )
6892
+ );
6893
+ }
6894
+ function warnIncompleteLegacyCleanup(failure) {
6895
+ if (failure == null) {
6896
+ return;
6897
+ }
6898
+ const legacyImageId = failure.legacyImageId ?? void 0;
6899
+ const label = legacyImageId ? ` (${legacyImageId})` : "";
6900
+ console.warn(
6901
+ `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}").`
6690
6902
  );
6691
6903
  }
6692
6904
  async function findSandboxImageByName(imageName) {
@@ -6730,13 +6942,14 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
6730
6942
  disk_mb: { type: "string" },
6731
6943
  builder_disk_mb: { type: "string" },
6732
6944
  docker_compat: { type: "boolean", default: false },
6733
- public: { type: "boolean", default: false }
6945
+ public: { type: "boolean", default: false },
6946
+ "no-cas": { type: "boolean", default: false }
6734
6947
  }
6735
6948
  });
6736
6949
  const dockerfilePath = parsed.positionals[0];
6737
6950
  if (!dockerfilePath) {
6738
6951
  throw new Error(
6739
- "Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MiB] [--disk_mb MiB] [--builder_disk_mb MiB] [--docker_compat] [--public]"
6952
+ "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]"
6740
6953
  );
6741
6954
  }
6742
6955
  const cpus = parsed.values.cpus != null ? Number(parsed.values.cpus) : void 0;
@@ -6768,7 +6981,8 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
6768
6981
  diskMb,
6769
6982
  builderDiskMb,
6770
6983
  dockerCompat: parsed.values.docker_compat,
6771
- isPublic: parsed.values.public
6984
+ isPublic: parsed.values.public,
6985
+ cas: !parsed.values["no-cas"]
6772
6986
  },
6773
6987
  { emit: ndjsonStdoutEmit, _allowPat: true }
6774
6988
  );
@@ -6784,13 +6998,14 @@ async function runImportSandboxImageCli(argv = process.argv.slice(2)) {
6784
6998
  disk_mb: { type: "string" },
6785
6999
  builder_disk_mb: { type: "string" },
6786
7000
  docker_compat: { type: "boolean", default: false },
6787
- public: { type: "boolean", default: false }
7001
+ public: { type: "boolean", default: false },
7002
+ "no-cas": { type: "boolean", default: false }
6788
7003
  }
6789
7004
  });
6790
7005
  const imageReference = parsed.positionals[0];
6791
7006
  if (!imageReference) {
6792
7007
  throw new Error(
6793
- "Usage: tensorlake-import-sandbox-image <image_reference> [--name NAME] [--cpus N] [--memory MiB] [--disk_mb MiB] [--builder_disk_mb MiB] [--docker_compat] [--public]"
7008
+ "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]"
6794
7009
  );
6795
7010
  }
6796
7011
  const cpus = parsed.values.cpus != null ? Number(parsed.values.cpus) : void 0;
@@ -6822,12 +7037,13 @@ async function runImportSandboxImageCli(argv = process.argv.slice(2)) {
6822
7037
  diskMb,
6823
7038
  builderDiskMb,
6824
7039
  dockerCompat: parsed.values.docker_compat,
6825
- isPublic: parsed.values.public
7040
+ isPublic: parsed.values.public,
7041
+ cas: !parsed.values["no-cas"]
6826
7042
  },
6827
7043
  { emit: ndjsonStdoutEmit, _allowPat: true }
6828
7044
  );
6829
7045
  }
6830
- var cachedNativeBinding, cachedNativeBindingError, DEFAULT_IMAGE_NAME2, __imageBuildInternals;
7046
+ 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;
6831
7047
  var init_sandbox_image = __esm({
6832
7048
  "src/sandbox-image.ts"() {
6833
7049
  "use strict";
@@ -6836,6 +7052,11 @@ var init_sandbox_image = __esm({
6836
7052
  init_native_binding();
6837
7053
  init_image_builds();
6838
7054
  DEFAULT_IMAGE_NAME2 = "default";
7055
+ DEFAULT_SANDBOX_IMAGE_NAME = "sandbox-image";
7056
+ DEFAULT_IMPORTED_IMAGE_NAME = "imported-image";
7057
+ CAS_NAME_SEPARATORS = "._-";
7058
+ RESERVED_IMAGE_NAME_PREFIXES = ["sandbox_template_", "image_", "cas-v1:"];
7059
+ MAX_CAS_IMAGE_NAME_LENGTH = 255;
6839
7060
  __imageBuildInternals = {
6840
7061
  loadNativeBinding: () => loadNativeBinding(),
6841
7062
  buildContextFromEnv: () => buildContextFromEnv(),
@@ -6844,7 +7065,12 @@ var init_sandbox_image = __esm({
6844
7065
  eventToEmitDict: (event) => eventToEmitDict(event),
6845
7066
  imageRequiresContext: (image) => imageRequiresContext(image),
6846
7067
  defaultRegisteredName: (dockerfilePath) => defaultRegisteredName(dockerfilePath),
6847
- defaultRegisteredNameFromImage: (reference) => defaultRegisteredNameFromImage(reference)
7068
+ defaultRegisteredNameFromImage: (reference) => defaultRegisteredNameFromImage(reference),
7069
+ registeredImageName: (explicit, generated, cas, fallback) => registeredImageName(explicit, generated, cas, fallback),
7070
+ casImageNameFrom: (raw, fallback) => casImageNameFrom(raw, fallback),
7071
+ canonicalCasImageName: (name) => canonicalCasImageName(name),
7072
+ isAddressableCasImageName: (name) => isAddressableCasImageName(name),
7073
+ defaultImportedImageName: DEFAULT_IMPORTED_IMAGE_NAME
6848
7074
  };
6849
7075
  }
6850
7076
  });
@@ -7011,10 +7237,12 @@ var CloudClient = class _CloudClient {
7011
7237
  );
7012
7238
  }
7013
7239
  /**
7014
- * Delete a registered sandbox image by name or id through the merged
7015
- * catalog, with this client's credentials: an `image_` id or a name the
7016
- * Image Service knows deletes a CAS image, a `sandbox_template_` id or a
7017
- * name registered only in the platform registry deletes a legacy image.
7240
+ * Delete a registered CAS or legacy sandbox image by name or id through the
7241
+ * merged catalog, with this client's credentials: an `image_` id or a name
7242
+ * the CAS image registry knows deletes a CAS image, a `sandbox_template_` id
7243
+ * or a name registered only in the legacy image registry deletes a legacy
7244
+ * image.
7245
+ * A name is deleted from both the CAS and the legacy image registries.
7018
7246
  * Rejects when neither catalog knows the reference. The same semantics
7019
7247
  * and accepted differences as the module-level `deleteSandboxImage`.
7020
7248
  */
@@ -7022,10 +7250,10 @@ var CloudClient = class _CloudClient {
7022
7250
  await deleteSandboxImageWithCredentials(this.catalogCredentials(), imageName);
7023
7251
  }
7024
7252
  /**
7025
- * Look up a registered sandbox image by name or id through the merged
7026
- * catalog, with this client's credentials. Returns the image in the
7027
- * sandbox-template shape, or `null` when neither the Image Service nor the
7028
- * platform registry knows the reference. An explicit organization/project
7253
+ * Look up a registered CAS or legacy sandbox image by name or id through
7254
+ * the merged catalog, with this client's credentials. Returns the image in
7255
+ * the sandbox-template shape, or `null` when neither the CAS nor the legacy
7256
+ * image registry knows the reference. An explicit organization/project
7029
7257
  * scope (the client's, or the call's override) addresses that project's
7030
7258
  * routes directly, as before; without one the key's own scope applies.
7031
7259
  */
@@ -10413,14 +10641,19 @@ export {
10413
10641
  Headers,
10414
10642
  HttpBody,
10415
10643
  Image,
10644
+ ImageBuildCancellationOutcome,
10416
10645
  ImageBuildCancelledError,
10417
10646
  ImageBuildError,
10647
+ ImageBuildErrorCode,
10418
10648
  ImageBuildFailedError,
10419
10649
  ImageBuildHandle,
10420
10650
  ImageBuildInProgressError,
10421
10651
  ImageBuildInterruptedError,
10652
+ ImageBuildKind,
10422
10653
  ImageBuildNotFoundError,
10423
10654
  ImageBuildOperationType,
10655
+ ImageBuildPhase,
10656
+ ImageBuildStatus,
10424
10657
  ImageBuildTimeoutError,
10425
10658
  MountError,
10426
10659
  OutputMode,