@boatdev/sdk 1.7.0 → 1.8.0

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.
Files changed (67) hide show
  1. package/.openapi-generator/FILES +4 -0
  2. package/dist/apis/BoatApi.d.ts +47 -4
  3. package/dist/apis/BoatApi.js +100 -4
  4. package/dist/esm/apis/BoatApi.d.ts +47 -4
  5. package/dist/esm/apis/BoatApi.js +100 -4
  6. package/dist/esm/http2-fetch.d.ts +1 -0
  7. package/dist/esm/http2-fetch.js +203 -0
  8. package/dist/esm/models/CreateSandboxRequest.d.ts +3 -2
  9. package/dist/esm/models/CreateSandboxRequest.js +2 -1
  10. package/dist/esm/models/ForkRequest.d.ts +2 -1
  11. package/dist/esm/models/ForkRequest.js +2 -1
  12. package/dist/esm/models/Recover200Response.d.ts +57 -0
  13. package/dist/esm/models/Recover200Response.js +53 -0
  14. package/dist/esm/models/ResumeRequest.d.ts +2 -1
  15. package/dist/esm/models/ResumeRequest.js +2 -1
  16. package/dist/esm/models/Sandbox.d.ts +2 -1
  17. package/dist/esm/models/Sandbox.js +2 -1
  18. package/dist/esm/models/SandboxUsageResponse.d.ts +2 -1
  19. package/dist/esm/models/SandboxUsageResponse.js +2 -1
  20. package/dist/esm/models/StopOperation.d.ts +1 -1
  21. package/dist/esm/models/StopOperationResponse.d.ts +58 -0
  22. package/dist/esm/models/StopOperationResponse.js +62 -0
  23. package/dist/esm/models/StopRequest.d.ts +1 -1
  24. package/dist/esm/models/UpdateSandboxRequest.d.ts +1 -1
  25. package/dist/esm/models/index.d.ts +2 -0
  26. package/dist/esm/models/index.js +2 -0
  27. package/dist/esm/runtime.js +2 -1
  28. package/dist/http2-fetch.d.ts +1 -0
  29. package/dist/http2-fetch.js +239 -0
  30. package/dist/models/CreateSandboxRequest.d.ts +3 -2
  31. package/dist/models/CreateSandboxRequest.js +2 -1
  32. package/dist/models/ForkRequest.d.ts +2 -1
  33. package/dist/models/ForkRequest.js +2 -1
  34. package/dist/models/Recover200Response.d.ts +57 -0
  35. package/dist/models/Recover200Response.js +61 -0
  36. package/dist/models/ResumeRequest.d.ts +2 -1
  37. package/dist/models/ResumeRequest.js +2 -1
  38. package/dist/models/Sandbox.d.ts +2 -1
  39. package/dist/models/Sandbox.js +2 -1
  40. package/dist/models/SandboxUsageResponse.d.ts +2 -1
  41. package/dist/models/SandboxUsageResponse.js +2 -1
  42. package/dist/models/StopOperation.d.ts +1 -1
  43. package/dist/models/StopOperationResponse.d.ts +58 -0
  44. package/dist/models/StopOperationResponse.js +70 -0
  45. package/dist/models/StopRequest.d.ts +1 -1
  46. package/dist/models/UpdateSandboxRequest.d.ts +1 -1
  47. package/dist/models/index.d.ts +2 -0
  48. package/dist/models/index.js +2 -0
  49. package/dist/runtime.js +9 -8
  50. package/docs/BoatApi.md +160 -2
  51. package/docs/Recover200Response.md +38 -0
  52. package/docs/StopOperationResponse.md +38 -0
  53. package/package.json +1 -1
  54. package/src/apis/BoatApi.ts +147 -4
  55. package/src/http2-fetch.ts +179 -0
  56. package/src/models/CreateSandboxRequest.ts +4 -3
  57. package/src/models/ForkRequest.ts +3 -2
  58. package/src/models/Recover200Response.ts +99 -0
  59. package/src/models/ResumeRequest.ts +3 -2
  60. package/src/models/Sandbox.ts +3 -2
  61. package/src/models/SandboxUsageResponse.ts +3 -2
  62. package/src/models/StopOperation.ts +1 -1
  63. package/src/models/StopOperationResponse.ts +111 -0
  64. package/src/models/StopRequest.ts +1 -1
  65. package/src/models/UpdateSandboxRequest.ts +1 -1
  66. package/src/models/index.ts +2 -0
  67. package/src/runtime.ts +2 -1
@@ -52,6 +52,7 @@ import { OrgListResponseFromJSON, } from '../models/OrgListResponse';
52
52
  import { PromptRequestToJSON, } from '../models/PromptRequest';
53
53
  import { PromptResponseFromJSON, } from '../models/PromptResponse';
54
54
  import { PromptRunResponseFromJSON, } from '../models/PromptRunResponse';
55
+ import { Recover200ResponseFromJSON, } from '../models/Recover200Response';
55
56
  import { RepoSelectionRequestToJSON, } from '../models/RepoSelectionRequest';
56
57
  import { RepoSelectionResponseFromJSON, } from '../models/RepoSelectionResponse';
57
58
  import { ReposResponseFromJSON, } from '../models/ReposResponse';
@@ -75,6 +76,7 @@ import { SshKeyRequestToJSON, } from '../models/SshKeyRequest';
75
76
  import { SshKeyResponseFromJSON, } from '../models/SshKeyResponse';
76
77
  import { SteerRequestToJSON, } from '../models/SteerRequest';
77
78
  import { SteerResponseFromJSON, } from '../models/SteerResponse';
79
+ import { StopOperationResponseFromJSON, } from '../models/StopOperationResponse';
78
80
  import { StopRequestToJSON, } from '../models/StopRequest';
79
81
  import { UpdateSandboxEnvironmentRequestToJSON, } from '../models/UpdateSandboxEnvironmentRequest';
80
82
  import { UpdateSandboxRequestToJSON, } from '../models/UpdateSandboxRequest';
@@ -250,6 +252,7 @@ export class BoatApi extends runtime.BaseAPI {
250
252
  };
251
253
  }
252
254
  /**
255
+ * Downloads one file of up to 50 MiB, under /home/user or /tmp, as raw bytes.
253
256
  * Download a sandbox artifact
254
257
  */
255
258
  async artifactRaw(requestParameters, initOverrides) {
@@ -258,6 +261,7 @@ export class BoatApi extends runtime.BaseAPI {
258
261
  return new runtime.BlobApiResponse(response);
259
262
  }
260
263
  /**
264
+ * Downloads one file of up to 50 MiB, under /home/user or /tmp, as raw bytes.
261
265
  * Download a sandbox artifact
262
266
  */
263
267
  async artifact(requestParameters, initOverrides) {
@@ -1520,6 +1524,52 @@ export class BoatApi extends runtime.BaseAPI {
1520
1524
  const response = await this.getSnapshotTreeRaw(requestParameters, initOverrides);
1521
1525
  return await response.value();
1522
1526
  }
1527
+ /**
1528
+ * Creates request options for getStop without sending the request
1529
+ */
1530
+ async getStopRequestOpts(requestParameters) {
1531
+ if (requestParameters['sandboxId'] == null) {
1532
+ throw new runtime.RequiredError('sandboxId', 'Required parameter "sandboxId" was null or undefined when calling getStop().');
1533
+ }
1534
+ if (requestParameters['stopId'] == null) {
1535
+ throw new runtime.RequiredError('stopId', 'Required parameter "stopId" was null or undefined when calling getStop().');
1536
+ }
1537
+ const queryParameters = {};
1538
+ const headerParameters = {};
1539
+ if (this.configuration && this.configuration.accessToken) {
1540
+ const token = this.configuration.accessToken;
1541
+ const tokenString = await token("BoatBearerAuth", []);
1542
+ if (tokenString) {
1543
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
1544
+ }
1545
+ }
1546
+ let urlPath = `/sandboxes/{sandboxId}/stops/{stopId}`;
1547
+ urlPath = urlPath.replace('{sandboxId}', encodeURIComponent(String(requestParameters['sandboxId'])));
1548
+ urlPath = urlPath.replace('{stopId}', encodeURIComponent(String(requestParameters['stopId'])));
1549
+ return {
1550
+ path: urlPath,
1551
+ method: 'GET',
1552
+ headers: headerParameters,
1553
+ query: queryParameters,
1554
+ };
1555
+ }
1556
+ /**
1557
+ * Returns one stop of this sandbox by the id that `POST /sandboxes/{sandboxId}/stop` returned. Old stops stay readable after a resume or a later stop. Returns 404 when the id is unknown or belongs to another sandbox.
1558
+ * Get a stop by id
1559
+ */
1560
+ async getStopRaw(requestParameters, initOverrides) {
1561
+ const requestOptions = await this.getStopRequestOpts(requestParameters);
1562
+ const response = await this.request(requestOptions, initOverrides);
1563
+ return new runtime.JSONApiResponse(response, (jsonValue) => StopOperationResponseFromJSON(jsonValue));
1564
+ }
1565
+ /**
1566
+ * Returns one stop of this sandbox by the id that `POST /sandboxes/{sandboxId}/stop` returned. Old stops stay readable after a resume or a later stop. Returns 404 when the id is unknown or belongs to another sandbox.
1567
+ * Get a stop by id
1568
+ */
1569
+ async getStop(requestParameters, initOverrides) {
1570
+ const response = await this.getStopRaw(requestParameters, initOverrides);
1571
+ return await response.value();
1572
+ }
1523
1573
  /**
1524
1574
  * Creates request options for getWebhook without sending the request
1525
1575
  */
@@ -2081,6 +2131,7 @@ export class BoatApi extends runtime.BaseAPI {
2081
2131
  };
2082
2132
  }
2083
2133
  /**
2134
+ * Files up to 5 MiB. Use `GET /sandboxes/{sandboxId}/artifacts` for files up to 50 MiB, and SCP over SSH for larger ones.
2084
2135
  * Read a file from a sandbox
2085
2136
  */
2086
2137
  async readFileRaw(requestParameters, initOverrides) {
@@ -2089,12 +2140,55 @@ export class BoatApi extends runtime.BaseAPI {
2089
2140
  return new runtime.JSONApiResponse(response, (jsonValue) => FileReadResponseFromJSON(jsonValue));
2090
2141
  }
2091
2142
  /**
2143
+ * Files up to 5 MiB. Use `GET /sandboxes/{sandboxId}/artifacts` for files up to 50 MiB, and SCP over SSH for larger ones.
2092
2144
  * Read a file from a sandbox
2093
2145
  */
2094
2146
  async readFile(requestParameters, initOverrides) {
2095
2147
  const response = await this.readFileRaw(requestParameters, initOverrides);
2096
2148
  return await response.value();
2097
2149
  }
2150
+ /**
2151
+ * Creates request options for recover without sending the request
2152
+ */
2153
+ async recoverRequestOpts(requestParameters) {
2154
+ if (requestParameters['sandboxId'] == null) {
2155
+ throw new runtime.RequiredError('sandboxId', 'Required parameter "sandboxId" was null or undefined when calling recover().');
2156
+ }
2157
+ const queryParameters = {};
2158
+ const headerParameters = {};
2159
+ if (this.configuration && this.configuration.accessToken) {
2160
+ const token = this.configuration.accessToken;
2161
+ const tokenString = await token("BoatBearerAuth", []);
2162
+ if (tokenString) {
2163
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
2164
+ }
2165
+ }
2166
+ let urlPath = `/sandboxes/{sandboxId}/recover`;
2167
+ urlPath = urlPath.replace('{sandboxId}', encodeURIComponent(String(requestParameters['sandboxId'])));
2168
+ return {
2169
+ path: urlPath,
2170
+ method: 'POST',
2171
+ headers: headerParameters,
2172
+ query: queryParameters,
2173
+ };
2174
+ }
2175
+ /**
2176
+ * Power-cycle the machine of a sandbox that stopped answering. The disk is not touched. The sandbox usually answers again within 1-2 minutes and then saves your work by itself; `sandbox.recovered` fires when it does. Refused with `409`: - `sandbox_is_reachable`: the sandbox answers normally. - `too_soon`: a recover started less than 10 minutes ago. - `no_machine`: the sandbox has no machine. Resume it instead. - `recover_unsupported`: its machine cannot be power-cycled. Wait for it to answer, or resume it from its last snapshot. - `reset_failed`: the power-cycle failed. Reply to the incident email.
2177
+ * Recover a sandbox that stopped responding
2178
+ */
2179
+ async recoverRaw(requestParameters, initOverrides) {
2180
+ const requestOptions = await this.recoverRequestOpts(requestParameters);
2181
+ const response = await this.request(requestOptions, initOverrides);
2182
+ return new runtime.JSONApiResponse(response, (jsonValue) => Recover200ResponseFromJSON(jsonValue));
2183
+ }
2184
+ /**
2185
+ * Power-cycle the machine of a sandbox that stopped answering. The disk is not touched. The sandbox usually answers again within 1-2 minutes and then saves your work by itself; `sandbox.recovered` fires when it does. Refused with `409`: - `sandbox_is_reachable`: the sandbox answers normally. - `too_soon`: a recover started less than 10 minutes ago. - `no_machine`: the sandbox has no machine. Resume it instead. - `recover_unsupported`: its machine cannot be power-cycled. Wait for it to answer, or resume it from its last snapshot. - `reset_failed`: the power-cycle failed. Reply to the incident email.
2186
+ * Recover a sandbox that stopped responding
2187
+ */
2188
+ async recover(requestParameters, initOverrides) {
2189
+ const response = await this.recoverRaw(requestParameters, initOverrides);
2190
+ return await response.value();
2191
+ }
2098
2192
  /**
2099
2193
  * Creates request options for repos without sending the request
2100
2194
  */
@@ -2771,7 +2865,7 @@ export class BoatApi extends runtime.BaseAPI {
2771
2865
  };
2772
2866
  }
2773
2867
  /**
2774
- * Send a new message to a turn that is already running, without losing what the agent is doing. This is what typing into a coding agent while it works does: the instruction is taken into account and the work continues. Where the harness has a native mid-turn primitive (Claude Code, Codex, pi, Prime Agent) nothing is interrupted and the response has `native: true`. Where it does not (OpenCode), Boat interrupts that turn and immediately continues the SAME conversation with the instruction, keeping the session and its memory, and the response has `native: false`. Refused with **409 `no_running_turn`** when the conversation has nothing in flight; queue work with `POST /prompt` instead. The steer shows up in `GET /events` as a `steer` event. See [Integrated agents](/integrated-agents).
2868
+ * Send a new message to a turn that is already running, without losing what the agent is doing. This is what typing into a coding agent while it works does: the instruction is taken into account and the work continues. Where the harness has a native mid-turn primitive (Claude Code, Codex, pi, Prime Agent) nothing is interrupted and the response has `native: true`. Where it does not (OpenCode), Boat interrupts that turn and immediately continues the SAME conversation with the instruction, keeping the session and its memory, and the response has `native: false`. Refused with **409 `no_running_turn`** when the conversation has nothing in flight; queue work with `POST /prompt` instead. `error.details.reason` says why: `turn_ended` (with `error.details.lastTurn.status` and `.error` of the newest turn), `turn_not_started` (the turn is starting; retry in a moment), `no_turn`, `not_running` (the sandbox is not running) or `delivery_failed` (the sandbox did not accept the steer; check the turn before sending more work). The steer shows up in `GET /events` as a `steer` event. See [Integrated agents](/integrated-agents).
2775
2869
  * Steer a running turn
2776
2870
  */
2777
2871
  async steerRaw(requestParameters, initOverrides) {
@@ -2780,7 +2874,7 @@ export class BoatApi extends runtime.BaseAPI {
2780
2874
  return new runtime.JSONApiResponse(response, (jsonValue) => SteerResponseFromJSON(jsonValue));
2781
2875
  }
2782
2876
  /**
2783
- * Send a new message to a turn that is already running, without losing what the agent is doing. This is what typing into a coding agent while it works does: the instruction is taken into account and the work continues. Where the harness has a native mid-turn primitive (Claude Code, Codex, pi, Prime Agent) nothing is interrupted and the response has `native: true`. Where it does not (OpenCode), Boat interrupts that turn and immediately continues the SAME conversation with the instruction, keeping the session and its memory, and the response has `native: false`. Refused with **409 `no_running_turn`** when the conversation has nothing in flight; queue work with `POST /prompt` instead. The steer shows up in `GET /events` as a `steer` event. See [Integrated agents](/integrated-agents).
2877
+ * Send a new message to a turn that is already running, without losing what the agent is doing. This is what typing into a coding agent while it works does: the instruction is taken into account and the work continues. Where the harness has a native mid-turn primitive (Claude Code, Codex, pi, Prime Agent) nothing is interrupted and the response has `native: true`. Where it does not (OpenCode), Boat interrupts that turn and immediately continues the SAME conversation with the instruction, keeping the session and its memory, and the response has `native: false`. Refused with **409 `no_running_turn`** when the conversation has nothing in flight; queue work with `POST /prompt` instead. `error.details.reason` says why: `turn_ended` (with `error.details.lastTurn.status` and `.error` of the newest turn), `turn_not_started` (the turn is starting; retry in a moment), `no_turn`, `not_running` (the sandbox is not running) or `delivery_failed` (the sandbox did not accept the steer; check the turn before sending more work). The steer shows up in `GET /events` as a `steer` event. See [Integrated agents](/integrated-agents).
2784
2878
  * Steer a running turn
2785
2879
  */
2786
2880
  async steer(requestParameters, initOverrides) {
@@ -2816,7 +2910,7 @@ export class BoatApi extends runtime.BaseAPI {
2816
2910
  };
2817
2911
  }
2818
2912
  /**
2819
- * Stop active work and archive/snapshot the sandbox for later resume or fork. A stop always saves the sandbox\'s disk first. If that save is failing, the stop is refused and the sandbox keeps running so your work is not discarded, we retry automatically and email you. You are not billed for time spent in that state. The stop is an operation: the response and the sandbox carry it as `stop`, with an `id` and a `status`. Poll `GET /sandboxes/{sandboxId}` until `stop.status` is `completed`. A failed attempt shows `failing` with its `error` and is retried until the sandbox archives; commands and prompts you send meanwhile do not cancel it. Only a resume ends it early (`superseded`). Calling stop again while one is pending returns the same `id`. Set `force: true` to stop anyway, accepting the loss of everything written since the last successful snapshot. This is irreversible; only reach for it after a stop has already failed.
2913
+ * Stop active work and archive/snapshot the sandbox for later resume or fork. A stop always saves the sandbox\'s disk first. If that save is failing, the stop is refused and the sandbox keeps running so your work is not discarded, we retry automatically and email you. You are not billed for time spent in that state. The stop is an operation: the response and the sandbox carry it as `stop`, with an `id` and a `status`. Poll `GET /sandboxes/{sandboxId}` until `stop.status` is `completed`. A failed attempt shows `failing` with its `error` and is retried until the sandbox archives; commands and prompts you send meanwhile do not cancel it. Only a resume ends it early (`superseded`). Calling stop again while one is pending returns the same `id`. Set `force: true` to stop anyway, keeping the last successful snapshot and losing everything written since then. This is irreversible; only reach for it after a stop has already failed. A force on a stop that is already pending escalates that stop.
2820
2914
  * Stop and archive sandbox
2821
2915
  */
2822
2916
  async stopRaw(requestParameters, initOverrides) {
@@ -2825,7 +2919,7 @@ export class BoatApi extends runtime.BaseAPI {
2825
2919
  return new runtime.JSONApiResponse(response, (jsonValue) => SandboxActionResponseFromJSON(jsonValue));
2826
2920
  }
2827
2921
  /**
2828
- * Stop active work and archive/snapshot the sandbox for later resume or fork. A stop always saves the sandbox\'s disk first. If that save is failing, the stop is refused and the sandbox keeps running so your work is not discarded, we retry automatically and email you. You are not billed for time spent in that state. The stop is an operation: the response and the sandbox carry it as `stop`, with an `id` and a `status`. Poll `GET /sandboxes/{sandboxId}` until `stop.status` is `completed`. A failed attempt shows `failing` with its `error` and is retried until the sandbox archives; commands and prompts you send meanwhile do not cancel it. Only a resume ends it early (`superseded`). Calling stop again while one is pending returns the same `id`. Set `force: true` to stop anyway, accepting the loss of everything written since the last successful snapshot. This is irreversible; only reach for it after a stop has already failed.
2922
+ * Stop active work and archive/snapshot the sandbox for later resume or fork. A stop always saves the sandbox\'s disk first. If that save is failing, the stop is refused and the sandbox keeps running so your work is not discarded, we retry automatically and email you. You are not billed for time spent in that state. The stop is an operation: the response and the sandbox carry it as `stop`, with an `id` and a `status`. Poll `GET /sandboxes/{sandboxId}` until `stop.status` is `completed`. A failed attempt shows `failing` with its `error` and is retried until the sandbox archives; commands and prompts you send meanwhile do not cancel it. Only a resume ends it early (`superseded`). Calling stop again while one is pending returns the same `id`. Set `force: true` to stop anyway, keeping the last successful snapshot and losing everything written since then. This is irreversible; only reach for it after a stop has already failed. A force on a stop that is already pending escalates that stop.
2829
2923
  * Stop and archive sandbox
2830
2924
  */
2831
2925
  async stop(requestParameters, initOverrides) {
@@ -3185,6 +3279,7 @@ export class BoatApi extends runtime.BaseAPI {
3185
3279
  };
3186
3280
  }
3187
3281
  /**
3282
+ * Files up to 5 MiB after decoding. Use SCP over SSH for larger files.
3188
3283
  * Write a file in a sandbox
3189
3284
  */
3190
3285
  async writeFileRaw(requestParameters, initOverrides) {
@@ -3193,6 +3288,7 @@ export class BoatApi extends runtime.BaseAPI {
3193
3288
  return new runtime.JSONApiResponse(response, (jsonValue) => FileWriteResponseFromJSON(jsonValue));
3194
3289
  }
3195
3290
  /**
3291
+ * Files up to 5 MiB after decoding. Use SCP over SSH for larger files.
3196
3292
  * Write a file in a sandbox
3197
3293
  */
3198
3294
  async writeFile(requestParameters, initOverrides) {
@@ -0,0 +1 @@
1
+ export declare const defaultFetch: typeof fetch;
@@ -0,0 +1,203 @@
1
+ // The SDK's default fetch. On Node it sends every request to an https origin over
2
+ // ONE shared HTTP/2 connection. Node's global fetch speaks HTTP/1.1 only, so N
3
+ // concurrent calls opened N TLS connections: a burst of 200 calls from a laptop
4
+ // made 200 handshakes (measured 2026-10-08), and 250 creates arrived at the API
5
+ // over 8-14 s. Elsewhere (browsers, Deno, Bun, an origin without HTTP/2), and for
6
+ // any body this does not handle, it is the global fetch.
7
+ // Pass `fetchApi` in the Configuration to use your own fetch instead.
8
+ const sessions = new Map();
9
+ const http1Only = new Set();
10
+ const slots = new WeakMap();
11
+ // A server caps the streams open at once on a connection (boat.dev: 250; this uses
12
+ // at most 100). A stream past the cap is refused, so the excess waits here. Requests open
13
+ // or waiting keep the process alive; an idle shared connection does not.
14
+ async function streamSlot(s, signal) {
15
+ var _a;
16
+ let st = slots.get(s);
17
+ if (!st) {
18
+ st = { active: 0, waiting: [] };
19
+ slots.set(s, st);
20
+ }
21
+ const state = st;
22
+ const cap = Math.max(1, Math.min(Number((_a = s.remoteSettings) === null || _a === void 0 ? void 0 : _a.maxConcurrentStreams) || 100, 100));
23
+ // Already aborted: take no stream, never queue (an abort listener added now never fires).
24
+ if (signal === null || signal === void 0 ? void 0 : signal.aborted)
25
+ return () => { };
26
+ if (state.active === 0 && state.waiting.length === 0)
27
+ s.ref();
28
+ if (state.active >= cap) {
29
+ const turn = await new Promise((wake) => {
30
+ const w = () => wake(true);
31
+ state.waiting.push(w);
32
+ // An aborted waiter leaves the queue without a stream; the caller rejects it.
33
+ signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', () => {
34
+ const i = state.waiting.indexOf(w);
35
+ if (i !== -1) {
36
+ state.waiting.splice(i, 1);
37
+ wake(false);
38
+ }
39
+ }, { once: true });
40
+ });
41
+ if (!turn)
42
+ return () => { };
43
+ }
44
+ state.active++;
45
+ let released = false;
46
+ return () => {
47
+ if (released)
48
+ return;
49
+ released = true;
50
+ state.active--;
51
+ const next = state.waiting.shift();
52
+ if (next)
53
+ next();
54
+ else if (state.active === 0)
55
+ s.unref();
56
+ };
57
+ }
58
+ let nodeHttp2;
59
+ function loadNode() {
60
+ var _a;
61
+ if (!nodeHttp2) {
62
+ const versions = (_a = globalThis.process) === null || _a === void 0 ? void 0 : _a.versions;
63
+ const isNode = !!(versions === null || versions === void 0 ? void 0 : versions.node) && !versions.bun && typeof globalThis.Deno === 'undefined';
64
+ // A variable, not a literal: a browser bundler must not try to resolve it.
65
+ const h2 = 'node:http2';
66
+ nodeHttp2 = isNode
67
+ ? import(/* webpackIgnore: true */ /* @vite-ignore */ h2).catch(() => null)
68
+ : Promise.resolve(null);
69
+ }
70
+ return nodeHttp2;
71
+ }
72
+ function session(origin, http2) {
73
+ const open = sessions.get(origin);
74
+ if (open)
75
+ return open;
76
+ const pending = new Promise((resolve) => {
77
+ let s;
78
+ try {
79
+ s = http2.connect(origin);
80
+ }
81
+ catch (_a) {
82
+ resolve(null);
83
+ return;
84
+ }
85
+ const drop = () => { if (sessions.get(origin) === pending)
86
+ sessions.delete(origin); };
87
+ s.once('connect', () => {
88
+ // An origin that answered without h2 never gets here: the TLS layer fails the connect.
89
+ s.unref(); // an idle shared connection must not keep the process alive
90
+ resolve(s);
91
+ });
92
+ // `on`, not `once`: a session can emit more than one error, and an unhandled one kills the process.
93
+ s.on('error', () => { drop(); resolve(null); });
94
+ s.once('close', drop);
95
+ s.once('goaway', drop);
96
+ });
97
+ sessions.set(origin, pending);
98
+ return pending;
99
+ }
100
+ function sendableBody(body) {
101
+ if (body == null)
102
+ return null;
103
+ if (typeof body === 'string')
104
+ return body;
105
+ if (body instanceof Uint8Array)
106
+ return body;
107
+ if (body instanceof ArrayBuffer)
108
+ return new Uint8Array(body);
109
+ if (typeof URLSearchParams !== 'undefined' && body instanceof URLSearchParams)
110
+ return body.toString();
111
+ return undefined; // FormData, Blob, streams: the global fetch encodes these
112
+ }
113
+ const HOP_BY_HOP = new Set(['connection', 'host', 'keep-alive', 'proxy-connection', 'transfer-encoding', 'upgrade']);
114
+ async function http2Fetch(input, init = {}) {
115
+ const url = new URL(typeof input === 'string' ? input : input instanceof URL ? input.href : input.url);
116
+ const body = sendableBody(init.body);
117
+ const node = await loadNode();
118
+ const isRequest = typeof input !== 'string' && !(input instanceof URL);
119
+ if (!node || isRequest || body === undefined || url.protocol !== 'https:' || http1Only.has(url.origin)) {
120
+ return fetch(input, init);
121
+ }
122
+ const s = await session(url.origin, node);
123
+ if (!s || s.closed || s.destroyed) {
124
+ if (!s)
125
+ http1Only.add(url.origin);
126
+ return fetch(input, init);
127
+ }
128
+ const headers = { ':method': (init.method || 'GET').toUpperCase(), ':path': url.pathname + url.search };
129
+ new Headers(init.headers).forEach((value, key) => { if (!HOP_BY_HOP.has(key))
130
+ headers[key] = value; });
131
+ const signal = init.signal;
132
+ const aborted = () => { var _a; return (_a = signal.reason) !== null && _a !== void 0 ? _a : new DOMException('This operation was aborted', 'AbortError'); };
133
+ const release = await streamSlot(s, signal);
134
+ return new Promise((resolve, reject) => {
135
+ if (signal === null || signal === void 0 ? void 0 : signal.aborted) {
136
+ release();
137
+ reject(aborted());
138
+ return;
139
+ }
140
+ let req;
141
+ try {
142
+ req = s.request(headers, { endStream: body === null });
143
+ }
144
+ catch (e) {
145
+ // The connection closed (GOAWAY) while this call waited for a stream.
146
+ release();
147
+ reject(e);
148
+ return;
149
+ }
150
+ const onAbort = () => { req.close(); reject(aborted()); };
151
+ signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', onAbort, { once: true });
152
+ req.once('close', () => { release(); signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', onAbort); });
153
+ req.on('error', reject); // after the response this errors its body stream; a no-op here
154
+ req.once('response', (h) => {
155
+ const status = Number(h[':status']);
156
+ const out = new Headers();
157
+ for (const [k, v] of Object.entries(h)) {
158
+ if (k.startsWith(':') || v === undefined)
159
+ continue;
160
+ for (const one of Array.isArray(v) ? v : [v])
161
+ out.append(k, String(one));
162
+ }
163
+ const empty = status === 204 || status === 205 || status === 304 || headers[':method'] === 'HEAD';
164
+ if (empty)
165
+ req.resume();
166
+ // Fed from 'data' events, not Readable.toWeb: an HTTP/2 stream the server has
167
+ // already closed is destroyed with its unread data, and toWeb's backpressure
168
+ // turned that into "Premature close" on 25 of 250 calls (prod, 2026-10-08).
169
+ // A slow reader (streamCommand between frames) must not let a fast command
170
+ // fill memory: past 4 MiB unread the stream pauses until the reader pulls.
171
+ const bodyStream = empty ? null : new ReadableStream({
172
+ start(controller) {
173
+ req.on('data', (chunk) => {
174
+ var _a;
175
+ controller.enqueue(new Uint8Array(chunk));
176
+ if (((_a = controller.desiredSize) !== null && _a !== void 0 ? _a : 1) <= 0)
177
+ req.pause();
178
+ });
179
+ req.once('end', () => controller.close());
180
+ req.once('error', (e) => controller.error(e));
181
+ req.once('close', () => {
182
+ if (!req.readableEnded) {
183
+ try {
184
+ controller.error(new Error(`HTTP/2 stream closed before its end (code ${req.rstCode})`));
185
+ }
186
+ catch (_a) { }
187
+ }
188
+ });
189
+ },
190
+ pull() { if (req.isPaused())
191
+ req.resume(); },
192
+ cancel() { req.close(); },
193
+ }, { highWaterMark: 4 * 1024 * 1024, size: (chunk) => { var _a; return (_a = chunk === null || chunk === void 0 ? void 0 : chunk.byteLength) !== null && _a !== void 0 ? _a : 0; } });
194
+ const response = new Response(bodyStream, { status, headers: out });
195
+ // Response.url is read-only; the generated client never reads it, but keep it right.
196
+ Object.defineProperty(response, 'url', { value: url.href });
197
+ resolve(response);
198
+ });
199
+ if (body !== null)
200
+ req.end(body);
201
+ });
202
+ }
203
+ export const defaultFetch = http2Fetch;
@@ -16,7 +16,7 @@
16
16
  */
17
17
  export interface CreateSandboxRequest {
18
18
  /**
19
- * Machine size. `small` consumes machine time at half rate and `large` at twice the default rate (see the Billing guide). A fork inherits the source sandbox's type unless the fork request passes its own, and resume and fork can move a sandbox between sizes.
19
+ * Machine size. `small` consumes machine time at half rate and `large` at twice the default rate (see the Billing guide). `xlarge` needs the $100/month plan or higher; lower plans get a 403 `machine_class_plan_required` on create, resume and fork. A fork inherits the source sandbox's type unless the fork request passes its own, and resume and fork can move a sandbox between sizes.
20
20
  * @type {CreateSandboxRequestTypeEnum}
21
21
  * @memberof CreateSandboxRequest
22
22
  */
@@ -60,7 +60,7 @@ export interface CreateSandboxRequest {
60
60
  */
61
61
  failFast?: boolean;
62
62
  /**
63
- * Shell script that runs on the sandbox after it is ready. Ready means "ready to accept the user", not "setup done": the script starts in the background once provisioning completes and never blocks the sandbox becoming usable. It runs as the sandbox user via `bash`, with the sandbox's environment applied, and its output goes to a log file on the sandbox. Observe the outcome as `setupStatus` (pending/running/done/failed) and `setupError` on the sandbox. Rejected with a 400 `invalid_setup_script` error when it is not a string or exceeds 64KB.
63
+ * Shell script that runs on the sandbox after it is ready. Ready means "ready to accept the user", not "setup done": the script starts in the background once provisioning completes and never blocks the sandbox becoming usable. It runs as the sandbox user (`user`, not root; `sudo` needs no password) via `bash`, with the sandbox's environment applied, and its output goes to a log file on the sandbox. Observe the outcome as `setupStatus` (pending/running/done/failed) and `setupError` on the sandbox. Rejected with a 400 `invalid_setup_script` error when it is not a string or exceeds 64KB.
64
64
  * @type {string}
65
65
  * @memberof CreateSandboxRequest
66
66
  */
@@ -91,6 +91,7 @@ export declare const CreateSandboxRequestTypeEnum: {
91
91
  readonly Small: 'small';
92
92
  readonly Default: 'default';
93
93
  readonly Large: 'large';
94
+ readonly Xlarge: 'xlarge';
94
95
  };
95
96
  export type CreateSandboxRequestTypeEnum = typeof CreateSandboxRequestTypeEnum[keyof typeof CreateSandboxRequestTypeEnum];
96
97
  /**
@@ -17,7 +17,8 @@
17
17
  export const CreateSandboxRequestTypeEnum = {
18
18
  Small: 'small',
19
19
  Default: 'default',
20
- Large: 'large'
20
+ Large: 'large',
21
+ Xlarge: 'xlarge'
21
22
  };
22
23
  /**
23
24
  * Check if a given object implements the CreateSandboxRequest interface.
@@ -42,7 +42,7 @@ export interface ForkRequest {
42
42
  */
43
43
  noEnv?: boolean;
44
44
  /**
45
- * Machine size for the fork. Omit to inherit the source sandbox's type. The source sandbox is never modified. Shrinking is rejected with `type_too_small` when the source's data would not fit the smaller disk.
45
+ * Machine size for the fork. Omit to inherit the source sandbox's type. `xlarge` needs the $100/month plan or higher (403 `machine_class_plan_required`). The source sandbox is never modified. Shrinking is rejected with `type_too_small` when the source's data would not fit the smaller disk.
46
46
  * @type {ForkRequestTypeEnum}
47
47
  * @memberof ForkRequest
48
48
  */
@@ -61,6 +61,7 @@ export declare const ForkRequestTypeEnum: {
61
61
  readonly Small: 'small';
62
62
  readonly Default: 'default';
63
63
  readonly Large: 'large';
64
+ readonly Xlarge: 'xlarge';
64
65
  };
65
66
  export type ForkRequestTypeEnum = typeof ForkRequestTypeEnum[keyof typeof ForkRequestTypeEnum];
66
67
  /**
@@ -17,7 +17,8 @@
17
17
  export const ForkRequestTypeEnum = {
18
18
  Small: 'small',
19
19
  Default: 'default',
20
- Large: 'large'
20
+ Large: 'large',
21
+ Xlarge: 'xlarge'
21
22
  };
22
23
  /**
23
24
  * Check if a given object implements the ForkRequest interface.
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Boat Public API v1
3
+ * Public JSON API for creating, operating, prompting, observing, and exposing sandboxes from backend services, CI jobs, hosted workers, and Boat automation products. The v1 reference intentionally documents the developer integration surface only. Dashboard billing actions are not part of v1.
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface Recover200Response
16
+ */
17
+ export interface Recover200Response {
18
+ /**
19
+ *
20
+ * @type {boolean}
21
+ * @memberof Recover200Response
22
+ */
23
+ ok?: boolean;
24
+ /**
25
+ *
26
+ * @type {string}
27
+ * @memberof Recover200Response
28
+ */
29
+ type?: string;
30
+ /**
31
+ *
32
+ * @type {Recover200ResponseStatusEnum}
33
+ * @memberof Recover200Response
34
+ */
35
+ status?: Recover200ResponseStatusEnum;
36
+ /**
37
+ *
38
+ * @type {string}
39
+ * @memberof Recover200Response
40
+ */
41
+ message?: string;
42
+ }
43
+ /**
44
+ * @export
45
+ */
46
+ export declare const Recover200ResponseStatusEnum: {
47
+ readonly Recovering: 'recovering';
48
+ };
49
+ export type Recover200ResponseStatusEnum = typeof Recover200ResponseStatusEnum[keyof typeof Recover200ResponseStatusEnum];
50
+ /**
51
+ * Check if a given object implements the Recover200Response interface.
52
+ */
53
+ export declare function instanceOfRecover200Response(value: object): value is Recover200Response;
54
+ export declare function Recover200ResponseFromJSON(json: any): Recover200Response;
55
+ export declare function Recover200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): Recover200Response;
56
+ export declare function Recover200ResponseToJSON(json: any): Recover200Response;
57
+ export declare function Recover200ResponseToJSONTyped(value?: Recover200Response | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,53 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Boat Public API v1
5
+ * Public JSON API for creating, operating, prompting, observing, and exposing sandboxes from backend services, CI jobs, hosted workers, and Boat automation products. The v1 reference intentionally documents the developer integration surface only. Dashboard billing actions are not part of v1.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ /**
15
+ * @export
16
+ */
17
+ export const Recover200ResponseStatusEnum = {
18
+ Recovering: 'recovering'
19
+ };
20
+ /**
21
+ * Check if a given object implements the Recover200Response interface.
22
+ */
23
+ export function instanceOfRecover200Response(value) {
24
+ return true;
25
+ }
26
+ export function Recover200ResponseFromJSON(json) {
27
+ return Recover200ResponseFromJSONTyped(json, false);
28
+ }
29
+ export function Recover200ResponseFromJSONTyped(json, ignoreDiscriminator) {
30
+ if (json == null) {
31
+ return json;
32
+ }
33
+ return {
34
+ 'ok': json['ok'] == null ? undefined : json['ok'],
35
+ 'type': json['type'] == null ? undefined : json['type'],
36
+ 'status': json['status'] == null ? undefined : json['status'],
37
+ 'message': json['message'] == null ? undefined : json['message'],
38
+ };
39
+ }
40
+ export function Recover200ResponseToJSON(json) {
41
+ return Recover200ResponseToJSONTyped(json, false);
42
+ }
43
+ export function Recover200ResponseToJSONTyped(value, ignoreDiscriminator = false) {
44
+ if (value == null) {
45
+ return value;
46
+ }
47
+ return {
48
+ 'ok': value['ok'],
49
+ 'type': value['type'],
50
+ 'status': value['status'],
51
+ 'message': value['message'],
52
+ };
53
+ }
@@ -22,7 +22,7 @@ export interface ResumeRequest {
22
22
  */
23
23
  failFast?: boolean;
24
24
  /**
25
- * Resume onto a different machine size. Omit to keep the sandbox's current type. A resume already restores onto a fresh machine, so changing size costs nothing extra. Shrinking is rejected with `type_too_small` when the sandbox's data would not fit the smaller disk.
25
+ * Resume onto a different machine size. Omit to keep the sandbox's current type. `xlarge` needs the $100/month plan or higher (403 `machine_class_plan_required`). A resume already restores onto a fresh machine, so changing size costs nothing extra. Shrinking is rejected with `type_too_small` when the sandbox's data would not fit the smaller disk.
26
26
  * @type {ResumeRequestTypeEnum}
27
27
  * @memberof ResumeRequest
28
28
  */
@@ -61,6 +61,7 @@ export declare const ResumeRequestTypeEnum: {
61
61
  readonly Small: 'small';
62
62
  readonly Default: 'default';
63
63
  readonly Large: 'large';
64
+ readonly Xlarge: 'xlarge';
64
65
  };
65
66
  export type ResumeRequestTypeEnum = typeof ResumeRequestTypeEnum[keyof typeof ResumeRequestTypeEnum];
66
67
  /**
@@ -17,7 +17,8 @@
17
17
  export const ResumeRequestTypeEnum = {
18
18
  Small: 'small',
19
19
  Default: 'default',
20
- Large: 'large'
20
+ Large: 'large',
21
+ Xlarge: 'xlarge'
21
22
  };
22
23
  /**
23
24
  * Check if a given object implements the ResumeRequest interface.
@@ -90,7 +90,7 @@ export interface Sandbox {
90
90
  */
91
91
  memoryGB?: number;
92
92
  /**
93
- * Rate at which this sandbox consumes machine time. 0.5 for `small`, 1 for `default`, and 2 for `large`.
93
+ * Rate at which this sandbox consumes machine time. 0.5 for `small`, 1 for `default`, 2 for `large`, and 50/9 (about 5.56) for `xlarge`.
94
94
  * @type {number}
95
95
  * @memberof Sandbox
96
96
  */
@@ -290,6 +290,7 @@ export declare const SandboxTypeEnum: {
290
290
  readonly Small: 'small';
291
291
  readonly Default: 'default';
292
292
  readonly Large: 'large';
293
+ readonly Xlarge: 'xlarge';
293
294
  };
294
295
  export type SandboxTypeEnum = typeof SandboxTypeEnum[keyof typeof SandboxTypeEnum];
295
296
  /**
@@ -42,7 +42,8 @@ export const SandboxHealthEnum = {
42
42
  export const SandboxTypeEnum = {
43
43
  Small: 'small',
44
44
  Default: 'default',
45
- Large: 'large'
45
+ Large: 'large',
46
+ Xlarge: 'xlarge'
46
47
  };
47
48
  /**
48
49
  * @export