@cortexkit/aft-pi 0.51.3 → 0.52.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.
package/dist/index.js CHANGED
@@ -19,12 +19,14 @@ var __toESM = (mod, isNodeMode, target) => {
19
19
  }
20
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
21
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
- for (let key of __getOwnPropNames(mod))
23
- if (!__hasOwnProp.call(to, key))
24
- __defProp(to, key, {
25
- get: __accessProp.bind(mod, key),
26
- enumerable: true
27
- });
22
+ if (mod && typeof mod === "object" || typeof mod === "function") {
23
+ for (let key of __getOwnPropNames(mod))
24
+ if (!__hasOwnProp.call(to, key))
25
+ __defProp(to, key, {
26
+ get: __accessProp.bind(mod, key),
27
+ enumerable: true
28
+ });
29
+ }
28
30
  if (canCache)
29
31
  cache.set(mod, to);
30
32
  return to;
@@ -46,7 +48,7 @@ var __export = (target, all) => {
46
48
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
47
49
 
48
50
  // ../../node_modules/.bun/esprima@4.0.1/node_modules/esprima/dist/esprima.js
49
- var require_esprima = __commonJS((exports, module) => {
51
+ var require_esprima = __commonJS(function(exports, module) {
50
52
  (function webpackUniversalModuleDefinition(root, factory) {
51
53
  if (typeof exports === "object" && typeof module === "object")
52
54
  module.exports = factory();
@@ -6186,7 +6188,7 @@ var require_esprima = __commonJS((exports, module) => {
6186
6188
  });
6187
6189
 
6188
6190
  // ../../node_modules/.bun/array-timsort@1.0.3/node_modules/array-timsort/src/index.js
6189
- var require_src = __commonJS((exports, module) => {
6191
+ var require_src = __commonJS(function(exports, module) {
6190
6192
  var DEFAULT_MIN_MERGE = 32;
6191
6193
  var DEFAULT_MIN_GALLOPING = 7;
6192
6194
  var DEFAULT_TMP_STORAGE_LENGTH = 256;
@@ -6829,7 +6831,7 @@ var require_src = __commonJS((exports, module) => {
6829
6831
  });
6830
6832
 
6831
6833
  // ../../node_modules/.bun/comment-json@5.0.0/node_modules/comment-json/src/common.js
6832
- var require_common = __commonJS((exports, module) => {
6834
+ var require_common = __commonJS(function(exports, module) {
6833
6835
  var PREFIX_BEFORE = "before";
6834
6836
  var PREFIX_AFTER_PROP = "after-prop";
6835
6837
  var PREFIX_AFTER_COLON = "after-colon";
@@ -7115,7 +7117,7 @@ var require_common = __commonJS((exports, module) => {
7115
7117
  });
7116
7118
 
7117
7119
  // ../../node_modules/.bun/comment-json@5.0.0/node_modules/comment-json/src/array.js
7118
- var require_array = __commonJS((exports, module) => {
7120
+ var require_array = __commonJS(function(exports, module) {
7119
7121
  var { sort } = require_src();
7120
7122
  var {
7121
7123
  PROP_SYMBOL_PREFIXES,
@@ -7273,7 +7275,7 @@ var require_array = __commonJS((exports, module) => {
7273
7275
  });
7274
7276
 
7275
7277
  // ../../node_modules/.bun/comment-json@5.0.0/node_modules/comment-json/src/parse.js
7276
- var require_parse = __commonJS((exports, module) => {
7278
+ var require_parse = __commonJS(function(exports, module) {
7277
7279
  var esprima = require_esprima();
7278
7280
  var {
7279
7281
  CommentArray
@@ -7639,7 +7641,7 @@ var require_parse = __commonJS((exports, module) => {
7639
7641
  });
7640
7642
 
7641
7643
  // ../../node_modules/.bun/comment-json@5.0.0/node_modules/comment-json/src/stringify.js
7642
- var require_stringify = __commonJS((exports, module) => {
7644
+ var require_stringify = __commonJS(function(exports, module) {
7643
7645
  var {
7644
7646
  PREFIX_BEFORE_ALL,
7645
7647
  PREFIX_BEFORE,
@@ -7847,7 +7849,7 @@ var require_stringify = __commonJS((exports, module) => {
7847
7849
  });
7848
7850
 
7849
7851
  // ../../node_modules/.bun/comment-json@5.0.0/node_modules/comment-json/src/index.js
7850
- var require_src2 = __commonJS((exports, module) => {
7852
+ var require_src2 = __commonJS(function(exports, module) {
7851
7853
  var { parse, tokenize } = require_parse();
7852
7854
  var stringify = require_stringify();
7853
7855
  var { CommentArray } = require_array();
@@ -10181,19 +10183,38 @@ async function downloadBinary(version) {
10181
10183
  releaseLock?.();
10182
10184
  }
10183
10185
  }
10186
+ var ensureBinaryInFlight = new Map;
10187
+ function ensureBinaryKey(version) {
10188
+ if (!version)
10189
+ return "latest";
10190
+ return version.startsWith("v") ? version : `v${version}`;
10191
+ }
10184
10192
  async function ensureBinary(version) {
10185
- if (version) {
10186
- const tag = version.startsWith("v") ? version : `v${version}`;
10187
- const versionCached = getCachedBinaryPath(tag);
10188
- if (versionCached && isExpectedCachedBinary(versionCached, tag)) {
10189
- log(`Found cached binary for ${tag}: ${versionCached}`);
10190
- return versionCached;
10191
- }
10192
- log(`No cached binary for ${tag}, downloading...`);
10193
- return downloadBinary(tag);
10193
+ const key = ensureBinaryKey(version);
10194
+ const existing = ensureBinaryInFlight.get(key);
10195
+ if (existing)
10196
+ return existing;
10197
+ const task = (async () => {
10198
+ if (version) {
10199
+ const tag = ensureBinaryKey(version);
10200
+ const versionCached = getCachedBinaryPath(tag);
10201
+ if (versionCached && isExpectedCachedBinary(versionCached, tag)) {
10202
+ log(`Found cached binary for ${tag}: ${versionCached}`);
10203
+ return versionCached;
10204
+ }
10205
+ log(`No cached binary for ${tag}, downloading...`);
10206
+ return downloadBinary(tag);
10207
+ }
10208
+ log("No cached binary found, downloading latest...");
10209
+ return downloadBinary();
10210
+ })();
10211
+ ensureBinaryInFlight.set(key, task);
10212
+ try {
10213
+ return await task;
10214
+ } finally {
10215
+ if (ensureBinaryInFlight.get(key) === task)
10216
+ ensureBinaryInFlight.delete(key);
10194
10217
  }
10195
- log("No cached binary found, downloading latest...");
10196
- return downloadBinary();
10197
10218
  }
10198
10219
  function createDownloadLockOwner() {
10199
10220
  return JSON.stringify({
@@ -10493,78 +10514,17 @@ ${reflowText}`;
10493
10514
  }
10494
10515
  return " Auto-formatted.";
10495
10516
  }
10496
- // ../../node_modules/.bun/@cortexkit+subc-client@0.5.0/node_modules/@cortexkit/subc-client/dist/client.js
10517
+ // ../../node_modules/.bun/@cortexkit+subc-client@0.8.1/node_modules/@cortexkit/subc-client/dist/client.js
10497
10518
  import { promises as fs3 } from "node:fs";
10498
10519
  import { debuglog } from "node:util";
10499
10520
 
10500
- // ../../node_modules/.bun/@cortexkit+subc-client@0.5.0/node_modules/@cortexkit/subc-client/dist/auth.js
10521
+ // ../../node_modules/.bun/@cortexkit+subc-client@0.8.1/node_modules/@cortexkit/subc-client/dist/auth.js
10501
10522
  import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
10502
- var NONCE_LEN = 32;
10503
- var MAX_AUTH_MESSAGE_LEN = 4096;
10504
- var SERVER_PROOF_DOMAIN = "subc-server-v1";
10505
- var CLIENT_AUTH_DOMAIN = "subc-client-v1";
10506
- var DEFAULT_CLIENT_ROLE = "client";
10507
10523
 
10508
- class AuthError extends Error {
10509
- }
10510
- function computeProof(key, domain, clientNonce, serverNonce, daemonId) {
10511
- const mac = createHmac("sha256", Buffer.from(key));
10512
- mac.update(Buffer.from(domain, "utf8"));
10513
- mac.update(Buffer.from(clientNonce));
10514
- mac.update(Buffer.from(serverNonce));
10515
- mac.update(Buffer.from(daemonId));
10516
- return new Uint8Array(mac.digest());
10517
- }
10518
- function constantTimeEq(a, b) {
10519
- if (a.length !== b.length)
10520
- return false;
10521
- return timingSafeEqual(Buffer.from(a), Buffer.from(b));
10522
- }
10523
- async function writeMessage(sock, value, deadlineMs) {
10524
- const json = Buffer.from(JSON.stringify(value), "utf8");
10525
- if (json.length > MAX_AUTH_MESSAGE_LEN) {
10526
- throw new AuthError(`auth message too large: ${json.length} > ${MAX_AUTH_MESSAGE_LEN}`);
10527
- }
10528
- const lenPrefix = new Uint8Array(4);
10529
- new DataView(lenPrefix.buffer).setUint32(0, json.length, true);
10530
- await sock.write(lenPrefix, deadlineMs);
10531
- await sock.write(json, deadlineMs);
10532
- }
10533
- async function readMessage(sock, deadlineMs) {
10534
- const lenBytes = await sock.readExact(4, deadlineMs);
10535
- const len = new DataView(lenBytes.buffer, lenBytes.byteOffset, 4).getUint32(0, true);
10536
- if (len > MAX_AUTH_MESSAGE_LEN) {
10537
- throw new AuthError(`auth message too large: ${len} > ${MAX_AUTH_MESSAGE_LEN}`);
10538
- }
10539
- const body = len === 0 ? new Uint8Array(0) : await sock.readExact(len, deadlineMs);
10540
- try {
10541
- return JSON.parse(Buffer.from(body).toString("utf8"));
10542
- } catch (err) {
10543
- throw new AuthError(`auth message JSON decode failed: ${String(err)}`);
10544
- }
10545
- }
10546
- async function authenticateClient(sock, conn, deadlineMs) {
10547
- const clientNonce = new Uint8Array(randomBytes(NONCE_LEN));
10548
- await writeMessage(sock, { client_nonce: Array.from(clientNonce), role: DEFAULT_CLIENT_ROLE }, deadlineMs);
10549
- const proof = await readMessage(sock, deadlineMs);
10550
- const serverNonce = Uint8Array.from(proof.server_nonce);
10551
- const daemonId = Uint8Array.from(proof.daemon_id);
10552
- const serverProof = Uint8Array.from(proof.server_proof);
10553
- const expected = computeProof(conn.key, SERVER_PROOF_DOMAIN, clientNonce, serverNonce, daemonId);
10554
- if (!constantTimeEq(expected, serverProof)) {
10555
- throw new AuthError("server proof mismatch — wrong key or impostor daemon");
10556
- }
10557
- if (!constantTimeEq(daemonId, conn.daemonId)) {
10558
- throw new AuthError("daemon id mismatch — connection file points at a different daemon");
10559
- }
10560
- const clientAuth = computeProof(conn.key, CLIENT_AUTH_DOMAIN, clientNonce, serverNonce, daemonId);
10561
- await writeMessage(sock, { client_auth: Array.from(clientAuth) }, deadlineMs);
10562
- }
10563
-
10564
- // ../../node_modules/.bun/@cortexkit+subc-client@0.5.0/node_modules/@cortexkit/subc-client/dist/connection-file.js
10565
- import { promises as fs2 } from "node:fs";
10524
+ // ../../node_modules/.bun/@cortexkit+subc-client@0.8.1/node_modules/@cortexkit/subc-client/dist/socket.js
10525
+ import net from "node:net";
10566
10526
 
10567
- // ../../node_modules/.bun/@cortexkit+subc-client@0.5.0/node_modules/@cortexkit/subc-client/dist/envelope.js
10527
+ // ../../node_modules/.bun/@cortexkit+subc-client@0.8.1/node_modules/@cortexkit/subc-client/dist/envelope.js
10568
10528
  var PROTOCOL_VERSION = 2;
10569
10529
  var HEADER_LEN = 21;
10570
10530
  var FROZEN_PREFIX_LEN = 5;
@@ -10638,6 +10598,39 @@ class DecodeError extends Error {
10638
10598
  this.name = "DecodeError";
10639
10599
  }
10640
10600
  }
10601
+ function validateHeaderFields(header) {
10602
+ const len = header.len >>> 0;
10603
+ const ver = header.ver >>> 0 & 255;
10604
+ const typeByte = header.ty >>> 0 & 255;
10605
+ const flags = header.flags >>> 0 & 255;
10606
+ const channel = header.channel >>> 0 & 65535;
10607
+ const epoch = header.epoch >>> 0;
10608
+ BigInt.asUintN(64, header.corr);
10609
+ if (ver !== PROTOCOL_VERSION)
10610
+ throw new DecodeError(`unsupported envelope version ${ver}`, "unsupported_version");
10611
+ if (typeByte > FRAME_TYPE_MAX)
10612
+ throw new DecodeError(`unknown frame type byte ${typeByte}`, "unknown_frame_type");
10613
+ const ty = typeByte;
10614
+ if ((flags & FLAG_RESERVED_MASK) !== 0) {
10615
+ throw new DecodeError(`reserved flag bits set in flags 0b${flags.toString(2).padStart(8, "0")}`, "reserved_flag_bits");
10616
+ }
10617
+ if ((flags & FLAG_PRIORITY_MASK) >> FLAG_PRIORITY_SHIFT === 3) {
10618
+ throw new DecodeError(`reserved priority bits set in flags 0b${flags.toString(2).padStart(8, "0")}`, "reserved_priority_bits");
10619
+ }
10620
+ const admission = (flags & FLAG_ADMISSION_MASK) >> FLAG_ADMISSION_SHIFT;
10621
+ if (admission === 3) {
10622
+ throw new DecodeError(`reserved admission class set in flags 0b${flags.toString(2).padStart(8, "0")}`, "reserved_admission_class");
10623
+ }
10624
+ if (admission === AdmissionClass.Sheddable && ty !== FrameType.Push && ty !== FrameType.StreamData) {
10625
+ throw new DecodeError(`SHEDDABLE admission class is illegal on ${FrameType[ty]} in flags 0b${flags.toString(2).padStart(8, "0")}`, "sheddable_illegal_frame_type");
10626
+ }
10627
+ if (channel === 0 && epoch !== 0) {
10628
+ throw new DecodeError(`control channel carried nonzero epoch ${epoch}`, "nonzero_epoch_on_control_channel");
10629
+ }
10630
+ if (isPureHeader(ty) && len !== 0) {
10631
+ throw new DecodeError(`pure-header frame ${FrameType[ty]} declared non-zero body length ${len}`, "pure_header_frame_with_body");
10632
+ }
10633
+ }
10641
10634
  function decodeHeader(bytes) {
10642
10635
  if (bytes.length < FROZEN_PREFIX_LEN) {
10643
10636
  throw new DecodeError(`header shorter than frozen prefix: have ${bytes.length} bytes`, "too_short_for_prefix");
@@ -10686,7 +10679,7 @@ function buildFrameWithVersion(ver, ty, flags, channel, epoch, corr, body) {
10686
10679
  throw new DecodeError(`frame body ${body.length} exceeds max ${MAX_FRAME_BODY_LEN}`, "frame_body_too_large");
10687
10680
  }
10688
10681
  const header = { len: body.length, ver, ty, flags, channel, epoch, corr };
10689
- decodeHeader(encodeHeader(header));
10682
+ validateHeaderFields(header);
10690
10683
  return { header, body };
10691
10684
  }
10692
10685
  function encodeFrame(frame) {
@@ -10700,7 +10693,315 @@ function encodeFrame(frame) {
10700
10693
  return output;
10701
10694
  }
10702
10695
 
10703
- // ../../node_modules/.bun/@cortexkit+subc-client@0.5.0/node_modules/@cortexkit/subc-client/dist/connection-file.js
10696
+ // ../../node_modules/.bun/@cortexkit+subc-client@0.8.1/node_modules/@cortexkit/subc-client/dist/socket.js
10697
+ class SocketClosedError extends Error {
10698
+ }
10699
+
10700
+ class SocketTimeoutError extends Error {
10701
+ }
10702
+
10703
+ class SocketWriteNotQueuedError extends Error {
10704
+ cause;
10705
+ constructor(message, cause) {
10706
+ super(message);
10707
+ this.cause = cause;
10708
+ }
10709
+ }
10710
+
10711
+ class SocketWriteQueuedError extends Error {
10712
+ cause;
10713
+ constructor(message, cause) {
10714
+ super(message);
10715
+ this.cause = cause;
10716
+ }
10717
+ }
10718
+ function toWriteBuffer(bytes) {
10719
+ return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
10720
+ }
10721
+ var WRITE_BORROWED = Symbol("subc.socket.writeBorrowed");
10722
+ var WRITE_TRACKED_BORROWED = Symbol("subc.socket.writeTrackedBorrowed");
10723
+ function writeBorrowed(socket, bytes, deadlineMs) {
10724
+ const borrowed = socket[WRITE_BORROWED];
10725
+ return borrowed ? borrowed.call(socket, bytes, deadlineMs) : socket.write(bytes, deadlineMs);
10726
+ }
10727
+ function writeTrackedBorrowed(socket, bytes, deadlineMs) {
10728
+ const borrowed = socket[WRITE_TRACKED_BORROWED];
10729
+ return borrowed ? borrowed.call(socket, bytes, deadlineMs) : socket.writeTracked(bytes, deadlineMs);
10730
+ }
10731
+
10732
+ class SubcSocket {
10733
+ sock;
10734
+ chunks = [];
10735
+ buffered = 0;
10736
+ waiter = null;
10737
+ closedErr = null;
10738
+ bufferedBytes() {
10739
+ return this.buffered;
10740
+ }
10741
+ constructor(sock) {
10742
+ this.sock = sock;
10743
+ sock.on("data", (chunk) => {
10744
+ this.chunks.push(chunk);
10745
+ this.buffered += chunk.length;
10746
+ this.tryServe();
10747
+ });
10748
+ const fail = (err) => {
10749
+ if (!this.closedErr)
10750
+ this.closedErr = err;
10751
+ this.tryServe();
10752
+ };
10753
+ sock.on("error", (err) => fail(err instanceof Error ? err : new Error(String(err))));
10754
+ sock.on("end", () => fail(new SocketClosedError("subc closed the connection")));
10755
+ sock.on("close", () => fail(new SocketClosedError("subc connection closed")));
10756
+ }
10757
+ localPort() {
10758
+ return this.sock.localPort ?? null;
10759
+ }
10760
+ static connect(host, port, deadlineMs) {
10761
+ return new Promise((resolve3, reject) => {
10762
+ const sock = net.connect({ host, port });
10763
+ sock.setNoDelay(true);
10764
+ const timer = setTimeout(() => {
10765
+ sock.destroy();
10766
+ reject(new SocketTimeoutError(`timed out connecting to ${host}:${port}`));
10767
+ }, Math.max(0, deadlineMs - Date.now()));
10768
+ sock.once("connect", () => {
10769
+ clearTimeout(timer);
10770
+ resolve3(new SubcSocket(sock));
10771
+ });
10772
+ sock.once("error", (err) => {
10773
+ clearTimeout(timer);
10774
+ reject(err);
10775
+ });
10776
+ });
10777
+ }
10778
+ async readFrame(headerDeadlineMs, bodyDeadline, onHeader) {
10779
+ const prefix = await this.readExact(FROZEN_PREFIX_LEN, headerDeadlineMs);
10780
+ const version = prefix[4];
10781
+ if (version !== PROTOCOL_VERSION)
10782
+ throw new DecodeError(`unsupported envelope version ${version}`, "unsupported_version");
10783
+ const remainder = await this.readExact(HEADER_LEN - FROZEN_PREFIX_LEN, headerDeadlineMs);
10784
+ const headerBytes = new Uint8Array(HEADER_LEN);
10785
+ headerBytes.set(prefix);
10786
+ headerBytes.set(remainder, FROZEN_PREFIX_LEN);
10787
+ const header = decodeHeader(headerBytes);
10788
+ if (header.len > MAX_FRAME_BODY_LEN) {
10789
+ throw new DecodeError(`frame body ${header.len} exceeds max ${MAX_FRAME_BODY_LEN}`, "frame_body_too_large");
10790
+ }
10791
+ onHeader?.();
10792
+ const bodyDeadlineMs = typeof bodyDeadline === "number" ? bodyDeadline : Date.now() + bodyDeadline.afterHeaderMs;
10793
+ const body = header.len === 0 ? new Uint8Array(0) : await this.readExact(header.len, bodyDeadlineMs);
10794
+ return { header, body };
10795
+ }
10796
+ readExact(n, deadlineMs) {
10797
+ if (this.waiter) {
10798
+ return Promise.reject(new Error("concurrent readExact is not supported"));
10799
+ }
10800
+ if (n === 0)
10801
+ return Promise.resolve(new Uint8Array(0));
10802
+ return new Promise((resolve3, reject) => {
10803
+ let timer = null;
10804
+ if (Number.isFinite(deadlineMs)) {
10805
+ const remaining = deadlineMs - Date.now();
10806
+ if (remaining <= 0) {
10807
+ reject(new SocketTimeoutError(`timed out waiting for ${n} bytes`));
10808
+ return;
10809
+ }
10810
+ timer = setTimeout(() => {
10811
+ this.waiter = null;
10812
+ reject(new SocketTimeoutError(`timed out waiting for ${n} bytes`));
10813
+ }, remaining);
10814
+ }
10815
+ this.waiter = { need: n, resolve: resolve3, reject, timer };
10816
+ this.tryServe();
10817
+ });
10818
+ }
10819
+ async write(bytes, deadlineMs) {
10820
+ await this.writeBuffer(Buffer.from(bytes), deadlineMs);
10821
+ }
10822
+ writeTracked(bytes, deadlineMs) {
10823
+ return this.writeTrackedBuffer(Buffer.from(bytes), deadlineMs);
10824
+ }
10825
+ async[WRITE_BORROWED](bytes, deadlineMs) {
10826
+ await this.writeBuffer(toWriteBuffer(bytes), deadlineMs);
10827
+ }
10828
+ [WRITE_TRACKED_BORROWED](bytes, deadlineMs) {
10829
+ return this.writeTrackedBuffer(toWriteBuffer(bytes), deadlineMs);
10830
+ }
10831
+ async writeBuffer(buffer, deadlineMs) {
10832
+ try {
10833
+ await this.writeTrackedBuffer(buffer, deadlineMs).completed;
10834
+ } catch (err) {
10835
+ if (err instanceof SocketWriteNotQueuedError || err instanceof SocketWriteQueuedError) {
10836
+ throw err.cause ?? err;
10837
+ }
10838
+ throw err;
10839
+ }
10840
+ }
10841
+ writeTrackedBuffer(buffer, deadlineMs) {
10842
+ if (this.closedErr) {
10843
+ return {
10844
+ queued: false,
10845
+ completed: Promise.reject(new SocketWriteNotQueuedError("subc socket was closed before bytes could be queued", this.closedErr))
10846
+ };
10847
+ }
10848
+ let queued = false;
10849
+ let settled = false;
10850
+ let timer = null;
10851
+ const completed = new Promise((resolve3, reject) => {
10852
+ const settle = (run) => {
10853
+ if (settled)
10854
+ return;
10855
+ settled = true;
10856
+ if (timer)
10857
+ clearTimeout(timer);
10858
+ run();
10859
+ };
10860
+ const remaining = deadlineMs - Date.now();
10861
+ if (remaining <= 0) {
10862
+ settle(() => reject(new SocketWriteNotQueuedError("timed out before bytes could be queued to subc", new SocketTimeoutError("timed out writing to subc"))));
10863
+ return;
10864
+ }
10865
+ timer = setTimeout(() => {
10866
+ const timeout = new SocketTimeoutError("timed out writing to subc");
10867
+ settle(() => reject(queued ? new SocketWriteQueuedError("timed out after bytes were handed to the subc socket", timeout) : new SocketWriteNotQueuedError("timed out before bytes could be queued to subc", timeout)));
10868
+ }, remaining);
10869
+ try {
10870
+ this.sock.write(buffer, (err) => {
10871
+ settle(() => {
10872
+ if (err) {
10873
+ reject(new SocketWriteQueuedError("subc socket reported a write error after bytes were handed to the socket", err instanceof Error ? err : new Error(String(err))));
10874
+ } else {
10875
+ resolve3();
10876
+ }
10877
+ });
10878
+ });
10879
+ queued = true;
10880
+ } catch (err) {
10881
+ settle(() => reject(new SocketWriteNotQueuedError("subc socket write threw before bytes could be queued", err instanceof Error ? err : new Error(String(err)))));
10882
+ }
10883
+ });
10884
+ return { queued, completed };
10885
+ }
10886
+ close() {
10887
+ this.sock.destroy();
10888
+ }
10889
+ tryServe() {
10890
+ const w = this.waiter;
10891
+ if (!w)
10892
+ return;
10893
+ if (this.buffered >= w.need) {
10894
+ const out = this.take(w.need);
10895
+ this.waiter = null;
10896
+ if (w.timer)
10897
+ clearTimeout(w.timer);
10898
+ w.resolve(out);
10899
+ return;
10900
+ }
10901
+ if (this.closedErr) {
10902
+ this.waiter = null;
10903
+ if (w.timer)
10904
+ clearTimeout(w.timer);
10905
+ w.reject(this.closedErr);
10906
+ }
10907
+ }
10908
+ take(n) {
10909
+ const out = Buffer.allocUnsafe(n);
10910
+ let off = 0;
10911
+ while (off < n) {
10912
+ const head = this.chunks[0];
10913
+ const want = n - off;
10914
+ if (head.length <= want) {
10915
+ head.copy(out, off);
10916
+ off += head.length;
10917
+ this.chunks.shift();
10918
+ } else {
10919
+ head.copy(out, off, 0, want);
10920
+ this.chunks[0] = head.subarray(want);
10921
+ off += want;
10922
+ }
10923
+ }
10924
+ this.buffered -= n;
10925
+ return out;
10926
+ }
10927
+ }
10928
+
10929
+ // ../../node_modules/.bun/@cortexkit+subc-client@0.8.1/node_modules/@cortexkit/subc-client/dist/auth.js
10930
+ var NONCE_LEN = 32;
10931
+ var MAX_AUTH_MESSAGE_LEN = 4096;
10932
+ var SERVER_PROOF_DOMAIN = "subc-server-v1";
10933
+ var CLIENT_AUTH_DOMAIN = "subc-client-v1";
10934
+ var DEFAULT_CLIENT_ROLE = "client";
10935
+
10936
+ class AuthError extends Error {
10937
+ }
10938
+ function computeProof(key, domain, clientNonce, serverNonce, daemonId) {
10939
+ const mac = createHmac("sha256", Buffer.from(key));
10940
+ mac.update(Buffer.from(domain, "utf8"));
10941
+ mac.update(Buffer.from(clientNonce));
10942
+ mac.update(Buffer.from(serverNonce));
10943
+ mac.update(Buffer.from(daemonId));
10944
+ return new Uint8Array(mac.digest());
10945
+ }
10946
+ function constantTimeEq(a, b) {
10947
+ if (a.length !== b.length)
10948
+ return false;
10949
+ return timingSafeEqual(Buffer.from(a), Buffer.from(b));
10950
+ }
10951
+ async function writeMessage(sock, value, deadlineMs) {
10952
+ const json = Buffer.from(JSON.stringify(value), "utf8");
10953
+ if (json.length > MAX_AUTH_MESSAGE_LEN) {
10954
+ throw new AuthError(`auth message too large: ${json.length} > ${MAX_AUTH_MESSAGE_LEN}`);
10955
+ }
10956
+ const lenPrefix = new Uint8Array(4);
10957
+ new DataView(lenPrefix.buffer).setUint32(0, json.length, true);
10958
+ await writeBorrowed(sock, lenPrefix, deadlineMs);
10959
+ await writeBorrowed(sock, json, deadlineMs);
10960
+ }
10961
+ async function readMessage(sock, deadlineMs) {
10962
+ const lenBytes = await sock.readExact(4, deadlineMs);
10963
+ const len = new DataView(lenBytes.buffer, lenBytes.byteOffset, 4).getUint32(0, true);
10964
+ if (len > MAX_AUTH_MESSAGE_LEN) {
10965
+ throw new AuthError(`auth message too large: ${len} > ${MAX_AUTH_MESSAGE_LEN}`);
10966
+ }
10967
+ const body = len === 0 ? new Uint8Array(0) : await sock.readExact(len, deadlineMs);
10968
+ try {
10969
+ return JSON.parse(Buffer.from(body).toString("utf8"));
10970
+ } catch (err) {
10971
+ throw new AuthError(`auth message JSON decode failed: ${String(err)}`);
10972
+ }
10973
+ }
10974
+ function authBytes(value, field) {
10975
+ if (!Array.isArray(value)) {
10976
+ throw new AuthError(`auth field '${field}' must be a byte array`);
10977
+ }
10978
+ for (const byte of value) {
10979
+ if (typeof byte !== "number" || !Number.isInteger(byte) || byte < 0 || byte > 255) {
10980
+ throw new AuthError(`auth field '${field}' has invalid byte ${String(byte)}`);
10981
+ }
10982
+ }
10983
+ return Uint8Array.from(value);
10984
+ }
10985
+ async function authenticateClient(sock, conn, deadlineMs) {
10986
+ const clientNonce = new Uint8Array(randomBytes(NONCE_LEN));
10987
+ await writeMessage(sock, { client_nonce: Array.from(clientNonce), role: DEFAULT_CLIENT_ROLE }, deadlineMs);
10988
+ const proof = await readMessage(sock, deadlineMs);
10989
+ const serverNonce = authBytes(proof.server_nonce, "server_nonce");
10990
+ const daemonId = authBytes(proof.daemon_id, "daemon_id");
10991
+ const serverProof = authBytes(proof.server_proof, "server_proof");
10992
+ const expected = computeProof(conn.key, SERVER_PROOF_DOMAIN, clientNonce, serverNonce, daemonId);
10993
+ if (!constantTimeEq(expected, serverProof)) {
10994
+ throw new AuthError("server proof mismatch — wrong key or impostor daemon");
10995
+ }
10996
+ if (!constantTimeEq(daemonId, conn.daemonId)) {
10997
+ throw new AuthError("daemon id mismatch — connection file points at a different daemon");
10998
+ }
10999
+ const clientAuth = computeProof(conn.key, CLIENT_AUTH_DOMAIN, clientNonce, serverNonce, daemonId);
11000
+ await writeMessage(sock, { client_auth: Array.from(clientAuth) }, deadlineMs);
11001
+ }
11002
+
11003
+ // ../../node_modules/.bun/@cortexkit+subc-client@0.8.1/node_modules/@cortexkit/subc-client/dist/connection-file.js
11004
+ import { promises as fs2 } from "node:fs";
10704
11005
  var SCHEMA_VERSION = 1;
10705
11006
  var MIN_KEY_LEN = 32;
10706
11007
  var DAEMON_ID_LEN = 16;
@@ -10708,9 +11009,14 @@ var DAEMON_ID_LEN = 16;
10708
11009
  class ConnectionFileError extends Error {
10709
11010
  }
10710
11011
  function toBytes(value, field) {
10711
- if (!Array.isArray(value) || value.some((n) => typeof n !== "number")) {
11012
+ if (!Array.isArray(value)) {
10712
11013
  throw new ConnectionFileError(`connection file field '${field}' must be a JSON array of bytes`);
10713
11014
  }
11015
+ for (const byte of value) {
11016
+ if (typeof byte !== "number" || !Number.isInteger(byte) || byte < 0 || byte > 255) {
11017
+ throw new ConnectionFileError(`connection file field '${field}' has invalid byte ${String(byte)}`);
11018
+ }
11019
+ }
10714
11020
  return Uint8Array.from(value);
10715
11021
  }
10716
11022
  function validate(info) {
@@ -10772,7 +11078,7 @@ async function readConnectionFile(path2) {
10772
11078
  return info;
10773
11079
  }
10774
11080
 
10775
- // ../../node_modules/.bun/@cortexkit+subc-client@0.5.0/node_modules/@cortexkit/subc-client/dist/route-handle.js
11081
+ // ../../node_modules/.bun/@cortexkit+subc-client@0.8.1/node_modules/@cortexkit/subc-client/dist/route-handle.js
10776
11082
  var connectionToken = new WeakMap;
10777
11083
 
10778
11084
  class RouteHandle {
@@ -10818,220 +11124,12 @@ function sameRouteHandle(left, right) {
10818
11124
  return left === right;
10819
11125
  }
10820
11126
 
10821
- // ../../node_modules/.bun/@cortexkit+subc-client@0.5.0/node_modules/@cortexkit/subc-client/dist/socket.js
10822
- import net from "node:net";
10823
- class SocketClosedError extends Error {
10824
- }
10825
-
10826
- class SocketTimeoutError extends Error {
10827
- }
10828
-
10829
- class SocketWriteNotQueuedError extends Error {
10830
- cause;
10831
- constructor(message, cause) {
10832
- super(message);
10833
- this.cause = cause;
10834
- }
10835
- }
10836
-
10837
- class SocketWriteQueuedError extends Error {
10838
- cause;
10839
- constructor(message, cause) {
10840
- super(message);
10841
- this.cause = cause;
10842
- }
10843
- }
10844
-
10845
- class SubcSocket {
10846
- sock;
10847
- chunks = [];
10848
- buffered = 0;
10849
- waiter = null;
10850
- closedErr = null;
10851
- bufferedBytes() {
10852
- return this.buffered;
10853
- }
10854
- constructor(sock) {
10855
- this.sock = sock;
10856
- sock.on("data", (chunk) => {
10857
- this.chunks.push(chunk);
10858
- this.buffered += chunk.length;
10859
- this.tryServe();
10860
- });
10861
- const fail = (err) => {
10862
- if (!this.closedErr)
10863
- this.closedErr = err;
10864
- this.tryServe();
10865
- };
10866
- sock.on("error", (err) => fail(err instanceof Error ? err : new Error(String(err))));
10867
- sock.on("end", () => fail(new SocketClosedError("subc closed the connection")));
10868
- sock.on("close", () => fail(new SocketClosedError("subc connection closed")));
10869
- }
10870
- localPort() {
10871
- return this.sock.localPort ?? null;
10872
- }
10873
- static connect(host, port, deadlineMs) {
10874
- return new Promise((resolve3, reject) => {
10875
- const sock = net.connect({ host, port });
10876
- sock.setNoDelay(true);
10877
- const timer = setTimeout(() => {
10878
- sock.destroy();
10879
- reject(new SocketTimeoutError(`timed out connecting to ${host}:${port}`));
10880
- }, Math.max(0, deadlineMs - Date.now()));
10881
- sock.once("connect", () => {
10882
- clearTimeout(timer);
10883
- resolve3(new SubcSocket(sock));
10884
- });
10885
- sock.once("error", (err) => {
10886
- clearTimeout(timer);
10887
- reject(err);
10888
- });
10889
- });
10890
- }
10891
- async readFrame(headerDeadlineMs, bodyDeadline, onHeader) {
10892
- const prefix = await this.readExact(FROZEN_PREFIX_LEN, headerDeadlineMs);
10893
- const version = prefix[4];
10894
- if (version !== PROTOCOL_VERSION)
10895
- throw new DecodeError(`unsupported envelope version ${version}`, "unsupported_version");
10896
- const remainder = await this.readExact(HEADER_LEN - FROZEN_PREFIX_LEN, headerDeadlineMs);
10897
- const headerBytes = new Uint8Array(HEADER_LEN);
10898
- headerBytes.set(prefix);
10899
- headerBytes.set(remainder, FROZEN_PREFIX_LEN);
10900
- const header = decodeHeader(headerBytes);
10901
- if (header.len > MAX_FRAME_BODY_LEN) {
10902
- throw new DecodeError(`frame body ${header.len} exceeds max ${MAX_FRAME_BODY_LEN}`, "frame_body_too_large");
10903
- }
10904
- onHeader?.();
10905
- const bodyDeadlineMs = typeof bodyDeadline === "number" ? bodyDeadline : Date.now() + bodyDeadline.afterHeaderMs;
10906
- const body = header.len === 0 ? new Uint8Array(0) : await this.readExact(header.len, bodyDeadlineMs);
10907
- return { header, body };
10908
- }
10909
- readExact(n, deadlineMs) {
10910
- if (this.waiter) {
10911
- return Promise.reject(new Error("concurrent readExact is not supported"));
10912
- }
10913
- if (n === 0)
10914
- return Promise.resolve(new Uint8Array(0));
10915
- return new Promise((resolve3, reject) => {
10916
- let timer = null;
10917
- if (Number.isFinite(deadlineMs)) {
10918
- const remaining = deadlineMs - Date.now();
10919
- if (remaining <= 0) {
10920
- reject(new SocketTimeoutError(`timed out waiting for ${n} bytes`));
10921
- return;
10922
- }
10923
- timer = setTimeout(() => {
10924
- this.waiter = null;
10925
- reject(new SocketTimeoutError(`timed out waiting for ${n} bytes`));
10926
- }, remaining);
10927
- }
10928
- this.waiter = { need: n, resolve: resolve3, reject, timer };
10929
- this.tryServe();
10930
- });
10931
- }
10932
- async write(bytes, deadlineMs) {
10933
- try {
10934
- await this.writeTracked(bytes, deadlineMs).completed;
10935
- } catch (err) {
10936
- if (err instanceof SocketWriteNotQueuedError || err instanceof SocketWriteQueuedError) {
10937
- throw err.cause ?? err;
10938
- }
10939
- throw err;
10940
- }
10941
- }
10942
- writeTracked(bytes, deadlineMs) {
10943
- if (this.closedErr) {
10944
- return {
10945
- queued: false,
10946
- completed: Promise.reject(new SocketWriteNotQueuedError("subc socket was closed before bytes could be queued", this.closedErr))
10947
- };
10948
- }
10949
- let queued = false;
10950
- let settled = false;
10951
- let timer = null;
10952
- const completed = new Promise((resolve3, reject) => {
10953
- const settle = (run) => {
10954
- if (settled)
10955
- return;
10956
- settled = true;
10957
- if (timer)
10958
- clearTimeout(timer);
10959
- run();
10960
- };
10961
- const remaining = deadlineMs - Date.now();
10962
- if (remaining <= 0) {
10963
- settle(() => reject(new SocketWriteNotQueuedError("timed out before bytes could be queued to subc", new SocketTimeoutError("timed out writing to subc"))));
10964
- return;
10965
- }
10966
- timer = setTimeout(() => {
10967
- const timeout = new SocketTimeoutError("timed out writing to subc");
10968
- settle(() => reject(queued ? new SocketWriteQueuedError("timed out after bytes were handed to the subc socket", timeout) : new SocketWriteNotQueuedError("timed out before bytes could be queued to subc", timeout)));
10969
- }, remaining);
10970
- try {
10971
- this.sock.write(Buffer.from(bytes), (err) => {
10972
- settle(() => {
10973
- if (err) {
10974
- reject(new SocketWriteQueuedError("subc socket reported a write error after bytes were handed to the socket", err instanceof Error ? err : new Error(String(err))));
10975
- } else {
10976
- resolve3();
10977
- }
10978
- });
10979
- });
10980
- queued = true;
10981
- } catch (err) {
10982
- settle(() => reject(new SocketWriteNotQueuedError("subc socket write threw before bytes could be queued", err instanceof Error ? err : new Error(String(err)))));
10983
- }
10984
- });
10985
- return { queued, completed };
10986
- }
10987
- close() {
10988
- this.sock.destroy();
10989
- }
10990
- tryServe() {
10991
- const w = this.waiter;
10992
- if (!w)
10993
- return;
10994
- if (this.buffered >= w.need) {
10995
- const out = this.take(w.need);
10996
- this.waiter = null;
10997
- if (w.timer)
10998
- clearTimeout(w.timer);
10999
- w.resolve(out);
11000
- return;
11001
- }
11002
- if (this.closedErr) {
11003
- this.waiter = null;
11004
- if (w.timer)
11005
- clearTimeout(w.timer);
11006
- w.reject(this.closedErr);
11007
- }
11008
- }
11009
- take(n) {
11010
- const out = Buffer.allocUnsafe(n);
11011
- let off = 0;
11012
- while (off < n) {
11013
- const head = this.chunks[0];
11014
- const want = n - off;
11015
- if (head.length <= want) {
11016
- head.copy(out, off);
11017
- off += head.length;
11018
- this.chunks.shift();
11019
- } else {
11020
- head.copy(out, off, 0, want);
11021
- this.chunks[0] = head.subarray(want);
11022
- off += want;
11023
- }
11024
- }
11025
- this.buffered -= n;
11026
- return out;
11027
- }
11028
- }
11029
-
11030
- // ../../node_modules/.bun/@cortexkit+subc-client@0.5.0/node_modules/@cortexkit/subc-client/dist/client.js
11127
+ // ../../node_modules/.bun/@cortexkit+subc-client@0.8.1/node_modules/@cortexkit/subc-client/dist/client.js
11031
11128
  var debug = debuglog("subc-client");
11032
11129
  var DEFAULT_HANDSHAKE_TIMEOUT_MS = 1e4;
11033
11130
  var DEFAULT_REQUEST_TIMEOUT_MS = 30000;
11034
11131
  var TIMEOUT_ARBITRATION_GRACE_MS = 50;
11132
+ var LIVENESS_PROBE_WINDOW_MS = 2000;
11035
11133
  var REQUEST_DEADLINE_MARKER = "request_deadline";
11036
11134
  var DEADLINE_NO_DROP_CODE = "deadline_exceeded_no_drop_observed";
11037
11135
  var ROUTE_OPEN_RETRY_DEADLINE_MS = 30000;
@@ -11162,12 +11260,13 @@ class SubcClient {
11162
11260
  } catch (err) {
11163
11261
  if (!(err instanceof SubcCallError))
11164
11262
  throw this.terminalCallError("managed call failed", err);
11165
- if (err.code === "unknown_channel" && !retriedUnknownChannel && !this.closeStarted) {
11263
+ const deadBindCode = err.code === "unknown_channel" || err.code === "stale_route_epoch";
11264
+ if (deadBindCode && !retriedUnknownChannel && !this.closeStarted) {
11166
11265
  retriedUnknownChannel = true;
11167
11266
  this.evictRouteHandle(routeHandle);
11168
11267
  continue;
11169
11268
  }
11170
- if (err.code === "unknown_channel" && retriedUnknownChannel) {
11269
+ if (deadBindCode && retriedUnknownChannel) {
11171
11270
  this.evictRouteHandle(routeHandle);
11172
11271
  }
11173
11272
  if (err.kind === "not_sent") {
@@ -11180,6 +11279,8 @@ class SubcClient {
11180
11279
  }
11181
11280
  if (err.kind === "outcome_unknown" && err.code !== DEADLINE_NO_DROP_CODE) {
11182
11281
  this.scheduleReconnectAfterDrop(err);
11282
+ } else if (err.kind === "outcome_unknown" && err.code === DEADLINE_NO_DROP_CODE) {
11283
+ this.probeLivenessAfterDeadline();
11183
11284
  }
11184
11285
  throw err;
11185
11286
  }
@@ -11192,21 +11293,25 @@ class SubcClient {
11192
11293
  const admission = opts.admissionClass ?? AdmissionClass.Normal;
11193
11294
  const corr = this.allocateCorr();
11194
11295
  const key = pendingKey(handle, corr);
11296
+ let subscriptionPending = null;
11297
+ let resolveClosed = null;
11195
11298
  const closed = new Promise((resolve3, reject) => {
11196
11299
  if (this.closedErr) {
11197
11300
  reject(this.closedErr);
11198
11301
  return;
11199
11302
  }
11200
- this.pending.set(key, {
11303
+ resolveClosed = resolve3;
11304
+ subscriptionPending = {
11201
11305
  handle,
11202
11306
  resolve: () => resolve3(),
11203
11307
  reject,
11204
11308
  onProgress: onEvent,
11205
11309
  timer: null,
11206
11310
  subscription: true
11207
- });
11311
+ };
11312
+ this.pending.set(key, subscriptionPending);
11208
11313
  const frame = buildFrame(FrameType.Request, buildFlags(false, priority, false, admission), handle.channel, handle.epoch, corr, bytes);
11209
- this.sock.write(encodeFrame(frame), Date.now() + DEFAULT_REQUEST_TIMEOUT_MS).catch((err) => {
11314
+ writeBorrowed(this.sock, encodeFrame(frame), Date.now() + DEFAULT_REQUEST_TIMEOUT_MS).catch((err) => {
11210
11315
  const pending = this.pending.get(key);
11211
11316
  if (pending)
11212
11317
  this.rejectPending(key, pending, err instanceof Error ? err : new SubcError(String(err)));
@@ -11217,14 +11322,17 @@ class SubcClient {
11217
11322
  if (cancelled)
11218
11323
  return;
11219
11324
  cancelled = true;
11220
- this.cancel(handle, corr, priority);
11325
+ if (subscriptionPending && resolveClosed)
11326
+ this.settle(key, subscriptionPending, resolveClosed);
11327
+ if (this.isLiveHandle(handle))
11328
+ this.cancel(handle, corr, priority);
11221
11329
  };
11222
11330
  return { unsubscribe, closed };
11223
11331
  }
11224
11332
  cancel(handle, corr, priority = Priority.Interactive) {
11225
11333
  this.assertLiveHandle(handle);
11226
11334
  const cancel = buildFrame(FrameType.Cancel, buildFlags(false, priority, false), handle.channel, handle.epoch, corr, EMPTY_BODY);
11227
- this.sock.write(encodeFrame(cancel), Date.now() + DEFAULT_REQUEST_TIMEOUT_MS).catch(() => {
11335
+ writeBorrowed(this.sock, encodeFrame(cancel), Date.now() + DEFAULT_REQUEST_TIMEOUT_MS).catch(() => {
11228
11336
  return;
11229
11337
  });
11230
11338
  }
@@ -11305,7 +11413,7 @@ class SubcClient {
11305
11413
  return;
11306
11414
  }
11307
11415
  const goodbye = buildFrame(FrameType.Goodbye, buildFlags(false, Priority.Interactive, false), handle.channel, handle.epoch, 0n, EMPTY_BODY);
11308
- const write = this.sock.writeTracked(encodeFrame(goodbye), Date.now() + DEFAULT_REQUEST_TIMEOUT_MS);
11416
+ const write = writeTrackedBorrowed(this.sock, encodeFrame(goodbye), Date.now() + DEFAULT_REQUEST_TIMEOUT_MS);
11309
11417
  if (!write.queued && closeOnQueueFailure)
11310
11418
  this.closeConnectionAfterCleanupFailure();
11311
11419
  write.completed.catch(() => {
@@ -11357,7 +11465,7 @@ class SubcClient {
11357
11465
  };
11358
11466
  pending.timer = setTimeout(() => this.arbitrateTimeout(key, pending, channel, corr, ms), ms);
11359
11467
  this.pending.set(key, pending);
11360
- this.sock.write(encodeFrame(frame), Date.now() + ms).catch((error2) => {
11468
+ writeBorrowed(this.sock, encodeFrame(frame), Date.now() + ms).catch((error2) => {
11361
11469
  const current = this.pending.get(key);
11362
11470
  if (current)
11363
11471
  this.rejectPending(key, current, error2 instanceof Error ? error2 : new SubcError(String(error2)));
@@ -11434,7 +11542,7 @@ class SubcClient {
11434
11542
  };
11435
11543
  pending.timer = setTimeout(() => this.arbitrateTimeout(key, pending, handle.channel, corr, ms), ms);
11436
11544
  this.pending.set(key, pending);
11437
- const write = this.sock.writeTracked(encodeFrame(frame), Date.now() + ms);
11545
+ const write = writeTrackedBorrowed(this.sock, encodeFrame(frame), Date.now() + ms);
11438
11546
  handedToSocket = write.queued;
11439
11547
  write.completed.catch((error2) => {
11440
11548
  const current = this.pending.get(key);
@@ -11522,6 +11630,46 @@ class SubcClient {
11522
11630
  }
11523
11631
  }
11524
11632
  }
11633
+ lastInboundAtMs = 0;
11634
+ livenessProbe = null;
11635
+ hasControlPending() {
11636
+ for (const pending of this.pending.values()) {
11637
+ if (pending.handle === null)
11638
+ return true;
11639
+ }
11640
+ return false;
11641
+ }
11642
+ probeLivenessAfterDeadline() {
11643
+ if (this.livenessProbe || this.closeStarted || this.closedErr)
11644
+ return;
11645
+ if (this.hasControlPending())
11646
+ return;
11647
+ const sock = this.sock;
11648
+ const generation = this.generation;
11649
+ let corr;
11650
+ try {
11651
+ corr = this.allocateCorr();
11652
+ } catch {
11653
+ return;
11654
+ }
11655
+ const t0 = Date.now();
11656
+ const ping = buildFrame(FrameType.Ping, buildFlags(false, Priority.Interactive, false, AdmissionClass.Normal), 0, 0, corr, new Uint8Array);
11657
+ const probe = (async () => {
11658
+ await writeBorrowed(sock, encodeFrame(ping), t0 + this.opts.livenessProbeWindowMs).catch(() => {});
11659
+ await this.opts.sleep(this.opts.livenessProbeWindowMs);
11660
+ if (this.sock !== sock || this.generation !== generation || this.closeStarted)
11661
+ return;
11662
+ if (this.lastInboundAtMs >= t0)
11663
+ return;
11664
+ if (this.hasControlPending())
11665
+ return;
11666
+ this.fail(new SocketClosedError(`liveness probe convicted a half-open socket: no inbound frame for ${this.opts.livenessProbeWindowMs}ms after a channel-0 Ping (deadline-no-drop settles preceded this); closing so the next call reconnects`));
11667
+ sock.close();
11668
+ })().finally(() => {
11669
+ this.livenessProbe = null;
11670
+ });
11671
+ this.livenessProbe = probe;
11672
+ }
11525
11673
  async ensureConnectedForManaged() {
11526
11674
  if (this.closeStarted)
11527
11675
  throw new SubcError("client closed");
@@ -11633,6 +11781,24 @@ class SubcClient {
11633
11781
  }
11634
11782
  }
11635
11783
  dispatch(frame) {
11784
+ this.lastInboundAtMs = Date.now();
11785
+ if (frame.header.channel === 0 && frame.header.ty === FrameType.Push) {
11786
+ const observer = this.opts.onControlPush;
11787
+ if (observer) {
11788
+ let parsed = null;
11789
+ try {
11790
+ const body = this.parseJson(frame);
11791
+ if (body && typeof body.op === "string")
11792
+ parsed = { op: body.op, body };
11793
+ } catch {}
11794
+ if (parsed) {
11795
+ try {
11796
+ observer(parsed);
11797
+ } catch {}
11798
+ }
11799
+ }
11800
+ return;
11801
+ }
11636
11802
  let handle = null;
11637
11803
  if (frame.header.channel !== 0) {
11638
11804
  handle = this.liveRoutes.get(frame.header.channel) ?? null;
@@ -11649,7 +11815,9 @@ class SubcClient {
11649
11815
  switch (frame.header.ty) {
11650
11816
  case FrameType.Push:
11651
11817
  case FrameType.StreamData:
11652
- pending.onProgress?.(frame.body);
11818
+ try {
11819
+ pending.onProgress?.(frame.body);
11820
+ } catch {}
11653
11821
  return;
11654
11822
  case FrameType.Response:
11655
11823
  case FrameType.StreamEnd:
@@ -11669,7 +11837,7 @@ class SubcClient {
11669
11837
  return;
11670
11838
  }
11671
11839
  if (frame.header.ty === FrameType.Goodbye && handle) {
11672
- this.failHandle(handle, new SubcError("route closed by subc (GOODBYE)"));
11840
+ this.failHandle(handle, new SubcError("route closed by subc (GOODBYE)", "route_closed"));
11673
11841
  if (this.liveRoutes.get(handle.channel) === handle)
11674
11842
  this.liveRoutes.delete(handle.channel);
11675
11843
  this.evictRouteHandle(handle);
@@ -11776,10 +11944,11 @@ class SubcClient {
11776
11944
  this.scheduleReconnectAfterDrop(error2);
11777
11945
  }
11778
11946
  encode(value) {
11779
- return new Uint8Array(Buffer.from(JSON.stringify(value), "utf8"));
11947
+ return Buffer.from(JSON.stringify(value), "utf8");
11780
11948
  }
11781
11949
  parseJson(frame) {
11782
- return JSON.parse(Buffer.from(frame.body).toString("utf8"));
11950
+ const b = frame.body;
11951
+ return JSON.parse(Buffer.from(b.buffer, b.byteOffset, b.byteLength).toString("utf8"));
11783
11952
  }
11784
11953
  }
11785
11954
  function isConsumerReconnectTransient(err) {
@@ -11797,7 +11966,7 @@ function isConsumerReconnectTransient(err) {
11797
11966
  return code === "ECONNREFUSED" || code === "ECONNRESET" || code === "EPIPE" || code === "ETIMEDOUT" || code === "ENOENT";
11798
11967
  }
11799
11968
  function isRetryableRouteOpenCode(code) {
11800
- return code === "unknown_module" || code === "module_reloading" || code === "target_unavailable" || code === "module_timeout";
11969
+ return code === "unknown_module" || code === "module_reloading" || code === "module_warming" || code === "target_unavailable" || code === "module_timeout";
11801
11970
  }
11802
11971
  async function connectionFileExists(path2) {
11803
11972
  try {
@@ -11815,7 +11984,9 @@ function normalizeConnectOptions(opts) {
11815
11984
  targetKind: opts.targetKind ?? DEFAULT_MANAGED_TARGET_KIND,
11816
11985
  reconnectBackoff: opts.reconnectBackoff ?? DEFAULT_RECONNECT_BACKOFF,
11817
11986
  sleep: opts.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms))),
11818
- timeoutArbitrationGraceMs: opts.timeoutArbitrationGraceMs ?? TIMEOUT_ARBITRATION_GRACE_MS
11987
+ timeoutArbitrationGraceMs: opts.timeoutArbitrationGraceMs ?? TIMEOUT_ARBITRATION_GRACE_MS,
11988
+ livenessProbeWindowMs: opts.livenessProbeWindowMs ?? LIVENESS_PROBE_WINDOW_MS,
11989
+ onControlPush: opts.onControlPush
11819
11990
  };
11820
11991
  }
11821
11992
  function routeCacheKey(target, identity, consumerIdentity) {
@@ -11847,1071 +12018,221 @@ function causeMessage(cause) {
11847
12018
  function pendingKey(handle, corr) {
11848
12019
  return handle ? `${handle.channel}:${handle.epoch}:${corr}` : `0:0:${corr}`;
11849
12020
  }
11850
- // ../../node_modules/.bun/@cortexkit+subc-client@0.5.0/node_modules/@cortexkit/subc-client/dist/provider.js
11851
- import { Buffer as Buffer2 } from "node:buffer";
11852
- var DEFAULT_HANDSHAKE_TIMEOUT_MS2 = 1e4;
11853
- var BODY_READ_TIMEOUT_MS2 = 30000;
11854
- var WRITE_TIMEOUT_MS = 30000;
11855
- var DEFAULT_RESTORED_DEBOUNCE_MS = 250;
11856
- var DEFAULT_PROVIDER_HANDLER_CAPACITY = 64;
11857
- var HEALTH_CHECK_OP = "health.check";
11858
- var HELLO_CORR = 1n;
12021
+ // ../aft-bridge/dist/subc-transport.js
12022
+ import { existsSync as existsSync3, statSync as statSync3 } from "node:fs";
11859
12023
 
11860
- class AsyncPermitPool {
11861
- available;
11862
- waiters = [];
11863
- constructor(capacity) {
11864
- if (!Number.isInteger(capacity) || capacity <= 0) {
11865
- throw new SubcProviderError("provider handler capacity must be a positive integer", "invalid_handler_capacity");
11866
- }
11867
- this.available = capacity;
11868
- }
11869
- async acquire() {
11870
- if (this.available > 0) {
11871
- this.available -= 1;
11872
- return this.releaseOnce();
11873
- }
11874
- await new Promise((resolve3) => {
11875
- this.waiters.push(resolve3);
11876
- });
11877
- return this.releaseOnce();
11878
- }
11879
- releaseOnce() {
11880
- let released = false;
11881
- return () => {
11882
- if (released)
11883
- return;
11884
- released = true;
11885
- const next = this.waiters.shift();
11886
- if (next) {
11887
- next();
11888
- } else {
11889
- this.available += 1;
11890
- }
11891
- };
12024
+ // ../aft-bridge/dist/lifecycle-registry.js
12025
+ import { lstat } from "node:fs/promises";
12026
+ function asCanonicalRootPath(root) {
12027
+ return root;
12028
+ }
12029
+ function asRootGeneration(generation) {
12030
+ if (!Number.isSafeInteger(generation) || generation < 1) {
12031
+ throw new RangeError("root generations must be positive safe integers");
11892
12032
  }
12033
+ return generation;
11893
12034
  }
11894
-
11895
- class SubcProviderError extends Error {
11896
- code;
11897
- constructor(message, code) {
11898
- super(message);
11899
- this.code = code;
12035
+ function asConcretePoolId(id) {
12036
+ return id;
12037
+ }
12038
+ var DEFAULT_LIFECYCLE_INTERVAL_MS = 5 * 60 * 1000;
12039
+ var DEFAULT_REALM = "default";
12040
+ function rootKey(root) {
12041
+ return root;
12042
+ }
12043
+ function resultMeansPresent(result) {
12044
+ if (typeof result === "boolean")
12045
+ return result;
12046
+ if (typeof result === "object" && result !== null && "exists" in result) {
12047
+ return result.exists !== false;
11900
12048
  }
12049
+ return true;
11901
12050
  }
11902
- class SubcProvider {
11903
- sock;
11904
- currentConn;
11905
- opts;
11906
- closed;
11907
- resolveClosed = () => {
11908
- return;
12051
+ function isEnoent(error2) {
12052
+ return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "ENOENT";
12053
+ }
12054
+ function closeCounts(result) {
12055
+ const teardown = typeof result === "object" && result !== null ? result : undefined;
12056
+ const sessions = teardown?.tornDownSessionCount;
12057
+ const facades = teardown?.tornDownFacadeCount;
12058
+ return {
12059
+ sessions: typeof sessions === "number" && Number.isFinite(sessions) ? Math.max(0, sessions) : 0,
12060
+ facades: typeof facades === "number" && Number.isFinite(facades) ? Math.max(0, facades) : 0
11909
12061
  };
11910
- closeStarted = false;
11911
- closedErr = null;
11912
- inflight = new Map;
11913
- pending = new Map;
11914
- liveRoutes = new Map;
11915
- connectionToken = newConnectionToken();
11916
- nextCorr = 1n;
11917
- ingressEpochDropCount = 0;
11918
- requestGate = new AsyncPermitPool(DEFAULT_PROVIDER_HANDLER_CAPACITY);
11919
- reconnecting = null;
11920
- generation = 1;
11921
- connectionEpoch = 1;
11922
- stateQueue = [];
11923
- drainingStateQueue = false;
11924
- restoredDebounceToken = 0;
11925
- storage;
11926
- constructor(sock, currentConn, opts, storage) {
11927
- this.sock = sock;
11928
- this.currentConn = currentConn;
11929
- this.opts = opts;
11930
- this.storage = storage;
11931
- this.closed = new Promise((resolve3) => {
11932
- this.resolveClosed = resolve3;
12062
+ }
12063
+ function defaultTimer() {
12064
+ return {
12065
+ setInterval(callback, delayMs) {
12066
+ const handle = setInterval(callback, delayMs);
12067
+ const maybeUnref = handle;
12068
+ maybeUnref.unref?.();
12069
+ return handle;
12070
+ },
12071
+ clearInterval(handle) {
12072
+ clearInterval(handle);
12073
+ }
12074
+ };
12075
+ }
12076
+
12077
+ class LifecycleRegistry {
12078
+ realm;
12079
+ intervalMs;
12080
+ registrations = new Map;
12081
+ registrationByPool = new WeakMap;
12082
+ nextGenerationByRoot = new Map;
12083
+ nextConcretePoolNumber = 1;
12084
+ nextRegistrationSequence = 1;
12085
+ timer;
12086
+ statRoot;
12087
+ demand;
12088
+ onEvent;
12089
+ intervalHandle = null;
12090
+ sweepInFlight = null;
12091
+ constructor(options = {}) {
12092
+ this.realm = options.realm ?? DEFAULT_REALM;
12093
+ this.intervalMs = options.intervalMs ?? DEFAULT_LIFECYCLE_INTERVAL_MS;
12094
+ if (!Number.isFinite(this.intervalMs) || this.intervalMs <= 0) {
12095
+ throw new RangeError("lifecycle interval must be a positive finite number");
12096
+ }
12097
+ const nativeTimer = defaultTimer();
12098
+ this.timer = options.timer ?? (options.setInterval || options.clearInterval ? {
12099
+ setInterval: options.setInterval ?? nativeTimer.setInterval,
12100
+ clearInterval: options.clearInterval ?? nativeTimer.clearInterval
12101
+ } : nativeTimer);
12102
+ this.statRoot = options.stat ?? ((root) => lstat(root));
12103
+ this.demand = options.demandCheck ?? (() => false);
12104
+ this.onEvent = options.onEvent;
12105
+ }
12106
+ registerLifecyclePool(pool, options) {
12107
+ if (!pool || typeof pool.closeProjectRoot !== "function") {
12108
+ throw new TypeError("a lifecycle pool must provide closeProjectRoot");
12109
+ }
12110
+ if (typeof options?.evictOuterFacade !== "function") {
12111
+ throw new TypeError("lifecycle registration requires evictOuterFacade");
12112
+ }
12113
+ if (typeof options.reapingEnabled !== "boolean") {
12114
+ throw new TypeError("reapingEnabled must be a boolean");
12115
+ }
12116
+ const previous = this.registrationByPool.get(pool);
12117
+ if (previous?.active)
12118
+ this.deregisterInternal(previous);
12119
+ const concretePoolId = asConcretePoolId(`pool-${this.nextConcretePoolNumber++}`);
12120
+ const registrationIdentity = Object.freeze({
12121
+ concretePoolId,
12122
+ registrationSequence: this.nextRegistrationSequence++
11933
12123
  });
11934
- this.readLoop(sock, this.generation);
11935
- this.enqueueConnectionState({ state: "connected", epoch: this.connectionEpoch });
12124
+ const internal = {
12125
+ pool,
12126
+ concretePoolId,
12127
+ registrationIdentity,
12128
+ reapingEnabled: options.reapingEnabled,
12129
+ evictOuterFacade: options.evictOuterFacade,
12130
+ roots: new Map,
12131
+ handle: undefined,
12132
+ active: true
12133
+ };
12134
+ const handle = {
12135
+ registrationIdentity,
12136
+ identity: registrationIdentity,
12137
+ get concretePoolId() {
12138
+ return concretePoolId;
12139
+ },
12140
+ get reapingEnabled() {
12141
+ return internal.reapingEnabled;
12142
+ },
12143
+ deregister: () => {
12144
+ this.deregisterInternal(internal);
12145
+ }
12146
+ };
12147
+ internal.handle = handle;
12148
+ this.registrations.set(concretePoolId, internal);
12149
+ this.registrationByPool.set(pool, internal);
12150
+ this.refreshTimer();
12151
+ return handle;
11936
12152
  }
11937
- get droppedIngressFrames() {
11938
- return this.ingressEpochDropCount;
12153
+ registerPool(pool, options) {
12154
+ return this.registerLifecyclePool(pool, options);
11939
12155
  }
11940
- get conn() {
11941
- return this.currentConn;
12156
+ registerRoot(poolId, root) {
12157
+ const registration = this.currentRegistration(poolId);
12158
+ if (!registration)
12159
+ throw new Error(`unknown lifecycle pool ${poolId}`);
12160
+ const key = rootKey(root);
12161
+ const existing = registration.roots.get(key);
12162
+ if (existing?.state === "live")
12163
+ return existing.generation;
12164
+ if (existing && !existing.synchronousPhaseComplete) {
12165
+ throw new Error("root registration raced its synchronous close phase");
12166
+ }
12167
+ const next = (this.nextGenerationByRoot.get(`${poolId}\x00${key}`) ?? 0) + 1;
12168
+ this.nextGenerationByRoot.set(`${poolId}\x00${key}`, next);
12169
+ const entry = {
12170
+ registration,
12171
+ canonicalRoot: root,
12172
+ generation: asRootGeneration(next),
12173
+ state: "live",
12174
+ consecutiveAbsences: 0,
12175
+ tombstoned: false,
12176
+ synchronousPhaseComplete: true,
12177
+ closePromise: null,
12178
+ eventEmitted: false,
12179
+ cause: null
12180
+ };
12181
+ registration.roots.set(key, entry);
12182
+ return entry.generation;
11942
12183
  }
11943
- currentEpoch() {
11944
- return this.connectionEpoch;
12184
+ currentGeneration(poolId, root) {
12185
+ return this.currentRoot(poolId, root)?.generation;
11945
12186
  }
11946
- async request(handle, body, opts = {}) {
11947
- this.assertLiveHandle(handle);
11948
- const corr = this.allocateCorr();
11949
- const key = routeKey(handle, corr);
11950
- const timeoutMs = opts.timeoutMs ?? WRITE_TIMEOUT_MS;
11951
- const frame = buildFrame(FrameType.Request, buildFlags(false, opts.priority ?? Priority.Interactive, false, opts.admissionClass ?? AdmissionClass.Normal), handle.channel, handle.epoch, corr, body);
11952
- return await new Promise((resolve3, reject) => {
11953
- const timer = setTimeout(() => {
11954
- if (this.pending.delete(key))
11955
- reject(new SubcProviderError("reverse request timed out", "request_timeout"));
11956
- }, timeoutMs);
11957
- this.pending.set(key, {
11958
- resolve: (response) => resolve3(response.body),
11959
- reject,
11960
- timer
11961
- });
11962
- this.sendOn(this.sock, this.generation, frame).catch((error2) => {
11963
- const pending = this.pending.get(key);
11964
- if (!pending)
11965
- return;
11966
- this.pending.delete(key);
11967
- clearTimeout(pending.timer);
11968
- reject(error2 instanceof Error ? error2 : new SubcProviderError(String(error2)));
11969
- });
11970
- });
12187
+ isTombstoned(poolId, root, generation) {
12188
+ const entry = this.currentRoot(poolId, root);
12189
+ return entry?.generation === generation && entry.tombstoned;
11971
12190
  }
11972
- async push(handle, body, opts = {}) {
11973
- this.assertLiveHandle(handle);
11974
- await this.sendOn(this.sock, this.generation, buildFrame(FrameType.Push, buildFlags(false, opts.priority ?? Priority.Interactive, false, opts.admissionClass ?? AdmissionClass.Normal), handle.channel, handle.epoch, 0n, body));
12191
+ isCurrentRegistration(identity) {
12192
+ const registration = this.registrations.get(identity.concretePoolId);
12193
+ return registration?.active === true && registration.registrationIdentity === identity;
11975
12194
  }
11976
- cancel(handle, corr) {
11977
- this.assertLiveHandle(handle);
11978
- this.sendOn(this.sock, this.generation, buildFrame(FrameType.Cancel, controlFlags(), handle.channel, handle.epoch, corr, new Uint8Array(0)));
12195
+ isCurrentLiveGeneration(poolId, root, generation) {
12196
+ const entry = this.currentRoot(poolId, root);
12197
+ return entry?.generation === generation && entry.state === "live";
11979
12198
  }
11980
- closeRoute(handle) {
11981
- this.assertLiveHandle(handle);
11982
- this.liveRoutes.delete(handle.channel);
11983
- this.abortHandle(handle);
11984
- this.sendOn(this.sock, this.generation, buildFrame(FrameType.Goodbye, controlFlags(), handle.channel, handle.epoch, 0n, new Uint8Array(0)));
12199
+ getRootSnapshot(poolId, root) {
12200
+ const entry = this.currentRoot(poolId, root);
12201
+ return entry ? this.snapshotRoot(entry) : undefined;
11985
12202
  }
11986
- static async connect(opts) {
11987
- if (opts.manifest.protocol_ver !== PROTOCOL_VERSION) {
11988
- throw new SubcProviderError(`manifest protocol_ver ${opts.manifest.protocol_ver} does not match client protocol ${PROTOCOL_VERSION}`, "invalid_manifest");
11989
- }
11990
- const normalized = normalizeProviderConnectOptions(opts);
11991
- const opened = await SubcProvider.openConnection(normalized);
11992
- return new SubcProvider(opened.sock, opened.conn, normalized, opened.ack.storage);
11993
- }
11994
- async close() {
11995
- if (!this.closeStarted) {
11996
- this.closeStarted = true;
11997
- this.cancelRestoredDebounce();
11998
- const sock = this.sock;
11999
- try {
12000
- await sendFrame(sock, buildFrame(FrameType.Goodbye, controlFlags(), 0, 0, 0n, new Uint8Array(0)));
12001
- } catch {} finally {
12002
- sock.close();
12003
- this.finishClosed();
12004
- }
12005
- }
12006
- await this.closed;
12203
+ rootSnapshots(poolId) {
12204
+ const entries = poolId ? [this.currentRegistration(poolId)].filter((registration) => registration != null) : [...this.registrations.values()];
12205
+ return entries.flatMap((registration) => [...registration.roots.values()].map((entry) => this.snapshotRoot(entry)));
12007
12206
  }
12008
- static async openConnection(opts, onSocket) {
12009
- const conn = await readConnectionFile(opts.connectionFile);
12010
- const deadline = Date.now() + (opts.handshakeTimeoutMs ?? DEFAULT_HANDSHAKE_TIMEOUT_MS2);
12011
- const endpoint = conn.endpoints[0];
12012
- const sock = await SubcSocket.connect(endpoint.host, endpoint.port, deadline);
12013
- try {
12014
- onSocket?.(sock);
12015
- await authenticateClient(sock, conn, deadline);
12016
- await sendFrame(sock, buildHelloFrame(opts));
12017
- const ack = await expectHelloAck(sock, deadline);
12018
- return { sock, conn, ack };
12019
- } catch (err) {
12020
- sock.close();
12021
- throw err;
12022
- }
12207
+ snapshot() {
12208
+ return {
12209
+ realm: this.realm,
12210
+ intervalMs: this.intervalMs,
12211
+ timerActive: this.intervalHandle !== null,
12212
+ registrations: [...this.registrations.values()].map((registration) => ({
12213
+ concretePoolId: registration.concretePoolId,
12214
+ reapingEnabled: registration.reapingEnabled,
12215
+ roots: [...registration.roots.values()].map((entry) => this.snapshotRoot(entry))
12216
+ }))
12217
+ };
12023
12218
  }
12024
- async readLoop(sock, generation) {
12219
+ status() {
12220
+ return this.snapshot();
12221
+ }
12222
+ async ensureRootForDemand(poolId, root) {
12223
+ const registration = this.currentRegistration(poolId);
12224
+ if (!registration)
12225
+ return;
12226
+ const existing = registration.roots.get(rootKey(root));
12227
+ if (existing?.state === "live")
12228
+ return existing.generation;
12229
+ if (existing && !existing.synchronousPhaseComplete)
12230
+ return;
12231
+ let result;
12025
12232
  try {
12026
- for (;; ) {
12027
- const frame = await sock.readFrame(Number.POSITIVE_INFINITY, { afterHeaderMs: BODY_READ_TIMEOUT_MS2 });
12028
- const keepGoing = await this.dispatch(frame, sock, generation);
12029
- if (!keepGoing) {
12030
- if (this.sock === sock && this.generation === generation)
12031
- this.closeStarted = true;
12032
- break;
12033
- }
12034
- }
12035
- } catch (error2) {
12036
- if (this.sock === sock && this.generation === generation && !this.closeStarted) {
12037
- this.handleUnexpectedDrop(sock, generation, error2 instanceof Error ? error2 : new SubcProviderError(String(error2)));
12038
- return;
12039
- }
12040
- } finally {
12041
- if (this.sock === sock && this.generation === generation) {
12042
- sock.close();
12043
- if (this.closeStarted)
12044
- this.finishClosed();
12045
- }
12046
- }
12047
- }
12048
- async dispatch(frame, sock, generation) {
12049
- let handle = null;
12050
- if (frame.header.channel !== 0) {
12051
- handle = this.liveRoutes.get(frame.header.channel) ?? null;
12052
- if (!handle || handle.epoch !== frame.header.epoch) {
12053
- this.ingressEpochDropCount += 1;
12054
- return true;
12055
- }
12056
- }
12057
- if (handle) {
12058
- const pendingKey2 = routeKey(handle, frame.header.corr);
12059
- const pending = this.pending.get(pendingKey2);
12060
- if (pending) {
12061
- if (frame.header.ty === FrameType.Push || frame.header.ty === FrameType.StreamData)
12062
- return true;
12063
- if (frame.header.ty === FrameType.Response || frame.header.ty === FrameType.StreamEnd) {
12064
- this.pending.delete(pendingKey2);
12065
- clearTimeout(pending.timer);
12066
- pending.resolve(frame);
12067
- return true;
12068
- }
12069
- if (frame.header.ty === FrameType.Error) {
12070
- this.pending.delete(pendingKey2);
12071
- clearTimeout(pending.timer);
12072
- pending.reject(providerErrorFromFrame(frame));
12073
- return true;
12074
- }
12075
- }
12076
- }
12077
- switch (frame.header.ty) {
12078
- case FrameType.Ping:
12079
- if (frame.header.channel === 0) {
12080
- await this.sendOn(sock, generation, buildFrameWithVersion(frame.header.ver, FrameType.Pong, frame.header.flags, 0, 0, frame.header.corr, new Uint8Array(0)));
12081
- }
12082
- return true;
12083
- case FrameType.Goodbye:
12084
- if (!handle)
12085
- return false;
12086
- this.liveRoutes.delete(handle.channel);
12087
- this.abortHandle(handle);
12088
- await this.opts.onRouteGone?.(handle);
12089
- return true;
12090
- case FrameType.Cancel:
12091
- if (handle)
12092
- this.inflight.get(routeKey(handle, frame.header.corr))?.abort();
12093
- return true;
12094
- case FrameType.Request:
12095
- if (frame.header.channel === 0) {
12096
- await this.handleControlRequest(frame, sock, generation);
12097
- } else if (handle) {
12098
- this.handleDataRequest(frame, handle, sock, generation).catch((error2) => {
12099
- if (!this.closeStarted && this.sock === sock && this.generation === generation) {
12100
- console.warn("SubcProvider handler failed after its request was dispatched", error2);
12101
- }
12102
- });
12103
- }
12104
- return true;
12105
- default:
12106
- return true;
12107
- }
12108
- }
12109
- abortHandle(handle) {
12110
- const prefix = `${handle.channel}:${handle.epoch}:`;
12111
- for (const [key, controller] of this.inflight) {
12112
- if (key.startsWith(prefix))
12113
- controller.abort();
12114
- }
12115
- for (const [key, pending] of this.pending) {
12116
- if (!key.startsWith(prefix))
12117
- continue;
12118
- this.pending.delete(key);
12119
- clearTimeout(pending.timer);
12120
- pending.reject(new StaleRouteHandleError(handle));
12121
- }
12122
- }
12123
- abortGeneration(_generation) {
12124
- this.abortAllInflight();
12125
- for (const [key, pending] of this.pending) {
12126
- this.pending.delete(key);
12127
- clearTimeout(pending.timer);
12128
- pending.reject(new SubcProviderError("provider connection dropped", "connection_dropped"));
12129
- }
12130
- this.liveRoutes.clear();
12131
- }
12132
- abortAllInflight() {
12133
- for (const controller of this.inflight.values())
12134
- controller.abort();
12135
- }
12136
- async handleControlRequest(frame, sock, generation) {
12137
- const request = parseJson(frame.body);
12138
- if (request.op === HEALTH_CHECK_OP) {
12139
- this.handleHealthRequest(frame, sock, generation).catch((error2) => {
12140
- if (!this.closeStarted && this.sock === sock && this.generation === generation) {
12141
- console.warn("SubcProvider health handler failed after its request was dispatched", error2);
12142
- }
12143
- });
12144
- return;
12145
- }
12146
- if (request.op !== "route.bind") {
12147
- throw new SubcProviderError(`unsupported module control request ${request.op ?? "<missing op>"}`);
12148
- }
12149
- const boundChannel = numberField(request.route_channel, "route_channel");
12150
- const boundEpoch = numberField(request.epoch, "epoch");
12151
- const stale = this.liveRoutes.get(boundChannel);
12152
- if (stale) {
12153
- if (boundEpoch <= stale.epoch) {
12154
- await this.sendError(frame, "route_rejected", `route.bind epoch ${boundEpoch} does not supersede installed epoch ${stale.epoch} on channel ${boundChannel}`, controlFlags(), sock, generation);
12155
- return;
12156
- }
12157
- this.liveRoutes.delete(stale.channel);
12158
- this.abortHandle(stale);
12159
- await this.opts.onRouteGone?.(stale);
12160
- }
12161
- const tentative = createRouteHandle(boundChannel, boundEpoch, this.connectionToken);
12162
- const bindRequest = {
12163
- handle: tentative,
12164
- target: request.target,
12165
- identity: request.identity,
12166
- principal: request.principal,
12167
- consumer_capabilities: request.consumer_capabilities
12168
- };
12169
- let decision;
12170
- try {
12171
- decision = await this.opts.onBind?.(bindRequest);
12172
- } catch (error2) {
12173
- try {
12174
- await this.sendError(frame, "route_rejected", error2 instanceof Error ? error2.message : String(error2), controlFlags(), sock, generation);
12175
- } finally {
12176
- await this.opts.onRouteGone?.(tentative);
12177
- }
12178
- return;
12179
- }
12180
- const rejection = bindRejection(decision);
12181
- if (rejection) {
12182
- try {
12183
- await this.sendError(frame, rejection.code, rejection.message, controlFlags(), sock, generation);
12184
- } finally {
12185
- await this.opts.onRouteGone?.(tentative);
12186
- }
12187
- return;
12188
- }
12189
- try {
12190
- await this.sendOn(sock, generation, buildFrameWithVersion(frame.header.ver, FrameType.Response, controlFlags(), 0, 0, frame.header.corr, encodeJson({ op: "route.bind" })));
12191
- } catch (error2) {
12192
- await this.opts.onRouteGone?.(tentative);
12193
- throw error2;
12194
- }
12195
- if (this.sock !== sock || this.generation !== generation || this.closeStarted || this.closedErr) {
12196
- await this.opts.onRouteGone?.(tentative);
12197
- return;
12198
- }
12199
- this.liveRoutes.set(tentative.channel, tentative);
12200
- await this.opts.onBound?.(tentative);
12201
- }
12202
- async handleDataRequest(frame, handle, sock, generation) {
12203
- const { corr, ver } = frame.header;
12204
- const key = routeKey(handle, corr);
12205
- const controller = new AbortController;
12206
- this.inflight.set(key, controller);
12207
- const context = {
12208
- handle,
12209
- signal: controller.signal,
12210
- currentEpoch: () => this.connectionEpoch,
12211
- emit: async (eventBody, options = {}) => {
12212
- this.assertLiveHandle(handle);
12213
- if (controller.signal.aborted)
12214
- return;
12215
- await this.sendOn(sock, generation, buildFrameWithVersion(ver, FrameType.StreamData, buildFlags(false, options.priority ?? Priority.Interactive, false, options.admissionClass ?? AdmissionClass.Normal), handle.channel, handle.epoch, corr, eventBody));
12216
- }
12217
- };
12218
- const releasePermit = await (this.requestGate ?? new AsyncPermitPool(DEFAULT_PROVIDER_HANDLER_CAPACITY)).acquire();
12219
- const dataFlags = buildFlags(false, Priority.Interactive, false);
12220
- try {
12221
- const body = await this.opts.handler(handle, frame.body, context);
12222
- if (controller.signal.aborted)
12223
- return;
12224
- this.assertLiveHandle(handle);
12225
- if (body === undefined) {
12226
- await this.sendOn(sock, generation, buildFrameWithVersion(ver, FrameType.StreamEnd, dataFlags, handle.channel, handle.epoch, corr, new Uint8Array(0)));
12227
- } else if (body instanceof Uint8Array) {
12228
- await this.sendOn(sock, generation, buildFrameWithVersion(ver, FrameType.Response, dataFlags, handle.channel, handle.epoch, corr, body));
12229
- } else {
12230
- throw new SubcProviderError("provider handler must return a Uint8Array or void", "invalid_handler_response");
12231
- }
12232
- } catch (error2) {
12233
- if (error2 instanceof StaleRouteHandleError || controller.signal.aborted)
12234
- return;
12235
- await this.sendError(frame, error2 instanceof SubcProviderError && error2.code ? error2.code : "handler_error", error2 instanceof Error ? error2.message : String(error2), dataFlags, sock, generation);
12236
- } finally {
12237
- releasePermit();
12238
- if (this.inflight.get(key) === controller)
12239
- this.inflight.delete(key);
12240
- }
12241
- }
12242
- async handleHealthRequest(frame, sock, generation) {
12243
- const { corr, ver } = frame.header;
12244
- const key = `control:${generation}:${corr}`;
12245
- const controller = new AbortController;
12246
- this.inflight.set(key, controller);
12247
- const releasePermit = await (this.requestGate ?? new AsyncPermitPool(DEFAULT_PROVIDER_HANDLER_CAPACITY)).acquire();
12248
- try {
12249
- if (controller.signal.aborted)
12250
- return;
12251
- const report = await this.opts.health();
12252
- await this.sendOn(sock, generation, buildFrameWithVersion(ver, FrameType.Response, controlFlags(), 0, 0, corr, encodeJson({
12253
- op: HEALTH_CHECK_OP,
12254
- status: report.status,
12255
- ...report.detail === undefined ? {} : { detail: report.detail },
12256
- ...report.metrics === undefined ? {} : { metrics: report.metrics }
12257
- })));
12258
- } catch (error2) {
12259
- await this.sendError(frame, error2 instanceof SubcProviderError && error2.code ? error2.code : "health_error", error2 instanceof Error ? error2.message : String(error2), controlFlags(), sock, generation);
12260
- } finally {
12261
- releasePermit();
12262
- if (this.inflight.get(key) === controller)
12263
- this.inflight.delete(key);
12264
- }
12265
- }
12266
- async sendError(frame, code, message, flags, sock, generation) {
12267
- await this.sendOn(sock, generation, buildFrameWithVersion(frame.header.ver, FrameType.Error, flags, frame.header.channel, frame.header.epoch, frame.header.corr, encodeJson({ code, message })));
12268
- }
12269
- async sendOn(sock, generation, frame) {
12270
- if (this.sock !== sock || this.generation !== generation || this.closeStarted || this.closedErr)
12271
- return;
12272
- await sendFrame(sock, frame);
12273
- }
12274
- handleUnexpectedDrop(sock, generation, cause) {
12275
- if (this.closeStarted || this.sock !== sock || this.generation !== generation)
12276
- return;
12277
- this.cancelRestoredDebounce();
12278
- this.abortGeneration(generation);
12279
- this.generation += 1;
12280
- sock.close();
12281
- this.scheduleReconnectAfterDrop(cause, this.generation, sock);
12282
- }
12283
- scheduleReconnectAfterDrop(cause, generation, droppedSocket) {
12284
- if (this.closeStarted)
12285
- return;
12286
- const previous = this.reconnecting;
12287
- if (previous) {
12288
- if (!this.shouldSupersedeReconnect(previous, generation, droppedSocket))
12289
- return;
12290
- previous.superseded = true;
12291
- previous.socket?.close();
12292
- }
12293
- const cycle = {
12294
- generation,
12295
- socket: null,
12296
- socketDied: false,
12297
- superseded: false
12298
- };
12299
- this.reconnecting = cycle;
12300
- this.enqueueConnectionState({ state: "down", cause });
12301
- this.reconnectWithRetry(cycle).catch((err) => {
12302
- if (this.isCurrentReconnect(cycle) && !this.closeStarted) {
12303
- this.failFatal(err instanceof Error ? err : new SubcProviderError(String(err)));
12304
- }
12305
- }).finally(() => {
12306
- if (this.isCurrentReconnect(cycle))
12307
- this.reconnecting = null;
12308
- });
12309
- }
12310
- async reconnectWithRetry(cycle) {
12311
- let attempt = 0;
12312
- let delay = this.opts.reconnectBackoff.baseMs;
12313
- for (;; ) {
12314
- if (!this.isCurrentReconnect(cycle))
12315
- return;
12316
- if (this.closeStarted)
12317
- throw new SubcProviderError("provider closed");
12318
- cycle.socket = null;
12319
- cycle.socketDied = false;
12320
- attempt += 1;
12321
- this.enqueueReconnectState(cycle, attempt);
12322
- try {
12323
- const opened = await SubcProvider.openConnection(this.opts, (sock) => {
12324
- if (!this.isCurrentReconnect(cycle)) {
12325
- sock.close();
12326
- return;
12327
- }
12328
- cycle.socket = sock;
12329
- });
12330
- if (!this.isCurrentReconnect(cycle) || this.closeStarted) {
12331
- opened.sock.close();
12332
- if (this.closeStarted)
12333
- throw new SubcProviderError("provider closed");
12334
- return;
12335
- }
12336
- const epoch = this.replaceConnection(opened, cycle.generation);
12337
- this.reconnecting = null;
12338
- if (this.reconnecting !== null) {
12339
- throw new SubcProviderError("reconnect state must clear before restored", "reconnect_state");
12340
- }
12341
- this.scheduleRestored(cycle.generation, epoch);
12342
- return;
12343
- } catch (err) {
12344
- if (!this.isCurrentReconnect(cycle))
12345
- return;
12346
- if (cycle.socket)
12347
- cycle.socketDied = true;
12348
- if (this.closeStarted)
12349
- throw err;
12350
- if (!isProviderReconnectTransient(err))
12351
- throw err;
12352
- await this.opts.sleep(delay);
12353
- delay = Math.min(delay * 2, this.opts.reconnectBackoff.capMs);
12354
- }
12355
- }
12356
- }
12357
- isCurrentReconnect(cycle) {
12358
- return !cycle.superseded && this.reconnecting === cycle && this.generation === cycle.generation;
12359
- }
12360
- shouldSupersedeReconnect(cycle, generation, droppedSocket) {
12361
- return cycle.generation < generation || cycle.socketDied || cycle.socket === droppedSocket;
12362
- }
12363
- enqueueReconnectState(cycle, attempt) {
12364
- if (!this.isCurrentReconnect(cycle))
12365
- return;
12366
- this.enqueueConnectionState({ state: "reconnecting", attempt }, cycle.generation, cycle);
12367
- }
12368
- replaceConnection(opened, generation) {
12369
- this.sock.close();
12370
- this.sock = opened.sock;
12371
- this.currentConn = opened.conn;
12372
- this.storage = opened.ack.storage;
12373
- this.closedErr = null;
12374
- this.connectionEpoch += 1;
12375
- this.connectionToken = newConnectionToken();
12376
- this.liveRoutes.clear();
12377
- this.nextCorr = 1n;
12378
- this.readLoop(opened.sock, generation);
12379
- return this.connectionEpoch;
12380
- }
12381
- scheduleRestored(generation, epoch) {
12382
- if (!this.opts.onConnectionState)
12383
- return;
12384
- const token = ++this.restoredDebounceToken;
12385
- this.opts.sleep(this.opts.restoredDebounceMs).then(() => {
12386
- if (token === this.restoredDebounceToken && !this.closeStarted && this.sock && this.generation === generation && this.connectionEpoch === epoch) {
12387
- this.enqueueConnectionState({ state: "restored", epoch }, generation);
12388
- }
12389
- }).catch((err) => {
12390
- if (token === this.restoredDebounceToken && !this.closeStarted) {
12391
- console.warn("SubcProvider restored debounce timer failed", err);
12392
- }
12393
- });
12394
- }
12395
- cancelRestoredDebounce() {
12396
- this.restoredDebounceToken += 1;
12397
- }
12398
- enqueueConnectionState(event, generation, reconnect) {
12399
- if (!this.opts.onConnectionState)
12400
- return;
12401
- this.stateQueue.push({ event, generation, reconnect });
12402
- if (!this.drainingStateQueue)
12403
- this.drainConnectionStateQueue();
12404
- }
12405
- async drainConnectionStateQueue() {
12406
- if (this.drainingStateQueue)
12407
- return;
12408
- this.drainingStateQueue = true;
12409
- try {
12410
- while (this.stateQueue.length > 0) {
12411
- const queued = this.stateQueue[0];
12412
- if (this.closeStarted || queued.generation !== undefined && queued.generation !== this.generation || queued.reconnect?.superseded) {
12413
- this.stateQueue.shift();
12414
- continue;
12415
- }
12416
- const { event } = queued;
12417
- try {
12418
- await this.opts.onConnectionState?.(event);
12419
- this.stateQueue.shift();
12420
- } catch (err) {
12421
- if (event.state === "restored") {
12422
- console.warn("SubcProvider restored callback failed; retrying delivery", err);
12423
- await pauseBeforeStateRetry();
12424
- continue;
12425
- }
12426
- console.warn("SubcProvider connection-state callback failed", err);
12427
- this.stateQueue.shift();
12428
- }
12429
- }
12430
- } finally {
12431
- this.drainingStateQueue = false;
12432
- if (this.stateQueue.length > 0)
12433
- this.drainConnectionStateQueue();
12434
- }
12435
- }
12436
- isLiveHandle(handle) {
12437
- return belongsToConnection(handle, this.connectionToken) && this.liveRoutes.get(handle.channel) === handle;
12438
- }
12439
- assertLiveHandle(handle) {
12440
- if (!this.isLiveHandle(handle))
12441
- throw new StaleRouteHandleError(handle);
12442
- }
12443
- allocateCorr() {
12444
- const maximum = 0xffffffffffffffffn;
12445
- if (this.nextCorr > maximum) {
12446
- const error2 = new SubcProviderError("channel-0 correlation id allocator exhausted", "corr_exhausted");
12447
- this.handleUnexpectedDrop(this.sock, this.generation, error2);
12448
- throw error2;
12449
- }
12450
- const corr = this.nextCorr;
12451
- this.nextCorr += 1n;
12452
- return corr;
12453
- }
12454
- failFatal(err) {
12455
- if (!this.closedErr)
12456
- this.closedErr = err;
12457
- this.closeStarted = true;
12458
- this.cancelRestoredDebounce();
12459
- this.abortAllInflight();
12460
- this.sock.close();
12461
- this.finishClosed();
12462
- }
12463
- finishClosed() {
12464
- this.resolveClosed();
12465
- }
12466
- }
12467
- function routeKey(handle, corr) {
12468
- return `${handle.channel}:${handle.epoch}:${corr}`;
12469
- }
12470
- function providerErrorFromFrame(frame) {
12471
- try {
12472
- const body = parseJson(frame.body);
12473
- return new SubcProviderError(body.message ?? "subc error", body.code);
12474
- } catch {
12475
- return new SubcProviderError(Buffer2.from(frame.body).toString("utf8") || "subc error");
12476
- }
12477
- }
12478
- function launchNonce(opts) {
12479
- const nonce = opts.launchNonce ?? process.env[SUBC_LAUNCH_NONCE_ENV2];
12480
- return nonce && nonce.length > 0 ? nonce : undefined;
12481
- }
12482
- var SUBC_LAUNCH_NONCE_ENV2 = "SUBC_LAUNCH_NONCE";
12483
- function normalizeProviderConnectOptions(opts) {
12484
- return {
12485
- connectionFile: opts.connectionFile,
12486
- manifest: opts.manifest,
12487
- handler: opts.handler,
12488
- health: opts.health ?? (() => ({ status: "ok" })),
12489
- handshakeTimeoutMs: opts.handshakeTimeoutMs,
12490
- controlOps: opts.controlOps,
12491
- onBind: opts.onBind,
12492
- onBound: opts.onBound,
12493
- onRouteGone: opts.onRouteGone,
12494
- reconnectBackoff: opts.reconnectBackoff ?? DEFAULT_RECONNECT_BACKOFF,
12495
- sleep: opts.sleep ?? ((ms) => new Promise((resolve3) => setTimeout(resolve3, ms))),
12496
- restoredDebounceMs: opts.restoredDebounceMs ?? DEFAULT_RESTORED_DEBOUNCE_MS,
12497
- onConnectionState: opts.onConnectionState,
12498
- launchNonce: opts.launchNonce
12499
- };
12500
- }
12501
- function normalizedControlOps(controlOps) {
12502
- if (controlOps === null)
12503
- return null;
12504
- const merged = new Set(controlOps ?? []);
12505
- merged.add(HEALTH_CHECK_OP);
12506
- return [...merged];
12507
- }
12508
- function buildHelloFrame(opts) {
12509
- const nonce = launchNonce(opts);
12510
- return buildFrame(FrameType.Hello, controlFlags(), 0, 0, HELLO_CORR, encodeJson({
12511
- manifest: normalizeManifest(opts.manifest),
12512
- protocol_ver: PROTOCOL_VERSION,
12513
- control_ops: normalizedControlOps(opts.controlOps),
12514
- ...nonce ? { launch_nonce: nonce } : {}
12515
- }));
12516
- }
12517
- function isProviderReconnectTransient(err) {
12518
- if (err instanceof SubcProviderError)
12519
- return err.code === "duplicate_module_id";
12520
- if (err instanceof SocketClosedError || err instanceof SocketTimeoutError)
12521
- return true;
12522
- if (err instanceof SocketWriteNotQueuedError || err instanceof SocketWriteQueuedError)
12523
- return true;
12524
- if (err instanceof AuthError)
12525
- return true;
12526
- if (err instanceof ConnectionFileError)
12527
- return false;
12528
- const code = errorCode2(err);
12529
- return code === "ECONNREFUSED" || code === "ECONNRESET" || code === "EPIPE" || code === "ETIMEDOUT" || code === "ENOENT";
12530
- }
12531
- function errorCode2(err) {
12532
- if (typeof err === "object" && err !== null && "code" in err) {
12533
- const code = err.code;
12534
- if (typeof code === "string")
12535
- return code;
12536
- }
12537
- return;
12538
- }
12539
- async function pauseBeforeStateRetry() {
12540
- await new Promise((resolve3) => setTimeout(resolve3, 0));
12541
- }
12542
- function controlFlags() {
12543
- return buildFlags(false, Priority.Passive, false);
12544
- }
12545
- async function sendFrame(sock, frame) {
12546
- await sock.write(encodeFrame(frame), Date.now() + WRITE_TIMEOUT_MS);
12547
- }
12548
- async function expectHelloAck(sock, deadline) {
12549
- const frame = await sock.readFrame(deadline, deadline);
12550
- switch (frame.header.ty) {
12551
- case FrameType.HelloAck: {
12552
- const ack = parseJson(frame.body);
12553
- if (ack.negotiated_ver !== PROTOCOL_VERSION) {
12554
- throw new SubcProviderError(`subc negotiated protocol ${ack.negotiated_ver}; expected exactly ${PROTOCOL_VERSION}`, "unsupported_version");
12555
- }
12556
- return ack;
12557
- }
12558
- case FrameType.Error: {
12559
- const error2 = parseJson(frame.body);
12560
- throw new SubcProviderError(`subc rejected HELLO: ${error2.code ?? "unknown"} — ${error2.message ?? "subc error"}`, error2.code);
12561
- }
12562
- default:
12563
- throw new SubcProviderError(`unexpected frame ${FrameType[frame.header.ty]} awaiting HELLO_ACK`);
12564
- }
12565
- }
12566
- function encodeJson(value) {
12567
- return new Uint8Array(Buffer2.from(JSON.stringify(value), "utf8"));
12568
- }
12569
- function parseJson(bytes) {
12570
- return JSON.parse(Buffer2.from(bytes).toString("utf8"));
12571
- }
12572
- function numberField(value, field) {
12573
- if (typeof value !== "number" || !Number.isInteger(value)) {
12574
- throw new SubcProviderError(`route.bind ${field} must be an integer`);
12575
- }
12576
- return value;
12577
- }
12578
- function bindRejection(decision) {
12579
- if (decision === undefined || decision === true)
12580
- return null;
12581
- if (decision === false) {
12582
- return { code: "route_rejected", message: "route.bind rejected by provider" };
12583
- }
12584
- if (decision.accept)
12585
- return null;
12586
- return {
12587
- code: decision.code ?? "route_rejected",
12588
- message: decision.message ?? "route.bind rejected by provider"
12589
- };
12590
- }
12591
- function normalizeManifest(manifest) {
12592
- return {
12593
- module_id: manifest.module_id,
12594
- module_version: manifest.module_version,
12595
- protocol_ver: manifest.protocol_ver,
12596
- trust_tier: manifest.trust_tier,
12597
- provides: manifest.provides.map(normalizeProviderRole),
12598
- consumes: manifest.consumes.map(normalizeConsumerRole),
12599
- scheduled_tasks: manifest.scheduled_tasks.map(normalizeScheduledTask),
12600
- bindings: {
12601
- storage: {
12602
- kind: manifest.bindings.storage.kind,
12603
- scope: manifest.bindings.storage.scope,
12604
- owns_schema: manifest.bindings.storage.owns_schema
12605
- },
12606
- vault_grants: manifest.bindings.vault_grants.map((grant) => ({
12607
- secret: grant.secret,
12608
- reason: grant.reason
12609
- })),
12610
- identity: {
12611
- requires: [...manifest.bindings.identity.requires],
12612
- optional: [...manifest.bindings.identity.optional]
12613
- }
12614
- }
12615
- };
12616
- }
12617
- function normalizeProviderRole(role) {
12618
- switch (role.role) {
12619
- case "tool_provider":
12620
- return {
12621
- role: "tool_provider",
12622
- tools: role.tools.map((tool) => ({
12623
- name: tool.name,
12624
- ...tool.description === undefined ? {} : { description: tool.description },
12625
- execution_mode: tool.execution_mode,
12626
- schema: tool.schema
12627
- })),
12628
- identity_scope: [...role.identity_scope],
12629
- concurrency: role.concurrency,
12630
- emits_push: role.emits_push,
12631
- sub_supervises: role.sub_supervises
12632
- };
12633
- case "pipeline_stage":
12634
- return {
12635
- role: "pipeline_stage",
12636
- stage: role.stage,
12637
- applies_to: {
12638
- provider: role.applies_to.provider,
12639
- model: role.applies_to.model
12640
- },
12641
- interface: role.interface,
12642
- declares_frozen_floor: role.declares_frozen_floor,
12643
- needs_signals: [...role.needs_signals],
12644
- conformance_class: role.conformance_class
12645
- };
12646
- case "management_surface":
12647
- return {
12648
- role: "management_surface",
12649
- operations: role.operations.map((operation) => ({
12650
- name: operation.name,
12651
- kind: operation.kind
12652
- })),
12653
- config_schema: role.config_schema,
12654
- observability: role.observability.map((surface) => ({
12655
- name: surface.name,
12656
- kind: surface.kind
12657
- })),
12658
- identity_scope: [...role.identity_scope]
12659
- };
12660
- case "internal_service":
12661
- return {
12662
- role: "internal_service",
12663
- service_id: role.service_id,
12664
- transport: role.transport,
12665
- agent_facing: role.agent_facing,
12666
- operations: [...role.operations]
12667
- };
12668
- }
12669
- }
12670
- function normalizeConsumerRole(role) {
12671
- switch (role.role) {
12672
- case "tool_client":
12673
- return { role: "tool_client", of: [...role.of] };
12674
- case "llm_client":
12675
- return { role: "llm_client", via: role.via, auth: role.auth };
12676
- case "service_client":
12677
- return { role: "service_client", of: [...role.of] };
12678
- }
12679
- }
12680
- function normalizeScheduledTask(task) {
12681
- return {
12682
- task_id: task.task_id,
12683
- eligibility: {
12684
- cooldown: task.eligibility.cooldown,
12685
- window: task.eligibility.window
12686
- },
12687
- lease_scope: task.lease_scope,
12688
- renews_during_calls: task.renews_during_calls,
12689
- toolset: [...task.toolset],
12690
- model_policy: {
12691
- tier: task.model_policy.tier,
12692
- fallback_chain: [...task.model_policy.fallback_chain]
12693
- },
12694
- step_cap: task.step_cap,
12695
- circuit_breaker: {
12696
- identical_failures: task.circuit_breaker.identical_failures
12697
- }
12698
- };
12699
- }
12700
- // ../aft-bridge/dist/subc-transport.js
12701
- import { existsSync as existsSync3, statSync as statSync3 } from "node:fs";
12702
-
12703
- // ../aft-bridge/dist/lifecycle-registry.js
12704
- import { lstat } from "node:fs/promises";
12705
- function asCanonicalRootPath(root) {
12706
- return root;
12707
- }
12708
- function asRootGeneration(generation) {
12709
- if (!Number.isSafeInteger(generation) || generation < 1) {
12710
- throw new RangeError("root generations must be positive safe integers");
12711
- }
12712
- return generation;
12713
- }
12714
- function asConcretePoolId(id) {
12715
- return id;
12716
- }
12717
- var DEFAULT_LIFECYCLE_INTERVAL_MS = 5 * 60 * 1000;
12718
- var DEFAULT_REALM = "default";
12719
- function rootKey(root) {
12720
- return root;
12721
- }
12722
- function resultMeansPresent(result) {
12723
- if (typeof result === "boolean")
12724
- return result;
12725
- if (typeof result === "object" && result !== null && "exists" in result) {
12726
- return result.exists !== false;
12727
- }
12728
- return true;
12729
- }
12730
- function isEnoent(error2) {
12731
- return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "ENOENT";
12732
- }
12733
- function closeCounts(result) {
12734
- const teardown = typeof result === "object" && result !== null ? result : undefined;
12735
- const sessions = teardown?.tornDownSessionCount;
12736
- const facades = teardown?.tornDownFacadeCount;
12737
- return {
12738
- sessions: typeof sessions === "number" && Number.isFinite(sessions) ? Math.max(0, sessions) : 0,
12739
- facades: typeof facades === "number" && Number.isFinite(facades) ? Math.max(0, facades) : 0
12740
- };
12741
- }
12742
- function defaultTimer() {
12743
- return {
12744
- setInterval(callback, delayMs) {
12745
- const handle = setInterval(callback, delayMs);
12746
- const maybeUnref = handle;
12747
- maybeUnref.unref?.();
12748
- return handle;
12749
- },
12750
- clearInterval(handle) {
12751
- clearInterval(handle);
12752
- }
12753
- };
12754
- }
12755
-
12756
- class LifecycleRegistry {
12757
- realm;
12758
- intervalMs;
12759
- registrations = new Map;
12760
- registrationByPool = new WeakMap;
12761
- nextGenerationByRoot = new Map;
12762
- nextConcretePoolNumber = 1;
12763
- nextRegistrationSequence = 1;
12764
- timer;
12765
- statRoot;
12766
- demand;
12767
- onEvent;
12768
- intervalHandle = null;
12769
- sweepInFlight = null;
12770
- constructor(options = {}) {
12771
- this.realm = options.realm ?? DEFAULT_REALM;
12772
- this.intervalMs = options.intervalMs ?? DEFAULT_LIFECYCLE_INTERVAL_MS;
12773
- if (!Number.isFinite(this.intervalMs) || this.intervalMs <= 0) {
12774
- throw new RangeError("lifecycle interval must be a positive finite number");
12775
- }
12776
- const nativeTimer = defaultTimer();
12777
- this.timer = options.timer ?? (options.setInterval || options.clearInterval ? {
12778
- setInterval: options.setInterval ?? nativeTimer.setInterval,
12779
- clearInterval: options.clearInterval ?? nativeTimer.clearInterval
12780
- } : nativeTimer);
12781
- this.statRoot = options.stat ?? ((root) => lstat(root));
12782
- this.demand = options.demandCheck ?? (() => false);
12783
- this.onEvent = options.onEvent;
12784
- }
12785
- registerLifecyclePool(pool, options) {
12786
- if (!pool || typeof pool.closeProjectRoot !== "function") {
12787
- throw new TypeError("a lifecycle pool must provide closeProjectRoot");
12788
- }
12789
- if (typeof options?.evictOuterFacade !== "function") {
12790
- throw new TypeError("lifecycle registration requires evictOuterFacade");
12791
- }
12792
- if (typeof options.reapingEnabled !== "boolean") {
12793
- throw new TypeError("reapingEnabled must be a boolean");
12794
- }
12795
- const previous = this.registrationByPool.get(pool);
12796
- if (previous?.active)
12797
- this.deregisterInternal(previous);
12798
- const concretePoolId = asConcretePoolId(`pool-${this.nextConcretePoolNumber++}`);
12799
- const registrationIdentity = Object.freeze({
12800
- concretePoolId,
12801
- registrationSequence: this.nextRegistrationSequence++
12802
- });
12803
- const internal = {
12804
- pool,
12805
- concretePoolId,
12806
- registrationIdentity,
12807
- reapingEnabled: options.reapingEnabled,
12808
- evictOuterFacade: options.evictOuterFacade,
12809
- roots: new Map,
12810
- handle: undefined,
12811
- active: true
12812
- };
12813
- const handle = {
12814
- registrationIdentity,
12815
- identity: registrationIdentity,
12816
- get concretePoolId() {
12817
- return concretePoolId;
12818
- },
12819
- get reapingEnabled() {
12820
- return internal.reapingEnabled;
12821
- },
12822
- deregister: () => {
12823
- this.deregisterInternal(internal);
12824
- }
12825
- };
12826
- internal.handle = handle;
12827
- this.registrations.set(concretePoolId, internal);
12828
- this.registrationByPool.set(pool, internal);
12829
- this.refreshTimer();
12830
- return handle;
12831
- }
12832
- registerPool(pool, options) {
12833
- return this.registerLifecyclePool(pool, options);
12834
- }
12835
- registerRoot(poolId, root) {
12836
- const registration = this.currentRegistration(poolId);
12837
- if (!registration)
12838
- throw new Error(`unknown lifecycle pool ${poolId}`);
12839
- const key = rootKey(root);
12840
- const existing = registration.roots.get(key);
12841
- if (existing?.state === "live")
12842
- return existing.generation;
12843
- if (existing && !existing.synchronousPhaseComplete) {
12844
- throw new Error("root registration raced its synchronous close phase");
12845
- }
12846
- const next = (this.nextGenerationByRoot.get(`${poolId}\x00${key}`) ?? 0) + 1;
12847
- this.nextGenerationByRoot.set(`${poolId}\x00${key}`, next);
12848
- const entry = {
12849
- registration,
12850
- canonicalRoot: root,
12851
- generation: asRootGeneration(next),
12852
- state: "live",
12853
- consecutiveAbsences: 0,
12854
- tombstoned: false,
12855
- synchronousPhaseComplete: true,
12856
- closePromise: null,
12857
- eventEmitted: false,
12858
- cause: null
12859
- };
12860
- registration.roots.set(key, entry);
12861
- return entry.generation;
12862
- }
12863
- currentGeneration(poolId, root) {
12864
- return this.currentRoot(poolId, root)?.generation;
12865
- }
12866
- isTombstoned(poolId, root, generation) {
12867
- const entry = this.currentRoot(poolId, root);
12868
- return entry?.generation === generation && entry.tombstoned;
12869
- }
12870
- isCurrentRegistration(identity) {
12871
- const registration = this.registrations.get(identity.concretePoolId);
12872
- return registration?.active === true && registration.registrationIdentity === identity;
12873
- }
12874
- isCurrentLiveGeneration(poolId, root, generation) {
12875
- const entry = this.currentRoot(poolId, root);
12876
- return entry?.generation === generation && entry.state === "live";
12877
- }
12878
- getRootSnapshot(poolId, root) {
12879
- const entry = this.currentRoot(poolId, root);
12880
- return entry ? this.snapshotRoot(entry) : undefined;
12881
- }
12882
- rootSnapshots(poolId) {
12883
- const entries = poolId ? [this.currentRegistration(poolId)].filter((registration) => registration != null) : [...this.registrations.values()];
12884
- return entries.flatMap((registration) => [...registration.roots.values()].map((entry) => this.snapshotRoot(entry)));
12885
- }
12886
- snapshot() {
12887
- return {
12888
- realm: this.realm,
12889
- intervalMs: this.intervalMs,
12890
- timerActive: this.intervalHandle !== null,
12891
- registrations: [...this.registrations.values()].map((registration) => ({
12892
- concretePoolId: registration.concretePoolId,
12893
- reapingEnabled: registration.reapingEnabled,
12894
- roots: [...registration.roots.values()].map((entry) => this.snapshotRoot(entry))
12895
- }))
12896
- };
12897
- }
12898
- status() {
12899
- return this.snapshot();
12900
- }
12901
- async ensureRootForDemand(poolId, root) {
12902
- const registration = this.currentRegistration(poolId);
12903
- if (!registration)
12904
- return;
12905
- const existing = registration.roots.get(rootKey(root));
12906
- if (existing?.state === "live")
12907
- return existing.generation;
12908
- if (existing && !existing.synchronousPhaseComplete)
12909
- return;
12910
- let result;
12911
- try {
12912
- result = await this.demand(root, poolId);
12913
- } catch {
12914
- return;
12233
+ result = await this.demand(root, poolId);
12234
+ } catch {
12235
+ return;
12915
12236
  }
12916
12237
  if (!resultMeansPresent(result))
12917
12238
  return;
@@ -13159,7 +12480,14 @@ class SubcTransportShuttingDownError extends SubcCallError {
13159
12480
  }
13160
12481
  var AFT_MODULE_ID = "aft";
13161
12482
  var MAX_CONSECUTIVE_TRANSPORT_FAILURES = 3;
12483
+ var RECONNECT_RETRY_FLOOR_MS = 100;
12484
+ var RECONNECT_RETRY_CAP_MS = 2000;
12485
+ var ROUTE_OPEN_RELOAD_WAIT_CAP_MS = 15000;
12486
+ var ROUTE_OPEN_RELOAD_WAIT_EXHAUSTED_SUFFIX = " The AFT daemon module did not return within the 15s reload window.";
13162
12487
  var BG_STABLE_MS = 5000;
12488
+ function reconnectBackoffMs(attempt) {
12489
+ return Math.min(RECONNECT_RETRY_FLOOR_MS * 2 ** Math.min(attempt, 6), RECONNECT_RETRY_CAP_MS);
12490
+ }
13163
12491
  var BG_LIFECYCLE_LOG_INTERVAL_MS = 60000;
13164
12492
  var BG_DISPATCH_PROBE_INTERVAL_MS = 60000;
13165
12493
  var DEFAULT_SESSION_ID = "__default__";
@@ -13423,6 +12751,8 @@ class BgSubscription {
13423
12751
  giveUp("stopped");
13424
12752
  return;
13425
12753
  }
12754
+ if (Date.now() - subscribedAt >= BG_STABLE_MS)
12755
+ backoffAttempt = 0;
13426
12756
  beginReconnect();
13427
12757
  } catch (err) {
13428
12758
  const routeId2 = this.routeId(route);
@@ -13447,8 +12777,7 @@ class BgSubscription {
13447
12777
  giveUp("stopped");
13448
12778
  }
13449
12779
  async backoff(attempt) {
13450
- const ms = Math.min(100 * 2 ** Math.min(attempt, 6), 2000);
13451
- await this.sleep(ms);
12780
+ await this.sleep(reconnectBackoffMs(attempt));
13452
12781
  }
13453
12782
  }
13454
12783
  function isRecord(value) {
@@ -13463,6 +12792,15 @@ function isAbsentRootRouteError(err) {
13463
12792
  function absentRootError(root) {
13464
12793
  return new SubcError(`invalid route project root: project root does not exist: ${root}`, "config_divergence");
13465
12794
  }
12795
+ function reloadWindowExhaustedError(error2) {
12796
+ if (error2 instanceof Error) {
12797
+ try {
12798
+ error2.message += ROUTE_OPEN_RELOAD_WAIT_EXHAUSTED_SUFFIX;
12799
+ return error2;
12800
+ } catch {}
12801
+ }
12802
+ return new Error(`${String(error2)}${ROUTE_OPEN_RELOAD_WAIT_EXHAUSTED_SUFFIX}`);
12803
+ }
13466
12804
  function safeCloseRoute(client, route) {
13467
12805
  try {
13468
12806
  client.closeRouteChannel(route).catch(() => {
@@ -13574,6 +12912,7 @@ class SubcTransportPool {
13574
12912
  onBgEventsNudge;
13575
12913
  onBgEventsNudgeRef;
13576
12914
  bgBackoffSleep;
12915
+ routeRetrySleep;
13577
12916
  bgDispatchProbeIntervalMs;
13578
12917
  lifecycleDemandCheck;
13579
12918
  onLifecycleEvent;
@@ -13584,6 +12923,9 @@ class SubcTransportPool {
13584
12923
  outerFacadeEvictor;
13585
12924
  client = null;
13586
12925
  connecting = null;
12926
+ routeReopenRetryDelayMs = RECONNECT_RETRY_FLOOR_MS;
12927
+ routeReopenRetry = null;
12928
+ routeReopenRetryMs = null;
13587
12929
  sessions = new Map;
13588
12930
  rootIndex = new Map;
13589
12931
  dormantRoots = new Map;
@@ -13604,6 +12946,7 @@ class SubcTransportPool {
13604
12946
  this.onBgEventsNudge = options.onBgEventsNudge;
13605
12947
  this.onBgEventsNudgeRef = options.onBgEventsNudgeRef;
13606
12948
  this.bgBackoffSleep = options.bgBackoffSleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
12949
+ this.routeRetrySleep = options.routeRetrySleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
13607
12950
  this.bgDispatchProbeIntervalMs = options.bgDispatchProbeIntervalMs ?? BG_DISPATCH_PROBE_INTERVAL_MS;
13608
12951
  const lifecycle = options.lifecycle;
13609
12952
  const demandCheck = options.lifecycleDemandCheck ?? options.demandCheck ?? lifecycle?.demandCheck;
@@ -14056,6 +13399,23 @@ class SubcTransportPool {
14056
13399
  throw error2;
14057
13400
  }
14058
13401
  };
13402
+ const openRouteAfterReloadWindow = async () => {
13403
+ let reloadWaitedMs = 0;
13404
+ while (true) {
13405
+ try {
13406
+ return await openRoute();
13407
+ } catch (error2) {
13408
+ if (!isRouteOpenReloadWindowError(error2))
13409
+ throw error2;
13410
+ const { delayMs, wait } = this.waitForRouteReopenBackoff();
13411
+ if (reloadWaitedMs + delayMs > ROUTE_OPEN_RELOAD_WAIT_CAP_MS) {
13412
+ throw reloadWindowExhaustedError(error2);
13413
+ }
13414
+ reloadWaitedMs += delayMs;
13415
+ await wait;
13416
+ }
13417
+ }
13418
+ };
14059
13419
  const clearRouteEntry = (entry) => {
14060
13420
  if (record.routeEntry !== entry)
14061
13421
  return;
@@ -14092,7 +13452,7 @@ class SubcTransportPool {
14092
13452
  this.ensureBgSubscription(identity, record);
14093
13453
  return reply;
14094
13454
  };
14095
- let routeAndEntry = await openRoute();
13455
+ let routeAndEntry = await openRouteAfterReloadWindow();
14096
13456
  try {
14097
13457
  return await requestOnRoute(routeAndEntry.route);
14098
13458
  } catch (error2) {
@@ -14100,9 +13460,12 @@ class SubcTransportPool {
14100
13460
  throw this.annotateReapError(error2, record);
14101
13461
  if (isRouteProvenAbsentError(error2) && this.isCurrentSession(key, record) && this.client === client) {
14102
13462
  clearRouteEntry(routeAndEntry.entry);
14103
- routeAndEntry = await openRoute();
13463
+ await this.waitForRouteReopenBackoff().wait;
13464
+ routeAndEntry = await openRouteAfterReloadWindow();
14104
13465
  try {
14105
- return await requestOnRoute(routeAndEntry.route);
13466
+ const reply = await requestOnRoute(routeAndEntry.route);
13467
+ this.resetRouteReopenBackoff();
13468
+ return reply;
14106
13469
  } catch (retryError) {
14107
13470
  if (this.isReapInduced(record))
14108
13471
  throw this.annotateReapError(retryError, record);
@@ -14122,6 +13485,27 @@ class SubcTransportPool {
14122
13485
  this.deleteSessionIfEmpty(key, record);
14123
13486
  }
14124
13487
  }
13488
+ waitForRouteReopenBackoff() {
13489
+ const pending = this.routeReopenRetry;
13490
+ const pendingDelay = this.routeReopenRetryMs;
13491
+ if (pending && pendingDelay !== null)
13492
+ return { delayMs: pendingDelay, wait: pending };
13493
+ const delayMs = this.routeReopenRetryDelayMs;
13494
+ this.routeReopenRetryDelayMs = Math.min(delayMs * 2, RECONNECT_RETRY_CAP_MS);
13495
+ let retry;
13496
+ retry = Promise.resolve().then(() => this.routeRetrySleep(delayMs)).finally(() => {
13497
+ if (this.routeReopenRetry === retry) {
13498
+ this.routeReopenRetry = null;
13499
+ this.routeReopenRetryMs = null;
13500
+ }
13501
+ });
13502
+ this.routeReopenRetry = retry;
13503
+ this.routeReopenRetryMs = delayMs;
13504
+ return { delayMs, wait: retry };
13505
+ }
13506
+ resetRouteReopenBackoff() {
13507
+ this.routeReopenRetryDelayMs = RECONNECT_RETRY_FLOOR_MS;
13508
+ }
14125
13509
  async ensureClient() {
14126
13510
  if (this.shuttingDown)
14127
13511
  throw new SubcTransportShuttingDownError;
@@ -14404,6 +13788,12 @@ function isRouteGoodbyeError(error2) {
14404
13788
  }
14405
13789
  return error2.code === "route_closed" && error2.message.includes("route closed by subc");
14406
13790
  }
13791
+ function isRouteOpenReloadWindowError(error2) {
13792
+ if (error2 === null || typeof error2 !== "object")
13793
+ return false;
13794
+ const code = error2.code;
13795
+ return code === "module_reloading" || code === "module_warming" || code === "target_unavailable";
13796
+ }
14407
13797
  function hasEngineResponse(error2) {
14408
13798
  const response = error2.response;
14409
13799
  if (response !== null && typeof response === "object")
@@ -14735,7 +14125,16 @@ function platformKey(platform = process.platform, arch = process.arch) {
14735
14125
  }
14736
14126
  return key;
14737
14127
  }
14128
+ function logBinaryResolution(resolution) {
14129
+ log(`Resolved binary from ${resolution.source}: ${resolution.path}`);
14130
+ }
14738
14131
  function findBinarySync(expectedVersion) {
14132
+ const resolution = findBinarySyncInner(expectedVersion);
14133
+ if (resolution)
14134
+ logBinaryResolution(resolution);
14135
+ return resolution?.path ?? null;
14136
+ }
14137
+ function findBinarySyncInner(expectedVersion) {
14739
14138
  const ext = process.platform === "win32" ? ".exe" : "";
14740
14139
  const env = { ...process.env };
14741
14140
  const pluginVersion = expectedVersion ?? (() => {
@@ -14749,8 +14148,9 @@ function findBinarySync(expectedVersion) {
14749
14148
  if (pluginVersion) {
14750
14149
  const tag = pluginVersion.startsWith("v") ? pluginVersion : `v${pluginVersion}`;
14751
14150
  const versionCached = cachedBinaryPathFromEnv(tag, env, ext);
14752
- if (versionCached && isExpectedCachedBinary2(versionCached, pluginVersion))
14753
- return versionCached;
14151
+ if (versionCached && isExpectedCachedBinary2(versionCached, pluginVersion)) {
14152
+ return { path: versionCached, source: "versioned cache" };
14153
+ }
14754
14154
  }
14755
14155
  try {
14756
14156
  const key = platformKey();
@@ -14765,7 +14165,7 @@ function findBinarySync(expectedVersion) {
14765
14165
  warn(`npm platform package binary v${npmVersion} does not match plugin v${pluginVersion}; skipping (continuing to PATH lookup)`);
14766
14166
  } else {
14767
14167
  const copied = copyToVersionedCache(resolved, npmVersion);
14768
- return copied ?? resolved;
14168
+ return { path: copied ?? resolved, source: "npm platform package" };
14769
14169
  }
14770
14170
  }
14771
14171
  } catch {}
@@ -14783,27 +14183,28 @@ function findBinarySync(expectedVersion) {
14783
14183
  }
14784
14184
  const usable = probeBinaryCandidate(candidate, "PATH", expectedVersion);
14785
14185
  if (usable)
14786
- return usable;
14186
+ return { path: usable, source: "PATH" };
14787
14187
  }
14788
14188
  } catch {}
14789
14189
  const cargoPath = join7(homeDirFromEnv(env), ".cargo", "bin", `aft${ext}`);
14790
14190
  if (existsSync5(cargoPath)) {
14791
14191
  const usable = probeBinaryCandidate(cargoPath, "cargo", expectedVersion);
14792
14192
  if (usable)
14793
- return usable;
14193
+ return { path: usable, source: "cargo" };
14794
14194
  }
14795
14195
  return null;
14796
14196
  }
14797
14197
  async function findBinary(expectedVersion) {
14798
14198
  const syncResult = findBinarySync(expectedVersion);
14799
14199
  if (syncResult) {
14800
- log(`Resolved binary: ${syncResult}`);
14801
14200
  return syncResult;
14802
14201
  }
14803
14202
  log("Binary not found locally, attempting auto-download...");
14804
14203
  const downloaded = await ensureBinaryForResolver(expectedVersion);
14805
- if (downloaded)
14204
+ if (downloaded) {
14205
+ logBinaryResolution({ path: downloaded, source: "auto-download" });
14806
14206
  return downloaded;
14207
+ }
14807
14208
  throw new Error([
14808
14209
  "Could not find the `aft` binary.",
14809
14210
  "",
@@ -16833,11 +16234,16 @@ function normalizeKey(projectRoot) {
16833
16234
  return canonicalizeProjectRoot(projectRoot);
16834
16235
  }
16835
16236
  // ../aft-bridge/dist/revivable-transport.js
16237
+ var REVIVAL_RETRY_FLOOR_MS = 100;
16238
+ var REVIVAL_RETRY_CAP_MS = 2000;
16239
+
16836
16240
  class RevivableTransportPool {
16837
16241
  createPool;
16838
16242
  onBinaryReplaced;
16839
16243
  activePool;
16840
16244
  revival = null;
16245
+ revivalRetryDelayMs = REVIVAL_RETRY_FLOOR_MS;
16246
+ revivalRetryNotBefore = 0;
16841
16247
  transports = new Map;
16842
16248
  configureOverrides = new Map;
16843
16249
  editSlotSurvivesCaptured = false;
@@ -16931,12 +16337,30 @@ class RevivableTransportPool {
16931
16337
  return this.activePool;
16932
16338
  if (this.revival)
16933
16339
  return this.revival;
16340
+ const delay = Math.max(0, this.revivalRetryNotBefore - Date.now());
16341
+ if (delay > 0) {
16342
+ let scheduled;
16343
+ scheduled = new Promise((resolve7) => setTimeout(resolve7, delay)).then(() => {
16344
+ if (this.revival === scheduled)
16345
+ this.revival = null;
16346
+ return this.ensureActivePool();
16347
+ });
16348
+ this.revival = scheduled;
16349
+ scheduled.then(() => {
16350
+ return;
16351
+ }, () => {
16352
+ return;
16353
+ });
16354
+ return scheduled;
16355
+ }
16934
16356
  warn("transport was shut down but new demand arrived — reviving (host quit hook fired without process exit?)");
16935
- const revival = this.createPool().then((pool) => {
16357
+ const revival = Promise.resolve().then(() => this.createPool()).then((pool) => {
16936
16358
  for (const [key, value] of this.configureOverrides) {
16937
16359
  pool.setConfigureOverride(key, value);
16938
16360
  }
16939
16361
  this.activePool = pool;
16362
+ this.revivalRetryDelayMs = REVIVAL_RETRY_FLOOR_MS;
16363
+ this.revivalRetryNotBefore = 0;
16940
16364
  for (const [root, transport] of this.transports) {
16941
16365
  transport.refreshStatusSubscription(pool.getActiveBridgeForRoot(root));
16942
16366
  }
@@ -16947,6 +16371,8 @@ class RevivableTransportPool {
16947
16371
  if (this.revival === revival)
16948
16372
  this.revival = null;
16949
16373
  }, () => {
16374
+ this.revivalRetryNotBefore = Date.now() + this.revivalRetryDelayMs;
16375
+ this.revivalRetryDelayMs = Math.min(this.revivalRetryDelayMs * 2, REVIVAL_RETRY_CAP_MS);
16950
16376
  if (this.revival === revival)
16951
16377
  this.revival = null;
16952
16378
  });
@@ -18017,7 +17443,7 @@ import {
18017
17443
  // package.json
18018
17444
  var package_default = {
18019
17445
  name: "@cortexkit/aft-pi",
18020
- version: "0.51.3",
17446
+ version: "0.52.1",
18021
17447
  type: "module",
18022
17448
  description: "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
18023
17449
  main: "dist/index.js",
@@ -18040,19 +17466,19 @@ var package_default = {
18040
17466
  "test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'"
18041
17467
  },
18042
17468
  dependencies: {
18043
- "@cortexkit/aft-bridge": "0.51.3",
17469
+ "@cortexkit/aft-bridge": "0.52.1",
18044
17470
  "comment-json": "^5.0.0",
18045
17471
  diff: "^8.0.4",
18046
17472
  typebox: "1.1.38",
18047
17473
  zod: "^4.4.3"
18048
17474
  },
18049
17475
  optionalDependencies: {
18050
- "@cortexkit/aft-darwin-arm64": "0.51.3",
18051
- "@cortexkit/aft-darwin-x64": "0.51.3",
18052
- "@cortexkit/aft-linux-arm64": "0.51.3",
18053
- "@cortexkit/aft-linux-x64": "0.51.3",
18054
- "@cortexkit/aft-win32-arm64": "0.51.3",
18055
- "@cortexkit/aft-win32-x64": "0.51.3"
17476
+ "@cortexkit/aft-darwin-arm64": "0.52.1",
17477
+ "@cortexkit/aft-darwin-x64": "0.52.1",
17478
+ "@cortexkit/aft-linux-arm64": "0.52.1",
17479
+ "@cortexkit/aft-linux-x64": "0.52.1",
17480
+ "@cortexkit/aft-win32-arm64": "0.52.1",
17481
+ "@cortexkit/aft-win32-x64": "0.52.1"
18056
17482
  },
18057
17483
  devDependencies: {
18058
17484
  "@earendil-works/pi-coding-agent": "^0.80.2",
@@ -18717,523 +18143,523 @@ var import_comment_json = __toESM(require_src2(), 1);
18717
18143
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/external.js
18718
18144
  var exports_external = {};
18719
18145
  __export(exports_external, {
18720
- xor: () => xor,
18721
- xid: () => xid2,
18722
- void: () => _void2,
18723
- uuidv7: () => uuidv7,
18724
- uuidv6: () => uuidv6,
18725
- uuidv4: () => uuidv4,
18726
- uuid: () => uuid2,
18727
- util: () => exports_util,
18728
- url: () => url,
18729
- uppercase: () => _uppercase,
18730
- unknown: () => unknown,
18731
- union: () => union,
18732
- undefined: () => _undefined3,
18733
- ulid: () => ulid2,
18734
- uint64: () => uint64,
18735
- uint32: () => uint32,
18736
- tuple: () => tuple,
18737
- trim: () => _trim,
18738
- treeifyError: () => treeifyError,
18739
- transform: () => transform,
18740
- toUpperCase: () => _toUpperCase,
18741
- toLowerCase: () => _toLowerCase,
18742
- toJSONSchema: () => toJSONSchema,
18743
- templateLiteral: () => templateLiteral,
18744
- symbol: () => symbol,
18745
- superRefine: () => superRefine,
18746
- success: () => success,
18747
- stringbool: () => stringbool,
18748
- stringFormat: () => stringFormat,
18749
- string: () => string2,
18750
- strictObject: () => strictObject,
18751
- startsWith: () => _startsWith,
18752
- slugify: () => _slugify,
18753
- size: () => _size,
18754
- setErrorMap: () => setErrorMap,
18755
- set: () => set,
18756
- safeParseAsync: () => safeParseAsync2,
18757
- safeParse: () => safeParse2,
18758
- safeEncodeAsync: () => safeEncodeAsync2,
18759
- safeEncode: () => safeEncode2,
18760
- safeDecodeAsync: () => safeDecodeAsync2,
18761
- safeDecode: () => safeDecode2,
18762
- registry: () => registry,
18763
- regexes: () => exports_regexes,
18764
- regex: () => _regex,
18765
- refine: () => refine,
18766
- record: () => record,
18767
- readonly: () => readonly,
18768
- property: () => _property,
18769
- promise: () => promise,
18770
- prettifyError: () => prettifyError,
18771
- preprocess: () => preprocess,
18772
- prefault: () => prefault,
18773
- positive: () => _positive,
18774
- pipe: () => pipe,
18775
- partialRecord: () => partialRecord,
18776
- parseAsync: () => parseAsync2,
18777
- parse: () => parse3,
18778
- overwrite: () => _overwrite,
18779
- optional: () => optional,
18780
- object: () => object,
18781
- number: () => number2,
18782
- nullish: () => nullish2,
18783
- nullable: () => nullable,
18784
- null: () => _null3,
18785
- normalize: () => _normalize,
18786
- nonpositive: () => _nonpositive,
18787
- nonoptional: () => nonoptional,
18788
- nonnegative: () => _nonnegative,
18789
- never: () => never,
18790
- negative: () => _negative,
18791
- nativeEnum: () => nativeEnum,
18792
- nanoid: () => nanoid2,
18793
- nan: () => nan,
18794
- multipleOf: () => _multipleOf,
18795
- minSize: () => _minSize,
18796
- minLength: () => _minLength,
18797
- mime: () => _mime,
18798
- meta: () => meta2,
18799
- maxSize: () => _maxSize,
18800
- maxLength: () => _maxLength,
18801
- map: () => map,
18802
- mac: () => mac2,
18803
- lte: () => _lte,
18804
- lt: () => _lt,
18805
- lowercase: () => _lowercase,
18806
- looseRecord: () => looseRecord,
18807
- looseObject: () => looseObject,
18808
- locales: () => exports_locales,
18809
- literal: () => literal,
18810
- length: () => _length,
18811
- lazy: () => lazy,
18812
- ksuid: () => ksuid2,
18813
- keyof: () => keyof,
18814
- jwt: () => jwt,
18815
- json: () => json,
18816
- iso: () => exports_iso,
18817
- ipv6: () => ipv62,
18818
- ipv4: () => ipv42,
18819
- invertCodec: () => invertCodec,
18820
- intersection: () => intersection,
18821
- int64: () => int64,
18822
- int32: () => int32,
18823
- int: () => int,
18824
- instanceof: () => _instanceof,
18825
- includes: () => _includes,
18826
- httpUrl: () => httpUrl,
18827
- hostname: () => hostname3,
18828
- hex: () => hex2,
18829
- hash: () => hash,
18830
- guid: () => guid2,
18831
- gte: () => _gte,
18832
- gt: () => _gt,
18833
- globalRegistry: () => globalRegistry,
18834
- getErrorMap: () => getErrorMap,
18835
- function: () => _function,
18836
- fromJSONSchema: () => fromJSONSchema,
18837
- formatError: () => formatError,
18838
- float64: () => float64,
18839
- float32: () => float32,
18840
- flattenError: () => flattenError,
18841
- file: () => file,
18842
- exactOptional: () => exactOptional,
18843
- enum: () => _enum2,
18844
- endsWith: () => _endsWith,
18845
- encodeAsync: () => encodeAsync2,
18846
- encode: () => encode2,
18847
- emoji: () => emoji2,
18848
- email: () => email2,
18849
- e164: () => e1642,
18850
- discriminatedUnion: () => discriminatedUnion,
18851
- describe: () => describe2,
18852
- decodeAsync: () => decodeAsync2,
18853
- decode: () => decode2,
18854
- date: () => date3,
18855
- custom: () => custom,
18856
- cuid2: () => cuid22,
18857
- cuid: () => cuid3,
18858
- core: () => exports_core2,
18859
- config: () => config,
18860
- coerce: () => exports_coerce,
18861
- codec: () => codec,
18862
- clone: () => clone,
18863
- cidrv6: () => cidrv62,
18864
- cidrv4: () => cidrv42,
18865
- check: () => check,
18866
- catch: () => _catch2,
18867
- boolean: () => boolean2,
18868
- bigint: () => bigint2,
18869
- base64url: () => base64url2,
18870
- base64: () => base642,
18871
- array: () => array,
18872
- any: () => any,
18873
- _function: () => _function,
18874
- _default: () => _default2,
18875
- _ZodString: () => _ZodString,
18876
- ZodXor: () => ZodXor,
18877
- ZodXID: () => ZodXID,
18878
- ZodVoid: () => ZodVoid,
18879
- ZodUnknown: () => ZodUnknown,
18880
- ZodUnion: () => ZodUnion,
18881
- ZodUndefined: () => ZodUndefined,
18882
- ZodUUID: () => ZodUUID,
18883
- ZodURL: () => ZodURL,
18884
- ZodULID: () => ZodULID,
18885
- ZodType: () => ZodType,
18886
- ZodTuple: () => ZodTuple,
18887
- ZodTransform: () => ZodTransform,
18888
- ZodTemplateLiteral: () => ZodTemplateLiteral,
18889
- ZodSymbol: () => ZodSymbol,
18890
- ZodSuccess: () => ZodSuccess,
18891
- ZodStringFormat: () => ZodStringFormat,
18892
- ZodString: () => ZodString,
18893
- ZodSet: () => ZodSet,
18894
- ZodRecord: () => ZodRecord,
18895
- ZodRealError: () => ZodRealError,
18896
- ZodReadonly: () => ZodReadonly,
18897
- ZodPromise: () => ZodPromise,
18898
- ZodPreprocess: () => ZodPreprocess,
18899
- ZodPrefault: () => ZodPrefault,
18900
- ZodPipe: () => ZodPipe,
18901
- ZodOptional: () => ZodOptional,
18902
- ZodObject: () => ZodObject,
18903
- ZodNumberFormat: () => ZodNumberFormat,
18904
- ZodNumber: () => ZodNumber,
18905
- ZodNullable: () => ZodNullable,
18906
- ZodNull: () => ZodNull,
18907
- ZodNonOptional: () => ZodNonOptional,
18908
- ZodNever: () => ZodNever,
18909
- ZodNanoID: () => ZodNanoID,
18910
- ZodNaN: () => ZodNaN,
18911
- ZodMap: () => ZodMap,
18912
- ZodMAC: () => ZodMAC,
18913
- ZodLiteral: () => ZodLiteral,
18914
- ZodLazy: () => ZodLazy,
18915
- ZodKSUID: () => ZodKSUID,
18916
- ZodJWT: () => ZodJWT,
18917
- ZodIssueCode: () => ZodIssueCode,
18918
- ZodIntersection: () => ZodIntersection,
18919
- ZodISOTime: () => ZodISOTime,
18920
- ZodISODuration: () => ZodISODuration,
18921
- ZodISODateTime: () => ZodISODateTime,
18922
- ZodISODate: () => ZodISODate,
18923
- ZodIPv6: () => ZodIPv6,
18924
- ZodIPv4: () => ZodIPv4,
18925
- ZodGUID: () => ZodGUID,
18926
- ZodFunction: () => ZodFunction,
18927
- ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
18928
- ZodFile: () => ZodFile,
18929
- ZodExactOptional: () => ZodExactOptional,
18930
- ZodError: () => ZodError,
18931
- ZodEnum: () => ZodEnum,
18932
- ZodEmoji: () => ZodEmoji,
18933
- ZodEmail: () => ZodEmail,
18934
- ZodE164: () => ZodE164,
18935
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
18936
- ZodDefault: () => ZodDefault,
18937
- ZodDate: () => ZodDate,
18938
- ZodCustomStringFormat: () => ZodCustomStringFormat,
18939
- ZodCustom: () => ZodCustom,
18940
- ZodCodec: () => ZodCodec,
18941
- ZodCatch: () => ZodCatch,
18942
- ZodCUID2: () => ZodCUID2,
18943
- ZodCUID: () => ZodCUID,
18944
- ZodCIDRv6: () => ZodCIDRv6,
18945
- ZodCIDRv4: () => ZodCIDRv4,
18946
- ZodBoolean: () => ZodBoolean,
18947
- ZodBigIntFormat: () => ZodBigIntFormat,
18948
- ZodBigInt: () => ZodBigInt,
18949
- ZodBase64URL: () => ZodBase64URL,
18950
- ZodBase64: () => ZodBase64,
18951
- ZodArray: () => ZodArray,
18952
- ZodAny: () => ZodAny,
18953
- TimePrecision: () => TimePrecision,
18954
- NEVER: () => NEVER,
18955
- $output: () => $output,
18146
+ $brand: () => $brand,
18956
18147
  $input: () => $input,
18957
- $brand: () => $brand
18148
+ $output: () => $output,
18149
+ NEVER: () => NEVER,
18150
+ TimePrecision: () => TimePrecision,
18151
+ ZodAny: () => ZodAny,
18152
+ ZodArray: () => ZodArray,
18153
+ ZodBase64: () => ZodBase64,
18154
+ ZodBase64URL: () => ZodBase64URL,
18155
+ ZodBigInt: () => ZodBigInt,
18156
+ ZodBigIntFormat: () => ZodBigIntFormat,
18157
+ ZodBoolean: () => ZodBoolean,
18158
+ ZodCIDRv4: () => ZodCIDRv4,
18159
+ ZodCIDRv6: () => ZodCIDRv6,
18160
+ ZodCUID: () => ZodCUID,
18161
+ ZodCUID2: () => ZodCUID2,
18162
+ ZodCatch: () => ZodCatch,
18163
+ ZodCodec: () => ZodCodec,
18164
+ ZodCustom: () => ZodCustom,
18165
+ ZodCustomStringFormat: () => ZodCustomStringFormat,
18166
+ ZodDate: () => ZodDate,
18167
+ ZodDefault: () => ZodDefault,
18168
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
18169
+ ZodE164: () => ZodE164,
18170
+ ZodEmail: () => ZodEmail,
18171
+ ZodEmoji: () => ZodEmoji,
18172
+ ZodEnum: () => ZodEnum,
18173
+ ZodError: () => ZodError,
18174
+ ZodExactOptional: () => ZodExactOptional,
18175
+ ZodFile: () => ZodFile,
18176
+ ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
18177
+ ZodFunction: () => ZodFunction,
18178
+ ZodGUID: () => ZodGUID,
18179
+ ZodIPv4: () => ZodIPv4,
18180
+ ZodIPv6: () => ZodIPv6,
18181
+ ZodISODate: () => ZodISODate,
18182
+ ZodISODateTime: () => ZodISODateTime,
18183
+ ZodISODuration: () => ZodISODuration,
18184
+ ZodISOTime: () => ZodISOTime,
18185
+ ZodIntersection: () => ZodIntersection,
18186
+ ZodIssueCode: () => ZodIssueCode,
18187
+ ZodJWT: () => ZodJWT,
18188
+ ZodKSUID: () => ZodKSUID,
18189
+ ZodLazy: () => ZodLazy,
18190
+ ZodLiteral: () => ZodLiteral,
18191
+ ZodMAC: () => ZodMAC,
18192
+ ZodMap: () => ZodMap,
18193
+ ZodNaN: () => ZodNaN,
18194
+ ZodNanoID: () => ZodNanoID,
18195
+ ZodNever: () => ZodNever,
18196
+ ZodNonOptional: () => ZodNonOptional,
18197
+ ZodNull: () => ZodNull,
18198
+ ZodNullable: () => ZodNullable,
18199
+ ZodNumber: () => ZodNumber,
18200
+ ZodNumberFormat: () => ZodNumberFormat,
18201
+ ZodObject: () => ZodObject,
18202
+ ZodOptional: () => ZodOptional,
18203
+ ZodPipe: () => ZodPipe,
18204
+ ZodPrefault: () => ZodPrefault,
18205
+ ZodPreprocess: () => ZodPreprocess,
18206
+ ZodPromise: () => ZodPromise,
18207
+ ZodReadonly: () => ZodReadonly,
18208
+ ZodRealError: () => ZodRealError,
18209
+ ZodRecord: () => ZodRecord,
18210
+ ZodSet: () => ZodSet,
18211
+ ZodString: () => ZodString,
18212
+ ZodStringFormat: () => ZodStringFormat,
18213
+ ZodSuccess: () => ZodSuccess,
18214
+ ZodSymbol: () => ZodSymbol,
18215
+ ZodTemplateLiteral: () => ZodTemplateLiteral,
18216
+ ZodTransform: () => ZodTransform,
18217
+ ZodTuple: () => ZodTuple,
18218
+ ZodType: () => ZodType,
18219
+ ZodULID: () => ZodULID,
18220
+ ZodURL: () => ZodURL,
18221
+ ZodUUID: () => ZodUUID,
18222
+ ZodUndefined: () => ZodUndefined,
18223
+ ZodUnion: () => ZodUnion,
18224
+ ZodUnknown: () => ZodUnknown,
18225
+ ZodVoid: () => ZodVoid,
18226
+ ZodXID: () => ZodXID,
18227
+ ZodXor: () => ZodXor,
18228
+ _ZodString: () => _ZodString,
18229
+ _default: () => _default2,
18230
+ _function: () => _function,
18231
+ any: () => any,
18232
+ array: () => array,
18233
+ base64: () => base642,
18234
+ base64url: () => base64url2,
18235
+ bigint: () => bigint2,
18236
+ boolean: () => boolean2,
18237
+ catch: () => _catch2,
18238
+ check: () => check,
18239
+ cidrv4: () => cidrv42,
18240
+ cidrv6: () => cidrv62,
18241
+ clone: () => clone,
18242
+ codec: () => codec,
18243
+ coerce: () => exports_coerce,
18244
+ config: () => config,
18245
+ core: () => exports_core2,
18246
+ cuid: () => cuid3,
18247
+ cuid2: () => cuid22,
18248
+ custom: () => custom,
18249
+ date: () => date3,
18250
+ decode: () => decode2,
18251
+ decodeAsync: () => decodeAsync2,
18252
+ describe: () => describe2,
18253
+ discriminatedUnion: () => discriminatedUnion,
18254
+ e164: () => e1642,
18255
+ email: () => email2,
18256
+ emoji: () => emoji2,
18257
+ encode: () => encode2,
18258
+ encodeAsync: () => encodeAsync2,
18259
+ endsWith: () => _endsWith,
18260
+ enum: () => _enum2,
18261
+ exactOptional: () => exactOptional,
18262
+ file: () => file,
18263
+ flattenError: () => flattenError,
18264
+ float32: () => float32,
18265
+ float64: () => float64,
18266
+ formatError: () => formatError,
18267
+ fromJSONSchema: () => fromJSONSchema,
18268
+ function: () => _function,
18269
+ getErrorMap: () => getErrorMap,
18270
+ globalRegistry: () => globalRegistry,
18271
+ gt: () => _gt,
18272
+ gte: () => _gte,
18273
+ guid: () => guid2,
18274
+ hash: () => hash,
18275
+ hex: () => hex2,
18276
+ hostname: () => hostname3,
18277
+ httpUrl: () => httpUrl,
18278
+ includes: () => _includes,
18279
+ instanceof: () => _instanceof,
18280
+ int: () => int,
18281
+ int32: () => int32,
18282
+ int64: () => int64,
18283
+ intersection: () => intersection,
18284
+ invertCodec: () => invertCodec,
18285
+ ipv4: () => ipv42,
18286
+ ipv6: () => ipv62,
18287
+ iso: () => exports_iso,
18288
+ json: () => json,
18289
+ jwt: () => jwt,
18290
+ keyof: () => keyof,
18291
+ ksuid: () => ksuid2,
18292
+ lazy: () => lazy,
18293
+ length: () => _length,
18294
+ literal: () => literal,
18295
+ locales: () => exports_locales,
18296
+ looseObject: () => looseObject,
18297
+ looseRecord: () => looseRecord,
18298
+ lowercase: () => _lowercase,
18299
+ lt: () => _lt,
18300
+ lte: () => _lte,
18301
+ mac: () => mac2,
18302
+ map: () => map,
18303
+ maxLength: () => _maxLength,
18304
+ maxSize: () => _maxSize,
18305
+ meta: () => meta2,
18306
+ mime: () => _mime,
18307
+ minLength: () => _minLength,
18308
+ minSize: () => _minSize,
18309
+ multipleOf: () => _multipleOf,
18310
+ nan: () => nan,
18311
+ nanoid: () => nanoid2,
18312
+ nativeEnum: () => nativeEnum,
18313
+ negative: () => _negative,
18314
+ never: () => never,
18315
+ nonnegative: () => _nonnegative,
18316
+ nonoptional: () => nonoptional,
18317
+ nonpositive: () => _nonpositive,
18318
+ normalize: () => _normalize,
18319
+ null: () => _null3,
18320
+ nullable: () => nullable,
18321
+ nullish: () => nullish2,
18322
+ number: () => number2,
18323
+ object: () => object,
18324
+ optional: () => optional,
18325
+ overwrite: () => _overwrite,
18326
+ parse: () => parse3,
18327
+ parseAsync: () => parseAsync2,
18328
+ partialRecord: () => partialRecord,
18329
+ pipe: () => pipe,
18330
+ positive: () => _positive,
18331
+ prefault: () => prefault,
18332
+ preprocess: () => preprocess,
18333
+ prettifyError: () => prettifyError,
18334
+ promise: () => promise,
18335
+ property: () => _property,
18336
+ readonly: () => readonly,
18337
+ record: () => record,
18338
+ refine: () => refine,
18339
+ regex: () => _regex,
18340
+ regexes: () => exports_regexes,
18341
+ registry: () => registry,
18342
+ safeDecode: () => safeDecode2,
18343
+ safeDecodeAsync: () => safeDecodeAsync2,
18344
+ safeEncode: () => safeEncode2,
18345
+ safeEncodeAsync: () => safeEncodeAsync2,
18346
+ safeParse: () => safeParse2,
18347
+ safeParseAsync: () => safeParseAsync2,
18348
+ set: () => set,
18349
+ setErrorMap: () => setErrorMap,
18350
+ size: () => _size,
18351
+ slugify: () => _slugify,
18352
+ startsWith: () => _startsWith,
18353
+ strictObject: () => strictObject,
18354
+ string: () => string2,
18355
+ stringFormat: () => stringFormat,
18356
+ stringbool: () => stringbool,
18357
+ success: () => success,
18358
+ superRefine: () => superRefine,
18359
+ symbol: () => symbol,
18360
+ templateLiteral: () => templateLiteral,
18361
+ toJSONSchema: () => toJSONSchema,
18362
+ toLowerCase: () => _toLowerCase,
18363
+ toUpperCase: () => _toUpperCase,
18364
+ transform: () => transform,
18365
+ treeifyError: () => treeifyError,
18366
+ trim: () => _trim,
18367
+ tuple: () => tuple,
18368
+ uint32: () => uint32,
18369
+ uint64: () => uint64,
18370
+ ulid: () => ulid2,
18371
+ undefined: () => _undefined3,
18372
+ union: () => union,
18373
+ unknown: () => unknown,
18374
+ uppercase: () => _uppercase,
18375
+ url: () => url,
18376
+ util: () => exports_util,
18377
+ uuid: () => uuid2,
18378
+ uuidv4: () => uuidv4,
18379
+ uuidv6: () => uuidv6,
18380
+ uuidv7: () => uuidv7,
18381
+ void: () => _void2,
18382
+ xid: () => xid2,
18383
+ xor: () => xor
18958
18384
  });
18959
18385
 
18960
18386
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/index.js
18961
18387
  var exports_core2 = {};
18962
18388
  __export(exports_core2, {
18963
- version: () => version,
18964
- util: () => exports_util,
18965
- treeifyError: () => treeifyError,
18966
- toJSONSchema: () => toJSONSchema,
18967
- toDotPath: () => toDotPath,
18968
- safeParseAsync: () => safeParseAsync,
18969
- safeParse: () => safeParse,
18970
- safeEncodeAsync: () => safeEncodeAsync,
18971
- safeEncode: () => safeEncode,
18972
- safeDecodeAsync: () => safeDecodeAsync,
18973
- safeDecode: () => safeDecode,
18974
- registry: () => registry,
18975
- regexes: () => exports_regexes,
18976
- process: () => process2,
18977
- prettifyError: () => prettifyError,
18978
- parseAsync: () => parseAsync,
18979
- parse: () => parse,
18980
- meta: () => meta,
18981
- locales: () => exports_locales,
18982
- isValidJWT: () => isValidJWT,
18983
- isValidBase64URL: () => isValidBase64URL,
18984
- isValidBase64: () => isValidBase64,
18985
- initializeContext: () => initializeContext,
18986
- globalRegistry: () => globalRegistry,
18987
- globalConfig: () => globalConfig,
18988
- formatError: () => formatError,
18989
- flattenError: () => flattenError,
18990
- finalize: () => finalize,
18991
- extractDefs: () => extractDefs,
18992
- encodeAsync: () => encodeAsync,
18993
- encode: () => encode,
18994
- describe: () => describe,
18995
- decodeAsync: () => decodeAsync,
18996
- decode: () => decode,
18997
- createToJSONSchemaMethod: () => createToJSONSchemaMethod,
18998
- createStandardJSONSchemaMethod: () => createStandardJSONSchemaMethod,
18999
- config: () => config,
19000
- clone: () => clone,
19001
- _xor: () => _xor,
19002
- _xid: () => _xid,
19003
- _void: () => _void,
19004
- _uuidv7: () => _uuidv7,
19005
- _uuidv6: () => _uuidv6,
19006
- _uuidv4: () => _uuidv4,
19007
- _uuid: () => _uuid,
19008
- _url: () => _url,
19009
- _uppercase: () => _uppercase,
19010
- _unknown: () => _unknown,
19011
- _union: () => _union,
19012
- _undefined: () => _undefined2,
19013
- _ulid: () => _ulid,
19014
- _uint64: () => _uint64,
19015
- _uint32: () => _uint32,
19016
- _tuple: () => _tuple,
19017
- _trim: () => _trim,
19018
- _transform: () => _transform,
19019
- _toUpperCase: () => _toUpperCase,
19020
- _toLowerCase: () => _toLowerCase,
19021
- _templateLiteral: () => _templateLiteral,
19022
- _symbol: () => _symbol,
19023
- _superRefine: () => _superRefine,
19024
- _success: () => _success,
19025
- _stringbool: () => _stringbool,
19026
- _stringFormat: () => _stringFormat,
19027
- _string: () => _string,
19028
- _startsWith: () => _startsWith,
19029
- _slugify: () => _slugify,
19030
- _size: () => _size,
19031
- _set: () => _set,
19032
- _safeParseAsync: () => _safeParseAsync,
19033
- _safeParse: () => _safeParse,
19034
- _safeEncodeAsync: () => _safeEncodeAsync,
19035
- _safeEncode: () => _safeEncode,
19036
- _safeDecodeAsync: () => _safeDecodeAsync,
19037
- _safeDecode: () => _safeDecode,
19038
- _regex: () => _regex,
19039
- _refine: () => _refine,
19040
- _record: () => _record,
19041
- _readonly: () => _readonly,
19042
- _property: () => _property,
19043
- _promise: () => _promise,
19044
- _positive: () => _positive,
19045
- _pipe: () => _pipe,
19046
- _parseAsync: () => _parseAsync,
19047
- _parse: () => _parse,
19048
- _overwrite: () => _overwrite,
19049
- _optional: () => _optional,
19050
- _number: () => _number,
19051
- _nullable: () => _nullable,
19052
- _null: () => _null2,
19053
- _normalize: () => _normalize,
19054
- _nonpositive: () => _nonpositive,
19055
- _nonoptional: () => _nonoptional,
19056
- _nonnegative: () => _nonnegative,
19057
- _never: () => _never,
19058
- _negative: () => _negative,
19059
- _nativeEnum: () => _nativeEnum,
19060
- _nanoid: () => _nanoid,
19061
- _nan: () => _nan,
19062
- _multipleOf: () => _multipleOf,
19063
- _minSize: () => _minSize,
19064
- _minLength: () => _minLength,
19065
- _min: () => _gte,
19066
- _mime: () => _mime,
19067
- _maxSize: () => _maxSize,
19068
- _maxLength: () => _maxLength,
19069
- _max: () => _lte,
19070
- _map: () => _map,
19071
- _mac: () => _mac,
19072
- _lte: () => _lte,
19073
- _lt: () => _lt,
19074
- _lowercase: () => _lowercase,
19075
- _literal: () => _literal,
19076
- _length: () => _length,
19077
- _lazy: () => _lazy,
19078
- _ksuid: () => _ksuid,
19079
- _jwt: () => _jwt,
19080
- _isoTime: () => _isoTime,
19081
- _isoDuration: () => _isoDuration,
19082
- _isoDateTime: () => _isoDateTime,
19083
- _isoDate: () => _isoDate,
19084
- _ipv6: () => _ipv6,
19085
- _ipv4: () => _ipv4,
19086
- _intersection: () => _intersection,
19087
- _int64: () => _int64,
19088
- _int32: () => _int32,
19089
- _int: () => _int,
19090
- _includes: () => _includes,
19091
- _guid: () => _guid,
19092
- _gte: () => _gte,
19093
- _gt: () => _gt,
19094
- _float64: () => _float64,
19095
- _float32: () => _float32,
19096
- _file: () => _file,
19097
- _enum: () => _enum,
19098
- _endsWith: () => _endsWith,
19099
- _encodeAsync: () => _encodeAsync,
19100
- _encode: () => _encode,
19101
- _emoji: () => _emoji2,
19102
- _email: () => _email,
19103
- _e164: () => _e164,
19104
- _discriminatedUnion: () => _discriminatedUnion,
19105
- _default: () => _default,
19106
- _decodeAsync: () => _decodeAsync,
19107
- _decode: () => _decode,
19108
- _date: () => _date,
19109
- _custom: () => _custom,
19110
- _cuid2: () => _cuid2,
19111
- _cuid: () => _cuid,
19112
- _coercedString: () => _coercedString,
19113
- _coercedNumber: () => _coercedNumber,
19114
- _coercedDate: () => _coercedDate,
19115
- _coercedBoolean: () => _coercedBoolean,
19116
- _coercedBigint: () => _coercedBigint,
19117
- _cidrv6: () => _cidrv6,
19118
- _cidrv4: () => _cidrv4,
19119
- _check: () => _check,
19120
- _catch: () => _catch,
19121
- _boolean: () => _boolean,
19122
- _bigint: () => _bigint,
19123
- _base64url: () => _base64url,
19124
- _base64: () => _base64,
19125
- _array: () => _array,
19126
- _any: () => _any,
19127
- TimePrecision: () => TimePrecision,
19128
- NEVER: () => NEVER,
19129
- JSONSchemaGenerator: () => JSONSchemaGenerator,
19130
- JSONSchema: () => exports_json_schema,
19131
- Doc: () => Doc,
19132
- $output: () => $output,
19133
- $input: () => $input,
19134
- $constructor: () => $constructor,
19135
- $brand: () => $brand,
19136
- $ZodXor: () => $ZodXor,
19137
- $ZodXID: () => $ZodXID,
19138
- $ZodVoid: () => $ZodVoid,
19139
- $ZodUnknown: () => $ZodUnknown,
19140
- $ZodUnion: () => $ZodUnion,
19141
- $ZodUndefined: () => $ZodUndefined,
19142
- $ZodUUID: () => $ZodUUID,
19143
- $ZodURL: () => $ZodURL,
19144
- $ZodULID: () => $ZodULID,
19145
- $ZodType: () => $ZodType,
19146
- $ZodTuple: () => $ZodTuple,
19147
- $ZodTransform: () => $ZodTransform,
19148
- $ZodTemplateLiteral: () => $ZodTemplateLiteral,
19149
- $ZodSymbol: () => $ZodSymbol,
19150
- $ZodSuccess: () => $ZodSuccess,
19151
- $ZodStringFormat: () => $ZodStringFormat,
19152
- $ZodString: () => $ZodString,
19153
- $ZodSet: () => $ZodSet,
19154
- $ZodRegistry: () => $ZodRegistry,
19155
- $ZodRecord: () => $ZodRecord,
19156
- $ZodRealError: () => $ZodRealError,
19157
- $ZodReadonly: () => $ZodReadonly,
19158
- $ZodPromise: () => $ZodPromise,
19159
- $ZodPreprocess: () => $ZodPreprocess,
19160
- $ZodPrefault: () => $ZodPrefault,
19161
- $ZodPipe: () => $ZodPipe,
19162
- $ZodOptional: () => $ZodOptional,
19163
- $ZodObjectJIT: () => $ZodObjectJIT,
19164
- $ZodObject: () => $ZodObject,
19165
- $ZodNumberFormat: () => $ZodNumberFormat,
19166
- $ZodNumber: () => $ZodNumber,
19167
- $ZodNullable: () => $ZodNullable,
19168
- $ZodNull: () => $ZodNull,
19169
- $ZodNonOptional: () => $ZodNonOptional,
19170
- $ZodNever: () => $ZodNever,
19171
- $ZodNanoID: () => $ZodNanoID,
19172
- $ZodNaN: () => $ZodNaN,
19173
- $ZodMap: () => $ZodMap,
19174
- $ZodMAC: () => $ZodMAC,
19175
- $ZodLiteral: () => $ZodLiteral,
19176
- $ZodLazy: () => $ZodLazy,
19177
- $ZodKSUID: () => $ZodKSUID,
19178
- $ZodJWT: () => $ZodJWT,
19179
- $ZodIntersection: () => $ZodIntersection,
19180
- $ZodISOTime: () => $ZodISOTime,
19181
- $ZodISODuration: () => $ZodISODuration,
19182
- $ZodISODateTime: () => $ZodISODateTime,
19183
- $ZodISODate: () => $ZodISODate,
19184
- $ZodIPv6: () => $ZodIPv6,
19185
- $ZodIPv4: () => $ZodIPv4,
19186
- $ZodGUID: () => $ZodGUID,
19187
- $ZodFunction: () => $ZodFunction,
19188
- $ZodFile: () => $ZodFile,
19189
- $ZodExactOptional: () => $ZodExactOptional,
19190
- $ZodError: () => $ZodError,
19191
- $ZodEnum: () => $ZodEnum,
19192
- $ZodEncodeError: () => $ZodEncodeError,
19193
- $ZodEmoji: () => $ZodEmoji,
19194
- $ZodEmail: () => $ZodEmail,
19195
- $ZodE164: () => $ZodE164,
19196
- $ZodDiscriminatedUnion: () => $ZodDiscriminatedUnion,
19197
- $ZodDefault: () => $ZodDefault,
19198
- $ZodDate: () => $ZodDate,
19199
- $ZodCustomStringFormat: () => $ZodCustomStringFormat,
19200
- $ZodCustom: () => $ZodCustom,
19201
- $ZodCodec: () => $ZodCodec,
19202
- $ZodCheckUpperCase: () => $ZodCheckUpperCase,
19203
- $ZodCheckStringFormat: () => $ZodCheckStringFormat,
19204
- $ZodCheckStartsWith: () => $ZodCheckStartsWith,
19205
- $ZodCheckSizeEquals: () => $ZodCheckSizeEquals,
19206
- $ZodCheckRegex: () => $ZodCheckRegex,
19207
- $ZodCheckProperty: () => $ZodCheckProperty,
19208
- $ZodCheckOverwrite: () => $ZodCheckOverwrite,
19209
- $ZodCheckNumberFormat: () => $ZodCheckNumberFormat,
19210
- $ZodCheckMultipleOf: () => $ZodCheckMultipleOf,
19211
- $ZodCheckMinSize: () => $ZodCheckMinSize,
19212
- $ZodCheckMinLength: () => $ZodCheckMinLength,
19213
- $ZodCheckMimeType: () => $ZodCheckMimeType,
19214
- $ZodCheckMaxSize: () => $ZodCheckMaxSize,
19215
- $ZodCheckMaxLength: () => $ZodCheckMaxLength,
19216
- $ZodCheckLowerCase: () => $ZodCheckLowerCase,
19217
- $ZodCheckLessThan: () => $ZodCheckLessThan,
19218
- $ZodCheckLengthEquals: () => $ZodCheckLengthEquals,
19219
- $ZodCheckIncludes: () => $ZodCheckIncludes,
19220
- $ZodCheckGreaterThan: () => $ZodCheckGreaterThan,
19221
- $ZodCheckEndsWith: () => $ZodCheckEndsWith,
19222
- $ZodCheckBigIntFormat: () => $ZodCheckBigIntFormat,
19223
- $ZodCheck: () => $ZodCheck,
19224
- $ZodCatch: () => $ZodCatch,
19225
- $ZodCUID2: () => $ZodCUID2,
19226
- $ZodCUID: () => $ZodCUID,
19227
- $ZodCIDRv6: () => $ZodCIDRv6,
19228
- $ZodCIDRv4: () => $ZodCIDRv4,
19229
- $ZodBoolean: () => $ZodBoolean,
19230
- $ZodBigIntFormat: () => $ZodBigIntFormat,
19231
- $ZodBigInt: () => $ZodBigInt,
19232
- $ZodBase64URL: () => $ZodBase64URL,
19233
- $ZodBase64: () => $ZodBase64,
19234
- $ZodAsyncError: () => $ZodAsyncError,
18389
+ $ZodAny: () => $ZodAny,
19235
18390
  $ZodArray: () => $ZodArray,
19236
- $ZodAny: () => $ZodAny
18391
+ $ZodAsyncError: () => $ZodAsyncError,
18392
+ $ZodBase64: () => $ZodBase64,
18393
+ $ZodBase64URL: () => $ZodBase64URL,
18394
+ $ZodBigInt: () => $ZodBigInt,
18395
+ $ZodBigIntFormat: () => $ZodBigIntFormat,
18396
+ $ZodBoolean: () => $ZodBoolean,
18397
+ $ZodCIDRv4: () => $ZodCIDRv4,
18398
+ $ZodCIDRv6: () => $ZodCIDRv6,
18399
+ $ZodCUID: () => $ZodCUID,
18400
+ $ZodCUID2: () => $ZodCUID2,
18401
+ $ZodCatch: () => $ZodCatch,
18402
+ $ZodCheck: () => $ZodCheck,
18403
+ $ZodCheckBigIntFormat: () => $ZodCheckBigIntFormat,
18404
+ $ZodCheckEndsWith: () => $ZodCheckEndsWith,
18405
+ $ZodCheckGreaterThan: () => $ZodCheckGreaterThan,
18406
+ $ZodCheckIncludes: () => $ZodCheckIncludes,
18407
+ $ZodCheckLengthEquals: () => $ZodCheckLengthEquals,
18408
+ $ZodCheckLessThan: () => $ZodCheckLessThan,
18409
+ $ZodCheckLowerCase: () => $ZodCheckLowerCase,
18410
+ $ZodCheckMaxLength: () => $ZodCheckMaxLength,
18411
+ $ZodCheckMaxSize: () => $ZodCheckMaxSize,
18412
+ $ZodCheckMimeType: () => $ZodCheckMimeType,
18413
+ $ZodCheckMinLength: () => $ZodCheckMinLength,
18414
+ $ZodCheckMinSize: () => $ZodCheckMinSize,
18415
+ $ZodCheckMultipleOf: () => $ZodCheckMultipleOf,
18416
+ $ZodCheckNumberFormat: () => $ZodCheckNumberFormat,
18417
+ $ZodCheckOverwrite: () => $ZodCheckOverwrite,
18418
+ $ZodCheckProperty: () => $ZodCheckProperty,
18419
+ $ZodCheckRegex: () => $ZodCheckRegex,
18420
+ $ZodCheckSizeEquals: () => $ZodCheckSizeEquals,
18421
+ $ZodCheckStartsWith: () => $ZodCheckStartsWith,
18422
+ $ZodCheckStringFormat: () => $ZodCheckStringFormat,
18423
+ $ZodCheckUpperCase: () => $ZodCheckUpperCase,
18424
+ $ZodCodec: () => $ZodCodec,
18425
+ $ZodCustom: () => $ZodCustom,
18426
+ $ZodCustomStringFormat: () => $ZodCustomStringFormat,
18427
+ $ZodDate: () => $ZodDate,
18428
+ $ZodDefault: () => $ZodDefault,
18429
+ $ZodDiscriminatedUnion: () => $ZodDiscriminatedUnion,
18430
+ $ZodE164: () => $ZodE164,
18431
+ $ZodEmail: () => $ZodEmail,
18432
+ $ZodEmoji: () => $ZodEmoji,
18433
+ $ZodEncodeError: () => $ZodEncodeError,
18434
+ $ZodEnum: () => $ZodEnum,
18435
+ $ZodError: () => $ZodError,
18436
+ $ZodExactOptional: () => $ZodExactOptional,
18437
+ $ZodFile: () => $ZodFile,
18438
+ $ZodFunction: () => $ZodFunction,
18439
+ $ZodGUID: () => $ZodGUID,
18440
+ $ZodIPv4: () => $ZodIPv4,
18441
+ $ZodIPv6: () => $ZodIPv6,
18442
+ $ZodISODate: () => $ZodISODate,
18443
+ $ZodISODateTime: () => $ZodISODateTime,
18444
+ $ZodISODuration: () => $ZodISODuration,
18445
+ $ZodISOTime: () => $ZodISOTime,
18446
+ $ZodIntersection: () => $ZodIntersection,
18447
+ $ZodJWT: () => $ZodJWT,
18448
+ $ZodKSUID: () => $ZodKSUID,
18449
+ $ZodLazy: () => $ZodLazy,
18450
+ $ZodLiteral: () => $ZodLiteral,
18451
+ $ZodMAC: () => $ZodMAC,
18452
+ $ZodMap: () => $ZodMap,
18453
+ $ZodNaN: () => $ZodNaN,
18454
+ $ZodNanoID: () => $ZodNanoID,
18455
+ $ZodNever: () => $ZodNever,
18456
+ $ZodNonOptional: () => $ZodNonOptional,
18457
+ $ZodNull: () => $ZodNull,
18458
+ $ZodNullable: () => $ZodNullable,
18459
+ $ZodNumber: () => $ZodNumber,
18460
+ $ZodNumberFormat: () => $ZodNumberFormat,
18461
+ $ZodObject: () => $ZodObject,
18462
+ $ZodObjectJIT: () => $ZodObjectJIT,
18463
+ $ZodOptional: () => $ZodOptional,
18464
+ $ZodPipe: () => $ZodPipe,
18465
+ $ZodPrefault: () => $ZodPrefault,
18466
+ $ZodPreprocess: () => $ZodPreprocess,
18467
+ $ZodPromise: () => $ZodPromise,
18468
+ $ZodReadonly: () => $ZodReadonly,
18469
+ $ZodRealError: () => $ZodRealError,
18470
+ $ZodRecord: () => $ZodRecord,
18471
+ $ZodRegistry: () => $ZodRegistry,
18472
+ $ZodSet: () => $ZodSet,
18473
+ $ZodString: () => $ZodString,
18474
+ $ZodStringFormat: () => $ZodStringFormat,
18475
+ $ZodSuccess: () => $ZodSuccess,
18476
+ $ZodSymbol: () => $ZodSymbol,
18477
+ $ZodTemplateLiteral: () => $ZodTemplateLiteral,
18478
+ $ZodTransform: () => $ZodTransform,
18479
+ $ZodTuple: () => $ZodTuple,
18480
+ $ZodType: () => $ZodType,
18481
+ $ZodULID: () => $ZodULID,
18482
+ $ZodURL: () => $ZodURL,
18483
+ $ZodUUID: () => $ZodUUID,
18484
+ $ZodUndefined: () => $ZodUndefined,
18485
+ $ZodUnion: () => $ZodUnion,
18486
+ $ZodUnknown: () => $ZodUnknown,
18487
+ $ZodVoid: () => $ZodVoid,
18488
+ $ZodXID: () => $ZodXID,
18489
+ $ZodXor: () => $ZodXor,
18490
+ $brand: () => $brand,
18491
+ $constructor: () => $constructor,
18492
+ $input: () => $input,
18493
+ $output: () => $output,
18494
+ Doc: () => Doc,
18495
+ JSONSchema: () => exports_json_schema,
18496
+ JSONSchemaGenerator: () => JSONSchemaGenerator,
18497
+ NEVER: () => NEVER,
18498
+ TimePrecision: () => TimePrecision,
18499
+ _any: () => _any,
18500
+ _array: () => _array,
18501
+ _base64: () => _base64,
18502
+ _base64url: () => _base64url,
18503
+ _bigint: () => _bigint,
18504
+ _boolean: () => _boolean,
18505
+ _catch: () => _catch,
18506
+ _check: () => _check,
18507
+ _cidrv4: () => _cidrv4,
18508
+ _cidrv6: () => _cidrv6,
18509
+ _coercedBigint: () => _coercedBigint,
18510
+ _coercedBoolean: () => _coercedBoolean,
18511
+ _coercedDate: () => _coercedDate,
18512
+ _coercedNumber: () => _coercedNumber,
18513
+ _coercedString: () => _coercedString,
18514
+ _cuid: () => _cuid,
18515
+ _cuid2: () => _cuid2,
18516
+ _custom: () => _custom,
18517
+ _date: () => _date,
18518
+ _decode: () => _decode,
18519
+ _decodeAsync: () => _decodeAsync,
18520
+ _default: () => _default,
18521
+ _discriminatedUnion: () => _discriminatedUnion,
18522
+ _e164: () => _e164,
18523
+ _email: () => _email,
18524
+ _emoji: () => _emoji2,
18525
+ _encode: () => _encode,
18526
+ _encodeAsync: () => _encodeAsync,
18527
+ _endsWith: () => _endsWith,
18528
+ _enum: () => _enum,
18529
+ _file: () => _file,
18530
+ _float32: () => _float32,
18531
+ _float64: () => _float64,
18532
+ _gt: () => _gt,
18533
+ _gte: () => _gte,
18534
+ _guid: () => _guid,
18535
+ _includes: () => _includes,
18536
+ _int: () => _int,
18537
+ _int32: () => _int32,
18538
+ _int64: () => _int64,
18539
+ _intersection: () => _intersection,
18540
+ _ipv4: () => _ipv4,
18541
+ _ipv6: () => _ipv6,
18542
+ _isoDate: () => _isoDate,
18543
+ _isoDateTime: () => _isoDateTime,
18544
+ _isoDuration: () => _isoDuration,
18545
+ _isoTime: () => _isoTime,
18546
+ _jwt: () => _jwt,
18547
+ _ksuid: () => _ksuid,
18548
+ _lazy: () => _lazy,
18549
+ _length: () => _length,
18550
+ _literal: () => _literal,
18551
+ _lowercase: () => _lowercase,
18552
+ _lt: () => _lt,
18553
+ _lte: () => _lte,
18554
+ _mac: () => _mac,
18555
+ _map: () => _map,
18556
+ _max: () => _lte,
18557
+ _maxLength: () => _maxLength,
18558
+ _maxSize: () => _maxSize,
18559
+ _mime: () => _mime,
18560
+ _min: () => _gte,
18561
+ _minLength: () => _minLength,
18562
+ _minSize: () => _minSize,
18563
+ _multipleOf: () => _multipleOf,
18564
+ _nan: () => _nan,
18565
+ _nanoid: () => _nanoid,
18566
+ _nativeEnum: () => _nativeEnum,
18567
+ _negative: () => _negative,
18568
+ _never: () => _never,
18569
+ _nonnegative: () => _nonnegative,
18570
+ _nonoptional: () => _nonoptional,
18571
+ _nonpositive: () => _nonpositive,
18572
+ _normalize: () => _normalize,
18573
+ _null: () => _null2,
18574
+ _nullable: () => _nullable,
18575
+ _number: () => _number,
18576
+ _optional: () => _optional,
18577
+ _overwrite: () => _overwrite,
18578
+ _parse: () => _parse,
18579
+ _parseAsync: () => _parseAsync,
18580
+ _pipe: () => _pipe,
18581
+ _positive: () => _positive,
18582
+ _promise: () => _promise,
18583
+ _property: () => _property,
18584
+ _readonly: () => _readonly,
18585
+ _record: () => _record,
18586
+ _refine: () => _refine,
18587
+ _regex: () => _regex,
18588
+ _safeDecode: () => _safeDecode,
18589
+ _safeDecodeAsync: () => _safeDecodeAsync,
18590
+ _safeEncode: () => _safeEncode,
18591
+ _safeEncodeAsync: () => _safeEncodeAsync,
18592
+ _safeParse: () => _safeParse,
18593
+ _safeParseAsync: () => _safeParseAsync,
18594
+ _set: () => _set,
18595
+ _size: () => _size,
18596
+ _slugify: () => _slugify,
18597
+ _startsWith: () => _startsWith,
18598
+ _string: () => _string,
18599
+ _stringFormat: () => _stringFormat,
18600
+ _stringbool: () => _stringbool,
18601
+ _success: () => _success,
18602
+ _superRefine: () => _superRefine,
18603
+ _symbol: () => _symbol,
18604
+ _templateLiteral: () => _templateLiteral,
18605
+ _toLowerCase: () => _toLowerCase,
18606
+ _toUpperCase: () => _toUpperCase,
18607
+ _transform: () => _transform,
18608
+ _trim: () => _trim,
18609
+ _tuple: () => _tuple,
18610
+ _uint32: () => _uint32,
18611
+ _uint64: () => _uint64,
18612
+ _ulid: () => _ulid,
18613
+ _undefined: () => _undefined2,
18614
+ _union: () => _union,
18615
+ _unknown: () => _unknown,
18616
+ _uppercase: () => _uppercase,
18617
+ _url: () => _url,
18618
+ _uuid: () => _uuid,
18619
+ _uuidv4: () => _uuidv4,
18620
+ _uuidv6: () => _uuidv6,
18621
+ _uuidv7: () => _uuidv7,
18622
+ _void: () => _void,
18623
+ _xid: () => _xid,
18624
+ _xor: () => _xor,
18625
+ clone: () => clone,
18626
+ config: () => config,
18627
+ createStandardJSONSchemaMethod: () => createStandardJSONSchemaMethod,
18628
+ createToJSONSchemaMethod: () => createToJSONSchemaMethod,
18629
+ decode: () => decode,
18630
+ decodeAsync: () => decodeAsync,
18631
+ describe: () => describe,
18632
+ encode: () => encode,
18633
+ encodeAsync: () => encodeAsync,
18634
+ extractDefs: () => extractDefs,
18635
+ finalize: () => finalize,
18636
+ flattenError: () => flattenError,
18637
+ formatError: () => formatError,
18638
+ globalConfig: () => globalConfig,
18639
+ globalRegistry: () => globalRegistry,
18640
+ initializeContext: () => initializeContext,
18641
+ isValidBase64: () => isValidBase64,
18642
+ isValidBase64URL: () => isValidBase64URL,
18643
+ isValidJWT: () => isValidJWT,
18644
+ locales: () => exports_locales,
18645
+ meta: () => meta,
18646
+ parse: () => parse,
18647
+ parseAsync: () => parseAsync,
18648
+ prettifyError: () => prettifyError,
18649
+ process: () => process2,
18650
+ regexes: () => exports_regexes,
18651
+ registry: () => registry,
18652
+ safeDecode: () => safeDecode,
18653
+ safeDecodeAsync: () => safeDecodeAsync,
18654
+ safeEncode: () => safeEncode,
18655
+ safeEncodeAsync: () => safeEncodeAsync,
18656
+ safeParse: () => safeParse,
18657
+ safeParseAsync: () => safeParseAsync,
18658
+ toDotPath: () => toDotPath,
18659
+ toJSONSchema: () => toJSONSchema,
18660
+ treeifyError: () => treeifyError,
18661
+ util: () => exports_util,
18662
+ version: () => version
19237
18663
  });
19238
18664
 
19239
18665
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/core.js
@@ -19317,69 +18743,69 @@ function config(newConfig) {
19317
18743
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/util.js
19318
18744
  var exports_util = {};
19319
18745
  __export(exports_util, {
19320
- unwrapMessage: () => unwrapMessage,
19321
- uint8ArrayToHex: () => uint8ArrayToHex,
19322
- uint8ArrayToBase64url: () => uint8ArrayToBase64url,
19323
- uint8ArrayToBase64: () => uint8ArrayToBase64,
19324
- stringifyPrimitive: () => stringifyPrimitive,
19325
- slugify: () => slugify,
19326
- shallowClone: () => shallowClone,
19327
- safeExtend: () => safeExtend,
19328
- required: () => required,
19329
- randomString: () => randomString,
19330
- propertyKeyTypes: () => propertyKeyTypes,
19331
- promiseAllObject: () => promiseAllObject,
19332
- primitiveTypes: () => primitiveTypes,
19333
- prefixIssues: () => prefixIssues,
19334
- pick: () => pick,
19335
- partial: () => partial,
19336
- parsedType: () => parsedType,
19337
- optionalKeys: () => optionalKeys,
19338
- omit: () => omit,
19339
- objectClone: () => objectClone,
19340
- numKeys: () => numKeys,
19341
- nullish: () => nullish,
19342
- normalizeParams: () => normalizeParams,
19343
- mergeDefs: () => mergeDefs,
19344
- merge: () => merge,
19345
- jsonStringifyReplacer: () => jsonStringifyReplacer,
19346
- joinValues: () => joinValues,
19347
- issue: () => issue,
19348
- isPlainObject: () => isPlainObject,
19349
- isObject: () => isObject,
19350
- hexToUint8Array: () => hexToUint8Array,
19351
- getSizableOrigin: () => getSizableOrigin,
19352
- getParsedType: () => getParsedType,
19353
- getLengthableOrigin: () => getLengthableOrigin,
19354
- getEnumValues: () => getEnumValues,
19355
- getElementAtPath: () => getElementAtPath,
19356
- floatSafeRemainder: () => floatSafeRemainder,
19357
- finalizeIssue: () => finalizeIssue,
19358
- extend: () => extend,
19359
- explicitlyAborted: () => explicitlyAborted,
19360
- escapeRegex: () => escapeRegex,
19361
- esc: () => esc,
19362
- defineLazy: () => defineLazy,
19363
- createTransparentProxy: () => createTransparentProxy,
19364
- cloneDef: () => cloneDef,
19365
- clone: () => clone,
19366
- cleanRegex: () => cleanRegex,
19367
- cleanEnum: () => cleanEnum,
19368
- captureStackTrace: () => captureStackTrace,
19369
- cached: () => cached,
19370
- base64urlToUint8Array: () => base64urlToUint8Array,
19371
- base64ToUint8Array: () => base64ToUint8Array,
19372
- assignProp: () => assignProp,
19373
- assertNotEqual: () => assertNotEqual,
19374
- assertNever: () => assertNever,
19375
- assertIs: () => assertIs,
19376
- assertEqual: () => assertEqual,
19377
- assert: () => assert,
19378
- allowsEval: () => allowsEval,
19379
- aborted: () => aborted,
19380
- NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
18746
+ BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
19381
18747
  Class: () => Class,
19382
- BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES
18748
+ NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
18749
+ aborted: () => aborted,
18750
+ allowsEval: () => allowsEval,
18751
+ assert: () => assert,
18752
+ assertEqual: () => assertEqual,
18753
+ assertIs: () => assertIs,
18754
+ assertNever: () => assertNever,
18755
+ assertNotEqual: () => assertNotEqual,
18756
+ assignProp: () => assignProp,
18757
+ base64ToUint8Array: () => base64ToUint8Array,
18758
+ base64urlToUint8Array: () => base64urlToUint8Array,
18759
+ cached: () => cached,
18760
+ captureStackTrace: () => captureStackTrace,
18761
+ cleanEnum: () => cleanEnum,
18762
+ cleanRegex: () => cleanRegex,
18763
+ clone: () => clone,
18764
+ cloneDef: () => cloneDef,
18765
+ createTransparentProxy: () => createTransparentProxy,
18766
+ defineLazy: () => defineLazy,
18767
+ esc: () => esc,
18768
+ escapeRegex: () => escapeRegex,
18769
+ explicitlyAborted: () => explicitlyAborted,
18770
+ extend: () => extend,
18771
+ finalizeIssue: () => finalizeIssue,
18772
+ floatSafeRemainder: () => floatSafeRemainder,
18773
+ getElementAtPath: () => getElementAtPath,
18774
+ getEnumValues: () => getEnumValues,
18775
+ getLengthableOrigin: () => getLengthableOrigin,
18776
+ getParsedType: () => getParsedType,
18777
+ getSizableOrigin: () => getSizableOrigin,
18778
+ hexToUint8Array: () => hexToUint8Array,
18779
+ isObject: () => isObject,
18780
+ isPlainObject: () => isPlainObject,
18781
+ issue: () => issue,
18782
+ joinValues: () => joinValues,
18783
+ jsonStringifyReplacer: () => jsonStringifyReplacer,
18784
+ merge: () => merge,
18785
+ mergeDefs: () => mergeDefs,
18786
+ normalizeParams: () => normalizeParams,
18787
+ nullish: () => nullish,
18788
+ numKeys: () => numKeys,
18789
+ objectClone: () => objectClone,
18790
+ omit: () => omit,
18791
+ optionalKeys: () => optionalKeys,
18792
+ parsedType: () => parsedType,
18793
+ partial: () => partial,
18794
+ pick: () => pick,
18795
+ prefixIssues: () => prefixIssues,
18796
+ primitiveTypes: () => primitiveTypes,
18797
+ promiseAllObject: () => promiseAllObject,
18798
+ propertyKeyTypes: () => propertyKeyTypes,
18799
+ randomString: () => randomString,
18800
+ required: () => required,
18801
+ safeExtend: () => safeExtend,
18802
+ shallowClone: () => shallowClone,
18803
+ slugify: () => slugify,
18804
+ stringifyPrimitive: () => stringifyPrimitive,
18805
+ uint8ArrayToBase64: () => uint8ArrayToBase64,
18806
+ uint8ArrayToBase64url: () => uint8ArrayToBase64url,
18807
+ uint8ArrayToHex: () => uint8ArrayToHex,
18808
+ unwrapMessage: () => unwrapMessage
19383
18809
  });
19384
18810
  function assertEqual(val) {
19385
18811
  return val;
@@ -20236,65 +19662,65 @@ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
20236
19662
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/core/regexes.js
20237
19663
  var exports_regexes = {};
20238
19664
  __export(exports_regexes, {
20239
- xid: () => xid,
20240
- uuid7: () => uuid7,
20241
- uuid6: () => uuid6,
20242
- uuid4: () => uuid4,
20243
- uuid: () => uuid,
20244
- uppercase: () => uppercase,
20245
- unicodeEmail: () => unicodeEmail,
20246
- undefined: () => _undefined,
20247
- ulid: () => ulid,
20248
- time: () => time,
20249
- string: () => string,
20250
- sha512_hex: () => sha512_hex,
20251
- sha512_base64url: () => sha512_base64url,
20252
- sha512_base64: () => sha512_base64,
20253
- sha384_hex: () => sha384_hex,
20254
- sha384_base64url: () => sha384_base64url,
20255
- sha384_base64: () => sha384_base64,
20256
- sha256_hex: () => sha256_hex,
20257
- sha256_base64url: () => sha256_base64url,
20258
- sha256_base64: () => sha256_base64,
20259
- sha1_hex: () => sha1_hex,
20260
- sha1_base64url: () => sha1_base64url,
20261
- sha1_base64: () => sha1_base64,
20262
- rfc5322Email: () => rfc5322Email,
20263
- number: () => number,
20264
- null: () => _null,
20265
- nanoid: () => nanoid,
20266
- md5_hex: () => md5_hex,
20267
- md5_base64url: () => md5_base64url,
20268
- md5_base64: () => md5_base64,
20269
- mac: () => mac,
20270
- lowercase: () => lowercase,
20271
- ksuid: () => ksuid,
20272
- ipv6: () => ipv6,
20273
- ipv4: () => ipv4,
20274
- integer: () => integer,
20275
- idnEmail: () => idnEmail,
20276
- httpProtocol: () => httpProtocol,
20277
- html5Email: () => html5Email,
20278
- hostname: () => hostname2,
20279
- hex: () => hex,
20280
- guid: () => guid,
20281
- extendedDuration: () => extendedDuration,
20282
- emoji: () => emoji,
20283
- email: () => email,
20284
- e164: () => e164,
20285
- duration: () => duration,
20286
- domain: () => domain,
20287
- datetime: () => datetime,
20288
- date: () => date,
20289
- cuid2: () => cuid2,
20290
- cuid: () => cuid,
20291
- cidrv6: () => cidrv6,
20292
- cidrv4: () => cidrv4,
20293
- browserEmail: () => browserEmail,
20294
- boolean: () => boolean,
20295
- bigint: () => bigint,
19665
+ base64: () => base64,
20296
19666
  base64url: () => base64url,
20297
- base64: () => base64
19667
+ bigint: () => bigint,
19668
+ boolean: () => boolean,
19669
+ browserEmail: () => browserEmail,
19670
+ cidrv4: () => cidrv4,
19671
+ cidrv6: () => cidrv6,
19672
+ cuid: () => cuid,
19673
+ cuid2: () => cuid2,
19674
+ date: () => date,
19675
+ datetime: () => datetime,
19676
+ domain: () => domain,
19677
+ duration: () => duration,
19678
+ e164: () => e164,
19679
+ email: () => email,
19680
+ emoji: () => emoji,
19681
+ extendedDuration: () => extendedDuration,
19682
+ guid: () => guid,
19683
+ hex: () => hex,
19684
+ hostname: () => hostname2,
19685
+ html5Email: () => html5Email,
19686
+ httpProtocol: () => httpProtocol,
19687
+ idnEmail: () => idnEmail,
19688
+ integer: () => integer,
19689
+ ipv4: () => ipv4,
19690
+ ipv6: () => ipv6,
19691
+ ksuid: () => ksuid,
19692
+ lowercase: () => lowercase,
19693
+ mac: () => mac,
19694
+ md5_base64: () => md5_base64,
19695
+ md5_base64url: () => md5_base64url,
19696
+ md5_hex: () => md5_hex,
19697
+ nanoid: () => nanoid,
19698
+ null: () => _null,
19699
+ number: () => number,
19700
+ rfc5322Email: () => rfc5322Email,
19701
+ sha1_base64: () => sha1_base64,
19702
+ sha1_base64url: () => sha1_base64url,
19703
+ sha1_hex: () => sha1_hex,
19704
+ sha256_base64: () => sha256_base64,
19705
+ sha256_base64url: () => sha256_base64url,
19706
+ sha256_hex: () => sha256_hex,
19707
+ sha384_base64: () => sha384_base64,
19708
+ sha384_base64url: () => sha384_base64url,
19709
+ sha384_hex: () => sha384_hex,
19710
+ sha512_base64: () => sha512_base64,
19711
+ sha512_base64url: () => sha512_base64url,
19712
+ sha512_hex: () => sha512_hex,
19713
+ string: () => string,
19714
+ time: () => time,
19715
+ ulid: () => ulid,
19716
+ undefined: () => _undefined,
19717
+ unicodeEmail: () => unicodeEmail,
19718
+ uppercase: () => uppercase,
19719
+ uuid: () => uuid,
19720
+ uuid4: () => uuid4,
19721
+ uuid6: () => uuid6,
19722
+ uuid7: () => uuid7,
19723
+ xid: () => xid
20298
19724
  });
20299
19725
  var cuid = /^[cC][0-9a-z]{6,}$/;
20300
19726
  var cuid2 = /^[0-9a-z]+$/;
@@ -23071,58 +22497,58 @@ function handleRefineResult(result, payload, input, inst) {
23071
22497
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/index.js
23072
22498
  var exports_locales = {};
23073
22499
  __export(exports_locales, {
23074
- zhTW: () => zh_TW_default,
23075
- zhCN: () => zh_CN_default,
23076
- yo: () => yo_default,
23077
- vi: () => vi_default,
23078
- uz: () => uz_default,
23079
- ur: () => ur_default,
23080
- uk: () => uk_default,
23081
- ua: () => ua_default,
23082
- tr: () => tr_default,
23083
- th: () => th_default,
23084
- ta: () => ta_default,
23085
- sv: () => sv_default,
23086
- sl: () => sl_default,
23087
- ru: () => ru_default,
23088
- ro: () => ro_default,
23089
- pt: () => pt_default,
23090
- ps: () => ps_default,
23091
- pl: () => pl_default,
23092
- ota: () => ota_default,
23093
- no: () => no_default,
23094
- nl: () => nl_default,
23095
- ms: () => ms_default,
23096
- mk: () => mk_default,
23097
- lt: () => lt_default,
23098
- ko: () => ko_default,
23099
- km: () => km_default,
23100
- kh: () => kh_default,
23101
- ka: () => ka_default,
23102
- ja: () => ja_default,
23103
- it: () => it_default,
23104
- is: () => is_default,
23105
- id: () => id_default,
23106
- hy: () => hy_default,
23107
- hu: () => hu_default,
23108
- hr: () => hr_default,
23109
- he: () => he_default,
23110
- frCA: () => fr_CA_default,
23111
- fr: () => fr_default,
23112
- fi: () => fi_default,
23113
- fa: () => fa_default,
23114
- es: () => es_default,
23115
- eo: () => eo_default,
23116
- en: () => en_default,
23117
- el: () => el_default,
23118
- de: () => de_default,
23119
- da: () => da_default,
23120
- cs: () => cs_default,
23121
- ca: () => ca_default,
23122
- bg: () => bg_default,
23123
- be: () => be_default,
22500
+ ar: () => ar_default,
23124
22501
  az: () => az_default,
23125
- ar: () => ar_default
22502
+ be: () => be_default,
22503
+ bg: () => bg_default,
22504
+ ca: () => ca_default,
22505
+ cs: () => cs_default,
22506
+ da: () => da_default,
22507
+ de: () => de_default,
22508
+ el: () => el_default,
22509
+ en: () => en_default,
22510
+ eo: () => eo_default,
22511
+ es: () => es_default,
22512
+ fa: () => fa_default,
22513
+ fi: () => fi_default,
22514
+ fr: () => fr_default,
22515
+ frCA: () => fr_CA_default,
22516
+ he: () => he_default,
22517
+ hr: () => hr_default,
22518
+ hu: () => hu_default,
22519
+ hy: () => hy_default,
22520
+ id: () => id_default,
22521
+ is: () => is_default,
22522
+ it: () => it_default,
22523
+ ja: () => ja_default,
22524
+ ka: () => ka_default,
22525
+ kh: () => kh_default,
22526
+ km: () => km_default,
22527
+ ko: () => ko_default,
22528
+ lt: () => lt_default,
22529
+ mk: () => mk_default,
22530
+ ms: () => ms_default,
22531
+ nl: () => nl_default,
22532
+ no: () => no_default,
22533
+ ota: () => ota_default,
22534
+ pl: () => pl_default,
22535
+ ps: () => ps_default,
22536
+ pt: () => pt_default,
22537
+ ro: () => ro_default,
22538
+ ru: () => ru_default,
22539
+ sl: () => sl_default,
22540
+ sv: () => sv_default,
22541
+ ta: () => ta_default,
22542
+ th: () => th_default,
22543
+ tr: () => tr_default,
22544
+ ua: () => ua_default,
22545
+ uk: () => uk_default,
22546
+ ur: () => ur_default,
22547
+ uz: () => uz_default,
22548
+ vi: () => vi_default,
22549
+ yo: () => yo_default,
22550
+ zhCN: () => zh_CN_default,
22551
+ zhTW: () => zh_TW_default
23126
22552
  });
23127
22553
 
23128
22554
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/locales/ar.js
@@ -30893,219 +30319,219 @@ var exports_json_schema = {};
30893
30319
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
30894
30320
  var exports_schemas2 = {};
30895
30321
  __export(exports_schemas2, {
30896
- xor: () => xor,
30897
- xid: () => xid2,
30898
- void: () => _void2,
30899
- uuidv7: () => uuidv7,
30900
- uuidv6: () => uuidv6,
30901
- uuidv4: () => uuidv4,
30902
- uuid: () => uuid2,
30903
- url: () => url,
30904
- unknown: () => unknown,
30905
- union: () => union,
30906
- undefined: () => _undefined3,
30907
- ulid: () => ulid2,
30908
- uint64: () => uint64,
30909
- uint32: () => uint32,
30910
- tuple: () => tuple,
30911
- transform: () => transform,
30912
- templateLiteral: () => templateLiteral,
30913
- symbol: () => symbol,
30914
- superRefine: () => superRefine,
30915
- success: () => success,
30916
- stringbool: () => stringbool,
30917
- stringFormat: () => stringFormat,
30918
- string: () => string2,
30919
- strictObject: () => strictObject,
30920
- set: () => set,
30921
- refine: () => refine,
30922
- record: () => record,
30923
- readonly: () => readonly,
30924
- promise: () => promise,
30925
- preprocess: () => preprocess,
30926
- prefault: () => prefault,
30927
- pipe: () => pipe,
30928
- partialRecord: () => partialRecord,
30929
- optional: () => optional,
30930
- object: () => object,
30931
- number: () => number2,
30932
- nullish: () => nullish2,
30933
- nullable: () => nullable,
30934
- null: () => _null3,
30935
- nonoptional: () => nonoptional,
30936
- never: () => never,
30937
- nativeEnum: () => nativeEnum,
30938
- nanoid: () => nanoid2,
30939
- nan: () => nan,
30940
- meta: () => meta2,
30941
- map: () => map,
30942
- mac: () => mac2,
30943
- looseRecord: () => looseRecord,
30944
- looseObject: () => looseObject,
30945
- literal: () => literal,
30946
- lazy: () => lazy,
30947
- ksuid: () => ksuid2,
30948
- keyof: () => keyof,
30949
- jwt: () => jwt,
30950
- json: () => json,
30951
- ipv6: () => ipv62,
30952
- ipv4: () => ipv42,
30953
- invertCodec: () => invertCodec,
30954
- intersection: () => intersection,
30955
- int64: () => int64,
30956
- int32: () => int32,
30957
- int: () => int,
30958
- instanceof: () => _instanceof,
30959
- httpUrl: () => httpUrl,
30960
- hostname: () => hostname3,
30961
- hex: () => hex2,
30962
- hash: () => hash,
30963
- guid: () => guid2,
30964
- function: () => _function,
30965
- float64: () => float64,
30966
- float32: () => float32,
30967
- file: () => file,
30968
- exactOptional: () => exactOptional,
30969
- enum: () => _enum2,
30970
- emoji: () => emoji2,
30971
- email: () => email2,
30972
- e164: () => e1642,
30973
- discriminatedUnion: () => discriminatedUnion,
30974
- describe: () => describe2,
30975
- date: () => date3,
30976
- custom: () => custom,
30977
- cuid2: () => cuid22,
30978
- cuid: () => cuid3,
30979
- codec: () => codec,
30980
- cidrv6: () => cidrv62,
30981
- cidrv4: () => cidrv42,
30982
- check: () => check,
30983
- catch: () => _catch2,
30984
- boolean: () => boolean2,
30985
- bigint: () => bigint2,
30986
- base64url: () => base64url2,
30987
- base64: () => base642,
30988
- array: () => array,
30989
- any: () => any,
30990
- _function: () => _function,
30991
- _default: () => _default2,
30992
- _ZodString: () => _ZodString,
30993
- ZodXor: () => ZodXor,
30994
- ZodXID: () => ZodXID,
30995
- ZodVoid: () => ZodVoid,
30996
- ZodUnknown: () => ZodUnknown,
30997
- ZodUnion: () => ZodUnion,
30998
- ZodUndefined: () => ZodUndefined,
30999
- ZodUUID: () => ZodUUID,
31000
- ZodURL: () => ZodURL,
31001
- ZodULID: () => ZodULID,
31002
- ZodType: () => ZodType,
31003
- ZodTuple: () => ZodTuple,
31004
- ZodTransform: () => ZodTransform,
31005
- ZodTemplateLiteral: () => ZodTemplateLiteral,
31006
- ZodSymbol: () => ZodSymbol,
31007
- ZodSuccess: () => ZodSuccess,
31008
- ZodStringFormat: () => ZodStringFormat,
31009
- ZodString: () => ZodString,
31010
- ZodSet: () => ZodSet,
31011
- ZodRecord: () => ZodRecord,
31012
- ZodReadonly: () => ZodReadonly,
31013
- ZodPromise: () => ZodPromise,
31014
- ZodPreprocess: () => ZodPreprocess,
31015
- ZodPrefault: () => ZodPrefault,
31016
- ZodPipe: () => ZodPipe,
31017
- ZodOptional: () => ZodOptional,
31018
- ZodObject: () => ZodObject,
31019
- ZodNumberFormat: () => ZodNumberFormat,
31020
- ZodNumber: () => ZodNumber,
31021
- ZodNullable: () => ZodNullable,
31022
- ZodNull: () => ZodNull,
31023
- ZodNonOptional: () => ZodNonOptional,
31024
- ZodNever: () => ZodNever,
31025
- ZodNanoID: () => ZodNanoID,
31026
- ZodNaN: () => ZodNaN,
31027
- ZodMap: () => ZodMap,
31028
- ZodMAC: () => ZodMAC,
31029
- ZodLiteral: () => ZodLiteral,
31030
- ZodLazy: () => ZodLazy,
31031
- ZodKSUID: () => ZodKSUID,
31032
- ZodJWT: () => ZodJWT,
31033
- ZodIntersection: () => ZodIntersection,
31034
- ZodIPv6: () => ZodIPv6,
31035
- ZodIPv4: () => ZodIPv4,
31036
- ZodGUID: () => ZodGUID,
31037
- ZodFunction: () => ZodFunction,
31038
- ZodFile: () => ZodFile,
31039
- ZodExactOptional: () => ZodExactOptional,
31040
- ZodEnum: () => ZodEnum,
31041
- ZodEmoji: () => ZodEmoji,
31042
- ZodEmail: () => ZodEmail,
31043
- ZodE164: () => ZodE164,
31044
- ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
31045
- ZodDefault: () => ZodDefault,
31046
- ZodDate: () => ZodDate,
31047
- ZodCustomStringFormat: () => ZodCustomStringFormat,
31048
- ZodCustom: () => ZodCustom,
31049
- ZodCodec: () => ZodCodec,
31050
- ZodCatch: () => ZodCatch,
31051
- ZodCUID2: () => ZodCUID2,
31052
- ZodCUID: () => ZodCUID,
31053
- ZodCIDRv6: () => ZodCIDRv6,
31054
- ZodCIDRv4: () => ZodCIDRv4,
31055
- ZodBoolean: () => ZodBoolean,
31056
- ZodBigIntFormat: () => ZodBigIntFormat,
31057
- ZodBigInt: () => ZodBigInt,
31058
- ZodBase64URL: () => ZodBase64URL,
31059
- ZodBase64: () => ZodBase64,
30322
+ ZodAny: () => ZodAny,
31060
30323
  ZodArray: () => ZodArray,
31061
- ZodAny: () => ZodAny
30324
+ ZodBase64: () => ZodBase64,
30325
+ ZodBase64URL: () => ZodBase64URL,
30326
+ ZodBigInt: () => ZodBigInt,
30327
+ ZodBigIntFormat: () => ZodBigIntFormat,
30328
+ ZodBoolean: () => ZodBoolean,
30329
+ ZodCIDRv4: () => ZodCIDRv4,
30330
+ ZodCIDRv6: () => ZodCIDRv6,
30331
+ ZodCUID: () => ZodCUID,
30332
+ ZodCUID2: () => ZodCUID2,
30333
+ ZodCatch: () => ZodCatch,
30334
+ ZodCodec: () => ZodCodec,
30335
+ ZodCustom: () => ZodCustom,
30336
+ ZodCustomStringFormat: () => ZodCustomStringFormat,
30337
+ ZodDate: () => ZodDate,
30338
+ ZodDefault: () => ZodDefault,
30339
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
30340
+ ZodE164: () => ZodE164,
30341
+ ZodEmail: () => ZodEmail,
30342
+ ZodEmoji: () => ZodEmoji,
30343
+ ZodEnum: () => ZodEnum,
30344
+ ZodExactOptional: () => ZodExactOptional,
30345
+ ZodFile: () => ZodFile,
30346
+ ZodFunction: () => ZodFunction,
30347
+ ZodGUID: () => ZodGUID,
30348
+ ZodIPv4: () => ZodIPv4,
30349
+ ZodIPv6: () => ZodIPv6,
30350
+ ZodIntersection: () => ZodIntersection,
30351
+ ZodJWT: () => ZodJWT,
30352
+ ZodKSUID: () => ZodKSUID,
30353
+ ZodLazy: () => ZodLazy,
30354
+ ZodLiteral: () => ZodLiteral,
30355
+ ZodMAC: () => ZodMAC,
30356
+ ZodMap: () => ZodMap,
30357
+ ZodNaN: () => ZodNaN,
30358
+ ZodNanoID: () => ZodNanoID,
30359
+ ZodNever: () => ZodNever,
30360
+ ZodNonOptional: () => ZodNonOptional,
30361
+ ZodNull: () => ZodNull,
30362
+ ZodNullable: () => ZodNullable,
30363
+ ZodNumber: () => ZodNumber,
30364
+ ZodNumberFormat: () => ZodNumberFormat,
30365
+ ZodObject: () => ZodObject,
30366
+ ZodOptional: () => ZodOptional,
30367
+ ZodPipe: () => ZodPipe,
30368
+ ZodPrefault: () => ZodPrefault,
30369
+ ZodPreprocess: () => ZodPreprocess,
30370
+ ZodPromise: () => ZodPromise,
30371
+ ZodReadonly: () => ZodReadonly,
30372
+ ZodRecord: () => ZodRecord,
30373
+ ZodSet: () => ZodSet,
30374
+ ZodString: () => ZodString,
30375
+ ZodStringFormat: () => ZodStringFormat,
30376
+ ZodSuccess: () => ZodSuccess,
30377
+ ZodSymbol: () => ZodSymbol,
30378
+ ZodTemplateLiteral: () => ZodTemplateLiteral,
30379
+ ZodTransform: () => ZodTransform,
30380
+ ZodTuple: () => ZodTuple,
30381
+ ZodType: () => ZodType,
30382
+ ZodULID: () => ZodULID,
30383
+ ZodURL: () => ZodURL,
30384
+ ZodUUID: () => ZodUUID,
30385
+ ZodUndefined: () => ZodUndefined,
30386
+ ZodUnion: () => ZodUnion,
30387
+ ZodUnknown: () => ZodUnknown,
30388
+ ZodVoid: () => ZodVoid,
30389
+ ZodXID: () => ZodXID,
30390
+ ZodXor: () => ZodXor,
30391
+ _ZodString: () => _ZodString,
30392
+ _default: () => _default2,
30393
+ _function: () => _function,
30394
+ any: () => any,
30395
+ array: () => array,
30396
+ base64: () => base642,
30397
+ base64url: () => base64url2,
30398
+ bigint: () => bigint2,
30399
+ boolean: () => boolean2,
30400
+ catch: () => _catch2,
30401
+ check: () => check,
30402
+ cidrv4: () => cidrv42,
30403
+ cidrv6: () => cidrv62,
30404
+ codec: () => codec,
30405
+ cuid: () => cuid3,
30406
+ cuid2: () => cuid22,
30407
+ custom: () => custom,
30408
+ date: () => date3,
30409
+ describe: () => describe2,
30410
+ discriminatedUnion: () => discriminatedUnion,
30411
+ e164: () => e1642,
30412
+ email: () => email2,
30413
+ emoji: () => emoji2,
30414
+ enum: () => _enum2,
30415
+ exactOptional: () => exactOptional,
30416
+ file: () => file,
30417
+ float32: () => float32,
30418
+ float64: () => float64,
30419
+ function: () => _function,
30420
+ guid: () => guid2,
30421
+ hash: () => hash,
30422
+ hex: () => hex2,
30423
+ hostname: () => hostname3,
30424
+ httpUrl: () => httpUrl,
30425
+ instanceof: () => _instanceof,
30426
+ int: () => int,
30427
+ int32: () => int32,
30428
+ int64: () => int64,
30429
+ intersection: () => intersection,
30430
+ invertCodec: () => invertCodec,
30431
+ ipv4: () => ipv42,
30432
+ ipv6: () => ipv62,
30433
+ json: () => json,
30434
+ jwt: () => jwt,
30435
+ keyof: () => keyof,
30436
+ ksuid: () => ksuid2,
30437
+ lazy: () => lazy,
30438
+ literal: () => literal,
30439
+ looseObject: () => looseObject,
30440
+ looseRecord: () => looseRecord,
30441
+ mac: () => mac2,
30442
+ map: () => map,
30443
+ meta: () => meta2,
30444
+ nan: () => nan,
30445
+ nanoid: () => nanoid2,
30446
+ nativeEnum: () => nativeEnum,
30447
+ never: () => never,
30448
+ nonoptional: () => nonoptional,
30449
+ null: () => _null3,
30450
+ nullable: () => nullable,
30451
+ nullish: () => nullish2,
30452
+ number: () => number2,
30453
+ object: () => object,
30454
+ optional: () => optional,
30455
+ partialRecord: () => partialRecord,
30456
+ pipe: () => pipe,
30457
+ prefault: () => prefault,
30458
+ preprocess: () => preprocess,
30459
+ promise: () => promise,
30460
+ readonly: () => readonly,
30461
+ record: () => record,
30462
+ refine: () => refine,
30463
+ set: () => set,
30464
+ strictObject: () => strictObject,
30465
+ string: () => string2,
30466
+ stringFormat: () => stringFormat,
30467
+ stringbool: () => stringbool,
30468
+ success: () => success,
30469
+ superRefine: () => superRefine,
30470
+ symbol: () => symbol,
30471
+ templateLiteral: () => templateLiteral,
30472
+ transform: () => transform,
30473
+ tuple: () => tuple,
30474
+ uint32: () => uint32,
30475
+ uint64: () => uint64,
30476
+ ulid: () => ulid2,
30477
+ undefined: () => _undefined3,
30478
+ union: () => union,
30479
+ unknown: () => unknown,
30480
+ url: () => url,
30481
+ uuid: () => uuid2,
30482
+ uuidv4: () => uuidv4,
30483
+ uuidv6: () => uuidv6,
30484
+ uuidv7: () => uuidv7,
30485
+ void: () => _void2,
30486
+ xid: () => xid2,
30487
+ xor: () => xor
31062
30488
  });
31063
30489
 
31064
30490
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/checks.js
31065
30491
  var exports_checks2 = {};
31066
30492
  __export(exports_checks2, {
31067
- uppercase: () => _uppercase,
31068
- trim: () => _trim,
31069
- toUpperCase: () => _toUpperCase,
31070
- toLowerCase: () => _toLowerCase,
31071
- startsWith: () => _startsWith,
31072
- slugify: () => _slugify,
31073
- size: () => _size,
31074
- regex: () => _regex,
31075
- property: () => _property,
31076
- positive: () => _positive,
31077
- overwrite: () => _overwrite,
31078
- normalize: () => _normalize,
31079
- nonpositive: () => _nonpositive,
31080
- nonnegative: () => _nonnegative,
31081
- negative: () => _negative,
31082
- multipleOf: () => _multipleOf,
31083
- minSize: () => _minSize,
31084
- minLength: () => _minLength,
31085
- mime: () => _mime,
31086
- maxSize: () => _maxSize,
31087
- maxLength: () => _maxLength,
31088
- lte: () => _lte,
31089
- lt: () => _lt,
31090
- lowercase: () => _lowercase,
31091
- length: () => _length,
31092
- includes: () => _includes,
31093
- gte: () => _gte,
30493
+ endsWith: () => _endsWith,
31094
30494
  gt: () => _gt,
31095
- endsWith: () => _endsWith
30495
+ gte: () => _gte,
30496
+ includes: () => _includes,
30497
+ length: () => _length,
30498
+ lowercase: () => _lowercase,
30499
+ lt: () => _lt,
30500
+ lte: () => _lte,
30501
+ maxLength: () => _maxLength,
30502
+ maxSize: () => _maxSize,
30503
+ mime: () => _mime,
30504
+ minLength: () => _minLength,
30505
+ minSize: () => _minSize,
30506
+ multipleOf: () => _multipleOf,
30507
+ negative: () => _negative,
30508
+ nonnegative: () => _nonnegative,
30509
+ nonpositive: () => _nonpositive,
30510
+ normalize: () => _normalize,
30511
+ overwrite: () => _overwrite,
30512
+ positive: () => _positive,
30513
+ property: () => _property,
30514
+ regex: () => _regex,
30515
+ size: () => _size,
30516
+ slugify: () => _slugify,
30517
+ startsWith: () => _startsWith,
30518
+ toLowerCase: () => _toLowerCase,
30519
+ toUpperCase: () => _toUpperCase,
30520
+ trim: () => _trim,
30521
+ uppercase: () => _uppercase
31096
30522
  });
31097
30523
 
31098
30524
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/iso.js
31099
30525
  var exports_iso = {};
31100
30526
  __export(exports_iso, {
31101
- time: () => time2,
31102
- duration: () => duration2,
31103
- datetime: () => datetime2,
31104
- date: () => date2,
31105
- ZodISOTime: () => ZodISOTime,
31106
- ZodISODuration: () => ZodISODuration,
30527
+ ZodISODate: () => ZodISODate,
31107
30528
  ZodISODateTime: () => ZodISODateTime,
31108
- ZodISODate: () => ZodISODate
30529
+ ZodISODuration: () => ZodISODuration,
30530
+ ZodISOTime: () => ZodISOTime,
30531
+ date: () => date2,
30532
+ datetime: () => datetime2,
30533
+ duration: () => duration2,
30534
+ time: () => time2
31109
30535
  });
31110
30536
  var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
31111
30537
  $ZodISODateTime.init(inst, def);
@@ -32966,11 +32392,11 @@ function fromJSONSchema(schema, params) {
32966
32392
  // ../../node_modules/.bun/zod@4.4.3/node_modules/zod/v4/classic/coerce.js
32967
32393
  var exports_coerce = {};
32968
32394
  __export(exports_coerce, {
32969
- string: () => string3,
32970
- number: () => number3,
32971
- date: () => date4,
32395
+ bigint: () => bigint3,
32972
32396
  boolean: () => boolean3,
32973
- bigint: () => bigint3
32397
+ date: () => date4,
32398
+ number: () => number3,
32399
+ string: () => string3
32974
32400
  });
32975
32401
  function string3(params) {
32976
32402
  return _coercedString(ZodString, params);
@@ -33139,6 +32565,9 @@ var SubcConfigSchema = exports_external.object({
33139
32565
  client_reaper: exports_external.boolean().optional(),
33140
32566
  connection_file: exports_external.string().optional()
33141
32567
  });
32568
+ var GhShimConfigSchema = exports_external.object({
32569
+ enabled: exports_external.boolean().optional()
32570
+ });
33142
32571
  var InspectConfigSchema = exports_external.object({
33143
32572
  enabled: exports_external.boolean().optional(),
33144
32573
  diagnostics_timeout_ms: exports_external.number().int().positive().optional().transform((value) => value === undefined ? undefined : clampInspectDiagnosticsTimeoutMs(value)),
@@ -33185,7 +32614,8 @@ var AftConfigSchema = exports_external.preprocess((value) => stripHarnessSpecifi
33185
32614
  url_fetch_allow_private: exports_external.boolean().optional(),
33186
32615
  semantic: SemanticConfigSchema.optional(),
33187
32616
  bridge: BridgeConfigSchema.optional(),
33188
- subc: SubcConfigSchema.optional()
32617
+ subc: SubcConfigSchema.optional(),
32618
+ gh_shim: GhShimConfigSchema.optional()
33189
32619
  }).strict());
33190
32620
  var CONFIG_MIGRATIONS = [
33191
32621
  { oldKey: "experimental_search_index", newPath: ["search_index"] },
@@ -33560,6 +32990,8 @@ function getStrippedTopLevelKeys(override) {
33560
32990
  stripped.push("sandbox.write_allow");
33561
32991
  if (override.subc !== undefined)
33562
32992
  stripped.push("subc");
32993
+ if (override.gh_shim !== undefined)
32994
+ stripped.push("gh_shim");
33563
32995
  if (override.disabled_tools?.includes("aft_safety"))
33564
32996
  stripped.push("disabled_tools.aft_safety");
33565
32997
  return stripped;
@@ -35853,6 +35285,17 @@ var EditParams = Type2.Object({
35853
35285
  description: "Batch edits — non-empty array of { oldString, newString }, { oldString, newString, replaceAll: true }, or { startLine, endLine, content } objects applied atomically."
35854
35286
  }))
35855
35287
  });
35288
+ var HASHLINE_EDIT_DESCRIPTION = [
35289
+ "Apply a hashline patch. Arguments are exactly `{patch}` where `patch` is a non-empty string. Server-owned preview control is outside this schema.",
35290
+ "",
35291
+ "Quick reference:",
35292
+ "- Header: `[path#TAG]`; TAG is exactly four hexadecimal digits from a current tagged read. Read every addressed row and gap boundary; REM and MV require a whole-file tagged read. Re-read after an edit before chaining: an edit-response tag can retain only changed context.",
35293
+ "- Same canonical path: multiple sections compose in patch order against pre-request coordinates.",
35294
+ "- Addresses: `0` (BOF), `N` (one line), `N.=M` (range; `N..=M`/`N..M` also work), `<N`/`>N` (gap before/after), `N*`/`<N*`/`>N*` (block), and `$`/`$-K` (EOF-relative). A plain `N` PUT replaces; use `<N` or `>N` to insert.",
35295
+ "- PUT text: `PUT <address>:` followed by one or more `+` body rows (`+` alone is blank). A final patch newline is allowed. PUT without `:` copies `@name` (or the anonymous register) and takes no body; names use `@` plus ASCII letters, digits, `_`, or `-`.",
35296
+ "- CUT: `CUT <address> [@name]`. REM: bare `REM` only, removing the whole file. MV: `MV <destination>` (one whitespace-free path, optional matching quotes), once and after any line operations. `*** Begin Patch`/`*** End Patch` is an optional envelope."
35297
+ ].join(`
35298
+ `);
35856
35299
  var HashlineEditParams = Type2.Object({
35857
35300
  patch: Type2.String({
35858
35301
  minLength: 1,
@@ -36030,7 +35473,7 @@ PDFs aren't supported on the Pi harness yet.`, response);
36030
35473
  pi.registerTool({
36031
35474
  name: "edit",
36032
35475
  label: "edit",
36033
- description: "Apply a hashline patch. Arguments are exactly `{patch}` where `patch` is a non-empty string of one or more `[path#TAG]` sections with PUT/CUT/REM/MV operations. Paths and tags come from section headers; obtain tags from tagged reads. Server-owned preview control is outside this schema.",
35476
+ description: HASHLINE_EDIT_DESCRIPTION,
36034
35477
  promptSnippet: "Apply a tagged hashline patch through the edit tool",
36035
35478
  promptGuidelines: [
36036
35479
  "Read a file to obtain its current hashline tag before editing it.",
@@ -36896,6 +36339,7 @@ function registerBashTool(pi, ctx, aftSearchRegistered = false) {
36896
36339
  const spawnHook = getBashSpawnHook(pi);
36897
36340
  const searchSteer = aftSearchRegistered ? "use `aft_search` (concepts, identifiers, regex, literals), `read`, `aft_outline`, or `aft_zoom` instead" : "use the `grep` tool, `read`, `aft_outline`, or `aft_zoom` instead";
36898
36341
  const bashCfg = resolveBashConfig(ctx.config);
36342
+ let hostFallbackActive = false;
36899
36343
  const compressionSentence = bashCfg.compress ? " Output is compressed by default; pass `compressed: false` for raw output. Piped commands run verbatim and show the pipeline's output; for AFT's test/build summary, run the runner without `| head`, `| tail`, or `| grep`." : "";
36900
36344
  const tasksSentence = bashCfg.background ? ' Commands run in the foreground and return inline; `wait: true` blocks until a long command finishes instead of auto-promoting, but detaches to background if you send a new message — use it when you need the result before doing anything else; keep it off otherwise so auto-promote can remind you while you work. Use `background: true` yourself ONLY when you have other useful work to do while it runs; then `bash_watch` waits on the task (sync blocks until exit/pattern, async notifies) and `bash_status` peeks at it — never background a command and immediately `bash_watch` it (that wastes a turn for what foreground returns in one), and never loop `bash_status` to wait. `pty: true` runs interactive programs (REPLs, TUIs), implies background, and is driven with `bash_status({ output_mode: "screen" })` plus `bash_write`.' : " Commands run in the foreground to completion; `timeout` is the hard kill cap (default 30 minutes).";
36901
36345
  pi.registerTool({
@@ -37001,10 +36445,13 @@ DO NOT use bash for code search or code exploration. If you are about to run gre
37001
36445
  env: spawnContext.env
37002
36446
  });
37003
36447
  usedHostFallback = true;
36448
+ hostFallbackActive = true;
37004
36449
  }
37005
36450
  if (response.success === false) {
37006
36451
  throw new Error(response.message ?? "bash failed");
37007
36452
  }
36453
+ if (!usedHostFallback && hostFallbackActive)
36454
+ hostFallbackActive = false;
37008
36455
  const taskId = response.task_id;
37009
36456
  if (response.status === "running" && taskId) {
37010
36457
  trackBgTask(resolveSessionId(extCtx), taskId);
@@ -39331,7 +38778,7 @@ var PLUGIN_VERSION = (() => {
39331
38778
  return "0.0.0";
39332
38779
  }
39333
38780
  })();
39334
- var ANNOUNCEMENT_VERSION = "0.51.3";
38781
+ var ANNOUNCEMENT_VERSION = "0.52.1";
39335
38782
  var ANNOUNCEMENT_FEATURES = [
39336
38783
  "Callgraph stays consistent under load: edits arriving mid-rebuild can no longer be silently lost from navigation results.",
39337
38784
  "aft_zoom handles real-world .jsonc: files with comment banners above the opening brace now resolve, and not-found errors point at the segment that actually failed (thanks @iceteaSA).",
@@ -39451,9 +38898,18 @@ async function src_default(pi) {
39451
38898
  return;
39452
38899
  }
39453
38900
  log2(`AFT extension loading (plugin v${PLUGIN_VERSION})`);
38901
+ const cachedBinaryPath = findBinarySync(PLUGIN_VERSION);
38902
+ if (!cachedBinaryPath) {
38903
+ ensureBinary(PLUGIN_VERSION).then((path2) => {
38904
+ if (path2)
38905
+ log2(`Background binary warmup ready at ${path2}`);
38906
+ }, (err) => {
38907
+ warn2(`Background binary warmup failed: ${err instanceof Error ? err.message : String(err)}`);
38908
+ });
38909
+ }
39454
38910
  let binaryPath;
39455
38911
  try {
39456
- binaryPath = await findBinary(PLUGIN_VERSION);
38912
+ binaryPath = cachedBinaryPath ?? await findBinary(PLUGIN_VERSION);
39457
38913
  } catch (err) {
39458
38914
  warn2(`Failed to resolve AFT binary: ${err instanceof Error ? err.message : String(err)}. ` + "Tools will not be registered.");
39459
38915
  return;
@@ -39755,6 +39211,6 @@ var __test__2 = {
39755
39211
  createVersionMismatchHandler
39756
39212
  };
39757
39213
  export {
39758
- src_default as default,
39759
- __test__2 as __test__
39214
+ __test__2 as __test__,
39215
+ src_default as default
39760
39216
  };