@runblackcat/sdk 0.1.0-alpha.115 → 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.115",
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;
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
  }