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

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.103",
3
+ "version": "0.1.0-alpha.105",
4
4
  "description": "TypeScript SDK for the Blackcat sandbox gateway",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/TreebeardHQ/blackcat",
@@ -288,6 +288,8 @@ export type CreateSandboxInput = {
288
288
  /** Stable across retries of one acquisition; never reuse for another request. */
289
289
  request_id: string;
290
290
  ssh_public_key?: string;
291
+ /** Per-copy values applied before the restore gate opens. */
292
+ copy_env?: Record<string, string>;
291
293
  lease: SandboxLeaseInput;
292
294
  /** A capacity reservation this create should draw a bound slot from. */
293
295
  reservation?: string;
@@ -320,6 +322,8 @@ export type CreateSandboxBatchInput = CreateSandboxInput & {
320
322
  };
321
323
  export type SandboxBatchMemberState = "pending" | "placed" | "failed" | "destroyed";
322
324
  export interface SandboxBatchMember {
325
+ /** The gateway accepted and forwarded non-empty copy_env for this placed member; older gateways omit it. */
326
+ copy_env_forwarded?: true;
323
327
  /** Poll this member alone with `sandboxes.acquisition(request_id)`. */
324
328
  request_id: string;
325
329
  id: string;
@@ -371,11 +375,14 @@ export type CreateCapacityReservationInput = ({
371
375
  * within `ttl_secs`. Absent: as soon as it can be, at the lowest cost. */
372
376
  needed_by?: number | string;
373
377
  /** `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`
378
+ * `dedicated`: as few new exclusive hosts as hold `count` (full hosts of
379
+ * the largest metal shape, the remainder on the smallest metal or nested
380
+ * shape that holds it), launched for this reservation alone, never shared
381
+ * with ordinary work or other reservations, a failed host replaced alone,
382
+ * and terminated when the reservation ends; a sandbox create naming it
383
+ * waits for one of its slots, filling one host before the next. A fleet
384
+ * with no metal shape a host of which holds one copy refuses it with 409
385
+ * `dedicated_metal_unavailable`
379
386
  * (`dedicated_cpu_unsupported` when no metal shape restores the version's CPU). Warm
380
387
  * reservations are always shared. */
381
388
  placement?: "shared" | "dedicated";
@@ -457,6 +464,8 @@ export type CreateSandboxResponse = {
457
464
  * predates this field.
458
465
  */
459
466
  restore_timing?: RestoreTiming;
467
+ /** The gateway accepted and forwarded non-empty copy_env at launch. Older gateways omit this. */
468
+ copy_env_forwarded?: true;
460
469
  /** Present when the create asked for `capability` and created this sandbox. */
461
470
  capability?: SandboxCapability;
462
471
  } & ({
@@ -903,9 +912,20 @@ declare class ReservationsResource {
903
912
  * grace; a dedicated reservation's host is fenced and terminated after its
904
913
  * remaining sandboxes have been destroyed. */
905
914
  release(id: string): Promise<CapacityReservation>;
915
+ /** Shrink an active reusable dedicated reservation pinned to a template version.
916
+ * Claimed copies stay on their hosts. Surplus empty hosts terminate; kept
917
+ * hosts receive smaller share caps and unclaimed bound slots are trimmed.
918
+ * Old-contract reservations without fresh exclusive hosts are refused with
919
+ * `resize_requires_fresh_hosts`; create a new dedicated reservation instead.
920
+ * Equal count (including replay) is a no-op.
921
+ * Count must be positive. 409: `resize_grow_unsupported`, `resize_below_claimed`,
922
+ * `resize_layout_occupied`, `resize_requires_active_reusable`,
923
+ * `retarget_requires_dedicated`, `retarget_follows_resource`, or
924
+ * `resize_changed` (concurrent change; submit again). */
925
+ resize(id: string, count: number): Promise<CapacityReservation>;
906
926
  /** Move an active, unoccupied, reusable dedicated reservation pinned to a
907
927
  * 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
928
+ * keeping its hosts and bindings. Retargeting to its current template is a
909
929
  * no-op. 409 with a `code` and `hint` when it is shared
910
930
  * (`retarget_requires_dedicated`), follows a template resource
911
931
  * (`retarget_follows_resource`), its slots are occupied
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
+ resize(id, count) {
449
+ return this.client.json("PUT", `/v1/capacity-reservations/${pathSegment(id)}/count`, { count }, "either");
450
+ }
448
451
  retarget(id, template) {
449
452
  return this.client.json("PUT", `/v1/capacity-reservations/${pathSegment(id)}/template`, { template }, "either");
450
453
  }