adhdev 0.8.63 → 0.8.65

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/cli/index.js CHANGED
@@ -1494,6 +1494,51 @@ var init_host_memory = __esm({
1494
1494
  }
1495
1495
  });
1496
1496
 
1497
+ // ../../oss/packages/daemon-core/src/status/chat-tail-hot-sessions.ts
1498
+ function parseMessageTimestamp(value) {
1499
+ if (typeof value === "number" && Number.isFinite(value)) return value;
1500
+ if (typeof value === "string") {
1501
+ const parsed = Date.parse(value);
1502
+ if (Number.isFinite(parsed)) return parsed;
1503
+ }
1504
+ return 0;
1505
+ }
1506
+ function classifyHotChatSessionsForSubscriptionFlush(sessions, previousHotSessionIds, options = {}) {
1507
+ const now = options.now ?? Date.now();
1508
+ const recentMessageGraceMs = Math.max(
1509
+ 0,
1510
+ Number.isFinite(options.recentMessageGraceMs) ? Number(options.recentMessageGraceMs) : DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS
1511
+ );
1512
+ const activeStatuses = options.activeStatuses ?? DEFAULT_ACTIVE_CHAT_POLL_STATUSES;
1513
+ const active = /* @__PURE__ */ new Set();
1514
+ for (const session of sessions) {
1515
+ const sessionId = typeof session?.id === "string" ? session.id : "";
1516
+ if (!sessionId) continue;
1517
+ const status = String(session?.status || "").toLowerCase();
1518
+ const lastMessageAt = parseMessageTimestamp(session?.lastMessageAt);
1519
+ const recentlyUpdated = lastMessageAt > 0 && now - lastMessageAt <= recentMessageGraceMs;
1520
+ if (activeStatuses.has(status) || recentlyUpdated) {
1521
+ active.add(sessionId);
1522
+ }
1523
+ }
1524
+ const finalizing = new Set(
1525
+ Array.from(previousHotSessionIds).filter((sessionId) => !active.has(sessionId))
1526
+ );
1527
+ return { active, finalizing };
1528
+ }
1529
+ var DEFAULT_ACTIVE_CHAT_POLL_STATUSES, DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS;
1530
+ var init_chat_tail_hot_sessions = __esm({
1531
+ "../../oss/packages/daemon-core/src/status/chat-tail-hot-sessions.ts"() {
1532
+ "use strict";
1533
+ DEFAULT_ACTIVE_CHAT_POLL_STATUSES = /* @__PURE__ */ new Set([
1534
+ "generating",
1535
+ "waiting_approval",
1536
+ "starting"
1537
+ ]);
1538
+ DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS = 8e3;
1539
+ }
1540
+ });
1541
+
1497
1542
  // ../../oss/packages/daemon-core/src/logging/logger.ts
1498
1543
  function setLogLevel(level) {
1499
1544
  currentLevel = level;
@@ -3359,19 +3404,75 @@ var init_status_monitor = __esm({
3359
3404
  });
3360
3405
 
3361
3406
  // ../../oss/packages/daemon-core/src/providers/chat-message-normalization.ts
3407
+ function canonicalizeKindHint(value) {
3408
+ return value.trim().toLowerCase().replace(/[\s-]+/g, "_");
3409
+ }
3410
+ function resolveBuiltinOrAliasKind(kind) {
3411
+ if (typeof kind !== "string") return null;
3412
+ const normalizedKind = canonicalizeKindHint(kind);
3413
+ if (!normalizedKind) return null;
3414
+ if (KNOWN_CHAT_MESSAGE_KINDS.has(normalizedKind)) return normalizedKind;
3415
+ return CHAT_MESSAGE_KIND_ALIASES[normalizedKind] || null;
3416
+ }
3417
+ function inferHintKind(value) {
3418
+ const direct = resolveBuiltinOrAliasKind(value);
3419
+ if (direct) return direct;
3420
+ if (typeof value !== "string") return null;
3421
+ const normalized = canonicalizeKindHint(value);
3422
+ if (!normalized) return null;
3423
+ if (/thought|thinking|reasoning/.test(normalized)) return "thought";
3424
+ if (/tool/.test(normalized)) return "tool";
3425
+ if (/terminal|command|shell|console/.test(normalized)) return "terminal";
3426
+ return null;
3427
+ }
3428
+ function inferKindFromToolCalls(message) {
3429
+ const toolCalls = Array.isArray(message?.toolCalls) ? message.toolCalls : [];
3430
+ if (toolCalls.length === 0) return null;
3431
+ if (toolCalls.some((toolCall) => toolCall?.kind === "think")) return "thought";
3432
+ if (toolCalls.some((toolCall) => toolCall?.kind === "execute")) return "terminal";
3433
+ if (toolCalls.some((toolCall) => Array.isArray(toolCall?.content) && toolCall.content.some((entry) => entry?.type === "terminal"))) {
3434
+ return "terminal";
3435
+ }
3436
+ return "tool";
3437
+ }
3438
+ function inferMissingChatMessageKind(message) {
3439
+ const role = typeof message?.role === "string" ? message.role.trim().toLowerCase() : "";
3440
+ if (role === "system") return "system";
3441
+ const meta3 = message?.meta && typeof message.meta === "object" ? message.meta : void 0;
3442
+ const hintCandidates = [
3443
+ message?._sub,
3444
+ message?._type,
3445
+ meta3?.label,
3446
+ typeof message?.senderName === "string" ? message.senderName : void 0
3447
+ ];
3448
+ for (const candidate of hintCandidates) {
3449
+ const inferred = inferHintKind(candidate);
3450
+ if (inferred) return inferred;
3451
+ }
3452
+ const inferredFromToolCalls = inferKindFromToolCalls(message);
3453
+ if (inferredFromToolCalls) return inferredFromToolCalls;
3454
+ return null;
3455
+ }
3362
3456
  function isBuiltinChatMessageKind(kind) {
3363
- return typeof kind === "string" && KNOWN_CHAT_MESSAGE_KINDS.has(kind.trim().toLowerCase());
3457
+ return resolveBuiltinOrAliasKind(kind) !== null;
3364
3458
  }
3365
3459
  function normalizeChatMessageKind(kind, role) {
3366
- const normalizedKind = typeof kind === "string" ? kind.trim().toLowerCase() : "";
3367
- if (normalizedKind && KNOWN_CHAT_MESSAGE_KINDS.has(normalizedKind)) return normalizedKind;
3460
+ const resolvedKind = resolveBuiltinOrAliasKind(kind);
3461
+ if (resolvedKind) return resolvedKind;
3368
3462
  const normalizedRole = typeof role === "string" ? role.trim().toLowerCase() : "";
3369
3463
  return normalizedRole === "system" ? "system" : "standard";
3370
3464
  }
3465
+ function resolveChatMessageKind(message) {
3466
+ const explicitKind = resolveBuiltinOrAliasKind(message?.kind);
3467
+ if (explicitKind) return explicitKind;
3468
+ const inferredKind = inferMissingChatMessageKind(message);
3469
+ if (inferredKind) return inferredKind;
3470
+ return normalizeChatMessageKind(message?.kind, message?.role);
3471
+ }
3371
3472
  function buildChatMessage(message) {
3372
3473
  return {
3373
3474
  ...message,
3374
- kind: normalizeChatMessageKind(message?.kind, message?.role)
3475
+ kind: resolveChatMessageKind(message)
3375
3476
  };
3376
3477
  }
3377
3478
  function buildSystemChatMessage(message) {
@@ -3394,6 +3495,24 @@ function buildAssistantChatMessage(message) {
3394
3495
  kind: message?.kind || "standard"
3395
3496
  });
3396
3497
  }
3498
+ function buildThoughtChatMessage(message) {
3499
+ return buildAssistantChatMessage({
3500
+ ...message,
3501
+ kind: message?.kind || "thought"
3502
+ });
3503
+ }
3504
+ function buildToolChatMessage(message) {
3505
+ return buildAssistantChatMessage({
3506
+ ...message,
3507
+ kind: message?.kind || "tool"
3508
+ });
3509
+ }
3510
+ function buildTerminalChatMessage(message) {
3511
+ return buildAssistantChatMessage({
3512
+ ...message,
3513
+ kind: message?.kind || "terminal"
3514
+ });
3515
+ }
3397
3516
  function buildUserChatMessage(message) {
3398
3517
  return buildChatMessage({
3399
3518
  ...message,
@@ -3407,12 +3526,30 @@ function normalizeChatMessage(message) {
3407
3526
  function normalizeChatMessages(messages) {
3408
3527
  return (Array.isArray(messages) ? messages : []).map((message) => normalizeChatMessage(message));
3409
3528
  }
3410
- var BUILTIN_CHAT_MESSAGE_KINDS, KNOWN_CHAT_MESSAGE_KINDS;
3529
+ var BUILTIN_CHAT_MESSAGE_KINDS, KNOWN_CHAT_MESSAGE_KINDS, CHAT_MESSAGE_KIND_ALIASES;
3411
3530
  var init_chat_message_normalization = __esm({
3412
3531
  "../../oss/packages/daemon-core/src/providers/chat-message-normalization.ts"() {
3413
3532
  "use strict";
3414
3533
  BUILTIN_CHAT_MESSAGE_KINDS = ["standard", "thought", "tool", "terminal", "system"];
3415
3534
  KNOWN_CHAT_MESSAGE_KINDS = new Set(BUILTIN_CHAT_MESSAGE_KINDS);
3535
+ CHAT_MESSAGE_KIND_ALIASES = {
3536
+ text: "standard",
3537
+ message: "standard",
3538
+ assistant: "standard",
3539
+ thinking: "thought",
3540
+ think: "thought",
3541
+ reasoning: "thought",
3542
+ reason: "thought",
3543
+ toolcall: "tool",
3544
+ tool_call: "tool",
3545
+ tooluse: "tool",
3546
+ tool_use: "tool",
3547
+ action: "tool",
3548
+ command: "terminal",
3549
+ cmd: "terminal",
3550
+ shell: "terminal",
3551
+ console: "terminal"
3552
+ };
3416
3553
  }
3417
3554
  });
3418
3555
 
@@ -4897,11 +5034,13 @@ var init_ide_provider_instance = __esm({
4897
5034
  if (pm.receivedAt) prevByHash.set(h, pm.receivedAt);
4898
5035
  }
4899
5036
  const now = Date.now();
4900
- const messages = chat.messages || [];
4901
- for (const msg of messages) {
5037
+ const rawMessages = chat.messages || [];
5038
+ for (const msg of rawMessages) {
4902
5039
  const h = `${msg.role}:${(msg.content || "").slice(0, 100)}`;
4903
5040
  msg.receivedAt = prevByHash.get(h) || now;
4904
5041
  }
5042
+ chat.messages = normalizeChatMessages(rawMessages);
5043
+ const messages = chat.messages || [];
4905
5044
  if (messages.length > 0) {
4906
5045
  const hiddenKinds = /* @__PURE__ */ new Set();
4907
5046
  if (this.settings.showThinking === false) hiddenKinds.add("thought");
@@ -29633,6 +29772,7 @@ var init_acp_provider_instance = __esm({
29633
29772
  activeToolCalls = [];
29634
29773
  stopReason = null;
29635
29774
  partialContent = "";
29775
+ partialThoughtContent = "";
29636
29776
  /** Rich content blocks accumulated during streaming */
29637
29777
  partialBlocks = [];
29638
29778
  /** Tool calls collected during current turn */
@@ -29678,6 +29818,10 @@ var init_acp_provider_instance = __esm({
29678
29818
  content
29679
29819
  });
29680
29820
  }));
29821
+ if (this.currentStatus === "generating") {
29822
+ const partialThoughtMessage = this.buildPartialThoughtMessage(Date.now());
29823
+ if (partialThoughtMessage) recentMessages.push(partialThoughtMessage);
29824
+ }
29681
29825
  if (this.currentStatus === "generating" && (this.partialContent || this.partialBlocks.length > 0)) {
29682
29826
  const blocks = this.buildPartialBlocks();
29683
29827
  if (blocks.length > 0) {
@@ -30236,6 +30380,7 @@ var init_acp_provider_instance = __esm({
30236
30380
  }));
30237
30381
  this.currentStatus = "generating";
30238
30382
  this.partialContent = "";
30383
+ this.partialThoughtContent = "";
30239
30384
  this.partialBlocks = [];
30240
30385
  this.turnToolCalls = [];
30241
30386
  this.detectStatusTransition();
@@ -30318,7 +30463,14 @@ var init_acp_provider_instance = __esm({
30318
30463
  this.currentStatus = "generating";
30319
30464
  break;
30320
30465
  }
30321
- case "agent_thought_chunk":
30466
+ case "agent_thought_chunk": {
30467
+ const content = update.content;
30468
+ if (content?.type === "text" && typeof content.text === "string") {
30469
+ this.partialThoughtContent += content.text;
30470
+ }
30471
+ this.currentStatus = "generating";
30472
+ break;
30473
+ }
30322
30474
  case "user_message_chunk": {
30323
30475
  break;
30324
30476
  }
@@ -30473,8 +30625,82 @@ var init_acp_provider_instance = __esm({
30473
30625
  blocks.push(...this.partialBlocks);
30474
30626
  return blocks;
30475
30627
  }
30628
+ buildPartialThoughtMessage(timestamp = Date.now()) {
30629
+ const content = this.partialThoughtContent.trim();
30630
+ if (!content) return null;
30631
+ return buildThoughtChatMessage({
30632
+ content,
30633
+ timestamp,
30634
+ meta: {
30635
+ label: "Thought",
30636
+ isRunning: this.currentStatus === "generating"
30637
+ }
30638
+ });
30639
+ }
30640
+ buildToolCallBubbleKind(toolCall) {
30641
+ if (toolCall.kind === "think") return "thought";
30642
+ if (toolCall.kind === "execute") return "terminal";
30643
+ if (Array.isArray(toolCall.content) && toolCall.content.some((entry) => entry?.type === "terminal")) return "terminal";
30644
+ return "tool";
30645
+ }
30646
+ summarizeToolCallBubbleContent(toolCall) {
30647
+ const rawOutput = typeof toolCall.rawOutput === "string" ? toolCall.rawOutput.trim() : toolCall.rawOutput != null ? JSON.stringify(toolCall.rawOutput) : "";
30648
+ if (rawOutput) return rawOutput;
30649
+ const contentText = Array.isArray(toolCall.content) ? toolCall.content.map((entry) => {
30650
+ if (!entry || typeof entry !== "object") return "";
30651
+ if (entry.type === "content") return flattenContent([entry.content]).trim();
30652
+ if (entry.type === "diff") return `${entry.path}
30653
+ ${entry.newText || ""}`.trim();
30654
+ if (entry.type === "terminal") return `Terminal: ${entry.terminalId || ""}`.trim();
30655
+ return "";
30656
+ }).filter(Boolean).join("\n\n").trim() : "";
30657
+ if (contentText) return contentText;
30658
+ const rawInput = typeof toolCall.rawInput === "string" ? toolCall.rawInput.trim() : toolCall.rawInput != null ? JSON.stringify(toolCall.rawInput) : "";
30659
+ if (rawInput) {
30660
+ return toolCall.title ? `${toolCall.title}
30661
+ ${rawInput}` : rawInput;
30662
+ }
30663
+ return toolCall.title || "";
30664
+ }
30665
+ buildTurnToolCallMessages(timestamp = Date.now()) {
30666
+ return this.turnToolCalls.map((toolCall) => {
30667
+ const content = this.summarizeToolCallBubbleContent(toolCall);
30668
+ if (!content) return null;
30669
+ const isRunning = toolCall.status === "pending" || toolCall.status === "in_progress";
30670
+ const label = toolCall.title || void 0;
30671
+ const kind = this.buildToolCallBubbleKind(toolCall);
30672
+ if (kind === "thought") {
30673
+ return buildThoughtChatMessage({
30674
+ content,
30675
+ timestamp,
30676
+ meta: { label: label || "Thought", isRunning }
30677
+ });
30678
+ }
30679
+ if (kind === "terminal") {
30680
+ return buildTerminalChatMessage({
30681
+ content,
30682
+ timestamp,
30683
+ meta: { label: label || "Ran command", isRunning }
30684
+ });
30685
+ }
30686
+ return buildToolChatMessage({
30687
+ content,
30688
+ timestamp,
30689
+ meta: { label: label || "Tool call", isRunning }
30690
+ });
30691
+ }).filter(Boolean);
30692
+ }
30476
30693
  /** Finalize streaming content into an assistant message */
30477
30694
  finalizeAssistantMessage() {
30695
+ const timestamp = Date.now();
30696
+ const thoughtMessage = this.buildPartialThoughtMessage(timestamp);
30697
+ if (thoughtMessage) {
30698
+ this.messages.push(thoughtMessage);
30699
+ }
30700
+ const toolCallMessages = this.buildTurnToolCallMessages(timestamp);
30701
+ if (toolCallMessages.length > 0) {
30702
+ this.messages.push(...toolCallMessages);
30703
+ }
30478
30704
  const blocks = this.buildPartialBlocks();
30479
30705
  const finalBlocks = blocks.map((b) => {
30480
30706
  if (b.type === "text" && b.text.endsWith("...")) {
@@ -30490,6 +30716,7 @@ var init_acp_provider_instance = __esm({
30490
30716
  }));
30491
30717
  }
30492
30718
  this.partialContent = "";
30719
+ this.partialThoughtContent = "";
30493
30720
  this.partialBlocks = [];
30494
30721
  this.turnToolCalls = [];
30495
30722
  }
@@ -35128,6 +35355,9 @@ function parseMessageTime(value) {
35128
35355
  }
35129
35356
  return 0;
35130
35357
  }
35358
+ function getMessageEventTime(message) {
35359
+ return parseMessageTime(message?.receivedAt) || parseMessageTime(message?.timestamp) || 0;
35360
+ }
35131
35361
  function stringifyPreviewContent(content) {
35132
35362
  if (typeof content === "string") return content;
35133
35363
  if (Array.isArray(content)) {
@@ -35172,7 +35402,7 @@ function getLastDisplayMessage(session) {
35172
35402
  return {
35173
35403
  role,
35174
35404
  preview,
35175
- receivedAt: parseMessageTime(candidate?.receivedAt),
35405
+ receivedAt: getMessageEventTime(candidate),
35176
35406
  hash: simplePreviewHash(`${role}:${preview}`)
35177
35407
  };
35178
35408
  }
@@ -35181,7 +35411,7 @@ function getLastDisplayMessage(session) {
35181
35411
  function getSessionMessageUpdatedAt(session) {
35182
35412
  const lastMessage = session.activeChat?.messages?.at?.(-1);
35183
35413
  if (!lastMessage) return 0;
35184
- return parseMessageTime(lastMessage.receivedAt) || 0;
35414
+ return getMessageEventTime(lastMessage);
35185
35415
  }
35186
35416
  function getSessionCompletionMarker(session) {
35187
35417
  const lastMessage = session.activeChat?.messages?.at?.(-1);
@@ -35191,7 +35421,7 @@ function getSessionCompletionMarker(session) {
35191
35421
  if (typeof lastMessage._turnKey === "string" && lastMessage._turnKey) return `turn:${lastMessage._turnKey}`;
35192
35422
  if (typeof lastMessage.id === "string" && lastMessage.id) return `id:${lastMessage.id}`;
35193
35423
  if (typeof lastMessage.index === "number" && Number.isFinite(lastMessage.index)) return `idx:${lastMessage.index}`;
35194
- const timestamp = parseMessageTime(lastMessage.receivedAt);
35424
+ const timestamp = getMessageEventTime(lastMessage);
35195
35425
  return timestamp > 0 ? `ts:${timestamp}` : "";
35196
35426
  }
35197
35427
  function getSessionLastUsedAt(session) {
@@ -36524,6 +36754,7 @@ var init_provider_adapter = __esm({
36524
36754
  "use strict";
36525
36755
  init_control_effects();
36526
36756
  init_provider_patch_state();
36757
+ init_chat_message_normalization();
36527
36758
  ProviderStreamAdapter = class {
36528
36759
  agentType;
36529
36760
  agentName;
@@ -36633,7 +36864,7 @@ var init_provider_adapter = __esm({
36633
36864
  agentName: this.agentName,
36634
36865
  extensionId: this.extensionId,
36635
36866
  status: data.status || "idle",
36636
- messages: data.messages || [],
36867
+ messages: normalizeChatMessages(Array.isArray(data.messages) ? data.messages : []),
36637
36868
  inputContent: data.inputContent || "",
36638
36869
  activeModal: data.activeModal
36639
36870
  };
@@ -43904,6 +44135,8 @@ __export(src_exports, {
43904
44135
  CdpDomHandlers: () => CdpDomHandlers,
43905
44136
  CliProviderInstance: () => CliProviderInstance,
43906
44137
  DAEMON_WS_PATH: () => DAEMON_WS_PATH,
44138
+ DEFAULT_ACTIVE_CHAT_POLL_STATUSES: () => DEFAULT_ACTIVE_CHAT_POLL_STATUSES,
44139
+ DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS: () => DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS,
43907
44140
  DEFAULT_DAEMON_PORT: () => DEFAULT_DAEMON_PORT,
43908
44141
  DEFAULT_SESSION_HOST_APP_NAME: () => DEFAULT_SESSION_HOST_APP_NAME,
43909
44142
  DEFAULT_STANDALONE_SESSION_HOST_APP_NAME: () => DEFAULT_STANDALONE_SESSION_HOST_APP_NAME,
@@ -43932,7 +44165,11 @@ __export(src_exports, {
43932
44165
  buildSessionEntries: () => buildSessionEntries,
43933
44166
  buildStatusSnapshot: () => buildStatusSnapshot,
43934
44167
  buildSystemChatMessage: () => buildSystemChatMessage,
44168
+ buildTerminalChatMessage: () => buildTerminalChatMessage,
44169
+ buildThoughtChatMessage: () => buildThoughtChatMessage,
44170
+ buildToolChatMessage: () => buildToolChatMessage,
43935
44171
  buildUserChatMessage: () => buildUserChatMessage,
44172
+ classifyHotChatSessionsForSubscriptionFlush: () => classifyHotChatSessionsForSubscriptionFlush,
43936
44173
  clearDebugTrace: () => clearDebugTrace,
43937
44174
  configureDebugTraceStore: () => configureDebugTraceStore,
43938
44175
  connectCdpManager: () => connectCdpManager,
@@ -43999,6 +44236,7 @@ __export(src_exports, {
43999
44236
  resetConfig: () => resetConfig,
44000
44237
  resetDebugRuntimeConfig: () => resetDebugRuntimeConfig,
44001
44238
  resetState: () => resetState,
44239
+ resolveChatMessageKind: () => resolveChatMessageKind,
44002
44240
  resolveDebugRuntimeConfig: () => resolveDebugRuntimeConfig,
44003
44241
  resolveSessionHostAppName: () => resolveSessionHostAppName,
44004
44242
  saveConfig: () => saveConfig,
@@ -44025,6 +44263,7 @@ var init_src = __esm({
44025
44263
  init_ide_detector();
44026
44264
  init_cli_detector();
44027
44265
  init_host_memory();
44266
+ init_chat_tail_hot_sessions();
44028
44267
  init_manager();
44029
44268
  init_devtools();
44030
44269
  init_setup();
@@ -84107,7 +84346,7 @@ function stopDaemon(ref = {}) {
84107
84346
  return false;
84108
84347
  }
84109
84348
  }
84110
- var os28, fs23, path30, import_http, import_ws3, pkgVersion, ACTIVE_CHAT_POLL_STATUSES, AdhdevDaemon;
84349
+ var os28, fs23, path30, import_http, import_ws3, pkgVersion, AdhdevDaemon;
84111
84350
  var init_adhdev_daemon = __esm({
84112
84351
  "src/adhdev-daemon.ts"() {
84113
84352
  "use strict";
@@ -84126,12 +84365,8 @@ var init_adhdev_daemon = __esm({
84126
84365
  import_ws3 = require("ws");
84127
84366
  init_source();
84128
84367
  init_version();
84129
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.63" });
84130
- ACTIVE_CHAT_POLL_STATUSES = /* @__PURE__ */ new Set([
84131
- "generating",
84132
- "waiting_approval",
84133
- "starting"
84134
- ]);
84368
+ init_src();
84369
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.8.65" });
84135
84370
  AdhdevDaemon = class _AdhdevDaemon {
84136
84371
  localHttpServer = null;
84137
84372
  localWss = null;
@@ -84358,14 +84593,12 @@ var init_adhdev_daemon = __esm({
84358
84593
  }
84359
84594
  getHotChatSessionIdsForP2PFlush() {
84360
84595
  const snapshot = this.buildLiveStatusSnapshot();
84361
- const active = new Set(
84362
- snapshot.sessions.filter((session) => ACTIVE_CHAT_POLL_STATUSES.has(String(session.status || "").toLowerCase())).map((session) => session.id)
84363
- );
84364
- const finalizing = new Set(
84365
- Array.from(this.hotP2PChatSessionIds).filter((sessionId) => !active.has(sessionId))
84596
+ const hotSessions = classifyHotChatSessionsForSubscriptionFlush(
84597
+ snapshot.sessions,
84598
+ this.hotP2PChatSessionIds
84366
84599
  );
84367
- this.hotP2PChatSessionIds = active;
84368
- return { active, finalizing };
84600
+ this.hotP2PChatSessionIds = hotSessions.active;
84601
+ return hotSessions;
84369
84602
  }
84370
84603
  async flushP2PChatSubscriptions(options = {}) {
84371
84604
  if (!this.p2p?.isConnected || !this.p2p.hasChatSubscriptions()) return;