@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.js CHANGED
@@ -9423,7 +9423,19 @@ function sessionStatusFromNodes(nodes, nodeId, sessionId) {
9423
9423
  if (!node) return { staleReason: "direct task node is no longer in the live mesh" };
9424
9424
  if (!sessionId) return {};
9425
9425
  const candidates = [];
9426
- 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]) {
9426
+ for (const value of [
9427
+ node.sessions,
9428
+ node.activeSessions,
9429
+ node.active_sessions,
9430
+ node.activeSessionDetails,
9431
+ node.active_session_details,
9432
+ node.sessionDetails,
9433
+ node.session_details,
9434
+ node.lastProbe?.sessions,
9435
+ node.last_probe?.sessions,
9436
+ node.lastProbe?.status?.sessions,
9437
+ node.last_probe?.status?.sessions
9438
+ ]) {
9427
9439
  if (Array.isArray(value)) candidates.push(...value);
9428
9440
  }
9429
9441
  for (const value of [node.activeSession, node.active_session, node.currentSession, node.current_session, node.runtimeSession, node.runtime_session, node.session]) {
@@ -11767,15 +11779,6 @@ function extractFinalSummaryFromMessages(messages, maxChars = DEFAULT_FINAL_SUMM
11767
11779
  if (text) return text.slice(0, maxChars);
11768
11780
  }
11769
11781
  }
11770
- for (let i = messages.length - 1; i >= 0; i--) {
11771
- const msg = messages[i];
11772
- if (!msg) continue;
11773
- const classification = classifyChatMessageVisibility(msg);
11774
- if (classification.isUserFacing) {
11775
- const text = flattenContent(msg.content).trim();
11776
- if (text) return text.slice(0, maxChars);
11777
- }
11778
- }
11779
11782
  return "";
11780
11783
  }
11781
11784
  var BUILTIN_CHAT_MESSAGE_KINDS = ["standard", "thought", "tool", "terminal", "system"];
@@ -16247,8 +16250,8 @@ function readCliProviderNativeHistory(agentStr, args) {
16247
16250
  historyBehavior: args.historyBehavior,
16248
16251
  scripts: args.scripts
16249
16252
  });
16250
- if (sessionHistory.source !== "native-unavailable" || !args.historySessionId || !args.workspace) {
16251
- return { ...sessionHistory, lookup: "session" };
16253
+ if (sessionHistory.source !== "native-unavailable" || args.exactSessionScoped || !args.historySessionId || !args.workspace) {
16254
+ return { ...sessionHistory, lookup: args.historySessionId ? "session" : "workspace" };
16252
16255
  }
16253
16256
  const workspaceHistory = readProviderChatHistory(agentStr, {
16254
16257
  canonicalHistory: args.canonicalHistory,
@@ -16869,6 +16872,9 @@ async function handleReadChat(h, args) {
16869
16872
  returnedMessages.length,
16870
16873
  200
16871
16874
  );
16875
+ const exactNativeHistoryScope = Boolean(
16876
+ 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()
16877
+ );
16872
16878
  let nativeHistory = null;
16873
16879
  try {
16874
16880
  nativeHistory = readCliProviderNativeHistory(agentStr, {
@@ -16879,7 +16885,8 @@ async function handleReadChat(h, args) {
16879
16885
  limit: nativeHistoryLimit,
16880
16886
  excludeRecentCount: 0,
16881
16887
  historyBehavior: provider?.historyBehavior,
16882
- scripts: provider?.scripts
16888
+ scripts: provider?.scripts,
16889
+ exactSessionScoped: exactNativeHistoryScope
16883
16890
  });
16884
16891
  } catch (error) {
16885
16892
  const fallbackReason = `native_history_error:${error?.message || String(error)}`;
@@ -16983,6 +16990,9 @@ async function handleReadChat(h, args) {
16983
16990
  try {
16984
16991
  const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h);
16985
16992
  const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
16993
+ const exactNativeHistoryScope = Boolean(
16994
+ 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()
16995
+ );
16986
16996
  const history = supportsCliNativeTranscript(agentStr, provider) && isNativeSourceCanonicalHistory(provider?.canonicalHistory) ? readCliProviderNativeHistory(agentStr, {
16987
16997
  canonicalHistory: provider?.canonicalHistory,
16988
16998
  historySessionId,
@@ -16991,7 +17001,8 @@ async function handleReadChat(h, args) {
16991
17001
  limit: historyLimit,
16992
17002
  excludeRecentCount: 0,
16993
17003
  historyBehavior: provider?.historyBehavior,
16994
- scripts: provider?.scripts
17004
+ scripts: provider?.scripts,
17005
+ exactSessionScoped: exactNativeHistoryScope
16995
17006
  }) : readProviderChatHistory(agentStr, {
16996
17007
  canonicalHistory: provider?.canonicalHistory,
16997
17008
  historySessionId,
@@ -19754,6 +19765,7 @@ var CliProviderInstance = class {
19754
19765
  }
19755
19766
  const runtime = this.adapter.getRuntimeMetadata();
19756
19767
  this.maybeAppendRuntimeRecoveryMessage(runtime);
19768
+ const activeChatId = this.providerSessionId || runtime?.runtimeId || this.instanceId;
19757
19769
  let parsedMessages = Array.isArray(parsedStatus?.messages) ? parsedStatus.messages : [];
19758
19770
  const historyMessageCount = Number.isFinite(parsedStatus?.historyMessageCount) ? Math.max(0, Number(parsedStatus.historyMessageCount)) : null;
19759
19771
  if (historyMessageCount !== null) {
@@ -19809,7 +19821,7 @@ var CliProviderInstance = class {
19809
19821
  status: visibleStatus,
19810
19822
  mode: this.presentationMode,
19811
19823
  activeChat: {
19812
- id: `${this.type}_${this.workingDir}`,
19824
+ id: activeChatId,
19813
19825
  title: parsedStatus?.title || dirName,
19814
19826
  status: activeChatStatus,
19815
19827
  messages: mergedMessages,