@runblackcat/sdk 0.1.0-alpha.100 → 0.1.0-alpha.101

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.100",
3
+ "version": "0.1.0-alpha.101",
4
4
  "description": "TypeScript SDK for the Blackcat sandbox gateway",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/TreebeardHQ/blackcat",
@@ -370,10 +370,14 @@ export type CreateCapacityReservationInput = ({
370
370
  /** When the capacity must be ready: seconds from now, or an RFC 3339 time
371
371
  * within `ttl_secs`. Absent: as soon as it can be, at the lowest cost. */
372
372
  needed_by?: number | string;
373
- /** `shared` (default): any eligible node, free headroom first. `dedicated`:
374
- * only hosts dedicated reservations hold, launched for them. A held host
375
- * serves only dedicated reservations (of any tenant: they pack), never
376
- * ordinary work; a sandbox create naming it waits for one of its slots. */
373
+ /** `shared` (default): any eligible node, free headroom first.
374
+ * `dedicated`: one new exclusive metal host launched for this reservation
375
+ * alone, never shared with ordinary work or other reservations, and
376
+ * terminated when the reservation ends; a sandbox create naming it waits
377
+ * for one of its slots. A fleet with no metal shape whose one host holds the
378
+ * whole `count` refuses it with 409 `dedicated_metal_unavailable`
379
+ * (`dedicated_cpu_unsupported` when no metal shape restores the version's CPU). Warm
380
+ * reservations are always shared. */
377
381
  placement?: "shared" | "dedicated";
378
382
  /** With `placement: "dedicated"`, the provider shape to launch: an exact
379
383
  * shape or a family (`c7i`) the fleet can launch (direct EC2: the config's
@@ -412,6 +416,15 @@ export interface CapacityReservation {
412
416
  expires_at: SystemTimeValue;
413
417
  /** When the capacity must be ready (epoch milliseconds), or null. */
414
418
  needed_by: number | null;
419
+ /** Why the reservation's capacity plan last fell short (no metal shape
420
+ * holds it, no room under the fleet ceiling or quota, ...), or null. */
421
+ unmet_reason?: string | null;
422
+ /** The latest launch made for it, or null. */
423
+ launch?: {
424
+ state: string;
425
+ shape: string;
426
+ detail: string | null;
427
+ } | null;
415
428
  }
416
429
  export interface WaitOptions {
417
430
  /**
@@ -885,9 +898,21 @@ declare class ReservationsResource {
885
898
  /** Reserve capacity for a burst of sandboxes of one template/shape. */
886
899
  create(input: CreateCapacityReservationInput): Promise<CapacityReservation>;
887
900
  get(id: string): Promise<CapacityReservation>;
888
- /** Release early. Unclaimed slots free immediately; bound nodes then fall
889
- * back to the normal empty-worker scale-in grace period. */
901
+ /** Release early. Unclaimed slots free immediately. A shared
902
+ * reservation's bound nodes fall back to the normal empty-worker scale-in
903
+ * grace; a dedicated reservation's host is fenced and terminated after its
904
+ * remaining sandboxes have been destroyed. */
890
905
  release(id: string): Promise<CapacityReservation>;
906
+ /** Move an active, unoccupied, reusable dedicated reservation pinned to a
907
+ * version to a prepared template of the same `vcpus` and `memory_mib`,
908
+ * keeping its host and bindings. Retargeting to its current template is a
909
+ * no-op. 409 with a `code` and `hint` when it is shared
910
+ * (`retarget_requires_dedicated`), follows a template resource
911
+ * (`retarget_follows_resource`), its slots are occupied
912
+ * (`retarget_slots_occupied`), its host cannot restore the version
913
+ * (`retarget_cpu_incompatible`) or claims are waiting
914
+ * (`retarget_claims_waiting`). */
915
+ retarget(id: string, template: string): Promise<CapacityReservation>;
891
916
  renew(id: string, input: {
892
917
  ttl_secs: number;
893
918
  idempotency_key: string;
package/sdk/dist/index.js CHANGED
@@ -445,6 +445,9 @@ class ReservationsResource {
445
445
  release(id) {
446
446
  return this.client.json("DELETE", `/v1/capacity-reservations/${pathSegment(id)}`, undefined, "either");
447
447
  }
448
+ retarget(id, template) {
449
+ return this.client.json("PUT", `/v1/capacity-reservations/${pathSegment(id)}/template`, { template }, "either");
450
+ }
448
451
  renew(id, input) {
449
452
  return this.client.json("POST", `/v1/capacity-reservations/${pathSegment(id)}/renew`, input, "either");
450
453
  }