tesseract-agent 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist-bundle/cli.js +28 -17
  2. package/package.json +1 -1
@@ -45578,6 +45578,11 @@ var PeerLinkManager = class {
45578
45578
  quicSrflx = null;
45579
45579
  quicInitP = null;
45580
45580
  quicKeepalive = null;
45581
+ /** Set once if the QUIC native dep (@matrixai/quic) can't be loaded on this host —
45582
+ * e.g. the desktop app doesn't ship it, or an arch with no prebuilt binding. The
45583
+ * QUIC tier then no-ops permanently and the TCP tiers carry every link (fail-closed,
45584
+ * exactly what the lazy-load design in quic-transport.ts promises). */
45585
+ quicUnavailable = false;
45581
45586
  constructor(certPath, keyPath) {
45582
45587
  this.certPath = certPath;
45583
45588
  this.keyPath = keyPath;
@@ -45624,22 +45629,28 @@ var PeerLinkManager = class {
45624
45629
  return;
45625
45630
  const stunPort = Number(process.env.CCB_STUN_PORT ?? 3478);
45626
45631
  const identity = await this.identity();
45627
- const q = await Promise.resolve().then(() => (init_quic_transport(), quic_transport_exports));
45628
- const socket2 = await q.makeQuicSocket(this.udpPort);
45629
- this.quicSocket = socket2;
45630
- await q.startQuicServerOnSocket({ socket: socket2, identity, onStream: (bs) => this.acceptInbound(bs, "punch") });
45631
- const refresh = async () => {
45632
- try {
45633
- const s = await q.discoverSrflx(socket2, stunHost, stunPort);
45634
- const i = s.lastIndexOf(":");
45635
- this.quicSrflx = { type: "srflx", ip: s.slice(0, i), port: Number(s.slice(i + 1)), proto: "udp", priority: 40 };
45636
- } catch {
45637
- }
45638
- };
45639
- await refresh();
45640
- this.quicKeepalive = setInterval(() => {
45641
- void refresh();
45642
- }, 2e4);
45632
+ try {
45633
+ const q = await Promise.resolve().then(() => (init_quic_transport(), quic_transport_exports));
45634
+ const socket2 = await q.makeQuicSocket(this.udpPort);
45635
+ this.quicSocket = socket2;
45636
+ await q.startQuicServerOnSocket({ socket: socket2, identity, onStream: (bs) => this.acceptInbound(bs, "punch") });
45637
+ const refresh = async () => {
45638
+ try {
45639
+ const s = await q.discoverSrflx(socket2, stunHost, stunPort);
45640
+ const i = s.lastIndexOf(":");
45641
+ this.quicSrflx = { type: "srflx", ip: s.slice(0, i), port: Number(s.slice(i + 1)), proto: "udp", priority: 40 };
45642
+ } catch {
45643
+ }
45644
+ };
45645
+ await refresh();
45646
+ this.quicKeepalive = setInterval(() => {
45647
+ void refresh();
45648
+ }, 2e4);
45649
+ } catch (e) {
45650
+ this.quicUnavailable = true;
45651
+ this.quicSocket = null;
45652
+ console.warn(`[peer-link] QUIC tier unavailable \u2014 using TCP tiers only: ${e?.message ?? e}`);
45653
+ }
45643
45654
  }
45644
45655
  async nudgeQuic(peer) {
45645
45656
  if (!this.quicSocket)
@@ -45755,7 +45766,7 @@ var PeerLinkManager = class {
45755
45766
  async handleGo(msg) {
45756
45767
  const token = Buffer.from(msg.token, "hex");
45757
45768
  const udp = msg.peerCandidates.filter((c) => c.proto === "udp");
45758
- const quicOn = this.quicEnabled() && udp.length > 0;
45769
+ const quicOn = this.quicEnabled() && udp.length > 0 && !this.quicUnavailable;
45759
45770
  if (msg.role === "listen") {
45760
45771
  if (quicOn) {
45761
45772
  await this.initQuic();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tesseract-agent",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "license": "UNLICENSED",
5
5
  "publishConfig": {
6
6
  "access": "public"