@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
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { C as CloudClientOptions, A as ApplicationManifest, B as BinaryPayload, S as SandboxTemplate, a as ApplicationSummary, R as RequestInput, c as RequestMetadata, b as RequestOutput, d as SecretsList, e as Secret, N as NewSecret, U as UpsertSecretResponse, f as StartImageBuildRequest, g as BuildInfo, h as CreateApplicationBuildRequest, i as ApplicationBuildContext, j as ApplicationBuildResponse, k as BuildLogEntry, F as FileSystem } from './sandbox-image-CAK_K7ND.cjs';
2
- export { l as ApplicationBuildImageResult, m as CreateApplicationBuildImageRequest, n as CreateSandboxImageOptions, I as Image, o as ImageBuildOperation, p as ImageBuildOperationType, p as ImageBuildOperationTypeValue, q as ImageOptions, r as ImportSandboxImageOptions, s as RequestErrorInfo, t as SandboxImageSource, u as SecretsPagination, v as createSandboxImage, w as deleteSandboxImage, x as dockerfileContent, y as findSandboxImageByName, z as importSandboxImage, D as listSandboxImages } from './sandbox-image-CAK_K7ND.cjs';
3
- export { v as APIClient, A as ApplicationCapability, a as ApplicationOptions, F as File, b as FunctionOptions, c as Future, H as Headers, d as HeadersInit, e as HttpBody, P as Parameter, g as RegisteredFunction, h as RemoteOptions, j as RequestContext, S as Schema, l as SimpleApplicationOptions, m as SimpleFunctionOptions, T as TailCall, r as registerApplication, o as registerFunction, p as remoteOptions, q as retries, s as runLocal, t as runRemote, u as schema } from './remote-CC48cvYP.cjs';
1
+ import { C as CloudClientOptions, A as ApplicationManifest, B as BinaryPayload, S as SandboxTemplate, a as ApplicationSummary, R as RequestInput, c as RequestMetadata, b as RequestOutput, d as SecretsList, e as Secret, N as NewSecret, U as UpsertSecretResponse, f as StartImageBuildRequest, g as BuildInfo, h as CreateApplicationBuildRequest, i as ApplicationBuildContext, j as ApplicationBuildResponse, k as BuildLogEntry, I as Image, l as CreateSandboxImageDeps, F as FileSystem } from './sandbox-image-BMiFlzAs.cjs';
2
+ export { m as ApplicationBuildImageResult, n as CreateApplicationBuildImageRequest, o as CreateSandboxImageOptions, p as ImageBuildOperation, q as ImageBuildOperationType, q as ImageBuildOperationTypeValue, r as ImageOptions, s as ImportSandboxImageOptions, t as RequestErrorInfo, u as SandboxImageSource, v as SecretsPagination, w as createSandboxImage, x as deleteSandboxImage, y as dockerfileContent, z as findSandboxImageByName, D as importSandboxImage, E as listSandboxImages } from './sandbox-image-BMiFlzAs.cjs';
3
+ export { v as APIClient, A as ApplicationCapability, a as ApplicationOptions, F as File, b as FunctionOptions, c as Future, H as Headers, d as HeadersInit, e as HttpBody, P as Parameter, g as RegisteredFunction, h as RemoteOptions, j as RequestContext, S as Schema, l as SimpleApplicationOptions, m as SimpleFunctionOptions, T as TailCall, r as registerApplication, o as registerFunction, p as remoteOptions, q as retries, s as runLocal, t as runRemote, u as schema } from './remote-B3vn4tt1.cjs';
4
4
 
5
5
  /** An SDK result paired with its server-side W3C trace ID. */
6
6
  type Traced<T> = T & {
@@ -179,7 +179,10 @@ declare enum SnapshotStatus {
179
179
  IN_PROGRESS = "in_progress",
180
180
  LOCAL_READY = "local_ready",
181
181
  COMPLETED = "completed",
182
- FAILED = "failed"
182
+ FAILED = "failed",
183
+ DELETING = "deleting",
184
+ REPLICATING = "replicating",
185
+ UNKNOWN = "unknown"
183
186
  }
184
187
  /**
185
188
  * Snapshot type for sandbox snapshot creation.
@@ -466,6 +469,11 @@ interface CopySandboxResponse {
466
469
  sandboxes: CopiedSandboxResponse[];
467
470
  }
468
471
  interface SandboxInfo {
472
+ /**
473
+ * The runtime the server chose for this sandbox: `firecracker`,
474
+ * `cloud-hypervisor` or `gvisor`. Informational only; it is never sent and
475
+ * is `firecracker` when the server recorded none.
476
+ */
469
477
  runtime?: string;
470
478
  resourceResize?: SandboxResourceResizeInfo | null;
471
479
  sandboxId: string;
@@ -521,6 +529,8 @@ interface ListArchivedSandboxesResponse {
521
529
  interface CreateSnapshotResponse {
522
530
  snapshotId: string;
523
531
  status: SnapshotStatus;
532
+ /** Original response, populated when decoded by the SDK. */
533
+ raw?: Record<string, unknown>;
524
534
  }
525
535
  interface SnapshotInfo {
526
536
  snapshotId: string;
@@ -528,6 +538,8 @@ interface SnapshotInfo {
528
538
  sandboxId: string;
529
539
  baseImage: string;
530
540
  status: SnapshotStatus;
541
+ /** Original response, populated when decoded by the SDK. */
542
+ raw?: Record<string, unknown>;
531
543
  snapshotType?: SnapshotType;
532
544
  error?: string;
533
545
  snapshotUri?: string;
@@ -1211,9 +1223,8 @@ declare class Sandbox {
1211
1223
  *
1212
1224
  * Resource targets use create's cpus, memoryMb, and diskMb names. Resize
1213
1225
  * waits by default; wait=false returns admission. Timeout does not cancel it.
1214
- * CPU-only CAS sandboxes support CPU, memory, and root-disk resize; GPU CAS sandboxes
1215
- * support only root-disk growth and reject CPU and memory changes.
1216
- * Non-CAS sandboxes do not support live resize.
1226
+ * Which runtimes and dimensions support a live resize is decided by the
1227
+ * server, whose policy error is thrown unchanged.
1217
1228
  * Wait, timeout, and pollInterval are ignored on non-resource updates.
1218
1229
  * A no-op returns current resources with absent or earlier resize metadata.
1219
1230
  *
@@ -1536,9 +1547,9 @@ declare class SandboxClient {
1536
1547
  /** List sandbox processes available as persisted-log filters. */
1537
1548
  listLogProcesses(sandboxId: string): Promise<Traced<SandboxProcessLogFiltersResponse>>;
1538
1549
  /**
1539
- * Update properties or resize a running sandbox. CPU-only CAS sandboxes support
1540
- * CPU, memory, and root-disk resize; GPU CAS sandboxes support only root-disk
1541
- * growth. Non-CAS sandboxes do not support live resize.
1550
+ * Update properties or resize a running sandbox. Which runtimes and
1551
+ * dimensions support a live resize is decided by the server, whose policy
1552
+ * error is thrown unchanged.
1542
1553
  * Resource names match create. Resize waits by default; wait=false returns
1543
1554
  * admission. Timeout leaves the resize running and reports its generation.
1544
1555
  * Wait, timeout, and pollInterval are ignored on non-resource updates.
@@ -1671,6 +1682,8 @@ declare class SandboxClient {
1671
1682
 
1672
1683
  declare class CloudClient {
1673
1684
  private readonly transport;
1685
+ private readonly apiUrl;
1686
+ private readonly apiKey?;
1674
1687
  private readonly organizationId?;
1675
1688
  private readonly projectId?;
1676
1689
  private readonly namespace;
@@ -1679,28 +1692,39 @@ declare class CloudClient {
1679
1692
  close(): void;
1680
1693
  upsertApplication(manifest: ApplicationManifest, codeZip: BinaryPayload, upgradeRunningRequests?: boolean): Promise<void>;
1681
1694
  deleteApplication(applicationName: string): Promise<void>;
1695
+ /**
1696
+ * Delete a registered sandbox image by name or id through the merged
1697
+ * catalog, with this client's credentials: an `image_` id or a name the
1698
+ * Image Service knows deletes a CAS image, a `sandbox_template_` id or a
1699
+ * name registered only in the platform registry deletes a legacy image.
1700
+ * Rejects when neither catalog knows the reference. The same semantics
1701
+ * and accepted differences as the module-level `deleteSandboxImage`.
1702
+ */
1682
1703
  deleteSandboxImage(imageName: string): Promise<void>;
1683
1704
  /**
1684
- * Look up a registered sandbox image (template) by its registered name.
1685
- *
1686
- * Returns the template, or `null` when no image with that name exists.
1687
- * API-key clients may omit organization/project IDs and use the
1688
- * token-scoped Platform API route directly. Explicit scope remains
1689
- * available for PAT callers.
1705
+ * Look up a registered sandbox image by name or id through the merged
1706
+ * catalog, with this client's credentials. Returns the image in the
1707
+ * sandbox-template shape, or `null` when neither the Image Service nor the
1708
+ * platform registry knows the reference. An explicit organization/project
1709
+ * scope (the client's, or the call's override) addresses that project's
1710
+ * routes directly, as before; without one the key's own scope applies.
1690
1711
  */
1691
1712
  findSandboxImageByName(imageName: string, options?: {
1692
1713
  organizationId?: string;
1693
1714
  projectId?: string;
1694
1715
  }): Promise<SandboxTemplate | null>;
1695
1716
  /**
1696
- * List all registered sandbox images (templates), following pagination to
1697
- * the end. API-key clients may omit organization/project IDs and use the
1698
- * token-scoped Platform API route directly.
1717
+ * List every registered sandbox image of the project (CAS and legacy, in
1718
+ * the sandbox-template shape, newest first) through the merged catalog,
1719
+ * with this client's credentials. An explicit organization/project scope
1720
+ * (the client's, or the call's override) addresses that project's routes
1721
+ * directly, as before; without one the key's own scope applies.
1699
1722
  */
1700
1723
  listSandboxImages(options?: {
1701
1724
  organizationId?: string;
1702
1725
  projectId?: string;
1703
1726
  }): Promise<SandboxTemplate[]>;
1727
+ private catalogCredentials;
1704
1728
  applications(): Promise<ApplicationSummary[]>;
1705
1729
  applicationManifest(applicationName: string): Promise<ApplicationManifest>;
1706
1730
  runRequest(applicationName: string, inputs?: RequestInput[]): Promise<string>;
@@ -1735,7 +1759,6 @@ declare class CloudClient {
1735
1759
  private runMultipartRequest;
1736
1760
  private namespacePath;
1737
1761
  private existingApplicationPublicEndpointId;
1738
- private platformProjectPath;
1739
1762
  private secretCollectionPath;
1740
1763
  }
1741
1764
 
@@ -2017,6 +2040,328 @@ declare class RepositoryClient {
2017
2040
  private tracedJson;
2018
2041
  }
2019
2042
 
2043
+ /**
2044
+ * Image Service build operations for CAS sandbox images.
2045
+ *
2046
+ * A CAS (content-addressed streaming) image is built or imported by an Image
2047
+ * Service *build operation*. This module exposes that operation directly:
2048
+ * {@link startImageBuild} / {@link startImageImport} admit a build (and upload
2049
+ * and seal its context) and return an {@link ImageBuildHandle} without
2050
+ * waiting; {@link getImageBuild} looks a build up by id; the handle's
2051
+ * `refresh`, `wait` and `cancel` read, wait for and cancel it.
2052
+ *
2053
+ * **CAS only.** Everything here addresses the Image Service. Legacy images
2054
+ * (`createSandboxImage` without `cas`, `sandbox_template_` ids, `.tlsnap`
2055
+ * snapshots) have no build operation: a `sandbox_template_` or `image_`
2056
+ * reference passed as a build id is refused locally, before any request, and
2057
+ * the legacy functions in `sandbox-image.ts` keep their own requests,
2058
+ * results, errors and interruption behavior.
2059
+ *
2060
+ * Response enum fields map unfamiliar wire values to `UNKNOWN`. `raw` is
2061
+ * diagnostic only and excluded from equality, hashing, and SDK serialization
2062
+ * (`JSON.stringify`). Events retain their original wire strings.
2063
+ *
2064
+ * **Build ids are the immutable record.** An image name and its `image_` id
2065
+ * name the *current* image; a rebuild replaces what they point at. A build id
2066
+ * and its result never change, so `wait` returns this build's own result even
2067
+ * after the image was rebuilt or deleted.
2068
+ *
2069
+ * **Cancellation by build id is sufficient.** Admission returns it, the CLI
2070
+ * prints it, and the `image_build_in_progress` conflict names it as
2071
+ * `activeBuildId`. The client request id (the admission's `Idempotency-Key`)
2072
+ * is kept on the handle only as a recovery aid for a lost admission answer.
2073
+ *
2074
+ * **AbortSignal versus timeout.** An `AbortSignal` passed to the new APIs (and
2075
+ * to `createSandboxImage`/`importSandboxImage` with `cas: true`) *requests
2076
+ * remote cancellation*: the Rust core runs a bounded (30 s) handshake and the
2077
+ * promise rejects with {@link ImageBuildInterruptedError} carrying the
2078
+ * outcome. A wait `timeoutMs` merely stops waiting: it rejects with
2079
+ * {@link ImageBuildTimeoutError} and leaves the build running. Abandoning a
2080
+ * promise, losing the process or dropping a handle never cancels the build.
2081
+ */
2082
+ declare enum ImageBuildStatus {
2083
+ PENDING = "pending",
2084
+ RUNNING = "running",
2085
+ SUCCEEDED = "succeeded",
2086
+ FAILED = "failed",
2087
+ CANCELLED = "cancelled",
2088
+ UNKNOWN = "unknown"
2089
+ }
2090
+ declare enum ImageBuildPhase {
2091
+ AWAITING_CONTEXT = "awaiting_context",
2092
+ STARTING_BUILDER = "starting_builder",
2093
+ EXECUTING = "executing",
2094
+ SNAPSHOTTING = "snapshotting",
2095
+ PUBLISHING = "publishing",
2096
+ FINISHED = "finished",
2097
+ UNKNOWN = "unknown"
2098
+ }
2099
+ declare enum ImageBuildKind {
2100
+ DOCKERFILE = "dockerfile",
2101
+ IMPORT = "import",
2102
+ DIRECT = "direct",
2103
+ UNKNOWN = "unknown"
2104
+ }
2105
+ declare enum ImageBuildCancellationOutcome {
2106
+ CANCELLED = "cancelled",
2107
+ ALREADY_CANCELLED = "already_cancelled",
2108
+ ALREADY_COMPLETED = "already_completed",
2109
+ ALREADY_FAILED = "already_failed",
2110
+ NOT_ADMITTED = "not_admitted",
2111
+ UNCONFIRMED = "unconfirmed",
2112
+ UNKNOWN = "unknown"
2113
+ }
2114
+ declare enum ImageBuildErrorCode {
2115
+ USAGE = "usage",
2116
+ AUTH = "auth",
2117
+ NOT_FOUND = "not_found",
2118
+ IMAGE_BUILD_IN_PROGRESS = "image_build_in_progress",
2119
+ CLIENT_REQUEST_ID_MISMATCH = "client_request_id_mismatch",
2120
+ FAILED = "failed",
2121
+ CANCELLED = "cancelled",
2122
+ TIMEOUT = "timeout",
2123
+ INTERRUPTED = "interrupted",
2124
+ SERVICE = "service",
2125
+ INTERNAL = "internal",
2126
+ UNKNOWN = "unknown"
2127
+ }
2128
+ /** Structured payload the native binding attaches to image-build failures. */
2129
+ interface ImageBuildErrorDetails {
2130
+ code: ImageBuildErrorCode;
2131
+ message: string;
2132
+ buildId?: string | null;
2133
+ clientRequestId?: string | null;
2134
+ imageName?: string | null;
2135
+ activeBuildId?: string | null;
2136
+ activeKind?: ImageBuildKind | null;
2137
+ activeStatus?: ImageBuildStatus | null;
2138
+ error?: string | null;
2139
+ info?: ImageBuildInfo | null;
2140
+ outcome?: ImageBuildCancellationOutcome | null;
2141
+ confirmed?: boolean | null;
2142
+ result?: Record<string, unknown> | null;
2143
+ waitedSecs?: number | null;
2144
+ status?: number | null;
2145
+ }
2146
+ /** An Image Service build operation failed. `code` is stable. */
2147
+ declare class ImageBuildError extends Error {
2148
+ readonly code: ImageBuildErrorCode;
2149
+ readonly buildId?: string;
2150
+ readonly clientRequestId?: string;
2151
+ readonly details: ImageBuildErrorDetails;
2152
+ readonly raw: Readonly<Record<string, unknown>>;
2153
+ constructor(details: ImageBuildErrorDetails);
2154
+ }
2155
+ /**
2156
+ * No such build is visible to the project: unknown, foreign or retired. A
2157
+ * finished build is kept only while it is its image's current build; a later
2158
+ * build of the image or deleting the image retires it.
2159
+ */
2160
+ declare class ImageBuildNotFoundError extends ImageBuildError {
2161
+ constructor(details: ImageBuildErrorDetails);
2162
+ }
2163
+ /**
2164
+ * The image name already has an unfinished build or import. Cancel
2165
+ * `activeBuildId` before starting another; the SDK never does so itself.
2166
+ */
2167
+ declare class ImageBuildInProgressError extends ImageBuildError {
2168
+ readonly imageName?: string;
2169
+ readonly activeBuildId?: string;
2170
+ readonly activeKind?: ImageBuildKind;
2171
+ readonly activeStatus?: ImageBuildStatus;
2172
+ constructor(details: ImageBuildErrorDetails);
2173
+ }
2174
+ /** The service reports the build failed; `error` is its message. */
2175
+ declare class ImageBuildFailedError extends ImageBuildError {
2176
+ readonly error: string;
2177
+ readonly info?: ImageBuildInfo;
2178
+ constructor(details: ImageBuildErrorDetails);
2179
+ }
2180
+ /** The service reports the build was cancelled (a distinct outcome). */
2181
+ declare class ImageBuildCancelledError extends ImageBuildError {
2182
+ readonly info?: ImageBuildInfo;
2183
+ constructor(details: ImageBuildErrorDetails);
2184
+ }
2185
+ /** The caller stopped waiting. The build may still be running. */
2186
+ declare class ImageBuildTimeoutError extends ImageBuildError {
2187
+ constructor(details: ImageBuildErrorDetails);
2188
+ }
2189
+ /**
2190
+ * An `AbortSignal` ran the cancellation handshake. `outcome` is `cancelled`,
2191
+ * `already_completed`, `already_cancelled`, `already_failed`, `not_admitted`
2192
+ * or `unconfirmed`; `confirmed` is true only when the remote build is known
2193
+ * not to publish. `not_admitted` is an observation, not a cancellation.
2194
+ */
2195
+ declare class ImageBuildInterruptedError extends ImageBuildError {
2196
+ readonly outcome: ImageBuildCancellationOutcome;
2197
+ readonly confirmed: boolean;
2198
+ readonly result?: Record<string, unknown>;
2199
+ constructor(details: ImageBuildErrorDetails);
2200
+ }
2201
+ /**
2202
+ * The published image of a succeeded build, in the sandbox-template shape
2203
+ * the merged catalog answers (derived by the core from the Image Service's
2204
+ * trimmed record): one image representation for `findSandboxImageByName`,
2205
+ * `listSandboxImages` and build results.
2206
+ */
2207
+ type ImageBuildResult = SandboxTemplate;
2208
+ /**
2209
+ * One build or import as the Image Service reports it (the twelve-field
2210
+ * `BuildInfo`; the service exposes no cleanup state, phase deadline,
2211
+ * content digest or upload capability on a build).
2212
+ */
2213
+ interface ImageBuildInfo {
2214
+ buildId: string;
2215
+ clientRequestId?: string | null;
2216
+ kind?: ImageBuildKind | null;
2217
+ name?: string | null;
2218
+ status: ImageBuildStatus;
2219
+ phase?: ImageBuildPhase | null;
2220
+ attemptNo: number;
2221
+ builderSandboxId?: string | null;
2222
+ error?: string | null;
2223
+ result?: ImageBuildResult | null;
2224
+ operationDeadlineMs?: number | null;
2225
+ createdAtMs?: number | null;
2226
+ updatedAtMs?: number | null;
2227
+ /** The service record as received, snake_case, with unknown fields. */
2228
+ raw: Record<string, unknown>;
2229
+ }
2230
+ /**
2231
+ * The service's answer to a cancellation. `outcome` is `cancelled`
2232
+ * (durable), `already_cancelled`, `already_completed` (publication won),
2233
+ * `already_failed` or `not_admitted` (nothing indexed under the client
2234
+ * request id: not a cancellation and no promise about a delayed admission).
2235
+ */
2236
+ interface CancelImageBuildOutcome {
2237
+ outcome: ImageBuildCancellationOutcome;
2238
+ build: ImageBuildInfo | null;
2239
+ /** Whether the build is known not to publish. */
2240
+ confirmed: boolean;
2241
+ raw: Record<string, unknown>;
2242
+ }
2243
+ interface ImageBuildEvent {
2244
+ type: string;
2245
+ message?: string;
2246
+ stream?: string;
2247
+ build_id?: string;
2248
+ client_request_id?: string | null;
2249
+ status?: string;
2250
+ phase?: string | null;
2251
+ attempt?: number;
2252
+ outcome?: string;
2253
+ confirmed?: boolean;
2254
+ [key: string]: unknown;
2255
+ }
2256
+ interface ImageBuildWaitOptions {
2257
+ /**
2258
+ * Caller bound in milliseconds on top of the service-informed deadline.
2259
+ * Expiry rejects with {@link ImageBuildTimeoutError} and leaves the build
2260
+ * running; it does not cancel.
2261
+ */
2262
+ timeoutMs?: number;
2263
+ /** Stream `tl-image-builder` output as `build_log` events. */
2264
+ followLogs?: boolean;
2265
+ /** Requests remote cancellation (bounded handshake), unlike `timeoutMs`. */
2266
+ signal?: AbortSignal;
2267
+ /**
2268
+ * Event callback. A throwing callback is recorded and rethrown once the
2269
+ * native call returns; it does not cancel the build.
2270
+ */
2271
+ emit?: (event: ImageBuildEvent) => void;
2272
+ verbose?: boolean;
2273
+ }
2274
+ interface Credentials {
2275
+ apiUrl: string;
2276
+ bearerToken: string;
2277
+ namespace: string;
2278
+ }
2279
+ /**
2280
+ * One admitted CAS build. Holds the build identity and the caller's
2281
+ * credentials; creating or dropping it performs no network I/O.
2282
+ */
2283
+ declare class ImageBuildHandle {
2284
+ #private;
2285
+ readonly buildId: string;
2286
+ /**
2287
+ * The admission's request id, when this handle started the build. Never
2288
+ * needed to cancel; a recovery aid for a lost admission answer.
2289
+ */
2290
+ readonly clientRequestId: string | null;
2291
+ /** @internal */
2292
+ constructor(info: ImageBuildInfo, credentials: Credentials, clientRequestId?: string | null);
2293
+ /** The last observed state. */
2294
+ get info(): ImageBuildInfo;
2295
+ /** Re-read the current state. */
2296
+ refresh(): Promise<ImageBuildInfo>;
2297
+ /**
2298
+ * Wait for publication and return this build's immutable result. See
2299
+ * {@link ImageBuildWaitOptions} for the timeout/abort distinction.
2300
+ */
2301
+ wait(options?: ImageBuildWaitOptions): Promise<ImageBuildResult>;
2302
+ /** Cancel this build by its id (the sufficient selector). */
2303
+ cancel(): Promise<CancelImageBuildOutcome>;
2304
+ }
2305
+ interface StartImageBuildOptions {
2306
+ registeredName?: string;
2307
+ cpus?: number;
2308
+ memoryMb?: number;
2309
+ diskMb?: number;
2310
+ isPublic?: boolean;
2311
+ contextDir?: string;
2312
+ buildArgs?: Record<string, string>;
2313
+ dockerConfigJson?: string;
2314
+ /** Requests remote cancellation of the admission/upload in progress. */
2315
+ signal?: AbortSignal;
2316
+ emit?: (event: ImageBuildEvent) => void;
2317
+ verbose?: boolean;
2318
+ }
2319
+ interface StartImageImportOptions {
2320
+ registeredName?: string;
2321
+ cpus?: number;
2322
+ memoryMb?: number;
2323
+ diskMb?: number;
2324
+ isPublic?: boolean;
2325
+ dockerConfigJson?: string;
2326
+ signal?: AbortSignal;
2327
+ emit?: (event: ImageBuildEvent) => void;
2328
+ verbose?: boolean;
2329
+ }
2330
+ /**
2331
+ * Admit a CAS image build and return without waiting. Parses the source like
2332
+ * `createSandboxImage` with `cas: true`, admits under a fresh client request
2333
+ * id, uploads and seals the context, and returns a handle whose `wait`
2334
+ * finishes the operation. The build keeps running if this process exits.
2335
+ */
2336
+ declare function startImageBuild(source: string | Image, options?: StartImageBuildOptions, deps?: CreateSandboxImageDeps): Promise<ImageBuildHandle>;
2337
+ /** Admit a CAS registry import and return without waiting. */
2338
+ declare function startImageImport(imageReference: string, options?: StartImageImportOptions, deps?: CreateSandboxImageDeps): Promise<ImageBuildHandle>;
2339
+ /**
2340
+ * Look a build up by its service-generated id. Unknown and foreign builds
2341
+ * reject with {@link ImageBuildNotFoundError}; a legacy `sandbox_template_`
2342
+ * or an `image_` reference is refused before any request.
2343
+ */
2344
+ declare function getImageBuild(buildId: string): Promise<ImageBuildHandle>;
2345
+ /**
2346
+ * `getImageBuild(buildId)` then `wait(options)`, as one interruptible
2347
+ * operation: the lookup runs inside the native wait, under the same
2348
+ * `AbortSignal` and `timeoutMs`, so an abort during a slow or stalled first
2349
+ * request still cancels the build by its id.
2350
+ */
2351
+ declare function waitImageBuild(buildId: string, options?: ImageBuildWaitOptions): Promise<ImageBuildResult>;
2352
+ interface CancelImageBuildSelector {
2353
+ /** The sufficient, documented selector. */
2354
+ buildId?: string;
2355
+ /**
2356
+ * Only to recover an admission whose response was lost. Its `not_admitted`
2357
+ * outcome is an observation of absence, not a cancellation, and does not
2358
+ * prevent a delayed admission (cancel again by request id then).
2359
+ */
2360
+ clientRequestId?: string;
2361
+ }
2362
+ /** Cancel a build. Exactly one selector; the build id alone is sufficient. */
2363
+ declare function cancelImageBuild(selector: CancelImageBuildSelector): Promise<CancelImageBuildOutcome>;
2364
+
2020
2365
  /**
2021
2366
  * Compatibility helpers for Artifact Storage filesystems.
2022
2367
  *
@@ -2462,4 +2807,4 @@ declare class RequestExecutionError extends Error {
2462
2807
  constructor(message: string, functionName?: string);
2463
2808
  }
2464
2809
 
2465
- export { ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, type AttachFileSystemOptions, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CheckpointOptions, type CheckpointType, type ClaimSandboxOptions, CliNotFoundError, CloudClient, CloudClientOptions, CommandExitReason, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, type FileEntry, FileNotFoundInFilesystemError, FileSystem, type FileSystemMount, Filesystem, FilesystemAPIError, FilesystemClient, type FilesystemClientOptions, FilesystemError, type FilesystemFileRead, type FilesystemInfo, FilesystemMount, FilesystemNotFoundError, type FilesystemReadOptions, type FilesystemSnapshot, type FilesystemSnapshotInfo, type FilesystemStatus, type FilesystemVersion, type GPUResources, type GetOrCreateOptions, type GetOrCreateOutcome, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type GpuModel, type GpuRequest, type HealthResponse, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, MountError, type MountStatus, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, PendingSandbox, type PendingSandboxRecord, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, ReadOnlyMountNotSupportedError, type ReadyOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RepositoryMount, type RepositoryMountOptions, type RepositoryMountStatus, type RepositoryUnmountOptions, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, ResizeErrorReason, ResizeStatus, type ResourceResizeWaitOptions, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, SandboxPending, SandboxPendingReason, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxResizeError, type SandboxResourceResizeInfo, SandboxStatus, SandboxTemplate, Secret, SecretsList, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, StartImageBuildRequest, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TERMINATION_REASON_CANCELLED, TERMINATION_REASON_NO_CAPACITY, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpdateSandboxOptions, UpsertSecretResponse, createFileSystem, deleteFileSystem, isSandboxPending, listFileSystems, sandboxUrlFromIngressEndpoint };
2810
+ export { ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, type AttachFileSystemOptions, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CancelImageBuildOutcome, type CancelImageBuildSelector, type CheckpointOptions, type CheckpointType, type ClaimSandboxOptions, CliNotFoundError, CloudClient, CloudClientOptions, CommandExitReason, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, type FileEntry, FileNotFoundInFilesystemError, FileSystem, type FileSystemMount, Filesystem, FilesystemAPIError, FilesystemClient, type FilesystemClientOptions, FilesystemError, type FilesystemFileRead, type FilesystemInfo, FilesystemMount, FilesystemNotFoundError, type FilesystemReadOptions, type FilesystemSnapshot, type FilesystemSnapshotInfo, type FilesystemStatus, type FilesystemVersion, type GPUResources, type GetOrCreateOptions, type GetOrCreateOutcome, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type GpuModel, type GpuRequest, type HealthResponse, Image, ImageBuildCancellationOutcome, ImageBuildCancelledError, ImageBuildError, ImageBuildErrorCode, type ImageBuildErrorDetails, type ImageBuildEvent, ImageBuildFailedError, ImageBuildHandle, ImageBuildInProgressError, type ImageBuildInfo, ImageBuildInterruptedError, ImageBuildKind, ImageBuildNotFoundError, ImageBuildPhase, type ImageBuildResult, ImageBuildStatus, ImageBuildTimeoutError, type ImageBuildWaitOptions, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, MountError, type MountStatus, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, PendingSandbox, type PendingSandboxRecord, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, ReadOnlyMountNotSupportedError, type ReadyOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RepositoryMount, type RepositoryMountOptions, type RepositoryMountStatus, type RepositoryUnmountOptions, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, ResizeErrorReason, ResizeStatus, type ResourceResizeWaitOptions, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, SandboxPending, SandboxPendingReason, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxResizeError, type SandboxResourceResizeInfo, SandboxStatus, SandboxTemplate, Secret, SecretsList, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, type StartImageBuildOptions, StartImageBuildRequest, type StartImageImportOptions, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TERMINATION_REASON_CANCELLED, TERMINATION_REASON_NO_CAPACITY, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpdateSandboxOptions, UpsertSecretResponse, cancelImageBuild, createFileSystem, deleteFileSystem, getImageBuild, isSandboxPending, listFileSystems, sandboxUrlFromIngressEndpoint, startImageBuild, startImageImport, waitImageBuild };