adhdev 0.9.10 → 0.9.12

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
@@ -46068,6 +46068,7 @@ var init_server_connection = __esm({
46068
46068
  reconnectTimer = null;
46069
46069
  pingTimer = null;
46070
46070
  pongTimeout = null;
46071
+ authTimeout = null;
46071
46072
  missedPongCount = 0;
46072
46073
  messageHandlers = /* @__PURE__ */ new Map();
46073
46074
  stateChangeCallbacks = [];
@@ -46077,6 +46078,9 @@ var init_server_connection = __esm({
46077
46078
  iceServers = null;
46078
46079
  planLimits = null;
46079
46080
  compatBlocked = false;
46081
+ get authTimeoutMs() {
46082
+ return Math.max(1, this.options.authTimeoutMs ?? 15e3);
46083
+ }
46080
46084
  constructor(options) {
46081
46085
  this.options = options;
46082
46086
  }
@@ -46179,6 +46183,7 @@ var init_server_connection = __esm({
46179
46183
  },
46180
46184
  timestamp: Date.now()
46181
46185
  });
46186
+ this.startAuthTimeout();
46182
46187
  }
46183
46188
  onMessage(text) {
46184
46189
  try {
@@ -46186,6 +46191,7 @@ var init_server_connection = __esm({
46186
46191
  this.missedPongCount = 0;
46187
46192
  const message = JSON.parse(text);
46188
46193
  if (message.type === "auth_ok") {
46194
+ this.clearAuthTimeout();
46189
46195
  this.reconnectAttempts = 0;
46190
46196
  this.compatBlocked = false;
46191
46197
  const payload = message.payload;
@@ -46200,6 +46206,7 @@ var init_server_connection = __esm({
46200
46206
  LOG.info("Server", `[ServerConn] \u2713 Authenticated (plan: ${this.userPlan})`);
46201
46207
  this.startHeartbeat();
46202
46208
  } else if (message.type === "auth_error") {
46209
+ this.clearAuthTimeout();
46203
46210
  LOG.error("Server", `Auth failed: ${message.payload.reason}`);
46204
46211
  this.setState("error");
46205
46212
  return;
@@ -46294,9 +46301,25 @@ var init_server_connection = __esm({
46294
46301
  clearTimeout(this.reconnectTimer);
46295
46302
  this.reconnectTimer = null;
46296
46303
  }
46304
+ this.clearAuthTimeout();
46297
46305
  this.stopHeartbeat();
46298
46306
  this.missedPongCount = 0;
46299
46307
  }
46308
+ startAuthTimeout() {
46309
+ this.clearAuthTimeout();
46310
+ this.authTimeout = setTimeout(() => {
46311
+ this.authTimeout = null;
46312
+ if (this.state !== "authenticating" || !this.ws) return;
46313
+ LOG.warn("Server", `[ServerConn] Auth timeout after ${(this.authTimeoutMs / 1e3).toFixed(1)}s \u2014 reconnecting`);
46314
+ this.ws.terminate();
46315
+ }, this.authTimeoutMs);
46316
+ }
46317
+ clearAuthTimeout() {
46318
+ if (this.authTimeout) {
46319
+ clearTimeout(this.authTimeout);
46320
+ this.authTimeout = null;
46321
+ }
46322
+ }
46300
46323
  // ─── WS Heartbeat (ping/pong) ─────────────────────
46301
46324
  startHeartbeat() {
46302
46325
  this.stopHeartbeat();
@@ -55373,7 +55396,7 @@ var init_adhdev_daemon = __esm({
55373
55396
  init_version();
55374
55397
  init_src();
55375
55398
  init_runtime_defaults();
55376
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.10" });
55399
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.12" });
55377
55400
  AdhdevDaemon = class _AdhdevDaemon {
55378
55401
  localHttpServer = null;
55379
55402
  localWss = null;
@@ -55569,11 +55592,7 @@ var init_adhdev_daemon = __esm({
55569
55592
  });
55570
55593
  }
55571
55594
  getHotChatSessionIdsForP2PFlush() {
55572
- const sessions = buildSessionEntries(
55573
- this.components.instanceManager.collectAllStates(),
55574
- this.components.cdpManagers,
55575
- { profile: "live" }
55576
- );
55595
+ const sessions = this.buildLiveStatusSnapshot().sessions || [];
55577
55596
  const hotSessions = classifyHotChatSessionsForSubscriptionFlush(
55578
55597
  sessions,
55579
55598
  this.hotP2PChatSessionIds