@adhdev/daemon-core 0.9.82-rc.124 → 0.9.82-rc.126

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
@@ -10255,6 +10255,7 @@ function buildMeshActiveWork(opts) {
10255
10255
  const live = sessionStatusFromNodes(opts.nodes, dispatch.nodeId, dispatch.sessionId);
10256
10256
  const status = terminalStatus || live.status || "assigned";
10257
10257
  const terminalRow = Boolean(terminal && terminal.kind !== "task_approval_needed");
10258
+ const ledgerOnlyStaleReason = !terminalRow && (status === "idle" || !terminalStatus && !live.status) ? "direct task dispatch has no provider acknowledgement, transcript append, or active runtime transition" : void 0;
10258
10259
  const message = readString2(dispatch.payload?.message) || readString2(dispatch.payload?.summary) || "";
10259
10260
  const { title, summary: summary2 } = summarizeMessage(message);
10260
10261
  const record = {
@@ -10275,13 +10276,13 @@ function buildMeshActiveWork(opts) {
10275
10276
  terminal: terminalRow,
10276
10277
  terminalKind: terminal?.kind,
10277
10278
  terminalAt: terminal?.timestamp,
10278
- staleReason: live.staleReason
10279
+ staleReason: live.staleReason || ledgerOnlyStaleReason
10279
10280
  };
10280
10281
  if (terminalRow) {
10281
10282
  terminalDirectWork.push(record);
10282
10283
  if (opts.includeTerminalDirect !== true) continue;
10283
10284
  }
10284
- if (live.staleReason && !terminalRow) {
10285
+ if ((live.staleReason || ledgerOnlyStaleReason) && !terminalRow) {
10285
10286
  staleDirectWork.push(record);
10286
10287
  continue;
10287
10288
  }
@@ -17076,12 +17077,17 @@ function buildCliMessageSourceProvenance(args) {
17076
17077
  const nativeMessages = args.nativeMessages || [];
17077
17078
  const ptyMessages = args.ptyMessages || [];
17078
17079
  const returnedMessages = args.returnedMessages || [];
17080
+ const identityStatus = args.selected === "native-history" ? "safe" : args.fallbackReason === "native_history_not_safely_mapped" ? "ambiguous_session_identity" : args.fallbackReason?.startsWith("native_history_unavailable") ? "transcript_unmapped" : void 0;
17079
17081
  return {
17080
17082
  selected: args.selected,
17081
17083
  provider: args.provider,
17082
17084
  providerType: args.provider,
17085
+ ...identityStatus ? { identityStatus } : {},
17083
17086
  ...args.nativeHandle ? { nativeHandle: args.nativeHandle } : {},
17084
17087
  ...args.nativeHandle ? { nativeSessionId: args.nativeHandle } : {},
17088
+ ...args.sessionWorkspace ? { sessionWorkspace: args.sessionWorkspace } : {},
17089
+ ...args.intendedWorkspace ? { intendedWorkspace: args.intendedWorkspace } : {},
17090
+ ...args.transcriptWorkspace ? { transcriptWorkspace: args.transcriptWorkspace } : {},
17085
17091
  ...args.fallbackReason ? { fallbackReason: args.fallbackReason } : {},
17086
17092
  ...args.nativeSource ? { nativeSource: args.nativeSource } : {},
17087
17093
  ...args.sourcePath ? { sourcePath: args.sourcePath } : {},
@@ -17100,7 +17106,10 @@ function buildCliMessageSourceProvenance(args) {
17100
17106
  nativeMessageCount: nativeMessages.length,
17101
17107
  ptyMessageCount: ptyMessages.length,
17102
17108
  returnedMessageCount: returnedMessages.length,
17103
- safeMapping: args.safeMapping === true
17109
+ safeMapping: args.safeMapping === true,
17110
+ // true when native-history was selected: PTY message bodies are suppressed and
17111
+ // must not be treated as chat content. PTY only contributes status/approval/screen evidence.
17112
+ ptyMessagesSuppressed: args.selected === "native-history"
17104
17113
  }
17105
17114
  };
17106
17115
  }
@@ -17612,7 +17621,14 @@ async function handleGetChatDebugBundle(h, args) {
17612
17621
  activeModal: readResult.activeModal,
17613
17622
  messagesTail: Array.isArray(readResult.messages) ? readResult.messages.slice(-20) : [],
17614
17623
  debugReadChat: readResult.debugReadChat
17615
- } : { success: false, error: readResult.error };
17624
+ } : {
17625
+ success: false,
17626
+ error: readResult.error,
17627
+ code: readResult.code,
17628
+ messageSource: readResult.messageSource,
17629
+ transcriptProvenance: readResult.transcriptProvenance,
17630
+ debugReadChat: readResult.debugReadChat
17631
+ };
17616
17632
  } catch (error) {
17617
17633
  readChat = { success: false, error: error?.message || String(error) };
17618
17634
  }
@@ -17844,17 +17860,21 @@ async function handleReadChat(h, args) {
17844
17860
  let selectedProviderSessionId = providerSessionId;
17845
17861
  let selectedTranscriptAuthority = transcriptAuthority;
17846
17862
  let selectedCoverage = coverage;
17863
+ const sessionWorkspace = typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : typeof adapter.workingDir === "string" ? adapter.workingDir : void 0;
17864
+ const intendedWorkspace = typeof args?.workspace === "string" ? args.workspace : void 0;
17847
17865
  let messageSource = buildCliMessageSourceProvenance({
17848
17866
  selected: "pty-parser",
17849
17867
  provider: adapter.cliType,
17850
17868
  fallbackReason: supportsCliNativeTranscript(providerType, provider) ? "native_history_not_checked" : "provider_native_transcript_not_supported",
17869
+ sessionWorkspace,
17870
+ intendedWorkspace,
17851
17871
  ptyMessages: returnedMessages,
17852
17872
  returnedMessages,
17853
17873
  ptyStatusApprovalOnly: false
17854
17874
  });
17855
17875
  if (supportsCliNativeTranscript(providerType, provider) && isNativeSourceCanonicalHistory(provider?.canonicalHistory)) {
17856
17876
  const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h, adapter.cliType);
17857
- const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : typeof adapter.workingDir === "string" ? adapter.workingDir : void 0;
17877
+ const workspace = sessionWorkspace;
17858
17878
  const nativeHistoryLimit = Math.max(
17859
17879
  normalizeReadChatTailLimit(args) || 0,
17860
17880
  returnedMessages.length,
@@ -17883,6 +17903,8 @@ async function handleReadChat(h, args) {
17883
17903
  selected: "pty-parser",
17884
17904
  provider: adapter.cliType,
17885
17905
  fallbackReason,
17906
+ sessionWorkspace,
17907
+ intendedWorkspace,
17886
17908
  ptyMessages: returnedMessages,
17887
17909
  returnedMessages,
17888
17910
  ptyStatusApprovalOnly: false
@@ -17896,6 +17918,7 @@ async function handleReadChat(h, args) {
17896
17918
  const partialReason = typeof nativeHistory?.partialReason === "string" ? nativeHistory.partialReason : void 0;
17897
17919
  const unavailableReason = typeof nativeHistory?.unavailableReason === "string" ? nativeHistory.unavailableReason : void 0;
17898
17920
  const lookup = nativeHistory.lookup === "workspace" ? "workspace" : "session";
17921
+ const transcriptWorkspace = typeof nativeHistory?.workspace === "string" ? nativeHistory.workspace : nativeMessages.map((message) => typeof message?.workspace === "string" ? message.workspace.trim() : "").find(Boolean);
17899
17922
  const nativeHistorySessionForMapping = adapter.cliType === "antigravity-cli" && historyProviderSessionId && nativeHistorySessionId && historyProviderSessionId !== nativeHistorySessionId ? void 0 : nativeHistorySessionId;
17900
17923
  const safeMapping = hasSafeNativeHistoryMapping({
17901
17924
  historySessionId: lookup === "workspace" ? void 0 : nativeHistorySessionForMapping,
@@ -17921,6 +17944,9 @@ async function handleReadChat(h, args) {
17921
17944
  selected: "native-history",
17922
17945
  provider: adapter.cliType,
17923
17946
  nativeHandle: selectedProviderSessionId || nativeHistorySessionId || historySessionId,
17947
+ sessionWorkspace,
17948
+ intendedWorkspace,
17949
+ transcriptWorkspace,
17924
17950
  nativeSource: nativeHistory.source,
17925
17951
  sourcePath: nativeHistory.sourcePath,
17926
17952
  sourceMtimeMs: nativeHistory.sourceMtimeMs,
@@ -17949,6 +17975,9 @@ async function handleReadChat(h, args) {
17949
17975
  selected: "pty-parser",
17950
17976
  provider: adapter.cliType,
17951
17977
  nativeHandle: historyProviderSessionId || nativeHistorySessionId || historySessionId,
17978
+ sessionWorkspace,
17979
+ intendedWorkspace,
17980
+ transcriptWorkspace,
17952
17981
  fallbackReason,
17953
17982
  nativeSource: nativeHistory.source,
17954
17983
  sourcePath: nativeHistory.sourcePath,
@@ -17994,7 +18023,8 @@ async function handleReadChat(h, args) {
17994
18023
  const historyLimit = normalizeReadChatTailLimit(args);
17995
18024
  try {
17996
18025
  const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h);
17997
- const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
18026
+ const workspace = typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
18027
+ const intendedWorkspace = typeof args?.workspace === "string" ? args.workspace : void 0;
17998
18028
  const exactNativeHistoryScope = Boolean(
17999
18029
  typeof args?.targetSessionId === "string" && args.targetSessionId.trim() || 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()
18000
18030
  );
@@ -18023,6 +18053,7 @@ async function handleReadChat(h, args) {
18023
18053
  const nativeHistoryCoverage = typeof history?.nativeHistoryCoverage === "string" ? history.nativeHistoryCoverage : void 0;
18024
18054
  const partialReason = typeof history?.partialReason === "string" ? history.partialReason : void 0;
18025
18055
  const unavailableReason = typeof history?.unavailableReason === "string" ? history.unavailableReason : void 0;
18056
+ const transcriptWorkspace = typeof history?.workspace === "string" ? history.workspace : historyMessages.map((message) => typeof message?.workspace === "string" ? message.workspace.trim() : "").find(Boolean);
18026
18057
  const safeMapping = supportsCliNativeTranscript(agentStr, provider) ? hasSafeNativeHistoryMapping({
18027
18058
  historySessionId: lookup === "workspace" ? void 0 : historySessionId,
18028
18059
  providerSessionId: lookup === "workspace" ? void 0 : historyProviderSessionId,
@@ -18034,6 +18065,9 @@ async function handleReadChat(h, args) {
18034
18065
  selected: nativeSelected ? "native-history" : "pty-parser",
18035
18066
  provider: agentStr,
18036
18067
  nativeHandle: historyProviderSessionId || historySessionId,
18068
+ sessionWorkspace: workspace,
18069
+ intendedWorkspace,
18070
+ transcriptWorkspace,
18037
18071
  fallbackReason: nativeSelected ? void 0 : buildNativeHistoryFallbackReason({
18038
18072
  providerType: agentStr,
18039
18073
  provider,