@runblackcat/sdk 0.1.0-alpha.51 → 0.1.0-alpha.56

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/README.md CHANGED
@@ -297,6 +297,7 @@ and pins its ID for safe retries. Intel Mac binaries are not published.
297
297
  - **[docs/PRODUCT.md](docs/PRODUCT.md)** — the product contract and readiness levels.
298
298
  - **[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)** — processes, crates, trust domains, a sandbox's life.
299
299
  - **[docs/SECURITY.md](docs/SECURITY.md)** — isolation boundaries and known gaps.
300
+ - **[docs/fleet-upgrades.md](docs/fleet-upgrades.md)** — stage, preview, run, and resume compatible fleet upgrades.
300
301
  - **[docs/GROOMED.md](docs/GROOMED.md)** — the ranked backlog.
301
302
  - **[AGENTS.md](AGENTS.md)** — how to work in this repository.
302
303
  - **[docs/forkable-templates.md](docs/forkable-templates.md)**,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runblackcat/sdk",
3
- "version": "0.1.0-alpha.51",
3
+ "version": "0.1.0-alpha.56",
4
4
  "description": "TypeScript SDK for the Blackcat sandbox gateway",
5
5
  "license": "Apache-2.0",
6
6
  "repository": "https://github.com/TreebeardHQ/blackcat",
@@ -208,7 +208,13 @@ export interface SandboxLeaseInput {
208
208
  /** Hard lifetime from acquisition, at least ttl_secs and at most 30 days. */
209
209
  renewable_for_secs: number;
210
210
  }
211
- /** Response returned by POST /v1/sandboxes (the gateway has no template field). */
211
+ /**
212
+ * Response returned by POST /v1/sandboxes (the gateway has no template field).
213
+ * The gateway sends a `failed` receipt with HTTP 409, so `create` and
214
+ * `acquisition` surface it as a `BlackcatApiError` whose `details` this
215
+ * parser accepts: placement was abandoned and its sandbox torn down, which is
216
+ * retryable under a new request id rather than a protocol fault.
217
+ */
212
218
  export type CreateSandboxResponse = {
213
219
  request_id: string;
214
220
  id: string;
@@ -221,6 +227,10 @@ export type CreateSandboxResponse = {
221
227
  } | {
222
228
  state: "pending";
223
229
  node: string | null;
230
+ } | {
231
+ state: "failed";
232
+ node: null;
233
+ error: string;
224
234
  });
225
235
  export interface Sandbox {
226
236
  id: string;
@@ -438,6 +448,7 @@ declare class TemplateResourcesResource {
438
448
  constructor(client: GatewayClient);
439
449
  get(name: string): Promise<TemplateResource>;
440
450
  configure(name: string, input: ConfigureTemplateResourceInput): Promise<TemplateResource>;
451
+ delete(name: string): Promise<void>;
441
452
  }
442
453
  declare class TemplateBuildsResource {
443
454
  private readonly client;
package/sdk/dist/index.js CHANGED
@@ -78,7 +78,7 @@ function parseCreateSandboxResponse(value, requestId) {
78
78
  throw new BlackcatProtocolError("sandbox create receipt is malformed or belongs to another request");
79
79
  }
80
80
  const row = value;
81
- if (row.request_id !== requestId || typeof row.id !== "string" || row.id.length === 0 || !["boot", "warm_pool", "restore"].includes(String(row.tier)) || !["placed", "pending"].includes(String(row.state)) || row.state === "placed" && typeof row.node !== "string" || row.state === "pending" && row.node !== null && typeof row.node !== "string" || !isSystemTime(row.expires_at) || !isSystemTime(row.renewable_until)) {
81
+ if (row.request_id !== requestId || typeof row.id !== "string" || row.id.length === 0 || !["boot", "warm_pool", "restore"].includes(String(row.tier)) || !["placed", "pending", "failed"].includes(String(row.state)) || row.state === "placed" && typeof row.node !== "string" || row.state === "pending" && row.node !== null && typeof row.node !== "string" || row.state === "failed" && (row.node !== null || typeof row.error !== "string") || !isSystemTime(row.expires_at) || !isSystemTime(row.renewable_until)) {
82
82
  throw new BlackcatProtocolError("sandbox create receipt is malformed or belongs to another request");
83
83
  }
84
84
  return value;
@@ -343,6 +343,9 @@ class TemplateResourcesResource {
343
343
  configure(name, input) {
344
344
  return this.client.json("PUT", `/v1/template-resources/${pathSegment(name)}`, input, "token");
345
345
  }
346
+ delete(name) {
347
+ return this.client.json("DELETE", `/v1/template-resources/${pathSegment(name)}`, undefined, "token");
348
+ }
346
349
  }
347
350
 
348
351
  class TemplateBuildsResource {