@adhdev/daemon-core 0.9.82-rc.127 → 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.js CHANGED
@@ -17107,9 +17107,9 @@ function buildCliMessageSourceProvenance(args) {
17107
17107
  ptyMessageCount: ptyMessages.length,
17108
17108
  returnedMessageCount: returnedMessages.length,
17109
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"
17110
+ // true when PTY message bodies are suppressed and must not be treated as
17111
+ // chat content. PTY may still contribute status/approval/screen evidence.
17112
+ ptyMessagesSuppressed: args.selected === "native-history" || args.ptyStatusApprovalOnly === true
17113
17113
  }
17114
17114
  };
17115
17115
  }
@@ -17125,6 +17125,14 @@ function buildNativeHistoryFallbackReason(args) {
17125
17125
  if (!args.freshEnough) return "native_history_stale";
17126
17126
  return "native_history_not_selected";
17127
17127
  }
17128
+ function isUnsafeNativeTranscriptFallback(reason) {
17129
+ const value = String(reason || "").trim();
17130
+ return value.startsWith("native_history_unavailable") || value === "native_history_not_safely_mapped" || value === "native_history_stale" || value === "native_history_partial";
17131
+ }
17132
+ function coerceUnsafeNativeFallbackStatus(status, activeModal) {
17133
+ if (status === "waiting_approval" && activeModal) return status;
17134
+ return "idle";
17135
+ }
17128
17136
  function supportsCliNativeTranscript(providerType, provider) {
17129
17137
  if (CLI_NATIVE_TRANSCRIPT_PROVIDERS.has(providerType)) return true;
17130
17138
  return provider?.category === "cli" && isNativeSourceCanonicalHistory(provider?.canonicalHistory);
@@ -17860,6 +17868,7 @@ async function handleReadChat(h, args) {
17860
17868
  let selectedProviderSessionId = providerSessionId;
17861
17869
  let selectedTranscriptAuthority = transcriptAuthority;
17862
17870
  let selectedCoverage = coverage;
17871
+ let selectedStatus = returnedStatus;
17863
17872
  const sessionWorkspace = typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : typeof adapter.workingDir === "string" ? adapter.workingDir : void 0;
17864
17873
  const intendedWorkspace = typeof args?.workspace === "string" ? args.workspace : void 0;
17865
17874
  let messageSource = buildCliMessageSourceProvenance({
@@ -17971,6 +17980,13 @@ async function handleReadChat(h, args) {
17971
17980
  safeMapping,
17972
17981
  freshEnough
17973
17982
  });
17983
+ const unsafeNativeFallback = adapter.cliType === "codex-cli" && isUnsafeNativeTranscriptFallback(fallbackReason);
17984
+ if (unsafeNativeFallback) {
17985
+ selectedMessages = [];
17986
+ selectedTranscriptAuthority = void 0;
17987
+ selectedCoverage = void 0;
17988
+ selectedStatus = coerceUnsafeNativeFallbackStatus(returnedStatus, activeModal);
17989
+ }
17974
17990
  messageSource = buildCliMessageSourceProvenance({
17975
17991
  selected: "pty-parser",
17976
17992
  provider: adapter.cliType,
@@ -17987,10 +18003,10 @@ async function handleReadChat(h, args) {
17987
18003
  unavailableReason,
17988
18004
  nativeMessages,
17989
18005
  ptyMessages: returnedMessages,
17990
- returnedMessages,
18006
+ returnedMessages: unsafeNativeFallback ? [] : returnedMessages,
17991
18007
  safeMapping,
17992
18008
  freshEnough,
17993
- ptyStatusApprovalOnly: false
18009
+ ptyStatusApprovalOnly: unsafeNativeFallback
17994
18010
  });
17995
18011
  }
17996
18012
  }
@@ -17998,7 +18014,7 @@ async function handleReadChat(h, args) {
17998
18014
  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}`);
17999
18015
  return buildReadChatCommandResult({
18000
18016
  messages: selectedMessages,
18001
- status: returnedStatus,
18017
+ status: selectedStatus,
18002
18018
  activeModal,
18003
18019
  messageSource,
18004
18020
  transcriptProvenance: messageSource,
@@ -18007,10 +18023,10 @@ async function handleReadChat(h, args) {
18007
18023
  targetSessionId: String(args?.targetSessionId || ""),
18008
18024
  adapterStatus: String(adapterStatus.status || ""),
18009
18025
  parsedStatus: String(parsedRecord.status || ""),
18010
- returnedStatus: String(returnedStatus || ""),
18026
+ returnedStatus: String(selectedStatus || ""),
18011
18027
  selectedMessageSource: messageSource.selected,
18012
18028
  messageSource,
18013
- 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"),
18029
+ 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"),
18014
18030
  parsedMsgCount: parsedRecord.messages.length,
18015
18031
  returnedMsgCount: selectedMessages.length
18016
18032
  },