@adhdev/daemon-standalone 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
@@ -38166,7 +38166,7 @@ ${effect.notification.body || ""}`.trim();
38166
38166
  };
38167
38167
  }
38168
38168
  function buildNativeHistoryFallbackReason(args) {
38169
- if (!supportsCliNativeTranscript(args.providerType)) return "provider_native_transcript_not_supported";
38169
+ if (!supportsCliNativeTranscript(args.providerType, args.provider)) return "provider_native_transcript_not_supported";
38170
38170
  if (args.nativeSource === "native-unavailable") return "native_history_unavailable";
38171
38171
  if (args.nativeSource && args.nativeSource !== "provider-native") return `native_history_source_${args.nativeSource}`;
38172
38172
  if (args.nativeMessageCount <= 0) return "native_history_empty";
@@ -38174,8 +38174,9 @@ ${effect.notification.body || ""}`.trim();
38174
38174
  if (!args.freshEnough) return "native_history_stale";
38175
38175
  return "native_history_not_selected";
38176
38176
  }
38177
- function supportsCliNativeTranscript(providerType) {
38178
- return CLI_NATIVE_TRANSCRIPT_PROVIDERS.has(providerType);
38177
+ function supportsCliNativeTranscript(providerType, provider) {
38178
+ if (CLI_NATIVE_TRANSCRIPT_PROVIDERS.has(providerType)) return true;
38179
+ return provider?.category === "cli" && provider?.canonicalHistory?.mode === "native-source";
38179
38180
  }
38180
38181
  function hasSafeNativeHistoryMapping(args) {
38181
38182
  const explicitSessionId = String(args.historySessionId || args.providerSessionId || "").trim();
@@ -38254,6 +38255,15 @@ ${effect.notification.body || ""}`.trim();
38254
38255
  function isGeneratingLikeStatus(status) {
38255
38256
  return status === "generating" || status === "streaming" || status === "long_generating" || status === "starting";
38256
38257
  }
38258
+ function hasVisibleAssistantMessage(messages) {
38259
+ if (!Array.isArray(messages)) return false;
38260
+ return messages.some((message) => {
38261
+ if (!message || message.role !== "assistant") return false;
38262
+ const kind = typeof message.kind === "string" ? message.kind : "standard";
38263
+ if (kind !== "standard") return false;
38264
+ return String(message.content || "").trim().length > 0;
38265
+ });
38266
+ }
38257
38267
  function shouldTrustCliAdapterTerminalStatus(parsedStatus, activeModal, adapter, adapterStatus) {
38258
38268
  if (!isGeneratingLikeStatus(parsedStatus)) return false;
38259
38269
  if (hasNonEmptyModalButtons(activeModal)) return false;
@@ -38267,6 +38277,9 @@ ${effect.notification.body || ""}`.trim();
38267
38277
  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())) {
38268
38278
  return "starting";
38269
38279
  }
38280
+ if (isGeneratingLikeStatus(adapterRawStatus) && parsedStatus === "idle" && !hasNonEmptyModalButtons(activeModal) && !hasVisibleAssistantMessage(parsedMessages)) {
38281
+ return adapterRawStatus;
38282
+ }
38270
38283
  if (shouldTrustCliAdapterTerminalStatus(parsedStatus, activeModal, adapter, adapterStatus)) return "idle";
38271
38284
  return typeof parsedStatus === "string" && parsedStatus.trim() ? parsedStatus : "idle";
38272
38285
  }
@@ -38770,12 +38783,12 @@ ${effect.notification.body || ""}`.trim();
38770
38783
  let messageSource = buildCliMessageSourceProvenance({
38771
38784
  selected: "pty-parser",
38772
38785
  provider: adapter.cliType,
38773
- fallbackReason: supportsCliNativeTranscript(providerType) ? "native_history_not_checked" : "provider_native_transcript_not_supported",
38786
+ fallbackReason: supportsCliNativeTranscript(providerType, provider) ? "native_history_not_checked" : "provider_native_transcript_not_supported",
38774
38787
  ptyMessages: returnedMessages,
38775
38788
  returnedMessages,
38776
38789
  ptyStatusApprovalOnly: false
38777
38790
  });
38778
- if (supportsCliNativeTranscript(providerType) && provider?.canonicalHistory?.mode === "native-source") {
38791
+ if (supportsCliNativeTranscript(providerType, provider) && provider?.canonicalHistory?.mode === "native-source") {
38779
38792
  const agentStr = provider?.type || args?.agentType || getCurrentProviderType(h, adapter.cliType);
38780
38793
  const workspace = typeof args?.workspace === "string" ? args.workspace : typeof h.currentSession?.workspace === "string" ? h.currentSession.workspace : typeof adapter.workingDir === "string" ? adapter.workingDir : void 0;
38781
38794
  const nativeHistoryLimit = Math.max(
@@ -38843,6 +38856,7 @@ ${effect.notification.body || ""}`.trim();
38843
38856
  } else {
38844
38857
  const fallbackReason = buildNativeHistoryFallbackReason({
38845
38858
  providerType,
38859
+ provider,
38846
38860
  nativeSource: nativeHistory.source,
38847
38861
  nativeMessageCount: nativeMessages.length,
38848
38862
  safeMapping,
@@ -38881,7 +38895,7 @@ ${effect.notification.body || ""}`.trim();
38881
38895
  returnedStatus: String(returnedStatus || ""),
38882
38896
  selectedMessageSource: messageSource.selected,
38883
38897
  messageSource,
38884
- shouldPreferAdapterMessages: supportsCliNativeTranscript(providerType) && messageSource.selected !== "native-history",
38898
+ shouldPreferAdapterMessages: supportsCliNativeTranscript(providerType, provider) && messageSource.selected !== "native-history",
38885
38899
  parsedMsgCount: parsedRecord.messages.length,
38886
38900
  returnedMsgCount: selectedMessages.length
38887
38901
  },
@@ -38907,19 +38921,20 @@ ${effect.notification.body || ""}`.trim();
38907
38921
  });
38908
38922
  const historyProviderSessionId = typeof history?.providerSessionId === "string" ? history.providerSessionId : historySessionId;
38909
38923
  const historyMessages = Array.isArray(history?.messages) ? normalizeChatMessages(history.messages) : [];
38910
- const safeMapping = supportsCliNativeTranscript(agentStr) ? hasSafeNativeHistoryMapping({
38924
+ const safeMapping = supportsCliNativeTranscript(agentStr, provider) ? hasSafeNativeHistoryMapping({
38911
38925
  historySessionId,
38912
38926
  providerSessionId: historyProviderSessionId,
38913
38927
  workspace,
38914
38928
  nativeMessages: historyMessages
38915
38929
  }) : false;
38916
- const nativeSelected = supportsCliNativeTranscript(agentStr) && history.source === "provider-native" && historyMessages.length > 0 && safeMapping;
38930
+ const nativeSelected = supportsCliNativeTranscript(agentStr, provider) && history.source === "provider-native" && historyMessages.length > 0 && safeMapping;
38917
38931
  const messageSource = buildCliMessageSourceProvenance({
38918
38932
  selected: nativeSelected ? "native-history" : "pty-parser",
38919
38933
  provider: agentStr,
38920
38934
  nativeHandle: historyProviderSessionId || historySessionId,
38921
38935
  fallbackReason: nativeSelected ? void 0 : buildNativeHistoryFallbackReason({
38922
38936
  providerType: agentStr,
38937
+ provider,
38923
38938
  nativeSource: history.source,
38924
38939
  nativeMessageCount: historyMessages.length,
38925
38940
  safeMapping,
@@ -38934,7 +38949,7 @@ ${effect.notification.body || ""}`.trim();
38934
38949
  freshEnough: true,
38935
38950
  ptyStatusApprovalOnly: false
38936
38951
  });
38937
- const requiresNativeSource = supportsCliNativeTranscript(agentStr) && provider?.canonicalHistory?.mode === "native-source";
38952
+ const requiresNativeSource = supportsCliNativeTranscript(agentStr, provider) && provider?.canonicalHistory?.mode === "native-source";
38938
38953
  if (requiresNativeSource && !nativeSelected) {
38939
38954
  return {
38940
38955
  success: false,