@runblackcat/sdk 0.1.0-alpha.114 → 0.1.0-alpha.116

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.114",
3
+ "version": "0.1.0-alpha.116",
4
4
  "description": "TypeScript SDK for the Blackcat sandbox gateway",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/TreebeardHQ/blackcat",
@@ -22,6 +22,7 @@ export declare const CAPABILITY_OPS: {
22
22
  };
23
23
  export type CapabilityOps = number;
24
24
  export declare const BLACKCAT_ERROR_CODES: {
25
+ readonly CHECKPOINT_KERNEL_MISMATCH: "checkpoint_kernel_mismatch";
25
26
  readonly SANDBOX_TRANSITIONING: "sandbox_transitioning";
26
27
  readonly FLEET_UPGRADE_QUIESCING: "fleet_upgrade_quiescing";
27
28
  };
@@ -491,6 +492,11 @@ export type CreateSandboxResponse = {
491
492
  * predates this field.
492
493
  */
493
494
  restore_timing?: RestoreTiming;
495
+ /** First recorded failure, also available while pending teardown. Rebuild captures on checkpoint_kernel_mismatch. */
496
+ failure?: {
497
+ code: string;
498
+ detail: string | null;
499
+ };
494
500
  /** The gateway accepted and forwarded non-empty copy_env at launch. Older gateways omit this. */
495
501
  copy_env_forwarded?: true;
496
502
  /** Present when the create asked for `capability` and created this sandbox. */
@@ -844,7 +850,7 @@ export interface RenewTokenResponse {
844
850
  }
845
851
  export declare class BlackcatApiError extends Error {
846
852
  readonly status: number;
847
- /** Stable gateway error code when one is provided. */
853
+ /** Stable gateway code, including failure.code on failed acquisition receipts. */
848
854
  readonly code?: string;
849
855
  readonly retryAfter?: number;
850
856
  readonly requestId?: string;
@@ -965,9 +971,27 @@ declare class ReservationsResource {
965
971
  idempotency_key: string;
966
972
  }): Promise<CapacityReservation>;
967
973
  }
974
+ /** Managed-DNS queries only; all timestamps are UTC epoch milliseconds. */
975
+ export interface SandboxEgressDnsEntry {
976
+ host: string;
977
+ queries: number;
978
+ decision: "allowed" | "filtered";
979
+ first_seen_at: number;
980
+ last_seen_at: number;
981
+ }
982
+ export interface SandboxEgressDns {
983
+ items: SandboxEgressDnsEntry[];
984
+ observation_started_at: number | null;
985
+ /** Queries for additional names after the node-local admission cap. */
986
+ overflow_queries: number;
987
+ /** Queries with invalid or unrecordable names. */
988
+ invalid_queries: number;
989
+ }
968
990
  declare class SandboxesResource {
969
991
  private readonly client;
970
992
  constructor(client: GatewayClient);
993
+ /** Read node-local DNS history for a running sandbox; never resumes it. */
994
+ egressDns(id: string): Promise<SandboxEgressDns>;
971
995
  /** List all of this tenant's non-destroyed sandboxes, including hibernated ones. */
972
996
  list(): Promise<Sandbox[]>;
973
997
  /**
package/sdk/dist/index.js CHANGED
@@ -15,6 +15,7 @@ var CAPABILITY_OPS = {
15
15
  RENEW: 4096
16
16
  };
17
17
  var BLACKCAT_ERROR_CODES = {
18
+ CHECKPOINT_KERNEL_MISMATCH: "checkpoint_kernel_mismatch",
18
19
  SANDBOX_TRANSITIONING: "sandbox_transitioning",
19
20
  FLEET_UPGRADE_QUIESCING: "fleet_upgrade_quiescing"
20
21
  };
@@ -37,7 +38,9 @@ class BlackcatApiError extends Error {
37
38
  this.status = status;
38
39
  this.details = details;
39
40
  if (typeof details === "object" && details !== null && !Array.isArray(details)) {
40
- const code = details.code;
41
+ const fields = details;
42
+ const failure = fields.failure;
43
+ const code = fields.code ?? (typeof failure === "object" && failure !== null ? failure.code : undefined);
41
44
  if (typeof code === "string")
42
45
  this.code = code;
43
46
  }
@@ -461,6 +464,9 @@ class SandboxesResource {
461
464
  constructor(client) {
462
465
  this.client = client;
463
466
  }
467
+ egressDns(id) {
468
+ return this.client.json("GET", `/v1/sandboxes/${pathSegment(id)}/egress/dns`, undefined, "either");
469
+ }
464
470
  list() {
465
471
  return this.client.json("GET", "/v1/sandboxes", undefined, "either");
466
472
  }