@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.mjs CHANGED
@@ -9989,6 +9989,7 @@ function buildMeshActiveWork(opts) {
9989
9989
  const live = sessionStatusFromNodes(opts.nodes, dispatch.nodeId, dispatch.sessionId);
9990
9990
  const status = terminalStatus || live.status || "assigned";
9991
9991
  const terminalRow = Boolean(terminal && terminal.kind !== "task_approval_needed");
9992
+ const ledgerOnlyStaleReason = !terminalRow && (status === "idle" || !terminalStatus && !live.status) ? "direct task dispatch has no provider acknowledgement, transcript append, or active runtime transition" : void 0;
9992
9993
  const message = readString2(dispatch.payload?.message) || readString2(dispatch.payload?.summary) || "";
9993
9994
  const { title, summary: summary2 } = summarizeMessage(message);
9994
9995
  const record = {
@@ -10009,13 +10010,13 @@ function buildMeshActiveWork(opts) {
10009
10010
  terminal: terminalRow,
10010
10011
  terminalKind: terminal?.kind,
10011
10012
  terminalAt: terminal?.timestamp,
10012
- staleReason: live.staleReason
10013
+ staleReason: live.staleReason || ledgerOnlyStaleReason
10013
10014
  };
10014
10015
  if (terminalRow) {
10015
10016
  terminalDirectWork.push(record);
10016
10017
  if (opts.includeTerminalDirect !== true) continue;
10017
10018
  }
10018
- if (live.staleReason && !terminalRow) {
10019
+ if ((live.staleReason || ledgerOnlyStaleReason) && !terminalRow) {
10019
10020
  staleDirectWork.push(record);
10020
10021
  continue;
10021
10022
  }
@@ -16810,12 +16811,17 @@ function buildCliMessageSourceProvenance(args) {
16810
16811
  const nativeMessages = args.nativeMessages || [];
16811
16812
  const ptyMessages = args.ptyMessages || [];
16812
16813
  const returnedMessages = args.returnedMessages || [];
16814
+ 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;
16813
16815
  return {
16814
16816
  selected: args.selected,
16815
16817
  provider: args.provider,
16816
16818
  providerType: args.provider,
16819
+ ...identityStatus ? { identityStatus } : {},
16817
16820
  ...args.nativeHandle ? { nativeHandle: args.nativeHandle } : {},
16818
16821
  ...args.nativeHandle ? { nativeSessionId: args.nativeHandle } : {},
16822
+ ...args.sessionWorkspace ? { sessionWorkspace: args.sessionWorkspace } : {},
16823
+ ...args.intendedWorkspace ? { intendedWorkspace: args.intendedWorkspace } : {},
16824
+ ...args.transcriptWorkspace ? { transcriptWorkspace: args.transcriptWorkspace } : {},
16819
16825
  ...args.fallbackReason ? { fallbackReason: args.fallbackReason } : {},
16820
16826
  ...args.nativeSource ? { nativeSource: args.nativeSource } : {},
16821
16827
  ...args.sourcePath ? { sourcePath: args.sourcePath } : {},
@@ -16834,7 +16840,10 @@ function buildCliMessageSourceProvenance(args) {
16834
16840
  nativeMessageCount: nativeMessages.length,
16835
16841
  ptyMessageCount: ptyMessages.length,
16836
16842
  returnedMessageCount: returnedMessages.length,
16837
- safeMapping: args.safeMapping === true
16843
+ safeMapping: args.safeMapping === true,
16844
+ // true when native-history was selected: PTY message bodies are suppressed and
16845
+ // must not be treated as chat content. PTY only contributes status/approval/screen evidence.
16846
+ ptyMessagesSuppressed: args.selected === "native-history"
16838
16847
  }
16839
16848
  };
16840
16849
  }
@@ -17346,7 +17355,14 @@ async function handleGetChatDebugBundle(h, args) {
17346
17355
  activeModal: readResult.activeModal,
17347
17356
  messagesTail: Array.isArray(readResult.messages) ? readResult.messages.slice(-20) : [],
17348
17357
  debugReadChat: readResult.debugReadChat
17349
- } : { success: false, error: readResult.error };
17358
+ } : {
17359
+ success: false,
17360
+ error: readResult.error,
17361
+ code: readResult.code,
17362
+ messageSource: readResult.messageSource,
17363
+ transcriptProvenance: readResult.transcriptProvenance,
17364
+ debugReadChat: readResult.debugReadChat
17365
+ };
17350
17366
  } catch (error) {
17351
17367
  readChat = { success: false, error: error?.message || String(error) };
17352
17368
  }
@@ -17578,17 +17594,21 @@ async function handleReadChat(h, args) {
17578
17594
  let selectedProviderSessionId = providerSessionId;
17579
17595
  let selectedTranscriptAuthority = transcriptAuthority;
17580
17596
  let selectedCoverage = coverage;
17597
+ const sessionWorkspace = typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : typeof adapter.workingDir === "string" ? adapter.workingDir : void 0;
17598
+ const intendedWorkspace = typeof args?.workspace === "string" ? args.workspace : void 0;
17581
17599
  let messageSource = buildCliMessageSourceProvenance({
17582
17600
  selected: "pty-parser",
17583
17601
  provider: adapter.cliType,
17584
17602
  fallbackReason: supportsCliNativeTranscript(providerType, provider) ? "native_history_not_checked" : "provider_native_transcript_not_supported",
17603
+ sessionWorkspace,
17604
+ intendedWorkspace,
17585
17605
  ptyMessages: returnedMessages,
17586
17606
  returnedMessages,
17587
17607
  ptyStatusApprovalOnly: false
17588
17608
  });
17589
17609
  if (supportsCliNativeTranscript(providerType, provider) && isNativeSourceCanonicalHistory(provider?.canonicalHistory)) {
17590
17610
  const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h, adapter.cliType);
17591
- const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : typeof adapter.workingDir === "string" ? adapter.workingDir : void 0;
17611
+ const workspace = sessionWorkspace;
17592
17612
  const nativeHistoryLimit = Math.max(
17593
17613
  normalizeReadChatTailLimit(args) || 0,
17594
17614
  returnedMessages.length,
@@ -17617,6 +17637,8 @@ async function handleReadChat(h, args) {
17617
17637
  selected: "pty-parser",
17618
17638
  provider: adapter.cliType,
17619
17639
  fallbackReason,
17640
+ sessionWorkspace,
17641
+ intendedWorkspace,
17620
17642
  ptyMessages: returnedMessages,
17621
17643
  returnedMessages,
17622
17644
  ptyStatusApprovalOnly: false
@@ -17630,6 +17652,7 @@ async function handleReadChat(h, args) {
17630
17652
  const partialReason = typeof nativeHistory?.partialReason === "string" ? nativeHistory.partialReason : void 0;
17631
17653
  const unavailableReason = typeof nativeHistory?.unavailableReason === "string" ? nativeHistory.unavailableReason : void 0;
17632
17654
  const lookup = nativeHistory.lookup === "workspace" ? "workspace" : "session";
17655
+ const transcriptWorkspace = typeof nativeHistory?.workspace === "string" ? nativeHistory.workspace : nativeMessages.map((message) => typeof message?.workspace === "string" ? message.workspace.trim() : "").find(Boolean);
17633
17656
  const nativeHistorySessionForMapping = adapter.cliType === "antigravity-cli" && historyProviderSessionId && nativeHistorySessionId && historyProviderSessionId !== nativeHistorySessionId ? void 0 : nativeHistorySessionId;
17634
17657
  const safeMapping = hasSafeNativeHistoryMapping({
17635
17658
  historySessionId: lookup === "workspace" ? void 0 : nativeHistorySessionForMapping,
@@ -17655,6 +17678,9 @@ async function handleReadChat(h, args) {
17655
17678
  selected: "native-history",
17656
17679
  provider: adapter.cliType,
17657
17680
  nativeHandle: selectedProviderSessionId || nativeHistorySessionId || historySessionId,
17681
+ sessionWorkspace,
17682
+ intendedWorkspace,
17683
+ transcriptWorkspace,
17658
17684
  nativeSource: nativeHistory.source,
17659
17685
  sourcePath: nativeHistory.sourcePath,
17660
17686
  sourceMtimeMs: nativeHistory.sourceMtimeMs,
@@ -17683,6 +17709,9 @@ async function handleReadChat(h, args) {
17683
17709
  selected: "pty-parser",
17684
17710
  provider: adapter.cliType,
17685
17711
  nativeHandle: historyProviderSessionId || nativeHistorySessionId || historySessionId,
17712
+ sessionWorkspace,
17713
+ intendedWorkspace,
17714
+ transcriptWorkspace,
17686
17715
  fallbackReason,
17687
17716
  nativeSource: nativeHistory.source,
17688
17717
  sourcePath: nativeHistory.sourcePath,
@@ -17728,7 +17757,8 @@ async function handleReadChat(h, args) {
17728
17757
  const historyLimit = normalizeReadChatTailLimit(args);
17729
17758
  try {
17730
17759
  const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h);
17731
- const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
17760
+ const workspace = typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : void 0;
17761
+ const intendedWorkspace = typeof args?.workspace === "string" ? args.workspace : void 0;
17732
17762
  const exactNativeHistoryScope = Boolean(
17733
17763
  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()
17734
17764
  );
@@ -17757,6 +17787,7 @@ async function handleReadChat(h, args) {
17757
17787
  const nativeHistoryCoverage = typeof history?.nativeHistoryCoverage === "string" ? history.nativeHistoryCoverage : void 0;
17758
17788
  const partialReason = typeof history?.partialReason === "string" ? history.partialReason : void 0;
17759
17789
  const unavailableReason = typeof history?.unavailableReason === "string" ? history.unavailableReason : void 0;
17790
+ const transcriptWorkspace = typeof history?.workspace === "string" ? history.workspace : historyMessages.map((message) => typeof message?.workspace === "string" ? message.workspace.trim() : "").find(Boolean);
17760
17791
  const safeMapping = supportsCliNativeTranscript(agentStr, provider) ? hasSafeNativeHistoryMapping({
17761
17792
  historySessionId: lookup === "workspace" ? void 0 : historySessionId,
17762
17793
  providerSessionId: lookup === "workspace" ? void 0 : historyProviderSessionId,
@@ -17768,6 +17799,9 @@ async function handleReadChat(h, args) {
17768
17799
  selected: nativeSelected ? "native-history" : "pty-parser",
17769
17800
  provider: agentStr,
17770
17801
  nativeHandle: historyProviderSessionId || historySessionId,
17802
+ sessionWorkspace: workspace,
17803
+ intendedWorkspace,
17804
+ transcriptWorkspace,
17771
17805
  fallbackReason: nativeSelected ? void 0 : buildNativeHistoryFallbackReason({
17772
17806
  providerType: agentStr,
17773
17807
  provider,