disk 1.11.0 → 1.12.1

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.
@@ -1,17 +1,164 @@
1
1
  import { t as toSegments } from "./paths-Br9snUhy.mjs";
2
- import createClientDefault from "openapi-fetch";
3
- import { XMLParser } from "fast-xml-parser";
2
+ //#region src/api-fetch.ts
3
+ function buildPath(template, params = {}) {
4
+ return template.replace(/\{([^}]+)\}/g, (_, name) => {
5
+ const value = params[name];
6
+ if (value === void 0) throw new Error(`Missing path parameter '${name}' for ${template}`);
7
+ return encodeURIComponent(String(value));
8
+ });
9
+ }
10
+ /** Serialize a query object; undefined/null values are omitted and arrays repeat the key. */
11
+ function buildQuery(query = {}) {
12
+ const parts = [];
13
+ for (const [name, value] of Object.entries(query)) for (const item of Array.isArray(value) ? value : [value]) {
14
+ if (item === void 0 || item === null) continue;
15
+ parts.push(`${encodeURIComponent(name)}=${encodeURIComponent(String(item))}`);
16
+ }
17
+ return parts.length > 0 ? `?${parts.join("&")}` : "";
18
+ }
19
+ function createClient(config) {
20
+ const baseUrl = config.baseUrl.replace(/\/+$/, "");
21
+ const send = (request) => (config.fetch ?? globalThis.fetch)(request);
22
+ const headersFor = (extra = {}) => {
23
+ const headers = new Headers(config.headers);
24
+ for (const [name, value] of Object.entries(extra)) if (value !== void 0) headers.set(name, value);
25
+ return headers;
26
+ };
27
+ const call = async (method, path, init = {}) => {
28
+ const url = baseUrl + buildPath(path, init.params?.path) + buildQuery(init.params?.query);
29
+ const headers = headersFor(init.params?.header);
30
+ let body;
31
+ if (init.body !== void 0) {
32
+ body = JSON.stringify(init.body);
33
+ if (!headers.has("Content-Type")) headers.set("Content-Type", "application/json");
34
+ }
35
+ const response = await send(new Request(url, {
36
+ method,
37
+ headers,
38
+ body
39
+ }));
40
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
41
+ await response.body?.cancel().catch(() => {});
42
+ return response.ok ? {
43
+ data: void 0,
44
+ response
45
+ } : {
46
+ error: void 0,
47
+ response
48
+ };
49
+ }
50
+ if (response.ok) return {
51
+ data: await response.json(),
52
+ response
53
+ };
54
+ const text = await response.text();
55
+ let error = text;
56
+ try {
57
+ error = JSON.parse(text);
58
+ } catch {}
59
+ return {
60
+ error,
61
+ response
62
+ };
63
+ };
64
+ const method = (name) => ((path, init) => call(name, path, init));
65
+ return {
66
+ GET: method("GET"),
67
+ PUT: method("PUT"),
68
+ POST: method("POST"),
69
+ DELETE: method("DELETE"),
70
+ PATCH: method("PATCH"),
71
+ raw: (methodName, url, init = {}) => send(new Request(url, {
72
+ method: methodName,
73
+ headers: headersFor(init.headers),
74
+ body: init.body
75
+ }))
76
+ };
77
+ }
78
+ //#endregion
4
79
  //#region src/s3xml.ts
5
- const parser = new XMLParser({
6
- isArray: (name) => name === "Contents" || name === "CommonPrefixes",
7
- parseTagValue: false,
8
- trimValues: true,
9
- ignoreAttributes: true
10
- });
80
+ const ALWAYS_ARRAY = /* @__PURE__ */ new Set(["Contents", "CommonPrefixes"]);
81
+ const NAMED_ENTITIES = {
82
+ amp: "&",
83
+ lt: "<",
84
+ gt: ">",
85
+ quot: "\"",
86
+ apos: "'"
87
+ };
88
+ function decodeEntities(text) {
89
+ if (!text.includes("&")) return text;
90
+ return text.replace(/&(#x[0-9a-fA-F]+|#[0-9]+|[a-zA-Z]+);/g, (match, ref) => {
91
+ if (ref[0] === "#") {
92
+ const code = ref[1] === "x" || ref[1] === "X" ? parseInt(ref.slice(2), 16) : parseInt(ref.slice(1), 10);
93
+ return code > 1114111 ? match : String.fromCodePoint(code);
94
+ }
95
+ return Object.hasOwn(NAMED_ENTITIES, ref) ? NAMED_ENTITIES[ref] : match;
96
+ });
97
+ }
98
+ function setOwn(target, name, value) {
99
+ Object.defineProperty(target, name, {
100
+ value,
101
+ enumerable: true,
102
+ writable: true,
103
+ configurable: true
104
+ });
105
+ }
106
+ function addChild(parent, name, value) {
107
+ parent.hasChildren = true;
108
+ const existing = Object.hasOwn(parent.children, name) ? parent.children[name] : void 0;
109
+ if (existing === void 0) setOwn(parent.children, name, ALWAYS_ARRAY.has(name) ? [value] : value);
110
+ else if (Array.isArray(existing)) existing.push(value);
111
+ else setOwn(parent.children, name, [existing, value]);
112
+ }
113
+ /** Index just past `terminator`, searching from `from`; throws if it never appears. */
114
+ function skipPast(xml, terminator, from) {
115
+ const end = xml.indexOf(terminator, from);
116
+ if (end === -1) throw new Error(`Malformed XML: missing '${terminator}'`);
117
+ return end + terminator.length;
118
+ }
11
119
  /** Parse an XML document into a plain object. Returns {} for empty/blank input. */
12
120
  function parseXml(xml) {
13
- if (!xml.trim()) return {};
14
- return parser.parse(xml);
121
+ const root = {
122
+ name: "",
123
+ children: {},
124
+ hasChildren: false,
125
+ text: ""
126
+ };
127
+ const stack = [root];
128
+ let position = 0;
129
+ while (position < xml.length) {
130
+ const current = stack[stack.length - 1];
131
+ const open = xml.indexOf("<", position);
132
+ current.text += decodeEntities(xml.slice(position, open === -1 ? xml.length : open));
133
+ if (open === -1) break;
134
+ if (xml.startsWith("<!--", open)) position = skipPast(xml, "-->", open + 4);
135
+ else if (xml.startsWith("<![CDATA[", open)) {
136
+ position = skipPast(xml, "]]>", open + 9);
137
+ current.text += xml.slice(open + 9, position - 3);
138
+ } else if (xml.startsWith("<?", open)) position = skipPast(xml, "?>", open + 2);
139
+ else if (xml.startsWith("<!", open)) throw new Error("Malformed XML: DOCTYPE and other declarations are not supported");
140
+ else {
141
+ position = skipPast(xml, ">", open + 1);
142
+ const tag = xml.slice(open + 1, position - 1);
143
+ const closing = tag.startsWith("/");
144
+ const selfClosing = !closing && tag.endsWith("/");
145
+ const name = /^[^\s/]+/.exec(closing ? tag.slice(1) : tag)?.[0];
146
+ if (!name) throw new Error(`Malformed XML: invalid tag <${tag}>`);
147
+ if (closing) {
148
+ if (current.name !== name || stack.length === 1) throw new Error(`Malformed XML: unexpected </${name}>`);
149
+ stack.pop();
150
+ addChild(stack[stack.length - 1], name, current.hasChildren ? current.children : current.text);
151
+ } else if (selfClosing) addChild(current, name, "");
152
+ else stack.push({
153
+ name,
154
+ children: {},
155
+ hasChildren: false,
156
+ text: ""
157
+ });
158
+ }
159
+ }
160
+ if (stack.length !== 1) throw new Error(`Malformed XML: unclosed <${stack[stack.length - 1].name}>`);
161
+ return root.children;
15
162
  }
16
163
  //#endregion
17
164
  //#region src/errors.ts
@@ -140,15 +287,15 @@ function deriveS3BaseUrl(controlBaseUrl) {
140
287
  }
141
288
  //#endregion
142
289
  //#region src/version.ts
143
- const VERSION = "1.11.0";
290
+ const VERSION = "1.12.1";
144
291
  const USER_AGENT = `archil-js/${VERSION}`;
145
292
  //#endregion
146
293
  //#region src/client.ts
147
- const createClient = typeof createClientDefault === "function" ? createClientDefault : createClientDefault.default;
148
294
  function isNodeRuntime() {
149
295
  return typeof process !== "undefined" && typeof process.versions?.node === "string";
150
296
  }
151
- const undiciModule = isNodeRuntime() ? import("undici") : void 0;
297
+ const undiciSpecifier = isNodeRuntime() && process.versions.bun !== void 0 ? "undici/index.js" : "undici";
298
+ const undiciModule = isNodeRuntime() ? import(undiciSpecifier) : void 0;
152
299
  const CONTROL_PLANE_CONNECTIONS = 1;
153
300
  const IDLE_SESSION_TIMEOUT_MS = 3e4;
154
301
  function isAsyncIterableBody(body) {
@@ -175,10 +322,10 @@ const bufferRequestBodies = (dispatch) => (options, handler) => {
175
322
  return true;
176
323
  };
177
324
  const sharedTransports = /* @__PURE__ */ new Map();
178
- function dispatcherKey(baseUrl, apiKey, ca) {
325
+ function dispatcherKey(baseUrl, authorization, ca) {
179
326
  return JSON.stringify([
180
327
  new URL(baseUrl).origin,
181
- apiKey,
328
+ authorization,
182
329
  ca?.map((cert) => cert.toString("base64"))
183
330
  ]);
184
331
  }
@@ -204,13 +351,13 @@ function getSharedTransport(key, ca) {
204
351
  });
205
352
  return transport;
206
353
  }
207
- function createPooledFetch(baseUrl, apiKey, tls) {
354
+ function createPooledFetch(baseUrl, authorization, tls) {
208
355
  if (!isNodeRuntime()) {
209
356
  if (tls?.ca !== void 0) throw new Error("Custom TLS CAs require Node.js");
210
357
  return;
211
358
  }
212
359
  const ca = tls?.ca === void 0 ? void 0 : (Array.isArray(tls.ca) ? tls.ca : [tls.ca]).map((cert) => Buffer.from(cert));
213
- const key = dispatcherKey(baseUrl, apiKey, ca);
360
+ const key = dispatcherKey(baseUrl, authorization, ca);
214
361
  return async (request) => {
215
362
  const { fetch, dispatcher } = await getSharedTransport(key, ca);
216
363
  const body = request.body === null ? null : new Uint8Array(await request.arrayBuffer());
@@ -224,14 +371,23 @@ function createPooledFetch(baseUrl, apiKey, tls) {
224
371
  });
225
372
  };
226
373
  }
374
+ /**
375
+ * The `Authorization` value for an API key: the key exactly as given, as a
376
+ * bearer token. Credential-injecting proxies substitute a placeholder only when
377
+ * it is the whole token, so the SDK must not add a prefix to it. The control
378
+ * plane accepts the key with or without its `key-` prefix after `Bearer`.
379
+ */
380
+ function apiKeyAuthorization(apiKey) {
381
+ return `Bearer ${apiKey}`;
382
+ }
227
383
  function createApiClient(opts) {
228
384
  const baseUrl = opts.baseUrl ?? resolveBaseUrl(opts.region);
229
- const apiKey = `key-${opts.apiKey.replace(/^key-/, "")}`;
385
+ const authorization = apiKeyAuthorization(opts.apiKey);
230
386
  return createClient({
231
387
  baseUrl,
232
- fetch: createPooledFetch(baseUrl, apiKey, opts.tls),
388
+ fetch: createPooledFetch(baseUrl, authorization, opts.tls),
233
389
  headers: {
234
- Authorization: apiKey,
390
+ Authorization: authorization,
235
391
  "User-Agent": USER_AGENT
236
392
  }
237
393
  });
@@ -271,6 +427,22 @@ async function unwrapEmpty(promise) {
271
427
  }
272
428
  if (!body.success) throw new ArchilApiError(body.error ?? "Unknown API error", response.status, body.code);
273
429
  }
430
+ //#endregion
431
+ //#region src/exec-options.ts
432
+ /**
433
+ * @internal Copies only the known option keys into a request body. Every key
434
+ * is required here, so an option added to the API fails to compile until it is
435
+ * copied.
436
+ */
437
+ function execVmBody(options) {
438
+ return {
439
+ baseImage: options?.baseImage,
440
+ imageId: options?.imageId,
441
+ vcpuCount: options?.vcpuCount,
442
+ memSizeMib: options?.memSizeMib,
443
+ network: options?.network
444
+ };
445
+ }
274
446
  const RETRY_BASE_MS = 100;
275
447
  const RETRY_CAP_MS = 2e3;
276
448
  const TRANSIENT_STATUSES = /* @__PURE__ */ new Set([
@@ -550,10 +722,13 @@ var Disk = class {
550
722
  * Execute a command in a container with this disk mounted.
551
723
  * Blocks until the command completes and returns stdout, stderr, and exit code.
552
724
  */
553
- async exec(command) {
725
+ async exec(command, options) {
554
726
  return unwrap(retryApiRequest(() => this._client.POST("/api/disks/{id}/exec", {
555
727
  params: { path: { id: this.id } },
556
- body: { command }
728
+ body: {
729
+ ...execVmBody(options),
730
+ command
731
+ }
557
732
  }), "connect"));
558
733
  }
559
734
  /**
@@ -900,29 +1075,22 @@ var Disk = class {
900
1075
  */
901
1076
  async _s3Request(method, key, opts = {}) {
902
1077
  if (!this._s3BaseUrl) throw new Error("S3 base URL not configured. Pass s3BaseUrl to new Archil({...}) or set ARCHIL_S3_BASE_URL.");
903
- const call = this._client[method];
904
1078
  const encodedKey = key.replace(/^\//, "").split("/").map(encodeURIComponent).join("/");
905
1079
  const path = encodedKey ? `/${this.id}/${encodedKey}` : `/${this.id}`;
1080
+ const url = `${this._s3BaseUrl.replace(/\/+$/, "")}${path}${buildQuery(opts.query)}`;
906
1081
  const init = {
907
- baseUrl: this._s3BaseUrl,
908
- parseAs: "stream",
909
- ...opts.query ? { params: { query: opts.query } } : {},
910
- ...opts.body !== void 0 ? {
911
- body: opts.body,
912
- bodySerializer: (b) => b
913
- } : {},
914
- ...opts.contentType || opts.extraHeaders ? { headers: {
1082
+ body: opts.body,
1083
+ headers: {
915
1084
  ...opts.contentType ? { "Content-Type": opts.contentType } : {},
916
1085
  ...opts.extraHeaders
917
- } } : {}
1086
+ }
918
1087
  };
919
1088
  const hasBody = method === "GET" || method === "POST";
920
1089
  const maxRetries = opts.retry === false ? 0 : 3;
921
1090
  for (let attempt = 0;; attempt++) {
922
- let error;
923
1091
  let response;
924
1092
  try {
925
- ({error, response} = await call(path, init));
1093
+ response = await this._client.raw(method, url, init);
926
1094
  } catch (transportError) {
927
1095
  if (attempt < maxRetries) {
928
1096
  await retrySleep(attempt);
@@ -936,15 +1104,15 @@ var Disk = class {
936
1104
  await retrySleep(attempt);
937
1105
  continue;
938
1106
  }
939
- const message = typeof error === "string" ? error : error ? JSON.stringify(error) : "";
940
1107
  return {
941
1108
  ok: false,
942
1109
  status: response.status,
943
1110
  statusText: response.statusText,
944
1111
  headers: response.headers,
945
- body: new TextEncoder().encode(message)
1112
+ body: new Uint8Array(await response.arrayBuffer())
946
1113
  };
947
1114
  }
1115
+ if (!hasBody) await response.body?.cancel().catch(() => {});
948
1116
  const bytes = hasBody ? new Uint8Array(await response.arrayBuffer()) : /* @__PURE__ */ new Uint8Array(0);
949
1117
  return {
950
1118
  ok: true,
@@ -1370,10 +1538,13 @@ var Disks = class {
1370
1538
  * disk ID directly so callers that do not need its metadata can execute
1371
1539
  * without fetching the disk first.
1372
1540
  */
1373
- async exec(id, command) {
1541
+ async exec(id, command, options) {
1374
1542
  return unwrap(retryApiRequest(() => this._client.POST("/api/disks/{id}/exec", {
1375
1543
  params: { path: { id } },
1376
- body: { command }
1544
+ body: {
1545
+ ...execVmBody(options),
1546
+ command
1547
+ }
1377
1548
  }), "connect"));
1378
1549
  }
1379
1550
  };
@@ -1451,6 +1622,15 @@ var Images = class {
1451
1622
  //#endregion
1452
1623
  //#region src/sandbox-process.ts
1453
1624
  const PROCESS_STDIN_CHUNK_BYTES = 1024 * 1024;
1625
+ /** Close codes the runtime uses when it ends a connection to a running process. */
1626
+ const CLOSE_REASONS = {
1627
+ 4001: "Process was taken over by another connection",
1628
+ 4003: "Process owner disconnected"
1629
+ };
1630
+ /** The subprotocol the runtime selects for a process connection. */
1631
+ const CONNECT_SUBPROTOCOL = "archil.connect.v1";
1632
+ /** Prefix of the subprotocol that carries a connection token. */
1633
+ const TOKEN_SUBPROTOCOL_PREFIX = "archil.token.";
1454
1634
  async function waitForSocketOpen(socket) {
1455
1635
  if (socket.readyState === WebSocket.OPEN) return;
1456
1636
  await new Promise((resolve, reject) => {
@@ -1476,12 +1656,13 @@ async function waitForSocketOpen(socket) {
1476
1656
  socket.addEventListener("close", closed, { once: true });
1477
1657
  });
1478
1658
  }
1479
- async function openProcessSocket(connectionUrl) {
1659
+ async function openProcessSocket(connectionEndpoint) {
1480
1660
  for (let attempt = 0;; attempt++) {
1481
- const url = await connectionUrl();
1661
+ const target = await connectionEndpoint();
1662
+ const endpoint = typeof target === "string" ? { url: target } : target;
1482
1663
  let socket;
1483
1664
  try {
1484
- socket = new WebSocket(url);
1665
+ socket = endpoint.protocols ? new WebSocket(endpoint.url, endpoint.protocols) : new WebSocket(endpoint.url);
1485
1666
  await waitForSocketOpen(socket);
1486
1667
  return socket;
1487
1668
  } catch (error) {
@@ -1517,7 +1698,7 @@ var SandboxProcess = class {
1517
1698
  _cursor;
1518
1699
  _onOutput;
1519
1700
  _collectOutput;
1520
- _connectionUrl;
1701
+ _connectionEndpoint;
1521
1702
  _controlProcess;
1522
1703
  _stdoutDecoder = new TextDecoder();
1523
1704
  _stderrDecoder = new TextDecoder();
@@ -1529,12 +1710,12 @@ var SandboxProcess = class {
1529
1710
  _connectionError;
1530
1711
  _stdinClosed = false;
1531
1712
  /** @internal */
1532
- constructor(processId, cursor, onOutput, collectOutput, connectionUrl, controlProcess) {
1713
+ constructor(processId, cursor, onOutput, collectOutput, connectionEndpoint, controlProcess) {
1533
1714
  this._id = processId;
1534
1715
  this._cursor = cursor;
1535
1716
  this._onOutput = onOutput;
1536
1717
  this._collectOutput = collectOutput;
1537
- this._connectionUrl = connectionUrl;
1718
+ this._connectionEndpoint = connectionEndpoint;
1538
1719
  this._controlProcess = controlProcess;
1539
1720
  this._terminal = new Promise((resolve) => {
1540
1721
  this._resolveTerminal = resolve;
@@ -1595,7 +1776,7 @@ var SandboxProcess = class {
1595
1776
  }
1596
1777
  /** @internal */
1597
1778
  async _connect(request) {
1598
- const socket = await openProcessSocket(this._connectionUrl);
1779
+ const socket = await openProcessSocket(this._connectionEndpoint);
1599
1780
  socket.binaryType = "arraybuffer";
1600
1781
  this._socket = socket;
1601
1782
  let resolveClosed;
@@ -1637,7 +1818,9 @@ var SandboxProcess = class {
1637
1818
  this._connectionError = error;
1638
1819
  fail(error);
1639
1820
  });
1640
- socket.addEventListener("close", () => {
1821
+ socket.addEventListener("close", (event) => {
1822
+ const reason = CLOSE_REASONS[event.code];
1823
+ if (reason && !this._result) this._connectionError = new Error(reason);
1641
1824
  if (this._socket === socket) this._socket = void 0;
1642
1825
  if (!readySettled) rejectReady(/* @__PURE__ */ new Error("Process connection closed before ready"));
1643
1826
  resolveClosed();
@@ -2054,7 +2237,7 @@ var Sandbox = class Sandbox {
2054
2237
  }
2055
2238
  /** Start a process and return its handle without waiting for exit. */
2056
2239
  async run(command, options = {}) {
2057
- const process = new SandboxProcess("", 0, options.onOutput, options.collectOutput ?? true, () => this._connectionUrl(), (request) => this._control(request));
2240
+ const process = new SandboxProcess("", 0, options.onOutput, options.collectOutput ?? true, () => this._connectionEndpoint(), (request) => this._control(request));
2058
2241
  const terminal = typeof options.terminal === "object" ? {
2059
2242
  cols: options.terminal.cols ?? 80,
2060
2243
  rows: options.terminal.rows ?? 24
@@ -2072,19 +2255,25 @@ var Sandbox = class Sandbox {
2072
2255
  /** Reattach to a process, optionally resuming output from a cursor. */
2073
2256
  async attach(processId, options = {}) {
2074
2257
  const offset = options.offset ?? 0;
2075
- const process = new SandboxProcess(processId, offset, options.onOutput, options.collectOutput ?? true, () => this._connectionUrl(), (request) => this._control(request));
2258
+ const process = new SandboxProcess(processId, offset, options.onOutput, options.collectOutput ?? true, () => this._connectionEndpoint(), (request) => this._control(request));
2076
2259
  await process._connect({
2077
2260
  type: "attach",
2078
2261
  process_id: processId,
2079
- offset
2262
+ offset,
2263
+ ...options.shared ? { shared: true } : {}
2080
2264
  });
2081
2265
  return process;
2082
2266
  }
2083
- async _connectionUrl() {
2084
- return (await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes/{sid}/connections", { params: { path: { sid: this.id } } }), "transient"))).url;
2267
+ async _connectionEndpoint() {
2268
+ const data = await unwrap(retryApiRequest(() => this._client.POST("/api/sandboxes/{sid}/connections", { params: { path: { sid: this.id } } }), "transient"));
2269
+ if (data.endpoint && data.token) return {
2270
+ url: data.endpoint,
2271
+ protocols: [CONNECT_SUBPROTOCOL, `${TOKEN_SUBPROTOCOL_PREFIX}${data.token}`]
2272
+ };
2273
+ return { url: data.url };
2085
2274
  }
2086
2275
  async _control(request) {
2087
- const socket = await openProcessSocket(() => this._connectionUrl());
2276
+ const socket = await openProcessSocket(() => this._connectionEndpoint());
2088
2277
  const expected = request.type === "kill" ? "killed" : "resized";
2089
2278
  await new Promise((resolve, reject) => {
2090
2279
  socket.addEventListener("message", (message) => {
@@ -2761,6 +2950,7 @@ var Archil = class {
2761
2950
  disks[relPath] = entry;
2762
2951
  } else disks[relPath] = diskIdFromMount(mount);
2763
2952
  return unwrap(retryApiRequest(() => this._client.POST("/api/exec", { body: {
2953
+ ...execVmBody(opts),
2764
2954
  disks,
2765
2955
  command: opts.command
2766
2956
  } }), "connect"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disk",
3
- "version": "1.11.0",
3
+ "version": "1.12.1",
4
4
  "description": "Pure-JS client and CLIs for Archil disks and sandboxes",
5
5
  "keywords": [
6
6
  "archil",
@@ -40,20 +40,23 @@
40
40
  "LICENSE"
41
41
  ],
42
42
  "dependencies": {
43
- "@archildata/api-types": "^0.0.78",
44
- "@clack/prompts": "^1.7.0",
45
- "commander": "^14.0.3",
46
- "fast-xml-parser": "^5.7.0",
47
- "openapi-fetch": "^0.13.5",
48
- "undici": "8.10.2",
49
- "uuid": "^11.1.1",
43
+ "@archildata/api-types": "^0.0.81",
44
+ "undici": "^8.12.3"
45
+ },
46
+ "peerDependencies": {
50
47
  "zod": "^4.4.3"
51
48
  },
49
+ "peerDependenciesMeta": {
50
+ "zod": {
51
+ "optional": true
52
+ }
53
+ },
52
54
  "devDependencies": {
53
55
  "@types/node": "^26.0.1",
54
56
  "tsdown": "^0.22.3",
55
57
  "typescript": "^6.0.3",
56
- "vitest": "^4.1.9"
58
+ "vitest": "^4.1.9",
59
+ "zod": "^4.4.3"
57
60
  },
58
61
  "engines": {
59
62
  "node": ">= 22.19.0"
@@ -62,6 +65,7 @@
62
65
  "build": "tsdown",
63
66
  "dev": "tsdown --watch",
64
67
  "typecheck": "tsc --noEmit",
65
- "test": "vitest run"
68
+ "test": "vitest run",
69
+ "test:bun": "bun test test/client-pool.test.ts test/client-tls.test.ts test/control-plane-retries.test.ts test/http2-goaway.test.ts"
66
70
  }
67
71
  }