@enclave-run/sdk 0.0.0-dev.4 → 0.0.0-dev.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1605,10 +1605,13 @@ interface paths {
1605
1605
  path?: never;
1606
1606
  cookie?: never;
1607
1607
  };
1608
- /** @description Get desired and locally observed activation for one template region. */
1608
+ /** @description Get desired and locally observed activation for one exact template build in a region. */
1609
1609
  get: {
1610
1610
  parameters: {
1611
- query?: never;
1611
+ query?: {
1612
+ /** @description Exact immutable build generation. When omitted, the build selected by the template identifier's tag (default when untagged) is used. */
1613
+ buildID?: string;
1614
+ };
1612
1615
  header?: never;
1613
1616
  path: {
1614
1617
  region: string;
@@ -1858,6 +1861,92 @@ interface paths {
1858
1861
  patch?: never;
1859
1862
  trace?: never;
1860
1863
  };
1864
+ "/templates/{templateID}/tags/{tag}": {
1865
+ parameters: {
1866
+ query?: never;
1867
+ header?: never;
1868
+ path?: never;
1869
+ cookie?: never;
1870
+ };
1871
+ /** @description Get the authoritative build and version selected by one template tag. */
1872
+ get: {
1873
+ parameters: {
1874
+ query?: never;
1875
+ header?: never;
1876
+ path: {
1877
+ tag: string;
1878
+ templateID: components["parameters"]["templateID"];
1879
+ };
1880
+ cookie?: never;
1881
+ };
1882
+ requestBody?: never;
1883
+ responses: {
1884
+ /** @description Current tag head. */
1885
+ 200: {
1886
+ headers: {
1887
+ [name: string]: unknown;
1888
+ };
1889
+ content: {
1890
+ "application/json": components["schemas"]["TemplateTagHead"];
1891
+ };
1892
+ };
1893
+ 400: components["responses"]["400"];
1894
+ 401: components["responses"]["401"];
1895
+ 403: components["responses"]["403"];
1896
+ 404: components["responses"]["404"];
1897
+ 409: components["responses"]["409"];
1898
+ 500: components["responses"]["500"];
1899
+ };
1900
+ };
1901
+ /** @description Atomically move one template tag when its build and version still match. */
1902
+ put: {
1903
+ parameters: {
1904
+ query?: never;
1905
+ header?: never;
1906
+ path: {
1907
+ tag: string;
1908
+ templateID: components["parameters"]["templateID"];
1909
+ };
1910
+ cookie?: never;
1911
+ };
1912
+ requestBody: {
1913
+ content: {
1914
+ "application/json": components["schemas"]["AssignTemplateTagHeadRequest"];
1915
+ };
1916
+ };
1917
+ responses: {
1918
+ /** @description Tag head advanced atomically. */
1919
+ 200: {
1920
+ headers: {
1921
+ [name: string]: unknown;
1922
+ };
1923
+ content: {
1924
+ "application/json": components["schemas"]["TemplateTagHead"];
1925
+ };
1926
+ };
1927
+ 400: components["responses"]["400"];
1928
+ 401: components["responses"]["401"];
1929
+ 403: components["responses"]["403"];
1930
+ 404: components["responses"]["404"];
1931
+ /** @description Promotion precondition or candidate-state conflict. */
1932
+ 409: {
1933
+ headers: {
1934
+ [name: string]: unknown;
1935
+ };
1936
+ content: {
1937
+ "application/json": components["schemas"]["TemplateTagPromotionConflict"];
1938
+ };
1939
+ };
1940
+ 500: components["responses"]["500"];
1941
+ };
1942
+ };
1943
+ post?: never;
1944
+ delete?: never;
1945
+ options?: never;
1946
+ head?: never;
1947
+ patch?: never;
1948
+ trace?: never;
1949
+ };
1861
1950
  "/templates/aliases/{alias}": {
1862
1951
  parameters: {
1863
1952
  query?: never;
@@ -2427,6 +2516,23 @@ interface components {
2427
2516
  /** @description Assigned tags of the template */
2428
2517
  tags: string[];
2429
2518
  };
2519
+ AssignTemplateTagHeadRequest: {
2520
+ /**
2521
+ * Format: uuid
2522
+ * @description Exact ready, remotely durable build to select.
2523
+ */
2524
+ buildID: string;
2525
+ /**
2526
+ * Format: uuid
2527
+ * @description Current build observed for the tag. Required when expectedVersion is greater than zero.
2528
+ */
2529
+ expectedBuildID?: string;
2530
+ /**
2531
+ * Format: int64
2532
+ * @description Current tag-head version, or zero to require an absent tag.
2533
+ */
2534
+ expectedVersion: number;
2535
+ };
2430
2536
  AssignTemplateTagsRequest: {
2431
2537
  /** @description Tags to assign to the template */
2432
2538
  tags: string[];
@@ -2684,6 +2790,11 @@ interface components {
2684
2790
  ListedSandbox: {
2685
2791
  /** @description Alias of the template */
2686
2792
  alias?: string;
2793
+ /**
2794
+ * Format: uuid
2795
+ * @description Identifier of the exact immutable template build generation used by the sandbox
2796
+ */
2797
+ buildID: string;
2687
2798
  cpuCount: components["schemas"]["CPUCount"];
2688
2799
  diskSizeMB: components["schemas"]["DiskSizeMB"];
2689
2800
  /**
@@ -2990,6 +3101,11 @@ interface components {
2990
3101
  Sandbox: {
2991
3102
  /** @description Alias of the template */
2992
3103
  alias?: string;
3104
+ /**
3105
+ * Format: uuid
3106
+ * @description Identifier of the exact immutable template build generation booted by the sandbox
3107
+ */
3108
+ buildID: string;
2993
3109
  capacityTier: components["schemas"]["SandboxCapacityTier"];
2994
3110
  /** @description Base domain where the sandbox traffic is accessible */
2995
3111
  domain?: string | null;
@@ -3088,6 +3204,11 @@ interface components {
3088
3204
  SandboxDetail: {
3089
3205
  /** @description Alias of the template */
3090
3206
  alias?: string;
3207
+ /**
3208
+ * Format: uuid
3209
+ * @description Identifier of the exact immutable template build generation used by the sandbox
3210
+ */
3211
+ buildID: string;
3091
3212
  cpuCount: components["schemas"]["CPUCount"];
3092
3213
  diskSizeMB: components["schemas"]["DiskSizeMB"];
3093
3214
  /** @description Base domain where the sandbox traffic is accessible */
@@ -3193,7 +3314,7 @@ interface components {
3193
3314
  /** @description List of allowed CIDR blocks or IP addresses for egress traffic. Allowed addresses always take precedence over blocked addresses. */
3194
3315
  allowOut?: string[];
3195
3316
  /**
3196
- * @description Specify if the sandbox URLs should be accessible only with authentication.
3317
+ * @description Whether sandbox URLs are publicly reachable without a traffic access token. Set false to require authenticated proxy access.
3197
3318
  * @default true
3198
3319
  */
3199
3320
  allowPublicTraffic?: boolean;
@@ -3596,6 +3717,11 @@ interface components {
3596
3717
  * @description Exact immutable build generation to materialize.
3597
3718
  */
3598
3719
  buildID: string;
3720
+ /**
3721
+ * Format: int64
3722
+ * @description Compare-and-swap precondition for this exact build activation. Use 0 to require that it does not yet exist, or the last observed version to update it.
3723
+ */
3724
+ expectedVersion?: number;
3599
3725
  /**
3600
3726
  * Format: int32
3601
3727
  * @default 1
@@ -3645,6 +3771,20 @@ interface components {
3645
3771
  /** @description The tag name */
3646
3772
  tag: string;
3647
3773
  };
3774
+ TemplateTagHead: {
3775
+ /** Format: uuid */
3776
+ buildID: string;
3777
+ /** Format: date-time */
3778
+ createdAt: string;
3779
+ tag: string;
3780
+ /** Format: int64 */
3781
+ version: number;
3782
+ };
3783
+ TemplateTagPromotionConflict: {
3784
+ /** @enum {string} */
3785
+ code: "candidate_not_promotable" | "tag_changed" | "concurrent_mutation" | "global_api_required";
3786
+ message: string;
3787
+ };
3648
3788
  TemplateUpdateRequest: {
3649
3789
  /** @description Whether the template is public or only accessible by the team */
3650
3790
  public?: boolean;
@@ -4072,6 +4212,30 @@ declare class GitUpstreamError extends SandboxError {
4072
4212
  declare class TemplateError extends SandboxError {
4073
4213
  constructor(message: string, stackTrace?: string);
4074
4214
  }
4215
+ type TemplateTagConflictReason = "tag_changed" | "concurrent_mutation";
4216
+ /**
4217
+ * A concurrent template tag mutation prevented an atomic promotion.
4218
+ *
4219
+ * Fetch the current head with `Template.getTagHead`, decide whether the
4220
+ * promotion is still appropriate, and retry with that newly observed token.
4221
+ */
4222
+ declare class TemplateTagConflictError extends TemplateError {
4223
+ readonly templateId: string;
4224
+ readonly tag: string;
4225
+ readonly candidateBuildId: string;
4226
+ readonly expectedBuildId?: string;
4227
+ readonly expectedVersion: number;
4228
+ readonly reason: TemplateTagConflictReason;
4229
+ constructor(options: {
4230
+ templateId: string;
4231
+ tag: string;
4232
+ candidateBuildId: string;
4233
+ expectedBuildId?: string;
4234
+ expectedVersion: number;
4235
+ reason: TemplateTagConflictReason;
4236
+ message?: string;
4237
+ });
4238
+ }
4075
4239
  /**
4076
4240
  * Thrown when the API rate limit is exceeded.
4077
4241
  */
@@ -7176,7 +7340,8 @@ type SandboxNetworkOpts = {
7176
7340
  */
7177
7341
  denyOut?: string[];
7178
7342
  /**
7179
- * Specify if the sandbox URLs should be accessible only with authentication.
7343
+ * Whether sandbox URLs are publicly reachable without a traffic access
7344
+ * token. Set false to require authenticated proxy access.
7180
7345
  * @default true
7181
7346
  */
7182
7347
  allowPublicTraffic?: boolean;
@@ -7291,6 +7456,19 @@ type SandboxConnectOpts = ConnectionOpts & {
7291
7456
  */
7292
7457
  timeoutMs?: number;
7293
7458
  };
7459
+ /**
7460
+ * Serializable locator for reconnecting to a sandbox through its owning
7461
+ * regional API.
7462
+ */
7463
+ interface SandboxRef {
7464
+ readonly sandboxId: string;
7465
+ readonly region: string;
7466
+ }
7467
+ /**
7468
+ * A sandbox can be addressed by a complete regional reference or, for
7469
+ * backwards compatibility, by its opaque ID plus connection options.
7470
+ */
7471
+ type SandboxTarget = string | SandboxRef;
7294
7472
  /**
7295
7473
  * State of the sandbox.
7296
7474
  */
@@ -7366,6 +7544,10 @@ interface SandboxInfo {
7366
7544
  * Sandbox ID.
7367
7545
  */
7368
7546
  sandboxId: string;
7547
+ /**
7548
+ * Exact immutable template build generation used by the sandbox.
7549
+ */
7550
+ buildId: string;
7369
7551
  /**
7370
7552
  * Template ID.
7371
7553
  */
@@ -7452,7 +7634,7 @@ declare class SandboxApi {
7452
7634
  *
7453
7635
  * @returns `true` if the sandbox was found and killed, `false` otherwise.
7454
7636
  */
7455
- static kill(sandboxId: string, opts?: SandboxApiOpts): Promise<boolean>;
7637
+ static kill(target: SandboxTarget, opts?: SandboxApiOpts): Promise<boolean>;
7456
7638
  /**
7457
7639
  * Get sandbox information like sandbox ID, template, metadata, started at/end at date.
7458
7640
  *
@@ -7461,7 +7643,7 @@ declare class SandboxApi {
7461
7643
  *
7462
7644
  * @returns sandbox information.
7463
7645
  */
7464
- static getInfo(sandboxId: string, opts?: SandboxApiOpts): Promise<SandboxInfo>;
7646
+ static getInfo(target: SandboxTarget, opts?: SandboxApiOpts): Promise<SandboxInfo>;
7465
7647
  /**
7466
7648
  * Get the metrics of the sandbox.
7467
7649
  *
@@ -7470,7 +7652,7 @@ declare class SandboxApi {
7470
7652
  *
7471
7653
  * @returns List of sandbox metrics containing CPU, memory and disk usage information.
7472
7654
  */
7473
- static getMetrics(sandboxId: string, opts?: SandboxMetricsOpts): Promise<SandboxMetrics[]>;
7655
+ static getMetrics(target: SandboxTarget, opts?: SandboxMetricsOpts): Promise<SandboxMetrics[]>;
7474
7656
  /**
7475
7657
  * Set the timeout of the specified sandbox.
7476
7658
  * After the timeout expires the sandbox will be automatically killed.
@@ -7483,8 +7665,8 @@ declare class SandboxApi {
7483
7665
  * @param timeoutMs timeout in **milliseconds**.
7484
7666
  * @param opts connection options.
7485
7667
  */
7486
- static setTimeout(sandboxId: string, timeoutMs: number, opts?: SandboxApiOpts): Promise<void>;
7487
- static getFullInfo(sandboxId: string, opts?: SandboxApiOpts): Promise<{
7668
+ static setTimeout(target: SandboxTarget, timeoutMs: number, opts?: SandboxApiOpts): Promise<void>;
7669
+ static getFullInfo(target: SandboxTarget, opts?: SandboxApiOpts): Promise<{
7488
7670
  metadata: {
7489
7671
  [key: string]: string;
7490
7672
  };
@@ -7499,6 +7681,7 @@ declare class SandboxApi {
7499
7681
  sandboxRegion: string;
7500
7682
  name?: string | undefined;
7501
7683
  sandboxId: string;
7684
+ buildId: string;
7502
7685
  templateId: string;
7503
7686
  }>;
7504
7687
  /**
@@ -7509,7 +7692,7 @@ declare class SandboxApi {
7509
7692
  *
7510
7693
  * @returns `true` if the sandbox got paused, `false` if the sandbox was already paused.
7511
7694
  */
7512
- static pause(sandboxId: string, opts?: SandboxApiOpts): Promise<boolean>;
7695
+ static pause(target: SandboxTarget, opts?: SandboxApiOpts): Promise<boolean>;
7513
7696
  /**
7514
7697
  * Create a snapshot from a sandbox.
7515
7698
  *
@@ -7522,7 +7705,7 @@ declare class SandboxApi {
7522
7705
  *
7523
7706
  * @returns snapshot information including the snapshot name that can be used with Sandbox.create().
7524
7707
  */
7525
- static createSnapshot(sandboxId: string, opts?: SandboxApiOpts): Promise<SnapshotInfo>;
7708
+ static createSnapshot(target: SandboxTarget, opts?: SandboxApiOpts): Promise<SnapshotInfo>;
7526
7709
  /**
7527
7710
  * List all snapshots.
7528
7711
  *
@@ -7542,6 +7725,7 @@ declare class SandboxApi {
7542
7725
  static deleteSnapshot(snapshotId: string, opts?: SandboxApiOpts): Promise<boolean>;
7543
7726
  protected static createSandbox(template: string, timeoutMs: number, opts?: SandboxOpts): Promise<{
7544
7727
  sandboxId: string;
7728
+ buildId: string;
7545
7729
  sandboxDomain: string | undefined;
7546
7730
  sandboxRegion: string;
7547
7731
  capacityTier: "shared";
@@ -7550,9 +7734,22 @@ declare class SandboxApi {
7550
7734
  envdAccessToken: string | undefined;
7551
7735
  trafficAccessToken: string | undefined;
7552
7736
  }>;
7737
+ protected static recoverSandboxCreate(recovery: SandboxCreateRecovery, opts?: SandboxOpts): Promise<{
7738
+ sandboxId: string;
7739
+ buildId: string;
7740
+ sandboxDomain: string | undefined;
7741
+ sandboxRegion: string;
7742
+ capacityTier: "shared";
7743
+ apiUrl: string;
7744
+ envdVersion: string;
7745
+ envdAccessToken: string | undefined;
7746
+ trafficAccessToken: string | undefined;
7747
+ }>;
7748
+ private static sandboxInfoFromCreate;
7553
7749
  private static waitForSandboxCreate;
7554
- protected static connectSandbox(sandboxId: string, opts?: SandboxConnectOpts): Promise<{
7750
+ protected static connectSandbox(target: SandboxTarget, opts?: SandboxConnectOpts): Promise<{
7555
7751
  sandboxId: string;
7752
+ buildId: string;
7556
7753
  sandboxDomain: string | undefined;
7557
7754
  sandboxRegion: string;
7558
7755
  capacityTier: "shared";
@@ -8521,6 +8718,14 @@ declare class Sandbox extends SandboxApi {
8521
8718
  * Unique identifier of the sandbox.
8522
8719
  */
8523
8720
  readonly sandboxId: string;
8721
+ /**
8722
+ * Serializable regional reference for reconnecting to this sandbox.
8723
+ */
8724
+ get ref(): SandboxRef;
8725
+ /**
8726
+ * Identifier of the exact immutable template build generation booted by this sandbox.
8727
+ */
8728
+ readonly buildId: string;
8524
8729
  /**
8525
8730
  * Domain where the sandbox is hosted.
8526
8731
  */
@@ -8554,6 +8759,7 @@ declare class Sandbox extends SandboxApi {
8554
8759
  */
8555
8760
  constructor(opts: SandboxConnectOpts & {
8556
8761
  sandboxId: string;
8762
+ buildId: string;
8557
8763
  sandboxDomain?: string;
8558
8764
  sandboxRegion: string;
8559
8765
  capacityTier: "shared";
@@ -8561,6 +8767,7 @@ declare class Sandbox extends SandboxApi {
8561
8767
  envdAccessToken?: string;
8562
8768
  trafficAccessToken?: string;
8563
8769
  });
8770
+ private connectionOptions;
8564
8771
  /**
8565
8772
  * List all sandboxes.
8566
8773
  *
@@ -8569,6 +8776,18 @@ declare class Sandbox extends SandboxApi {
8569
8776
  * @returns paginator for listing sandboxes.
8570
8777
  */
8571
8778
  static list(opts?: SandboxListOpts): SandboxPaginator;
8779
+ /**
8780
+ * Create an immutable regional scope so repeated sandbox operations do not
8781
+ * need to repeat the same region option.
8782
+ *
8783
+ * @example
8784
+ * ```ts
8785
+ * const yyz = Sandbox.inRegion("yyz")
8786
+ * const sandbox = await yyz.create()
8787
+ * const sameSandbox = await yyz.connect(sandbox.sandboxId)
8788
+ * ```
8789
+ */
8790
+ static inRegion<S extends typeof Sandbox>(this: S, region: string): SandboxRegionScope<S>;
8572
8791
  /**
8573
8792
  * Create a new sandbox from the default `base` sandbox template.
8574
8793
  *
@@ -8598,6 +8817,26 @@ declare class Sandbox extends SandboxApi {
8598
8817
  * @constructs {@link Sandbox}
8599
8818
  */
8600
8819
  static create<S extends typeof Sandbox>(this: S, template: string, opts?: SandboxOpts): Promise<InstanceType<S>>;
8820
+ /**
8821
+ * Recover a create whose authoritative response was lost without resending
8822
+ * the original create payload.
8823
+ *
8824
+ * Pass `OutcomeUnknownError.recovery`. Recovery is pinned to the operation's
8825
+ * owning region and cannot create a second sandbox with different options.
8826
+ *
8827
+ * @example
8828
+ * ```ts
8829
+ * try {
8830
+ * return await Sandbox.create("base", { idempotencyKey: "job-123" })
8831
+ * } catch (error) {
8832
+ * if (error instanceof OutcomeUnknownError) {
8833
+ * return Sandbox.recoverCreate(error.recovery)
8834
+ * }
8835
+ * throw error
8836
+ * }
8837
+ * ```
8838
+ */
8839
+ static recoverCreate<S extends typeof Sandbox>(this: S, recovery: SandboxCreateRecovery, opts?: SandboxOpts): Promise<InstanceType<S>>;
8601
8840
  /**
8602
8841
  * @beta This feature is in beta and may change in the future.
8603
8842
  *
@@ -8635,9 +8874,11 @@ declare class Sandbox extends SandboxApi {
8635
8874
  * Connect to a sandbox. If the sandbox is paused, it will be automatically resumed.
8636
8875
  * Sandbox must be either running or be paused.
8637
8876
  *
8638
- * With sandbox ID you can connect to the same sandbox from different places or environments (serverless functions, etc).
8877
+ * Persist {@link Sandbox.ref} to reconnect through the sandbox's owning
8878
+ * regional API from another process or environment.
8639
8879
  *
8640
- * @param sandboxId sandbox ID.
8880
+ * @param target sandbox ID, or a serializable reference containing its ID
8881
+ * and owning region.
8641
8882
  * @param opts connection options.
8642
8883
  *
8643
8884
  * @returns A running sandbox instance
@@ -8651,7 +8892,7 @@ declare class Sandbox extends SandboxApi {
8651
8892
  * const sameSandbox = await Sandbox.connect(sandboxId)
8652
8893
  * ```
8653
8894
  */
8654
- static connect<S extends typeof Sandbox>(this: S, sandboxId: string, opts?: SandboxConnectOpts): Promise<InstanceType<S>>;
8895
+ static connect<S extends typeof Sandbox>(this: S, target: SandboxTarget, opts?: SandboxConnectOpts): Promise<InstanceType<S>>;
8655
8896
  /**
8656
8897
  * Connect to a sandbox. If the sandbox is paused, it will be automatically resumed.
8657
8898
  * Sandbox must be either running or be paused.
@@ -8822,6 +9063,51 @@ declare class Sandbox extends SandboxApi {
8822
9063
  getMetrics(opts?: SandboxMetricsOpts): Promise<SandboxMetrics[]>;
8823
9064
  private fileUrl;
8824
9065
  }
9066
+ type Scoped<T> = Omit<T, "region">;
9067
+ /**
9068
+ * Immutable facade over Sandbox's static API, pinned to one region.
9069
+ * Construct it with {@link Sandbox.inRegion}.
9070
+ */
9071
+ declare class SandboxRegionScope<S extends typeof Sandbox = typeof Sandbox> {
9072
+ private readonly sandboxClass;
9073
+ private readonly selectedRegion;
9074
+ constructor(sandboxClass: S, region: string);
9075
+ get region(): string;
9076
+ private options;
9077
+ list(opts?: Scoped<SandboxListOpts>): SandboxPaginator;
9078
+ create(opts?: Scoped<SandboxOpts>): Promise<InstanceType<S>>;
9079
+ create(template: string, opts?: Scoped<SandboxOpts>): Promise<InstanceType<S>>;
9080
+ recoverCreate(recovery: SandboxCreateRecovery, opts?: Scoped<SandboxOpts>): Promise<InstanceType<S>>;
9081
+ betaCreate(opts?: Scoped<SandboxOpts>): Promise<InstanceType<S>>;
9082
+ betaCreate(template: string, opts?: Scoped<SandboxOpts>): Promise<InstanceType<S>>;
9083
+ connect(target: SandboxTarget, opts?: Scoped<SandboxConnectOpts>): Promise<InstanceType<S>>;
9084
+ kill(target: SandboxTarget, opts?: Scoped<SandboxApiOpts>): Promise<boolean>;
9085
+ getInfo(target: SandboxTarget, opts?: Scoped<SandboxApiOpts>): Promise<SandboxInfo>;
9086
+ getFullInfo(target: SandboxTarget, opts?: Scoped<SandboxApiOpts>): Promise<{
9087
+ metadata: {
9088
+ [key: string]: string;
9089
+ };
9090
+ envdVersion: string;
9091
+ envdAccessToken: string | undefined;
9092
+ startedAt: Date;
9093
+ endAt: Date;
9094
+ state: "running" | "paused";
9095
+ cpuCount: number;
9096
+ memoryMB: number;
9097
+ sandboxDomain: string | undefined;
9098
+ sandboxRegion: string;
9099
+ name?: string | undefined;
9100
+ sandboxId: string;
9101
+ buildId: string;
9102
+ templateId: string;
9103
+ }>;
9104
+ getMetrics(target: SandboxTarget, opts?: Scoped<SandboxMetricsOpts>): Promise<SandboxMetrics[]>;
9105
+ setTimeout(target: SandboxTarget, timeoutMs: number, opts?: Scoped<SandboxApiOpts>): Promise<void>;
9106
+ pause(target: SandboxTarget, opts?: Scoped<SandboxApiOpts>): Promise<boolean>;
9107
+ createSnapshot(target: SandboxTarget, opts?: Scoped<SandboxApiOpts>): Promise<SnapshotInfo>;
9108
+ listSnapshots(opts?: Scoped<SnapshotListOpts>): SnapshotPaginator;
9109
+ deleteSnapshot(snapshotId: string, opts?: Scoped<SandboxApiOpts>): Promise<boolean>;
9110
+ }
8825
9111
 
8826
9112
  /**
8827
9113
  * Class for ready check commands.
@@ -9104,6 +9390,12 @@ type TemplateActivationOptions = ConnectionOpts & {
9104
9390
  * @default false
9105
9391
  */
9106
9392
  allowRemoteFallback?: boolean;
9393
+ /**
9394
+ * Compare-and-swap precondition for this exact build activation.
9395
+ * Use `0` to require a new activation, or the last observed version when
9396
+ * changing one.
9397
+ */
9398
+ expectedVersion?: number;
9107
9399
  };
9108
9400
  type GetTemplateActivationOptions = ConnectionOpts & {
9109
9401
  /**
@@ -9111,6 +9403,23 @@ type GetTemplateActivationOptions = ConnectionOpts & {
9111
9403
  * @default ENCLAVE_REGION, then yyz
9112
9404
  */
9113
9405
  region?: string;
9406
+ /**
9407
+ * Exact immutable build generation whose regional state should be returned.
9408
+ * When omitted, Enclave resolves the tag in `templateId` (`default` when
9409
+ * untagged) for compatibility with existing callers.
9410
+ */
9411
+ buildId?: string;
9412
+ };
9413
+ type DeactivateTemplateOptions = ConnectionOpts & {
9414
+ /**
9415
+ * Region in which the exact build generation should be deactivated.
9416
+ * @default ENCLAVE_REGION, then yyz
9417
+ */
9418
+ region?: string;
9419
+ /**
9420
+ * Compare-and-swap precondition using the last observed activation version.
9421
+ */
9422
+ expectedVersion?: number;
9114
9423
  };
9115
9424
  /**
9116
9425
  * Information about assigned template tags.
@@ -9142,6 +9451,33 @@ type TemplateTag = {
9142
9451
  */
9143
9452
  createdAt: Date;
9144
9453
  };
9454
+ /**
9455
+ * Authoritative traffic-selection token for one template tag.
9456
+ */
9457
+ type TemplateTagHead = {
9458
+ /**
9459
+ * Name of the tag.
9460
+ */
9461
+ tag: string;
9462
+ /**
9463
+ * Exact build currently selected by the tag.
9464
+ */
9465
+ buildId: string;
9466
+ /**
9467
+ * Monotonic version used to fence concurrent promotion attempts.
9468
+ */
9469
+ version: number;
9470
+ /**
9471
+ * When this head was assigned.
9472
+ */
9473
+ createdAt: Date;
9474
+ };
9475
+ /**
9476
+ * The previously observed tag head required for a safe promotion.
9477
+ *
9478
+ * Pass `null` to require that the tag does not yet exist.
9479
+ */
9480
+ type TemplateTagHeadExpectation = Pick<TemplateTagHead, "buildId" | "version"> | null;
9145
9481
  /**
9146
9482
  * Configuration for a single file/directory copy operation.
9147
9483
  */
@@ -9779,7 +10115,7 @@ declare class TemplateBase implements TemplateFromImage, TemplateBuilder, Templa
9779
10115
  /**
9780
10116
  * Stop pinning and maintaining one exact build generation in a region.
9781
10117
  */
9782
- static deactivate(data: Pick<BuildInfo, "templateId" | "buildId">, options?: GetTemplateActivationOptions): Promise<TemplateRegionActivation>;
10118
+ static deactivate(data: Pick<BuildInfo, "templateId" | "buildId">, options?: DeactivateTemplateOptions): Promise<TemplateRegionActivation>;
9783
10119
  /**
9784
10120
  * Check if a template with the given name exists.
9785
10121
  *
@@ -9847,6 +10183,23 @@ declare class TemplateBase implements TemplateFromImage, TemplateBuilder, Templa
9847
10183
  * ```
9848
10184
  */
9849
10185
  static getTags(templateId: string, options?: ConnectionOpts): Promise<TemplateTag[]>;
10186
+ /**
10187
+ * Get the authoritative traffic-selection token for one template tag.
10188
+ *
10189
+ * Pass the returned head directly to {@link promoteTag}; its monotonic
10190
+ * version prevents concurrent releasers from silently overwriting each
10191
+ * other.
10192
+ */
10193
+ static getTagHead(templateId: string, tag: string, options?: ConnectionOpts): Promise<TemplateTagHead>;
10194
+ /**
10195
+ * Atomically move one template tag to an exact ready, durable build.
10196
+ *
10197
+ * Use a head returned by {@link getTagHead} as `expected`. Pass `null` only
10198
+ * when creating a tag that must not already exist. A concurrent change throws
10199
+ * `TemplateTagConflictError`; fetch the head again before deciding whether to
10200
+ * retry.
10201
+ */
10202
+ static promoteTag(candidate: Pick<BuildInfo, "templateId" | "buildId">, tag: string, expected: TemplateTagHeadExpectation, options?: ConnectionOpts): Promise<TemplateTagHead>;
9850
10203
  fromDebianImage(variant?: string): TemplateBuilder;
9851
10204
  fromUbuntuImage(variant?: string): TemplateBuilder;
9852
10205
  fromPythonImage(version?: string): TemplateBuilder;
@@ -10024,8 +10377,10 @@ declare namespace Template {
10024
10377
  var assignTags: typeof TemplateBase.assignTags;
10025
10378
  var removeTags: typeof TemplateBase.removeTags;
10026
10379
  var getTags: typeof TemplateBase.getTags;
10380
+ var getTagHead: typeof TemplateBase.getTagHead;
10381
+ var promoteTag: typeof TemplateBase.promoteTag;
10027
10382
  var toJSON: typeof TemplateBase.toJSON;
10028
10383
  var toDockerfile: typeof TemplateBase.toDockerfile;
10029
10384
  }
10030
10385
 
10031
- export { ALL_TRAFFIC, ApiClient, AuthenticationError, BuildError, type BuildInfo, type BuildOptions, type BuildStatusReason, type CommandConnectOpts, CommandExitError, CommandHandle, type CommandRequestOpts, type CommandResult, type CommandStartOpts, Commands, ConnectionConfig, type ConnectionOpts, type CopyItem, type CredentialAuditEvent, type EntryInfo, FileType, FileUploadError, Filesystem, type FilesystemEvent, FilesystemEventType, type GetBuildStatusOptions, type GetTemplateActivationOptions, Git, type GitAddOpts, GitAuthError, type GitBranches, type GitCloneOpts, type GitCommitOpts, type GitConfigOpts, type GitConfigScope, type GitDangerouslyAuthenticateOpts, type GitDeleteBranchOpts, type GitFileStatus, GitHubApp, type GitHubAuditQuery, type GitHubCredentialGrant, type GitHubGrantScope, type GitHubInstallation, type GitHubInstallationCallback, type GitHubInstallationLink, type GitHubRepositoryBinding, type GitHubRepositoryBindingOpts, type GitHubRepositoryPermissions, type GitInitOpts, type GitPullOpts, type GitPushOpts, type GitRemoteAddOpts, type GitRequestOpts, type GitStatus, GitUpstreamError, IdempotencyMismatchError, InvalidArgumentError, LogEntry, LogEntryEnd, type LogEntryLevel, LogEntryStart, type Logger, type McpServer$1 as McpServer, type McpServerName, NotEnoughSpaceError, NotFoundError, OutcomeUnknownError, type ProcessInfo, Pty, type PtyOutput, RateLimitError, ReadyCmd, RegionCapacityError, Sandbox, type SandboxApiOpts, type SandboxConnectOpts, type SandboxCreateRecovery, SandboxCreateRejectedError, type SandboxCreateRejectionReason, SandboxError, type SandboxInfo, type SandboxLifecycle, type SandboxListOpts, type SandboxMetrics, type SandboxMetricsOpts, type SandboxNetworkOpts, type SandboxOpts, SandboxPaginator, type SandboxState, type SnapshotInfo, type SnapshotListOpts, SnapshotPaginator, type Stderr, type Stdout, Template, type TemplateActivationOptions, TemplateBase, type TemplateBuildStatus, type TemplateBuildStatusResponse, type TemplateBuilder, type TemplateClass, TemplateError, type TemplateRegionActivation, type TemplateTag, type TemplateTagInfo, TimeoutError, type Username, WatchHandle, type WriteInfo, type components, Sandbox as default, defaultBuildLogger, getSignature, type paths, waitForFile, waitForPort, waitForProcess, waitForTimeout, waitForURL };
10386
+ export { ALL_TRAFFIC, ApiClient, AuthenticationError, BuildError, type BuildInfo, type BuildOptions, type BuildStatusReason, type CommandConnectOpts, CommandExitError, CommandHandle, type CommandRequestOpts, type CommandResult, type CommandStartOpts, Commands, ConnectionConfig, type ConnectionOpts, type CopyItem, type CredentialAuditEvent, type DeactivateTemplateOptions, type EntryInfo, FileType, FileUploadError, Filesystem, type FilesystemEvent, FilesystemEventType, type GetBuildStatusOptions, type GetTemplateActivationOptions, Git, type GitAddOpts, GitAuthError, type GitBranches, type GitCloneOpts, type GitCommitOpts, type GitConfigOpts, type GitConfigScope, type GitDangerouslyAuthenticateOpts, type GitDeleteBranchOpts, type GitFileStatus, GitHubApp, type GitHubAuditQuery, type GitHubCredentialGrant, type GitHubGrantScope, type GitHubInstallation, type GitHubInstallationCallback, type GitHubInstallationLink, type GitHubRepositoryBinding, type GitHubRepositoryBindingOpts, type GitHubRepositoryPermissions, type GitInitOpts, type GitPullOpts, type GitPushOpts, type GitRemoteAddOpts, type GitRequestOpts, type GitStatus, GitUpstreamError, IdempotencyMismatchError, InvalidArgumentError, LogEntry, LogEntryEnd, type LogEntryLevel, LogEntryStart, type Logger, type McpServer$1 as McpServer, type McpServerName, NotEnoughSpaceError, NotFoundError, OutcomeUnknownError, type ProcessInfo, Pty, type PtyOutput, RateLimitError, ReadyCmd, RegionCapacityError, Sandbox, type SandboxApiOpts, type SandboxConnectOpts, type SandboxCreateRecovery, SandboxCreateRejectedError, type SandboxCreateRejectionReason, SandboxError, type SandboxInfo, type SandboxLifecycle, type SandboxListOpts, type SandboxMetrics, type SandboxMetricsOpts, type SandboxNetworkOpts, type SandboxOpts, SandboxPaginator, type SandboxRef, SandboxRegionScope, type SandboxState, type SandboxTarget, type SnapshotInfo, type SnapshotListOpts, SnapshotPaginator, type Stderr, type Stdout, Template, type TemplateActivationOptions, TemplateBase, type TemplateBuildStatus, type TemplateBuildStatusResponse, type TemplateBuilder, type TemplateClass, TemplateError, type TemplateRegionActivation, type TemplateTag, TemplateTagConflictError, type TemplateTagConflictReason, type TemplateTagHead, type TemplateTagHeadExpectation, type TemplateTagInfo, TimeoutError, type Username, WatchHandle, type WriteInfo, type components, Sandbox as default, defaultBuildLogger, getSignature, type paths, waitForFile, waitForPort, waitForProcess, waitForTimeout, waitForURL };