@adhdev/daemon-core 0.9.82-rc.90 → 0.9.82-rc.91

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.mjs CHANGED
@@ -9164,7 +9164,19 @@ function sessionStatusFromNodes(nodes, nodeId, sessionId) {
9164
9164
  if (!node) return { staleReason: "direct task node is no longer in the live mesh" };
9165
9165
  if (!sessionId) return {};
9166
9166
  const candidates = [];
9167
- for (const value of [node.sessions, node.activeSessions, node.active_sessions, node.lastProbe?.sessions, node.last_probe?.sessions, node.lastProbe?.status?.sessions, node.last_probe?.status?.sessions]) {
9167
+ for (const value of [
9168
+ node.sessions,
9169
+ node.activeSessions,
9170
+ node.active_sessions,
9171
+ node.activeSessionDetails,
9172
+ node.active_session_details,
9173
+ node.sessionDetails,
9174
+ node.session_details,
9175
+ node.lastProbe?.sessions,
9176
+ node.last_probe?.sessions,
9177
+ node.lastProbe?.status?.sessions,
9178
+ node.last_probe?.status?.sessions
9179
+ ]) {
9168
9180
  if (Array.isArray(value)) candidates.push(...value);
9169
9181
  }
9170
9182
  for (const value of [node.activeSession, node.active_session, node.currentSession, node.current_session, node.runtimeSession, node.runtime_session, node.session]) {
@@ -11508,15 +11520,6 @@ function extractFinalSummaryFromMessages(messages, maxChars = DEFAULT_FINAL_SUMM
11508
11520
  if (text) return text.slice(0, maxChars);
11509
11521
  }
11510
11522
  }
11511
- for (let i = messages.length - 1; i >= 0; i--) {
11512
- const msg = messages[i];
11513
- if (!msg) continue;
11514
- const classification = classifyChatMessageVisibility(msg);
11515
- if (classification.isUserFacing) {
11516
- const text = flattenContent(msg.content).trim();
11517
- if (text) return text.slice(0, maxChars);
11518
- }
11519
- }
11520
11523
  return "";
11521
11524
  }
11522
11525
  var BUILTIN_CHAT_MESSAGE_KINDS = ["standard", "thought", "tool", "terminal", "system"];
@@ -15988,8 +15991,8 @@ function readCliProviderNativeHistory(agentStr, args) {
15988
15991
  historyBehavior: args.historyBehavior,
15989
15992
  scripts: args.scripts
15990
15993
  });
15991
- if (sessionHistory.source !== "native-unavailable" || !args.historySessionId || !args.workspace) {
15992
- return { ...sessionHistory, lookup: "session" };
15994
+ if (sessionHistory.source !== "native-unavailable" || args.exactSessionScoped || !args.historySessionId || !args.workspace) {
15995
+ return { ...sessionHistory, lookup: args.historySessionId ? "session" : "workspace" };
15993
15996
  }
15994
15997
  const workspaceHistory = readProviderChatHistory(agentStr, {
15995
15998
  canonicalHistory: args.canonicalHistory,
@@ -16610,6 +16613,9 @@ async function handleReadChat(h, args) {
16610
16613
  returnedMessages.length,
16611
16614
  200
16612
16615
  );
16616
+ const exactNativeHistoryScope = Boolean(
16617
+ typeof args?.historySessionId === "string" && args.historySessionId.trim() || typeof args?.providerSessionId === "string" && args.providerSessionId.trim() || providerSessionId || h.currentSession?.sessionId === args?.targetSessionId && typeof h.currentSession?.providerSessionId === "string" && h.currentSession.providerSessionId.trim()
16618
+ );
16613
16619
  let nativeHistory = null;
16614
16620
  try {
16615
16621
  nativeHistory = readCliProviderNativeHistory(agentStr, {
@@ -16620,7 +16626,8 @@ async function handleReadChat(h, args) {
16620
16626
  limit: nativeHistoryLimit,
16621
16627
  excludeRecentCount: 0,
16622
16628
  historyBehavior: provider?.historyBehavior,
16623
- scripts: provider?.scripts
16629
+ scripts: provider?.scripts,
16630
+ exactSessionScoped: exactNativeHistoryScope
16624
16631
  });
16625
16632
  } catch (error) {
16626
16633
  const fallbackReason = `native_history_error:${error?.message || String(error)}`;
@@ -16724,6 +16731,9 @@ async function handleReadChat(h, args) {
16724
16731
  try {
16725
16732
  const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h);
16726
16733
  const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
16734
+ const exactNativeHistoryScope = Boolean(
16735
+ typeof args?.historySessionId === "string" && args.historySessionId.trim() || typeof args?.providerSessionId === "string" && args.providerSessionId.trim() || h.currentSession?.sessionId === args?.targetSessionId && typeof h.currentSession?.providerSessionId === "string" && h.currentSession.providerSessionId.trim()
16736
+ );
16727
16737
  const history = supportsCliNativeTranscript(agentStr, provider) && isNativeSourceCanonicalHistory(provider?.canonicalHistory) ? readCliProviderNativeHistory(agentStr, {
16728
16738
  canonicalHistory: provider?.canonicalHistory,
16729
16739
  historySessionId,
@@ -16732,7 +16742,8 @@ async function handleReadChat(h, args) {
16732
16742
  limit: historyLimit,
16733
16743
  excludeRecentCount: 0,
16734
16744
  historyBehavior: provider?.historyBehavior,
16735
- scripts: provider?.scripts
16745
+ scripts: provider?.scripts,
16746
+ exactSessionScoped: exactNativeHistoryScope
16736
16747
  }) : readProviderChatHistory(agentStr, {
16737
16748
  canonicalHistory: provider?.canonicalHistory,
16738
16749
  historySessionId,
@@ -19495,6 +19506,7 @@ var CliProviderInstance = class {
19495
19506
  }
19496
19507
  const runtime = this.adapter.getRuntimeMetadata();
19497
19508
  this.maybeAppendRuntimeRecoveryMessage(runtime);
19509
+ const activeChatId = this.providerSessionId || runtime?.runtimeId || this.instanceId;
19498
19510
  let parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [];
19499
19511
  const historyMessageCount = Number.isFinite(parsedStatus?.historyMessageCount) ? Math.max(0, Number(parsedStatus.historyMessageCount)) : null;
19500
19512
  if (historyMessageCount !== null) {
@@ -19550,7 +19562,7 @@ var CliProviderInstance = class {
19550
19562
  status: visibleStatus,
19551
19563
  mode: this.presentationMode,
19552
19564
  activeChat: {
19553
- id: `${this.type}_${this.workingDir}`,
19565
+ id: activeChatId,
19554
19566
  title: parsedStatus?.title || dirName,
19555
19567
  status: activeChatStatus,
19556
19568
  messages: mergedMessages,