@runblackcat/sdk 0.1.0-alpha.105 → 0.1.0-alpha.107

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runblackcat/sdk",
3
- "version": "0.1.0-alpha.105",
3
+ "version": "0.1.0-alpha.107",
4
4
  "description": "TypeScript SDK for the Blackcat sandbox gateway",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/TreebeardHQ/blackcat",
@@ -349,7 +349,7 @@ export interface SandboxLeaseInput {
349
349
  /** Hard lifetime from acquisition, at least ttl_secs and at most 30 days. */
350
350
  renewable_for_secs: number;
351
351
  }
352
- export type CreateCapacityReservationInput = ({
352
+ type CapacityReservationTarget = ({
353
353
  /** One immutable template version, pinned for the reservation's life. */
354
354
  template: string;
355
355
  template_resource?: never;
@@ -359,13 +359,19 @@ export type CreateCapacityReservationInput = ({
359
359
  * warmed with each new version as it is activated. */
360
360
  template_resource: string;
361
361
  template?: never;
362
- }) & {
363
- /** How many sandboxes of this template/shape to reserve. */
364
- count: number;
362
+ });
363
+ type CapacityReservationCommonInput = {
365
364
  vcpus: number;
366
365
  memory_mib: number;
367
366
  /** How long to hold the reservation, between 1 second and 4 hours. */
368
367
  ttl_secs: number;
368
+ /** Stable retry key, at most 107 ASCII letters, digits, `_` or `-`. */
369
+ idempotency_key?: string;
370
+ };
371
+ export type CreateCapacityReservationInput = CapacityReservationTarget & CapacityReservationCommonInput & ({
372
+ /** How many sandboxes of this template/shape to reserve. */
373
+ count: number;
374
+ host?: never;
369
375
  /** Defaults to `consumable`; `reusable` returns each slot after confirmed destruction.
370
376
  * `warm` keeps `count` free slots on workers that cache a pinned template
371
377
  * version; it takes `template` (not `template_resource`), is never held
@@ -390,10 +396,19 @@ export type CreateCapacityReservationInput = ({
390
396
  * shape or a family (`c7i`) the fleet can launch (direct EC2: the config's
391
397
  * instance_types). Absent: the planner chooses. */
392
398
  shape?: string;
393
- /** Stable retry key, at most 107 ASCII letters, digits, `_` or `-`. */
394
- idempotency_key?: string;
395
- };
396
- export interface CapacityReservation {
399
+ } | {
400
+ /** Reserve exactly one dedicated host, with no VM slot budget. */
401
+ host: {
402
+ shape: string;
403
+ };
404
+ count?: never;
405
+ template_resource?: never;
406
+ mode: "reusable";
407
+ placement: "dedicated";
408
+ needed_by?: never;
409
+ shape?: never;
410
+ });
411
+ interface CapacityReservationBase {
397
412
  id: string;
398
413
  state: "active" | "released" | "expired";
399
414
  /** The version nodes are warmed with; null while a reservation following a
@@ -401,7 +416,6 @@ export interface CapacityReservation {
401
416
  template: string | null;
402
417
  /** The template resource this reservation follows, or null when pinned. */
403
418
  template_resource: string | null;
404
- count: number;
405
419
  mode: "consumable" | "reusable" | "warm";
406
420
  placement: "shared" | "dedicated";
407
421
  /** The shape a dedicated reservation launches, or null. */
@@ -433,6 +447,19 @@ export interface CapacityReservation {
433
447
  detail: string | null;
434
448
  } | null;
435
449
  }
450
+ export type CapacityReservation = CapacityReservationBase & ({
451
+ capacity: {
452
+ kind: "copies";
453
+ count: number;
454
+ };
455
+ count: number;
456
+ } | {
457
+ capacity: {
458
+ kind: "host";
459
+ shape: string;
460
+ };
461
+ count?: never;
462
+ });
436
463
  export interface WaitOptions {
437
464
  /**
438
465
  * Have the gateway hold a still-pending claim for up to this many seconds