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

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
@@ -16841,9 +16841,9 @@ function buildCliMessageSourceProvenance(args) {
16841
16841
  ptyMessageCount: ptyMessages.length,
16842
16842
  returnedMessageCount: returnedMessages.length,
16843
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"
16844
+ // true when PTY message bodies are suppressed and must not be treated as
16845
+ // chat content. PTY may still contribute status/approval/screen evidence.
16846
+ ptyMessagesSuppressed: args.selected === "native-history" || args.ptyStatusApprovalOnly === true
16847
16847
  }
16848
16848
  };
16849
16849
  }
@@ -16859,6 +16859,14 @@ function buildNativeHistoryFallbackReason(args) {
16859
16859
  if (!args.freshEnough) return "native_history_stale";
16860
16860
  return "native_history_not_selected";
16861
16861
  }
16862
+ function isUnsafeNativeTranscriptFallback(reason) {
16863
+ const value = String(reason || "").trim();
16864
+ return value.startsWith("native_history_unavailable") || value === "native_history_not_safely_mapped" || value === "native_history_stale" || value === "native_history_partial";
16865
+ }
16866
+ function coerceUnsafeNativeFallbackStatus(status, activeModal) {
16867
+ if (status === "waiting_approval" && activeModal) return status;
16868
+ return "idle";
16869
+ }
16862
16870
  function supportsCliNativeTranscript(providerType, provider) {
16863
16871
  if (CLI_NATIVE_TRANSCRIPT_PROVIDERS.has(providerType)) return true;
16864
16872
  return provider?.category === "cli" && isNativeSourceCanonicalHistory(provider?.canonicalHistory);
@@ -17594,6 +17602,7 @@ async function handleReadChat(h, args) {
17594
17602
  let selectedProviderSessionId = providerSessionId;
17595
17603
  let selectedTranscriptAuthority = transcriptAuthority;
17596
17604
  let selectedCoverage = coverage;
17605
+ let selectedStatus = returnedStatus;
17597
17606
  const sessionWorkspace = typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : typeof adapter.workingDir === "string" ? adapter.workingDir : void 0;
17598
17607
  const intendedWorkspace = typeof args?.workspace === "string" ? args.workspace : void 0;
17599
17608
  let messageSource = buildCliMessageSourceProvenance({
@@ -17705,6 +17714,13 @@ async function handleReadChat(h, args) {
17705
17714
  safeMapping,
17706
17715
  freshEnough
17707
17716
  });
17717
+ const unsafeNativeFallback = adapter.cliType === "codex-cli" && isUnsafeNativeTranscriptFallback(fallbackReason);
17718
+ if (unsafeNativeFallback) {
17719
+ selectedMessages = [];
17720
+ selectedTranscriptAuthority = void 0;
17721
+ selectedCoverage = void 0;
17722
+ selectedStatus = coerceUnsafeNativeFallbackStatus(returnedStatus, activeModal);
17723
+ }
17708
17724
  messageSource = buildCliMessageSourceProvenance({
17709
17725
  selected: "pty-parser",
17710
17726
  provider: adapter.cliType,
@@ -17721,10 +17737,10 @@ async function handleReadChat(h, args) {
17721
17737
  unavailableReason,
17722
17738
  nativeMessages,
17723
17739
  ptyMessages: returnedMessages,
17724
- returnedMessages,
17740
+ returnedMessages: unsafeNativeFallback ? [] : returnedMessages,
17725
17741
  safeMapping,
17726
17742
  freshEnough,
17727
- ptyStatusApprovalOnly: false
17743
+ ptyStatusApprovalOnly: unsafeNativeFallback
17728
17744
  });
17729
17745
  }
17730
17746
  }
@@ -17732,7 +17748,7 @@ async function handleReadChat(h, args) {
17732
17748
  LOG.debug("Command", `[read_chat] cli-like parsed provider=${adapter.cliType} target=${String(args?.targetSessionId || "")} adapterStatus=${String(adapterStatus.status || "")} parsedStatus=${String(parsedRecord.status || "")} parsedMsgCount=${parsedRecord.messages.length} returnedMsgCount=${returnedMessages.length}`);
17733
17749
  return buildReadChatCommandResult({
17734
17750
  messages: selectedMessages,
17735
- status: returnedStatus,
17751
+ status: selectedStatus,
17736
17752
  activeModal,
17737
17753
  messageSource,
17738
17754
  transcriptProvenance: messageSource,
@@ -17741,10 +17757,10 @@ async function handleReadChat(h, args) {
17741
17757
  targetSessionId: String(args?.targetSessionId || ""),
17742
17758
  adapterStatus: String(adapterStatus.status || ""),
17743
17759
  parsedStatus: String(parsedRecord.status || ""),
17744
- returnedStatus: String(returnedStatus || ""),
17760
+ returnedStatus: String(selectedStatus || ""),
17745
17761
  selectedMessageSource: messageSource.selected,
17746
17762
  messageSource,
17747
- shouldPreferAdapterMessages: supportsCliNativeTranscript(providerType, provider) && isNativeSourceCanonicalHistory(provider?.canonicalHistory) && messageSource.selected !== "native-history" && typeof messageSource.fallbackReason === "string" && messageSource.fallbackReason.startsWith("native_history_") && messageSource.fallbackReason !== "native_history_not_checked" && !(selectedTranscriptAuthority === "provider" && selectedCoverage === "full"),
17763
+ shouldPreferAdapterMessages: supportsCliNativeTranscript(providerType, provider) && isNativeSourceCanonicalHistory(provider?.canonicalHistory) && messageSource.selected !== "native-history" && typeof messageSource.fallbackReason === "string" && messageSource.fallbackReason.startsWith("native_history_") && messageSource.fallbackReason !== "native_history_not_checked" && !isUnsafeNativeTranscriptFallback(messageSource.fallbackReason) && !(selectedTranscriptAuthority === "provider" && selectedCoverage === "full"),
17748
17764
  parsedMsgCount: parsedRecord.messages.length,
17749
17765
  returnedMsgCount: selectedMessages.length
17750
17766
  },