@tensorlakeai/tensorlake 0.5.152 → 0.5.154

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 +3596 -3377
  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 +3559 -3340
  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 +1502 -880
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +366 -21
  14. package/dist/index.d.ts +366 -21
  15. package/dist/index.js +1475 -871
  16. package/dist/index.js.map +1 -1
  17. package/dist/{remote-CC48cvYP.d.cts → remote-B3vn4tt1.d.cts} +1 -1
  18. package/dist/{remote-BbSrvgUn.d.ts → remote-DqBUuciu.d.ts} +1 -1
  19. package/dist/{sandbox-image-CAK_K7ND.d.cts → sandbox-image-BMiFlzAs.d.cts} +168 -13
  20. package/dist/{sandbox-image-CAK_K7ND.d.ts → sandbox-image-BMiFlzAs.d.ts} +168 -13
  21. package/dist/sandbox-image.cjs +437 -1300
  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 +436 -1299
  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
@@ -1,4 +1,4 @@
1
- import { C as CloudClientOptions, A as ApplicationManifest, F as FileSystem, a as ApplicationSummary, R as RequestInput, b as RequestOutput, I as Image } from './sandbox-image-CAK_K7ND.cjs';
1
+ import { C as CloudClientOptions, A as ApplicationManifest, F as FileSystem, a as ApplicationSummary, R as RequestInput, b as RequestOutput, I as Image } from './sandbox-image-BMiFlzAs.cjs';
2
2
 
3
3
  declare class APIClient {
4
4
  private readonly cloudClient;
@@ -1,4 +1,4 @@
1
- import { C as CloudClientOptions, A as ApplicationManifest, F as FileSystem, a as ApplicationSummary, R as RequestInput, b as RequestOutput, I as Image } from './sandbox-image-CAK_K7ND.js';
1
+ import { C as CloudClientOptions, A as ApplicationManifest, F as FileSystem, a as ApplicationSummary, R as RequestInput, b as RequestOutput, I as Image } from './sandbox-image-BMiFlzAs.js';
2
2
 
3
3
  declare class APIClient {
4
4
  private readonly cloudClient;
@@ -136,7 +136,14 @@ interface ApplicationBuildResponse {
136
136
  finishedAt?: Date;
137
137
  imageBuilds: ApplicationBuildImageResult[];
138
138
  }
139
- /** A registered sandbox image (template) as returned by the platform API. */
139
+ /**
140
+ * A registered sandbox image in the platform template shape. Both image
141
+ * families answer it: legacy templates verbatim from the platform API, and
142
+ * CAS images (`snapshotFormatVersion === "content_addressed_streaming_v1"`)
143
+ * derived by the core from the Image Service's trimmed record (id, name,
144
+ * snapshot id, visibility, sizes, timestamps); no content digest or build
145
+ * provenance rides on either.
146
+ */
140
147
  interface SandboxTemplate {
141
148
  id?: string;
142
149
  name?: string;
@@ -148,6 +155,10 @@ interface SandboxTemplate {
148
155
  rootfsDiskBytes?: number;
149
156
  rootfsNodeKind?: string;
150
157
  public?: boolean;
158
+ dockerfile?: string;
159
+ createdByUserId?: string;
160
+ createdAt?: string;
161
+ updatedAt?: string;
151
162
  }
152
163
  /** A registered file system as returned by the platform API. */
153
164
  interface FileSystem {
@@ -245,6 +256,25 @@ interface CreateSandboxImageOptions {
245
256
  * memory and disk space on builder sandbox).
246
257
  */
247
258
  dockerCompat?: boolean;
259
+ /**
260
+ * Build a CAS (content-addressed streaming) image through the Image
261
+ * Service instead of a legacy template. Off by default.
262
+ */
263
+ cas?: boolean;
264
+ /**
265
+ * Dockerfile build args (`--build-arg KEY=VALUE`), forwarded to BuildKit
266
+ * and expanded in `FROM` references. CAS builds only; a legacy build with
267
+ * build args is rejected.
268
+ */
269
+ buildArgs?: Record<string, string>;
270
+ /**
271
+ * CAS builds only (`cas: true`): aborting requests *remote cancellation*
272
+ * of the Image Service build through a bounded handshake, and the call
273
+ * rejects with `ImageBuildInterruptedError` carrying the outcome. It is
274
+ * rejected for legacy builds, which have no build operation to cancel.
275
+ * Abandoning the promise alone never cancels anything.
276
+ */
277
+ signal?: AbortSignal;
248
278
  /**
249
279
  * Print build progress to stderr. Ignored when an explicit `emit` is
250
280
  * passed via `deps`. Defaults to false — `createSandboxImage` is silent
@@ -275,6 +305,16 @@ interface ImportSandboxImageOptions {
275
305
  * memory and disk space on builder sandbox).
276
306
  */
277
307
  dockerCompat?: boolean;
308
+ /**
309
+ * Import as a CAS (content-addressed streaming) image through the Image
310
+ * Service instead of a legacy template. Off by default.
311
+ */
312
+ cas?: boolean;
313
+ /**
314
+ * CAS imports only (`cas: true`): aborting requests remote cancellation of
315
+ * the Image Service import; see `CreateSandboxImageOptions.signal`.
316
+ */
317
+ signal?: AbortSignal;
278
318
  /**
279
319
  * Print build progress to stderr. Ignored when an explicit `emit` is
280
320
  * passed via `deps`. Defaults to false.
@@ -309,19 +349,74 @@ interface NativeBindingOptions extends NativeBindingCommonOptions {
309
349
  dockerfilePath: string;
310
350
  dockerfileText?: string | undefined | null;
311
351
  contextDir?: string | undefined | null;
352
+ cas?: boolean | undefined | null;
353
+ buildArgs?: Record<string, string> | undefined | null;
312
354
  }
313
355
  interface NativeBindingImportOptions extends NativeBindingCommonOptions {
314
356
  imageReference: string;
357
+ cas?: boolean | undefined | null;
358
+ }
359
+ /** Credentials and scope for the merged image catalog. */
360
+ interface NativeBindingCatalogOptions {
361
+ apiUrl: string;
362
+ bearerToken: string;
363
+ organizationId?: string | undefined | null;
364
+ projectId?: string | undefined | null;
365
+ useScopeHeaders?: boolean | undefined | null;
366
+ userAgent?: string | undefined | null;
315
367
  }
316
368
  interface NativeBindingEvent {
317
369
  eventType: string;
318
370
  stream?: string | undefined | null;
319
371
  message: string;
372
+ /** CAS build events (`build_accepted`, `build_progress`, `build_terminal`, `interrupted`). */
373
+ buildId?: string | undefined | null;
374
+ clientRequestId?: string | undefined | null;
375
+ status?: string | undefined | null;
376
+ phase?: string | undefined | null;
377
+ attempt?: number | undefined | null;
378
+ outcome?: string | undefined | null;
379
+ confirmed?: boolean | undefined | null;
380
+ }
381
+ /** Credentials and scope for build lookups, waits and cancellations. */
382
+ interface NativeBindingBuildClientOptions {
383
+ apiUrl: string;
384
+ bearerToken: string;
385
+ organizationId?: string | undefined | null;
386
+ projectId?: string | undefined | null;
387
+ namespace?: string | undefined | null;
388
+ useScopeHeaders?: boolean | undefined | null;
389
+ userAgent?: string | undefined | null;
320
390
  }
321
391
  interface NativeBinding {
322
392
  loadDockerConfigJson(): string;
323
- buildSandboxImage(options: NativeBindingOptions, emit?: ((event: NativeBindingEvent) => void) | null | undefined): Promise<string>;
324
- importSandboxImage(options: NativeBindingImportOptions, emit?: ((event: NativeBindingEvent) => void) | null | undefined): Promise<string>;
393
+ /** `interruptId` is honored for CAS builds only; legacy builds ignore it. */
394
+ buildSandboxImage(options: NativeBindingOptions, emit?: ((event: NativeBindingEvent) => void) | null | undefined, interruptId?: number | undefined | null): Promise<string>;
395
+ importSandboxImage(options: NativeBindingImportOptions, emit?: ((event: NativeBindingEvent) => void) | null | undefined, interruptId?: number | undefined | null): Promise<string>;
396
+ createImageBuildInterrupt(): number;
397
+ triggerImageBuildInterrupt(id: number): void;
398
+ releaseImageBuildInterrupt(id: number): void;
399
+ /** JSON `{build, client_request_id}` after admission (and context seal). */
400
+ startImageBuild(options: Omit<NativeBindingOptions, "builderDiskMb" | "dockerCompat">, emit?: ((event: NativeBindingEvent) => void) | null | undefined, interruptId?: number | undefined | null): Promise<string>;
401
+ startImageImport(options: Omit<NativeBindingImportOptions, "builderDiskMb" | "dockerCompat">, emit?: ((event: NativeBindingEvent) => void) | null | undefined, interruptId?: number | undefined | null): Promise<string>;
402
+ /** BuildInfo JSON. */
403
+ getImageBuild(options: NativeBindingBuildClientOptions, buildId: string): Promise<string>;
404
+ /** The build's immutable result JSON. */
405
+ waitImageBuild(options: NativeBindingBuildClientOptions, buildId: string, wait: {
406
+ timeoutMs?: number | undefined | null;
407
+ followLogs?: boolean | undefined | null;
408
+ }, emit?: ((event: NativeBindingEvent) => void) | null | undefined, interruptId?: number | undefined | null): Promise<string>;
409
+ /** JSON `{outcome, build}`. */
410
+ cancelImageBuild(options: NativeBindingBuildClientOptions, selector: {
411
+ buildId?: string | undefined | null;
412
+ clientRequestId?: string | undefined | null;
413
+ }): Promise<string>;
414
+ /** JSON array of every image of both families, newest first. */
415
+ listSandboxImages(options: NativeBindingCatalogOptions): Promise<string>;
416
+ /** JSON record of one image by name or id, or null when unknown. */
417
+ findSandboxImage(options: NativeBindingCatalogOptions, reference: string): Promise<string | null>;
418
+ /** Delete one image by name or id; unknown in both catalogs rejects. */
419
+ deleteSandboxImage(options: NativeBindingCatalogOptions, reference: string): Promise<void>;
325
420
  }
326
421
  /** Test seam: replace the native binding with a stub. */
327
422
  declare function __setNativeBindingForTest(binding: NativeBinding | undefined): void;
@@ -335,6 +430,21 @@ interface BuildContext {
335
430
  debug: boolean;
336
431
  }
337
432
  declare function buildContextFromEnv(): BuildContext;
433
+ /**
434
+ * @internal Shared with `image-builds.ts`, which implements the Image
435
+ * Service build operations on top of the same native binding and
436
+ * environment context.
437
+ */
438
+ declare const __imageBuildInternals: {
439
+ loadNativeBinding: () => NativeBinding;
440
+ buildContextFromEnv: () => BuildContext;
441
+ stderrEmit: (event: Record<string, unknown>) => void;
442
+ noopEmit: (event: Record<string, unknown>) => void;
443
+ eventToEmitDict: (event: NativeBindingEvent) => Record<string, unknown>;
444
+ imageRequiresContext: (image: Image) => boolean;
445
+ defaultRegisteredName: (dockerfilePath: string) => string;
446
+ defaultRegisteredNameFromImage: (reference: string) => string;
447
+ };
338
448
  declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
339
449
  /**
340
450
  * Import a registry image directly into a sandbox image — no Docker.
@@ -348,24 +458,69 @@ declare function createSandboxImage(source: SandboxImageSource, options?: Create
348
458
  * registry.
349
459
  */
350
460
  declare function importSandboxImage(imageReference: string, options?: ImportSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
351
- declare function deleteSandboxImage(imageName: string): Promise<void>;
461
+ /** Credentials the merged-catalog operations run with. */
462
+ interface SandboxImageCatalogCredentials {
463
+ apiUrl?: string;
464
+ apiKey?: string;
465
+ organizationId?: string;
466
+ projectId?: string;
467
+ }
352
468
  /**
353
- * Look up a registered sandbox image by its registered name.
469
+ * Delete a registered sandbox image by name or id. Both families are
470
+ * covered: an `image_` id or a name registered in the Image Service deletes
471
+ * a CAS image, a `sandbox_template_` id or a name registered only in the
472
+ * platform registry deletes a legacy image. Rejects when neither catalog
473
+ * knows the reference.
474
+ *
475
+ * Deleting removes a *published* image. An unfinished CAS build is cancelled
476
+ * with `cancelImageBuild({ buildId })` (or `tl sbx image build cancel
477
+ * BUILD_ID`), never by deleting its name: a name whose only state is an
478
+ * unfinished first build has no image, so the Image Service answers 404 and
479
+ * the lookup falls through to the platform registry as usual. A 202
480
+ * (deletion in progress) counts as success; a 409 `image_build_in_progress`,
481
+ * a 5xx or a transport failure rejects as is and never falls through.
354
482
  *
355
- * Returns the registered sandbox template, or `null` if no image with that
356
- * name exists. Uses the same environment-based Tensorlake auth as
357
- * `createSandboxImage`. Ingress derives project scope from the API key.
483
+ * Accepted merged-catalog differences from the released SDKs, for legacy
484
+ * images: this deletes the platform-api template itself (the released SDKs
485
+ * only removed the engine registration and left the template listed), and
486
+ * an unknown name rejects instead of succeeding silently.
358
487
  */
359
- declare function findSandboxImageByName(imageName: string): Promise<SandboxTemplate | null>;
488
+ declare function deleteSandboxImage(imageName: string): Promise<void>;
489
+ /** @internal `APIClient.deleteSandboxImage` with the client's credentials. */
490
+ declare function deleteSandboxImageWithCredentials(credentials: SandboxImageCatalogCredentials, imageName: string): Promise<void>;
360
491
  /**
361
- * List all registered sandbox images for the current project.
492
+ * Look up a registered sandbox image by its registered name or id.
362
493
  *
363
- * Returns the registered sandbox templates (each with `id`, `name`,
364
- * `snapshotId`, `public`, etc.). Uses the same environment-based Tensorlake
494
+ * Returns the image in the sandbox-template shape (CAS images carry
495
+ * `snapshotFormatVersion === "content_addressed_streaming_v1"`; the shape is
496
+ * derived from the Image Service's trimmed record, so no content digest or
497
+ * build provenance rides on it), or `null` if neither the Image Service nor
498
+ * the platform registry knows the reference. Uses the same environment-based Tensorlake
365
499
  * auth as `createSandboxImage`. Ingress derives project scope from the API key.
500
+ *
501
+ * An `image_` id names the *current* image under its name; a rebuild
502
+ * replaces it. A build's own immutable result is read with `getImageBuild`.
503
+ *
504
+ * Accepted merged-catalog difference from the released SDKs, for legacy
505
+ * images: a name that fits the Image Service grammar is looked up there first
506
+ * and only a clean 404 falls through to the platform registry, so Image
507
+ * Service unavailability (or a deploy 5xx) rejects the lookup of a legacy name
508
+ * where the released SDKs touched only platform-api. A `sandbox_template_` id
509
+ * never consults the Image Service.
510
+ */
511
+ declare function findSandboxImageByName(imageName: string): Promise<SandboxTemplate | null>;
512
+ /** @internal `CloudClient.findSandboxImageByName` with the client's credentials. */
513
+ declare function findSandboxImageByNameWithCredentials(credentials: SandboxImageCatalogCredentials, imageName: string): Promise<SandboxTemplate | null>;
514
+ /**
515
+ * List all registered sandbox images for the current project: every CAS and
516
+ * legacy image in the sandbox-template shape, newest first. Uses the same
517
+ * environment-based Tensorlake auth as `createSandboxImage`. Ingress derives
518
+ * project scope from the API key.
366
519
  */
367
520
  declare function listSandboxImages(): Promise<SandboxTemplate[]>;
521
+ /** @internal `CloudClient.listSandboxImages` with the client's credentials. */
522
+ declare function listSandboxImagesWithCredentials(credentials: SandboxImageCatalogCredentials): Promise<SandboxTemplate[]>;
368
523
  declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
369
524
  declare function runImportSandboxImageCli(argv?: string[]): Promise<void>;
370
525
 
371
- export { type ApplicationManifest as A, type BinaryPayload as B, type CloudClientOptions as C, listSandboxImages as D, type BuildContext as E, type FileSystem as F, type CreateSandboxImageDeps as G, buildContextFromEnv as H, Image as I, runCreateSandboxImageCli as J, runImportSandboxImageCli as K, type NewSecret as N, type RequestInput as R, type SandboxTemplate as S, type UpsertSecretResponse as U, __setNativeBindingForTest as _, type ApplicationSummary as a, type RequestOutput as b, type RequestMetadata as c, type SecretsList as d, type Secret as e, type StartImageBuildRequest as f, type BuildInfo as g, type CreateApplicationBuildRequest as h, type ApplicationBuildContext as i, type ApplicationBuildResponse as j, type BuildLogEntry as k, type ApplicationBuildImageResult as l, type CreateApplicationBuildImageRequest as m, type CreateSandboxImageOptions as n, type ImageBuildOperation as o, ImageBuildOperationType as p, type ImageOptions as q, type ImportSandboxImageOptions as r, type RequestErrorInfo as s, type SandboxImageSource as t, type SecretsPagination as u, createSandboxImage as v, deleteSandboxImage as w, dockerfileContent as x, findSandboxImageByName as y, importSandboxImage as z };
526
+ export { type ApplicationManifest as A, type BinaryPayload as B, type CloudClientOptions as C, importSandboxImage as D, listSandboxImages as E, type FileSystem as F, type BuildContext as G, type SandboxImageCatalogCredentials as H, Image as I, __setNativeBindingForTest as J, buildContextFromEnv as K, deleteSandboxImageWithCredentials as L, findSandboxImageByNameWithCredentials as M, type NewSecret as N, listSandboxImagesWithCredentials as O, runCreateSandboxImageCli as P, runImportSandboxImageCli as Q, type RequestInput as R, type SandboxTemplate as S, type UpsertSecretResponse as U, __imageBuildInternals as _, type ApplicationSummary as a, type RequestOutput as b, type RequestMetadata as c, type SecretsList as d, type Secret as e, type StartImageBuildRequest as f, type BuildInfo as g, type CreateApplicationBuildRequest as h, type ApplicationBuildContext as i, type ApplicationBuildResponse as j, type BuildLogEntry as k, type CreateSandboxImageDeps as l, type ApplicationBuildImageResult as m, type CreateApplicationBuildImageRequest as n, type CreateSandboxImageOptions as o, type ImageBuildOperation as p, ImageBuildOperationType as q, type ImageOptions as r, type ImportSandboxImageOptions as s, type RequestErrorInfo as t, type SandboxImageSource as u, type SecretsPagination as v, createSandboxImage as w, deleteSandboxImage as x, dockerfileContent as y, findSandboxImageByName as z };
@@ -136,7 +136,14 @@ interface ApplicationBuildResponse {
136
136
  finishedAt?: Date;
137
137
  imageBuilds: ApplicationBuildImageResult[];
138
138
  }
139
- /** A registered sandbox image (template) as returned by the platform API. */
139
+ /**
140
+ * A registered sandbox image in the platform template shape. Both image
141
+ * families answer it: legacy templates verbatim from the platform API, and
142
+ * CAS images (`snapshotFormatVersion === "content_addressed_streaming_v1"`)
143
+ * derived by the core from the Image Service's trimmed record (id, name,
144
+ * snapshot id, visibility, sizes, timestamps); no content digest or build
145
+ * provenance rides on either.
146
+ */
140
147
  interface SandboxTemplate {
141
148
  id?: string;
142
149
  name?: string;
@@ -148,6 +155,10 @@ interface SandboxTemplate {
148
155
  rootfsDiskBytes?: number;
149
156
  rootfsNodeKind?: string;
150
157
  public?: boolean;
158
+ dockerfile?: string;
159
+ createdByUserId?: string;
160
+ createdAt?: string;
161
+ updatedAt?: string;
151
162
  }
152
163
  /** A registered file system as returned by the platform API. */
153
164
  interface FileSystem {
@@ -245,6 +256,25 @@ interface CreateSandboxImageOptions {
245
256
  * memory and disk space on builder sandbox).
246
257
  */
247
258
  dockerCompat?: boolean;
259
+ /**
260
+ * Build a CAS (content-addressed streaming) image through the Image
261
+ * Service instead of a legacy template. Off by default.
262
+ */
263
+ cas?: boolean;
264
+ /**
265
+ * Dockerfile build args (`--build-arg KEY=VALUE`), forwarded to BuildKit
266
+ * and expanded in `FROM` references. CAS builds only; a legacy build with
267
+ * build args is rejected.
268
+ */
269
+ buildArgs?: Record<string, string>;
270
+ /**
271
+ * CAS builds only (`cas: true`): aborting requests *remote cancellation*
272
+ * of the Image Service build through a bounded handshake, and the call
273
+ * rejects with `ImageBuildInterruptedError` carrying the outcome. It is
274
+ * rejected for legacy builds, which have no build operation to cancel.
275
+ * Abandoning the promise alone never cancels anything.
276
+ */
277
+ signal?: AbortSignal;
248
278
  /**
249
279
  * Print build progress to stderr. Ignored when an explicit `emit` is
250
280
  * passed via `deps`. Defaults to false — `createSandboxImage` is silent
@@ -275,6 +305,16 @@ interface ImportSandboxImageOptions {
275
305
  * memory and disk space on builder sandbox).
276
306
  */
277
307
  dockerCompat?: boolean;
308
+ /**
309
+ * Import as a CAS (content-addressed streaming) image through the Image
310
+ * Service instead of a legacy template. Off by default.
311
+ */
312
+ cas?: boolean;
313
+ /**
314
+ * CAS imports only (`cas: true`): aborting requests remote cancellation of
315
+ * the Image Service import; see `CreateSandboxImageOptions.signal`.
316
+ */
317
+ signal?: AbortSignal;
278
318
  /**
279
319
  * Print build progress to stderr. Ignored when an explicit `emit` is
280
320
  * passed via `deps`. Defaults to false.
@@ -309,19 +349,74 @@ interface NativeBindingOptions extends NativeBindingCommonOptions {
309
349
  dockerfilePath: string;
310
350
  dockerfileText?: string | undefined | null;
311
351
  contextDir?: string | undefined | null;
352
+ cas?: boolean | undefined | null;
353
+ buildArgs?: Record<string, string> | undefined | null;
312
354
  }
313
355
  interface NativeBindingImportOptions extends NativeBindingCommonOptions {
314
356
  imageReference: string;
357
+ cas?: boolean | undefined | null;
358
+ }
359
+ /** Credentials and scope for the merged image catalog. */
360
+ interface NativeBindingCatalogOptions {
361
+ apiUrl: string;
362
+ bearerToken: string;
363
+ organizationId?: string | undefined | null;
364
+ projectId?: string | undefined | null;
365
+ useScopeHeaders?: boolean | undefined | null;
366
+ userAgent?: string | undefined | null;
315
367
  }
316
368
  interface NativeBindingEvent {
317
369
  eventType: string;
318
370
  stream?: string | undefined | null;
319
371
  message: string;
372
+ /** CAS build events (`build_accepted`, `build_progress`, `build_terminal`, `interrupted`). */
373
+ buildId?: string | undefined | null;
374
+ clientRequestId?: string | undefined | null;
375
+ status?: string | undefined | null;
376
+ phase?: string | undefined | null;
377
+ attempt?: number | undefined | null;
378
+ outcome?: string | undefined | null;
379
+ confirmed?: boolean | undefined | null;
380
+ }
381
+ /** Credentials and scope for build lookups, waits and cancellations. */
382
+ interface NativeBindingBuildClientOptions {
383
+ apiUrl: string;
384
+ bearerToken: string;
385
+ organizationId?: string | undefined | null;
386
+ projectId?: string | undefined | null;
387
+ namespace?: string | undefined | null;
388
+ useScopeHeaders?: boolean | undefined | null;
389
+ userAgent?: string | undefined | null;
320
390
  }
321
391
  interface NativeBinding {
322
392
  loadDockerConfigJson(): string;
323
- buildSandboxImage(options: NativeBindingOptions, emit?: ((event: NativeBindingEvent) => void) | null | undefined): Promise<string>;
324
- importSandboxImage(options: NativeBindingImportOptions, emit?: ((event: NativeBindingEvent) => void) | null | undefined): Promise<string>;
393
+ /** `interruptId` is honored for CAS builds only; legacy builds ignore it. */
394
+ buildSandboxImage(options: NativeBindingOptions, emit?: ((event: NativeBindingEvent) => void) | null | undefined, interruptId?: number | undefined | null): Promise<string>;
395
+ importSandboxImage(options: NativeBindingImportOptions, emit?: ((event: NativeBindingEvent) => void) | null | undefined, interruptId?: number | undefined | null): Promise<string>;
396
+ createImageBuildInterrupt(): number;
397
+ triggerImageBuildInterrupt(id: number): void;
398
+ releaseImageBuildInterrupt(id: number): void;
399
+ /** JSON `{build, client_request_id}` after admission (and context seal). */
400
+ startImageBuild(options: Omit<NativeBindingOptions, "builderDiskMb" | "dockerCompat">, emit?: ((event: NativeBindingEvent) => void) | null | undefined, interruptId?: number | undefined | null): Promise<string>;
401
+ startImageImport(options: Omit<NativeBindingImportOptions, "builderDiskMb" | "dockerCompat">, emit?: ((event: NativeBindingEvent) => void) | null | undefined, interruptId?: number | undefined | null): Promise<string>;
402
+ /** BuildInfo JSON. */
403
+ getImageBuild(options: NativeBindingBuildClientOptions, buildId: string): Promise<string>;
404
+ /** The build's immutable result JSON. */
405
+ waitImageBuild(options: NativeBindingBuildClientOptions, buildId: string, wait: {
406
+ timeoutMs?: number | undefined | null;
407
+ followLogs?: boolean | undefined | null;
408
+ }, emit?: ((event: NativeBindingEvent) => void) | null | undefined, interruptId?: number | undefined | null): Promise<string>;
409
+ /** JSON `{outcome, build}`. */
410
+ cancelImageBuild(options: NativeBindingBuildClientOptions, selector: {
411
+ buildId?: string | undefined | null;
412
+ clientRequestId?: string | undefined | null;
413
+ }): Promise<string>;
414
+ /** JSON array of every image of both families, newest first. */
415
+ listSandboxImages(options: NativeBindingCatalogOptions): Promise<string>;
416
+ /** JSON record of one image by name or id, or null when unknown. */
417
+ findSandboxImage(options: NativeBindingCatalogOptions, reference: string): Promise<string | null>;
418
+ /** Delete one image by name or id; unknown in both catalogs rejects. */
419
+ deleteSandboxImage(options: NativeBindingCatalogOptions, reference: string): Promise<void>;
325
420
  }
326
421
  /** Test seam: replace the native binding with a stub. */
327
422
  declare function __setNativeBindingForTest(binding: NativeBinding | undefined): void;
@@ -335,6 +430,21 @@ interface BuildContext {
335
430
  debug: boolean;
336
431
  }
337
432
  declare function buildContextFromEnv(): BuildContext;
433
+ /**
434
+ * @internal Shared with `image-builds.ts`, which implements the Image
435
+ * Service build operations on top of the same native binding and
436
+ * environment context.
437
+ */
438
+ declare const __imageBuildInternals: {
439
+ loadNativeBinding: () => NativeBinding;
440
+ buildContextFromEnv: () => BuildContext;
441
+ stderrEmit: (event: Record<string, unknown>) => void;
442
+ noopEmit: (event: Record<string, unknown>) => void;
443
+ eventToEmitDict: (event: NativeBindingEvent) => Record<string, unknown>;
444
+ imageRequiresContext: (image: Image) => boolean;
445
+ defaultRegisteredName: (dockerfilePath: string) => string;
446
+ defaultRegisteredNameFromImage: (reference: string) => string;
447
+ };
338
448
  declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
339
449
  /**
340
450
  * Import a registry image directly into a sandbox image — no Docker.
@@ -348,24 +458,69 @@ declare function createSandboxImage(source: SandboxImageSource, options?: Create
348
458
  * registry.
349
459
  */
350
460
  declare function importSandboxImage(imageReference: string, options?: ImportSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
351
- declare function deleteSandboxImage(imageName: string): Promise<void>;
461
+ /** Credentials the merged-catalog operations run with. */
462
+ interface SandboxImageCatalogCredentials {
463
+ apiUrl?: string;
464
+ apiKey?: string;
465
+ organizationId?: string;
466
+ projectId?: string;
467
+ }
352
468
  /**
353
- * Look up a registered sandbox image by its registered name.
469
+ * Delete a registered sandbox image by name or id. Both families are
470
+ * covered: an `image_` id or a name registered in the Image Service deletes
471
+ * a CAS image, a `sandbox_template_` id or a name registered only in the
472
+ * platform registry deletes a legacy image. Rejects when neither catalog
473
+ * knows the reference.
474
+ *
475
+ * Deleting removes a *published* image. An unfinished CAS build is cancelled
476
+ * with `cancelImageBuild({ buildId })` (or `tl sbx image build cancel
477
+ * BUILD_ID`), never by deleting its name: a name whose only state is an
478
+ * unfinished first build has no image, so the Image Service answers 404 and
479
+ * the lookup falls through to the platform registry as usual. A 202
480
+ * (deletion in progress) counts as success; a 409 `image_build_in_progress`,
481
+ * a 5xx or a transport failure rejects as is and never falls through.
354
482
  *
355
- * Returns the registered sandbox template, or `null` if no image with that
356
- * name exists. Uses the same environment-based Tensorlake auth as
357
- * `createSandboxImage`. Ingress derives project scope from the API key.
483
+ * Accepted merged-catalog differences from the released SDKs, for legacy
484
+ * images: this deletes the platform-api template itself (the released SDKs
485
+ * only removed the engine registration and left the template listed), and
486
+ * an unknown name rejects instead of succeeding silently.
358
487
  */
359
- declare function findSandboxImageByName(imageName: string): Promise<SandboxTemplate | null>;
488
+ declare function deleteSandboxImage(imageName: string): Promise<void>;
489
+ /** @internal `APIClient.deleteSandboxImage` with the client's credentials. */
490
+ declare function deleteSandboxImageWithCredentials(credentials: SandboxImageCatalogCredentials, imageName: string): Promise<void>;
360
491
  /**
361
- * List all registered sandbox images for the current project.
492
+ * Look up a registered sandbox image by its registered name or id.
362
493
  *
363
- * Returns the registered sandbox templates (each with `id`, `name`,
364
- * `snapshotId`, `public`, etc.). Uses the same environment-based Tensorlake
494
+ * Returns the image in the sandbox-template shape (CAS images carry
495
+ * `snapshotFormatVersion === "content_addressed_streaming_v1"`; the shape is
496
+ * derived from the Image Service's trimmed record, so no content digest or
497
+ * build provenance rides on it), or `null` if neither the Image Service nor
498
+ * the platform registry knows the reference. Uses the same environment-based Tensorlake
365
499
  * auth as `createSandboxImage`. Ingress derives project scope from the API key.
500
+ *
501
+ * An `image_` id names the *current* image under its name; a rebuild
502
+ * replaces it. A build's own immutable result is read with `getImageBuild`.
503
+ *
504
+ * Accepted merged-catalog difference from the released SDKs, for legacy
505
+ * images: a name that fits the Image Service grammar is looked up there first
506
+ * and only a clean 404 falls through to the platform registry, so Image
507
+ * Service unavailability (or a deploy 5xx) rejects the lookup of a legacy name
508
+ * where the released SDKs touched only platform-api. A `sandbox_template_` id
509
+ * never consults the Image Service.
510
+ */
511
+ declare function findSandboxImageByName(imageName: string): Promise<SandboxTemplate | null>;
512
+ /** @internal `CloudClient.findSandboxImageByName` with the client's credentials. */
513
+ declare function findSandboxImageByNameWithCredentials(credentials: SandboxImageCatalogCredentials, imageName: string): Promise<SandboxTemplate | null>;
514
+ /**
515
+ * List all registered sandbox images for the current project: every CAS and
516
+ * legacy image in the sandbox-template shape, newest first. Uses the same
517
+ * environment-based Tensorlake auth as `createSandboxImage`. Ingress derives
518
+ * project scope from the API key.
366
519
  */
367
520
  declare function listSandboxImages(): Promise<SandboxTemplate[]>;
521
+ /** @internal `CloudClient.listSandboxImages` with the client's credentials. */
522
+ declare function listSandboxImagesWithCredentials(credentials: SandboxImageCatalogCredentials): Promise<SandboxTemplate[]>;
368
523
  declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
369
524
  declare function runImportSandboxImageCli(argv?: string[]): Promise<void>;
370
525
 
371
- export { type ApplicationManifest as A, type BinaryPayload as B, type CloudClientOptions as C, listSandboxImages as D, type BuildContext as E, type FileSystem as F, type CreateSandboxImageDeps as G, buildContextFromEnv as H, Image as I, runCreateSandboxImageCli as J, runImportSandboxImageCli as K, type NewSecret as N, type RequestInput as R, type SandboxTemplate as S, type UpsertSecretResponse as U, __setNativeBindingForTest as _, type ApplicationSummary as a, type RequestOutput as b, type RequestMetadata as c, type SecretsList as d, type Secret as e, type StartImageBuildRequest as f, type BuildInfo as g, type CreateApplicationBuildRequest as h, type ApplicationBuildContext as i, type ApplicationBuildResponse as j, type BuildLogEntry as k, type ApplicationBuildImageResult as l, type CreateApplicationBuildImageRequest as m, type CreateSandboxImageOptions as n, type ImageBuildOperation as o, ImageBuildOperationType as p, type ImageOptions as q, type ImportSandboxImageOptions as r, type RequestErrorInfo as s, type SandboxImageSource as t, type SecretsPagination as u, createSandboxImage as v, deleteSandboxImage as w, dockerfileContent as x, findSandboxImageByName as y, importSandboxImage as z };
526
+ export { type ApplicationManifest as A, type BinaryPayload as B, type CloudClientOptions as C, importSandboxImage as D, listSandboxImages as E, type FileSystem as F, type BuildContext as G, type SandboxImageCatalogCredentials as H, Image as I, __setNativeBindingForTest as J, buildContextFromEnv as K, deleteSandboxImageWithCredentials as L, findSandboxImageByNameWithCredentials as M, type NewSecret as N, listSandboxImagesWithCredentials as O, runCreateSandboxImageCli as P, runImportSandboxImageCli as Q, type RequestInput as R, type SandboxTemplate as S, type UpsertSecretResponse as U, __imageBuildInternals as _, type ApplicationSummary as a, type RequestOutput as b, type RequestMetadata as c, type SecretsList as d, type Secret as e, type StartImageBuildRequest as f, type BuildInfo as g, type CreateApplicationBuildRequest as h, type ApplicationBuildContext as i, type ApplicationBuildResponse as j, type BuildLogEntry as k, type CreateSandboxImageDeps as l, type ApplicationBuildImageResult as m, type CreateApplicationBuildImageRequest as n, type CreateSandboxImageOptions as o, type ImageBuildOperation as p, ImageBuildOperationType as q, type ImageOptions as r, type ImportSandboxImageOptions as s, type RequestErrorInfo as t, type SandboxImageSource as u, type SecretsPagination as v, createSandboxImage as w, deleteSandboxImage as x, dockerfileContent as y, findSandboxImageByName as z };