@adhdev/daemon-core 0.9.82-rc.83 → 0.9.82-rc.85

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
@@ -16136,7 +16136,7 @@ function buildCliMessageSourceProvenance(args) {
16136
16136
  };
16137
16137
  }
16138
16138
  function buildNativeHistoryFallbackReason(args) {
16139
- if (!supportsCliNativeTranscript(args.providerType)) return "provider_native_transcript_not_supported";
16139
+ if (!supportsCliNativeTranscript(args.providerType, args.provider)) return "provider_native_transcript_not_supported";
16140
16140
  if (args.nativeSource === "native-unavailable") return "native_history_unavailable";
16141
16141
  if (args.nativeSource && args.nativeSource !== "provider-native") return `native_history_source_${args.nativeSource}`;
16142
16142
  if (args.nativeMessageCount <= 0) return "native_history_empty";
@@ -16144,8 +16144,9 @@ function buildNativeHistoryFallbackReason(args) {
16144
16144
  if (!args.freshEnough) return "native_history_stale";
16145
16145
  return "native_history_not_selected";
16146
16146
  }
16147
- function supportsCliNativeTranscript(providerType) {
16148
- return CLI_NATIVE_TRANSCRIPT_PROVIDERS.has(providerType);
16147
+ function supportsCliNativeTranscript(providerType, provider) {
16148
+ if (CLI_NATIVE_TRANSCRIPT_PROVIDERS.has(providerType)) return true;
16149
+ return provider?.category === "cli" && provider?.canonicalHistory?.mode === "native-source";
16149
16150
  }
16150
16151
  function hasSafeNativeHistoryMapping(args) {
16151
16152
  const explicitSessionId = String(args.historySessionId || args.providerSessionId || "").trim();
@@ -16224,6 +16225,15 @@ function normalizeReadChatCommandStatus(status, activeModal) {
16224
16225
  function isGeneratingLikeStatus(status) {
16225
16226
  return status === "generating" || status === "streaming" || status === "long_generating" || status === "starting";
16226
16227
  }
16228
+ function hasVisibleAssistantMessage(messages) {
16229
+ if (!Array.isArray(messages)) return false;
16230
+ return messages.some((message) => {
16231
+ if (!message || message.role !== "assistant") return false;
16232
+ const kind = typeof message.kind === "string" ? message.kind : "standard";
16233
+ if (kind !== "standard") return false;
16234
+ return String(message.content || "").trim().length > 0;
16235
+ });
16236
+ }
16227
16237
  function shouldTrustCliAdapterTerminalStatus(parsedStatus, activeModal, adapter, adapterStatus) {
16228
16238
  if (!isGeneratingLikeStatus(parsedStatus)) return false;
16229
16239
  if (hasNonEmptyModalButtons(activeModal)) return false;
@@ -16237,6 +16247,9 @@ function normalizeCliReadChatStatus(parsedStatus, activeModal, adapter, adapterS
16237
16247
  if (adapterRawStatus === "starting" && isGeneratingLikeStatus(parsedStatus) && !hasNonEmptyModalButtons(activeModal) && Array.isArray(parsedMessages) && parsedMessages.length === 0 && Array.isArray(adapterStatus?.messages) && adapterStatus.messages.length === 0 && !(typeof adapter.isProcessing === "function" && adapter.isProcessing())) {
16238
16248
  return "starting";
16239
16249
  }
16250
+ if (isGeneratingLikeStatus(adapterRawStatus) && parsedStatus === "idle" && !hasNonEmptyModalButtons(activeModal) && !hasVisibleAssistantMessage(parsedMessages)) {
16251
+ return adapterRawStatus;
16252
+ }
16240
16253
  if (shouldTrustCliAdapterTerminalStatus(parsedStatus, activeModal, adapter, adapterStatus)) return "idle";
16241
16254
  return typeof parsedStatus === "string" && parsedStatus.trim() ? parsedStatus : "idle";
16242
16255
  }
@@ -16740,12 +16753,12 @@ async function handleReadChat(h, args) {
16740
16753
  let messageSource = buildCliMessageSourceProvenance({
16741
16754
  selected: "pty-parser",
16742
16755
  provider: adapter.cliType,
16743
- fallbackReason: supportsCliNativeTranscript(providerType) ? "native_history_not_checked" : "provider_native_transcript_not_supported",
16756
+ fallbackReason: supportsCliNativeTranscript(providerType, provider) ? "native_history_not_checked" : "provider_native_transcript_not_supported",
16744
16757
  ptyMessages: returnedMessages,
16745
16758
  returnedMessages,
16746
16759
  ptyStatusApprovalOnly: false
16747
16760
  });
16748
- if (supportsCliNativeTranscript(providerType) && provider?.canonicalHistory?.mode === "native-source") {
16761
+ if (supportsCliNativeTranscript(providerType, provider) && provider?.canonicalHistory?.mode === "native-source") {
16749
16762
  const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h, adapter.cliType);
16750
16763
  const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : typeof adapter.workingDir === "string" ? adapter.workingDir : void 0;
16751
16764
  const nativeHistoryLimit = Math.max(
@@ -16813,6 +16826,7 @@ async function handleReadChat(h, args) {
16813
16826
  } else {
16814
16827
  const fallbackReason = buildNativeHistoryFallbackReason({
16815
16828
  providerType,
16829
+ provider,
16816
16830
  nativeSource: nativeHistory.source,
16817
16831
  nativeMessageCount: nativeMessages.length,
16818
16832
  safeMapping,
@@ -16851,7 +16865,7 @@ async function handleReadChat(h, args) {
16851
16865
  returnedStatus: String(returnedStatus || ""),
16852
16866
  selectedMessageSource: messageSource.selected,
16853
16867
  messageSource,
16854
- shouldPreferAdapterMessages: supportsCliNativeTranscript(providerType) && messageSource.selected !== "native-history",
16868
+ shouldPreferAdapterMessages: supportsCliNativeTranscript(providerType, provider) && messageSource.selected !== "native-history",
16855
16869
  parsedMsgCount: parsedRecord.messages.length,
16856
16870
  returnedMsgCount: selectedMessages.length
16857
16871
  },
@@ -16877,19 +16891,20 @@ async function handleReadChat(h, args) {
16877
16891
  });
16878
16892
  const historyProviderSessionId = typeof history?.providerSessionId === "string" ? history.providerSessionId : historySessionId;
16879
16893
  const historyMessages = Array.isArray(history?.messages) ? normalizeChatMessages(history.messages) : [];
16880
- const safeMapping = supportsCliNativeTranscript(agentStr) ? hasSafeNativeHistoryMapping({
16894
+ const safeMapping = supportsCliNativeTranscript(agentStr, provider) ? hasSafeNativeHistoryMapping({
16881
16895
  historySessionId,
16882
16896
  providerSessionId: historyProviderSessionId,
16883
16897
  workspace,
16884
16898
  nativeMessages: historyMessages
16885
16899
  }) : false;
16886
- const nativeSelected = supportsCliNativeTranscript(agentStr) && history.source === "provider-native" && historyMessages.length > 0 && safeMapping;
16900
+ const nativeSelected = supportsCliNativeTranscript(agentStr, provider) && history.source === "provider-native" && historyMessages.length > 0 && safeMapping;
16887
16901
  const messageSource = buildCliMessageSourceProvenance({
16888
16902
  selected: nativeSelected ? "native-history" : "pty-parser",
16889
16903
  provider: agentStr,
16890
16904
  nativeHandle: historyProviderSessionId || historySessionId,
16891
16905
  fallbackReason: nativeSelected ? void 0 : buildNativeHistoryFallbackReason({
16892
16906
  providerType: agentStr,
16907
+ provider,
16893
16908
  nativeSource: history.source,
16894
16909
  nativeMessageCount: historyMessages.length,
16895
16910
  safeMapping,
@@ -16904,7 +16919,7 @@ async function handleReadChat(h, args) {
16904
16919
  freshEnough: true,
16905
16920
  ptyStatusApprovalOnly: false
16906
16921
  });
16907
- const requiresNativeSource = supportsCliNativeTranscript(agentStr) && provider?.canonicalHistory?.mode === "native-source";
16922
+ const requiresNativeSource = supportsCliNativeTranscript(agentStr, provider) && provider?.canonicalHistory?.mode === "native-source";
16908
16923
  if (requiresNativeSource && !nativeSelected) {
16909
16924
  return {
16910
16925
  success: false,