@adhdev/daemon-core 0.9.82-rc.101 → 0.9.82-rc.103

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
@@ -13313,7 +13313,11 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
13313
13313
  return {
13314
13314
  records,
13315
13315
  sourcePath: typeof result.sourcePath === "string" ? result.sourcePath : "",
13316
- sourceMtimeMs: Number(result.sourceMtimeMs) || 0
13316
+ sourceMtimeMs: Number(result.sourceMtimeMs) || 0,
13317
+ providerSessionId: typeof result.providerSessionId === "string" ? result.providerSessionId.trim() : void 0,
13318
+ nativeHistoryCoverage: typeof result.nativeHistoryCoverage === "string" ? result.nativeHistoryCoverage.trim() : void 0,
13319
+ partialReason: typeof result.partialReason === "string" ? result.partialReason.trim() : void 0,
13320
+ unavailableReason: typeof result.unavailableReason === "string" ? result.unavailableReason.trim() : void 0
13317
13321
  };
13318
13322
  }
13319
13323
  function buildNativeHistoryReadResult(agentType, canonicalHistory, scripts, historySessionId, workspace) {
@@ -13355,7 +13359,11 @@ function readProviderChatHistory(agentType, options = {}) {
13355
13359
  ...pageHistoryRecords(agentType, nativeResult.records, options.offset || 0, options.limit || 30, options.excludeRecentCount || 0, options.historyBehavior),
13356
13360
  source: "provider-native",
13357
13361
  sourcePath: nativeResult.sourcePath,
13358
- sourceMtimeMs: nativeResult.sourceMtimeMs
13362
+ sourceMtimeMs: nativeResult.sourceMtimeMs,
13363
+ providerSessionId: nativeResult.providerSessionId,
13364
+ nativeHistoryCoverage: nativeResult.nativeHistoryCoverage,
13365
+ partialReason: nativeResult.partialReason,
13366
+ unavailableReason: nativeResult.unavailableReason
13359
13367
  };
13360
13368
  }
13361
13369
  return {
@@ -16151,6 +16159,9 @@ function buildCliMessageSourceProvenance(args) {
16151
16159
  ...args.fallbackReason ? { fallbackReason: args.fallbackReason } : {},
16152
16160
  ...args.nativeSource ? { nativeSource: args.nativeSource } : {},
16153
16161
  ...args.sourcePath ? { sourcePath: args.sourcePath } : {},
16162
+ ...args.nativeHistoryCoverage ? { nativeHistoryCoverage: args.nativeHistoryCoverage } : {},
16163
+ ...args.partialReason ? { partialReason: args.partialReason } : {},
16164
+ ...args.unavailableReason ? { unavailableReason: args.unavailableReason } : {},
16154
16165
  ptyStatusApprovalOnly: args.ptyStatusApprovalOnly === true,
16155
16166
  staleness: {
16156
16167
  sourceMtimeMs: sourceMtimeMs || void 0,
@@ -16170,6 +16181,8 @@ function buildCliMessageSourceProvenance(args) {
16170
16181
  function buildNativeHistoryFallbackReason(args) {
16171
16182
  if (!supportsCliNativeTranscript(args.providerType, args.provider)) return "provider_native_transcript_not_supported";
16172
16183
  if (args.nativeSource === "native-unavailable") return "native_history_unavailable";
16184
+ if (args.nativeHistoryCoverage === "partial") return "native_history_partial";
16185
+ if (args.nativeHistoryCoverage === "unavailable") return "native_history_unavailable";
16173
16186
  if (args.nativeSource && args.nativeSource !== "provider-native") return `native_history_source_${args.nativeSource}`;
16174
16187
  if (args.nativeMessageCount <= 0) return "native_history_empty";
16175
16188
  if (!args.safeMapping) return "native_history_not_safely_mapped";
@@ -16903,6 +16916,9 @@ async function handleReadChat(h, args) {
16903
16916
  if (nativeHistory) {
16904
16917
  const nativeMessages = Array.isArray(nativeHistory.messages) ? normalizeNativeHistoryMessages(agentStr, nativeHistory.messages) : [];
16905
16918
  const historyProviderSessionId = typeof nativeHistory?.providerSessionId === "string" ? nativeHistory.providerSessionId : readHistorySessionIdFromMessages(nativeMessages) || nativeHistorySessionId || historySessionId;
16919
+ const nativeHistoryCoverage = typeof nativeHistory?.nativeHistoryCoverage === "string" ? nativeHistory.nativeHistoryCoverage : void 0;
16920
+ const partialReason = typeof nativeHistory?.partialReason === "string" ? nativeHistory.partialReason : void 0;
16921
+ const unavailableReason = typeof nativeHistory?.unavailableReason === "string" ? nativeHistory.unavailableReason : void 0;
16906
16922
  const lookup = nativeHistory.lookup === "workspace" ? "workspace" : "session";
16907
16923
  const safeMapping = hasSafeNativeHistoryMapping({
16908
16924
  historySessionId: lookup === "workspace" ? void 0 : nativeHistorySessionId,
@@ -16917,7 +16933,7 @@ async function handleReadChat(h, args) {
16917
16933
  nativeMessages,
16918
16934
  ptyMessages: returnedMessages
16919
16935
  });
16920
- if (nativeHistory.source === "provider-native" && nativeMessages.length > 0 && safeMapping && freshEnough) {
16936
+ if (nativeHistory.source === "provider-native" && nativeMessages.length > 0 && nativeHistoryCoverage !== "partial" && nativeHistoryCoverage !== "unavailable" && safeMapping && freshEnough) {
16921
16937
  selectedMessages = finalizeStreamingMessagesWhenIdle(nativeMessages, returnedStatus);
16922
16938
  selectedProviderSessionId = historyProviderSessionId || providerSessionId;
16923
16939
  selectedTranscriptAuthority = "provider";
@@ -16929,6 +16945,9 @@ async function handleReadChat(h, args) {
16929
16945
  nativeSource: nativeHistory.source,
16930
16946
  sourcePath: nativeHistory.sourcePath,
16931
16947
  sourceMtimeMs: nativeHistory.sourceMtimeMs,
16948
+ nativeHistoryCoverage,
16949
+ partialReason,
16950
+ unavailableReason,
16932
16951
  nativeMessages,
16933
16952
  ptyMessages: returnedMessages,
16934
16953
  returnedMessages: selectedMessages,
@@ -16941,6 +16960,7 @@ async function handleReadChat(h, args) {
16941
16960
  providerType,
16942
16961
  provider,
16943
16962
  nativeSource: nativeHistory.source,
16963
+ nativeHistoryCoverage,
16944
16964
  nativeMessageCount: nativeMessages.length,
16945
16965
  safeMapping,
16946
16966
  freshEnough
@@ -16953,6 +16973,9 @@ async function handleReadChat(h, args) {
16953
16973
  nativeSource: nativeHistory.source,
16954
16974
  sourcePath: nativeHistory.sourcePath,
16955
16975
  sourceMtimeMs: nativeHistory.sourceMtimeMs,
16976
+ nativeHistoryCoverage,
16977
+ partialReason,
16978
+ unavailableReason,
16956
16979
  nativeMessages,
16957
16980
  ptyMessages: returnedMessages,
16958
16981
  returnedMessages,
@@ -17018,13 +17041,16 @@ async function handleReadChat(h, args) {
17018
17041
  const lookup = history.lookup === "workspace" ? "workspace" : "session";
17019
17042
  const historyMessages = Array.isArray(history?.messages) ? normalizeNativeHistoryMessages(agentStr, history.messages) : [];
17020
17043
  const historyProviderSessionId = typeof history?.providerSessionId === "string" ? history.providerSessionId : readHistorySessionIdFromMessages(historyMessages) || historySessionId;
17044
+ const nativeHistoryCoverage = typeof history?.nativeHistoryCoverage === "string" ? history.nativeHistoryCoverage : void 0;
17045
+ const partialReason = typeof history?.partialReason === "string" ? history.partialReason : void 0;
17046
+ const unavailableReason = typeof history?.unavailableReason === "string" ? history.unavailableReason : void 0;
17021
17047
  const safeMapping = supportsCliNativeTranscript(agentStr, provider) ? hasSafeNativeHistoryMapping({
17022
17048
  historySessionId: lookup === "workspace" ? void 0 : historySessionId,
17023
17049
  providerSessionId: lookup === "workspace" ? void 0 : historyProviderSessionId,
17024
17050
  workspace,
17025
17051
  nativeMessages: historyMessages
17026
17052
  }) : false;
17027
- const nativeSelected = supportsCliNativeTranscript(agentStr, provider) && history.source === "provider-native" && historyMessages.length > 0 && safeMapping;
17053
+ const nativeSelected = supportsCliNativeTranscript(agentStr, provider) && history.source === "provider-native" && historyMessages.length > 0 && nativeHistoryCoverage !== "partial" && nativeHistoryCoverage !== "unavailable" && safeMapping;
17028
17054
  const messageSource = buildCliMessageSourceProvenance({
17029
17055
  selected: nativeSelected ? "native-history" : "pty-parser",
17030
17056
  provider: agentStr,
@@ -17033,6 +17059,7 @@ async function handleReadChat(h, args) {
17033
17059
  providerType: agentStr,
17034
17060
  provider,
17035
17061
  nativeSource: history.source,
17062
+ nativeHistoryCoverage,
17036
17063
  nativeMessageCount: historyMessages.length,
17037
17064
  safeMapping,
17038
17065
  freshEnough: true
@@ -17040,6 +17067,9 @@ async function handleReadChat(h, args) {
17040
17067
  nativeSource: history.source,
17041
17068
  sourcePath: history.sourcePath,
17042
17069
  sourceMtimeMs: history.sourceMtimeMs,
17070
+ nativeHistoryCoverage,
17071
+ partialReason,
17072
+ unavailableReason,
17043
17073
  nativeMessages: historyMessages,
17044
17074
  returnedMessages: historyMessages,
17045
17075
  safeMapping,