@runblackcat/sdk 0.1.0-alpha.104 → 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 +1 -1
- package/sdk/dist/index.d.ts +53 -9
- package/sdk/dist/index.js +3 -0
package/package.json
CHANGED
package/sdk/dist/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -345,7 +349,7 @@ export interface SandboxLeaseInput {
|
|
|
345
349
|
/** Hard lifetime from acquisition, at least ttl_secs and at most 30 days. */
|
|
346
350
|
renewable_for_secs: number;
|
|
347
351
|
}
|
|
348
|
-
|
|
352
|
+
type CapacityReservationTarget = ({
|
|
349
353
|
/** One immutable template version, pinned for the reservation's life. */
|
|
350
354
|
template: string;
|
|
351
355
|
template_resource?: never;
|
|
@@ -355,13 +359,19 @@ export type CreateCapacityReservationInput = ({
|
|
|
355
359
|
* warmed with each new version as it is activated. */
|
|
356
360
|
template_resource: string;
|
|
357
361
|
template?: never;
|
|
358
|
-
})
|
|
359
|
-
|
|
360
|
-
count: number;
|
|
362
|
+
});
|
|
363
|
+
type CapacityReservationCommonInput = {
|
|
361
364
|
vcpus: number;
|
|
362
365
|
memory_mib: number;
|
|
363
366
|
/** How long to hold the reservation, between 1 second and 4 hours. */
|
|
364
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;
|
|
365
375
|
/** Defaults to `consumable`; `reusable` returns each slot after confirmed destruction.
|
|
366
376
|
* `warm` keeps `count` free slots on workers that cache a pinned template
|
|
367
377
|
* version; it takes `template` (not `template_resource`), is never held
|
|
@@ -386,10 +396,19 @@ export type CreateCapacityReservationInput = ({
|
|
|
386
396
|
* shape or a family (`c7i`) the fleet can launch (direct EC2: the config's
|
|
387
397
|
* instance_types). Absent: the planner chooses. */
|
|
388
398
|
shape?: string;
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
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 {
|
|
393
412
|
id: string;
|
|
394
413
|
state: "active" | "released" | "expired";
|
|
395
414
|
/** The version nodes are warmed with; null while a reservation following a
|
|
@@ -397,7 +416,6 @@ export interface CapacityReservation {
|
|
|
397
416
|
template: string | null;
|
|
398
417
|
/** The template resource this reservation follows, or null when pinned. */
|
|
399
418
|
template_resource: string | null;
|
|
400
|
-
count: number;
|
|
401
419
|
mode: "consumable" | "reusable" | "warm";
|
|
402
420
|
placement: "shared" | "dedicated";
|
|
403
421
|
/** The shape a dedicated reservation launches, or null. */
|
|
@@ -429,6 +447,19 @@ export interface CapacityReservation {
|
|
|
429
447
|
detail: string | null;
|
|
430
448
|
} | null;
|
|
431
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
|
+
});
|
|
432
463
|
export interface WaitOptions {
|
|
433
464
|
/**
|
|
434
465
|
* Have the gateway hold a still-pending claim for up to this many seconds
|
|
@@ -460,6 +491,8 @@ export type CreateSandboxResponse = {
|
|
|
460
491
|
* predates this field.
|
|
461
492
|
*/
|
|
462
493
|
restore_timing?: RestoreTiming;
|
|
494
|
+
/** The gateway accepted and forwarded non-empty copy_env at launch. Older gateways omit this. */
|
|
495
|
+
copy_env_forwarded?: true;
|
|
463
496
|
/** Present when the create asked for `capability` and created this sandbox. */
|
|
464
497
|
capability?: SandboxCapability;
|
|
465
498
|
} & ({
|
|
@@ -906,6 +939,17 @@ declare class ReservationsResource {
|
|
|
906
939
|
* grace; a dedicated reservation's host is fenced and terminated after its
|
|
907
940
|
* remaining sandboxes have been destroyed. */
|
|
908
941
|
release(id: string): Promise<CapacityReservation>;
|
|
942
|
+
/** Shrink an active reusable dedicated reservation pinned to a template version.
|
|
943
|
+
* Claimed copies stay on their hosts. Surplus empty hosts terminate; kept
|
|
944
|
+
* hosts receive smaller share caps and unclaimed bound slots are trimmed.
|
|
945
|
+
* Old-contract reservations without fresh exclusive hosts are refused with
|
|
946
|
+
* `resize_requires_fresh_hosts`; create a new dedicated reservation instead.
|
|
947
|
+
* Equal count (including replay) is a no-op.
|
|
948
|
+
* Count must be positive. 409: `resize_grow_unsupported`, `resize_below_claimed`,
|
|
949
|
+
* `resize_layout_occupied`, `resize_requires_active_reusable`,
|
|
950
|
+
* `retarget_requires_dedicated`, `retarget_follows_resource`, or
|
|
951
|
+
* `resize_changed` (concurrent change; submit again). */
|
|
952
|
+
resize(id: string, count: number): Promise<CapacityReservation>;
|
|
909
953
|
/** Move an active, unoccupied, reusable dedicated reservation pinned to a
|
|
910
954
|
* version to a prepared template of the same `vcpus` and `memory_mib`,
|
|
911
955
|
* keeping its hosts and bindings. Retargeting to its current template is a
|
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
|
}
|