@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.
@@ -116,6 +116,10 @@ export declare function readProviderChatHistory(agentType: string, options?: {
116
116
  source: 'provider-native' | 'adhdev-mirror' | 'native-unavailable';
117
117
  sourcePath?: string;
118
118
  sourceMtimeMs?: number;
119
+ providerSessionId?: string;
120
+ nativeHistoryCoverage?: string;
121
+ partialReason?: string;
122
+ unavailableReason?: string;
119
123
  };
120
124
  export declare function listProviderHistorySessions(agentType: string, options?: {
121
125
  canonicalHistory?: ProviderCanonicalHistoryConfig;
package/dist/index.js CHANGED
@@ -13572,7 +13572,11 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
13572
13572
  return {
13573
13573
  records,
13574
13574
  sourcePath: typeof result.sourcePath === "string" ? result.sourcePath : "",
13575
- sourceMtimeMs: Number(result.sourceMtimeMs) || 0
13575
+ sourceMtimeMs: Number(result.sourceMtimeMs) || 0,
13576
+ providerSessionId: typeof result.providerSessionId === "string" ? result.providerSessionId.trim() : void 0,
13577
+ nativeHistoryCoverage: typeof result.nativeHistoryCoverage === "string" ? result.nativeHistoryCoverage.trim() : void 0,
13578
+ partialReason: typeof result.partialReason === "string" ? result.partialReason.trim() : void 0,
13579
+ unavailableReason: typeof result.unavailableReason === "string" ? result.unavailableReason.trim() : void 0
13576
13580
  };
13577
13581
  }
13578
13582
  function buildNativeHistoryReadResult(agentType, canonicalHistory, scripts, historySessionId, workspace) {
@@ -13614,7 +13618,11 @@ function readProviderChatHistory(agentType, options = {}) {
13614
13618
  ...pageHistoryRecords(agentType, nativeResult.records, options.offset || 0, options.limit || 30, options.excludeRecentCount || 0, options.historyBehavior),
13615
13619
  source: "provider-native",
13616
13620
  sourcePath: nativeResult.sourcePath,
13617
- sourceMtimeMs: nativeResult.sourceMtimeMs
13621
+ sourceMtimeMs: nativeResult.sourceMtimeMs,
13622
+ providerSessionId: nativeResult.providerSessionId,
13623
+ nativeHistoryCoverage: nativeResult.nativeHistoryCoverage,
13624
+ partialReason: nativeResult.partialReason,
13625
+ unavailableReason: nativeResult.unavailableReason
13618
13626
  };
13619
13627
  }
13620
13628
  return {
@@ -16410,6 +16418,9 @@ function buildCliMessageSourceProvenance(args) {
16410
16418
  ...args.fallbackReason ? { fallbackReason: args.fallbackReason } : {},
16411
16419
  ...args.nativeSource ? { nativeSource: args.nativeSource } : {},
16412
16420
  ...args.sourcePath ? { sourcePath: args.sourcePath } : {},
16421
+ ...args.nativeHistoryCoverage ? { nativeHistoryCoverage: args.nativeHistoryCoverage } : {},
16422
+ ...args.partialReason ? { partialReason: args.partialReason } : {},
16423
+ ...args.unavailableReason ? { unavailableReason: args.unavailableReason } : {},
16413
16424
  ptyStatusApprovalOnly: args.ptyStatusApprovalOnly === true,
16414
16425
  staleness: {
16415
16426
  sourceMtimeMs: sourceMtimeMs || void 0,
@@ -16429,6 +16440,8 @@ function buildCliMessageSourceProvenance(args) {
16429
16440
  function buildNativeHistoryFallbackReason(args) {
16430
16441
  if (!supportsCliNativeTranscript(args.providerType, args.provider)) return "provider_native_transcript_not_supported";
16431
16442
  if (args.nativeSource === "native-unavailable") return "native_history_unavailable";
16443
+ if (args.nativeHistoryCoverage === "partial") return "native_history_partial";
16444
+ if (args.nativeHistoryCoverage === "unavailable") return "native_history_unavailable";
16432
16445
  if (args.nativeSource && args.nativeSource !== "provider-native") return `native_history_source_${args.nativeSource}`;
16433
16446
  if (args.nativeMessageCount <= 0) return "native_history_empty";
16434
16447
  if (!args.safeMapping) return "native_history_not_safely_mapped";
@@ -17162,6 +17175,9 @@ async function handleReadChat(h, args) {
17162
17175
  if (nativeHistory) {
17163
17176
  const nativeMessages = Array.isArray(nativeHistory.messages) ? normalizeNativeHistoryMessages(agentStr, nativeHistory.messages) : [];
17164
17177
  const historyProviderSessionId = typeof nativeHistory?.providerSessionId === "string" ? nativeHistory.providerSessionId : readHistorySessionIdFromMessages(nativeMessages) || nativeHistorySessionId || historySessionId;
17178
+ const nativeHistoryCoverage = typeof nativeHistory?.nativeHistoryCoverage === "string" ? nativeHistory.nativeHistoryCoverage : void 0;
17179
+ const partialReason = typeof nativeHistory?.partialReason === "string" ? nativeHistory.partialReason : void 0;
17180
+ const unavailableReason = typeof nativeHistory?.unavailableReason === "string" ? nativeHistory.unavailableReason : void 0;
17165
17181
  const lookup = nativeHistory.lookup === "workspace" ? "workspace" : "session";
17166
17182
  const safeMapping = hasSafeNativeHistoryMapping({
17167
17183
  historySessionId: lookup === "workspace" ? void 0 : nativeHistorySessionId,
@@ -17176,7 +17192,7 @@ async function handleReadChat(h, args) {
17176
17192
  nativeMessages,
17177
17193
  ptyMessages: returnedMessages
17178
17194
  });
17179
- if (nativeHistory.source === "provider-native" && nativeMessages.length > 0 && safeMapping && freshEnough) {
17195
+ if (nativeHistory.source === "provider-native" && nativeMessages.length > 0 && nativeHistoryCoverage !== "partial" && nativeHistoryCoverage !== "unavailable" && safeMapping && freshEnough) {
17180
17196
  selectedMessages = finalizeStreamingMessagesWhenIdle(nativeMessages, returnedStatus);
17181
17197
  selectedProviderSessionId = historyProviderSessionId || providerSessionId;
17182
17198
  selectedTranscriptAuthority = "provider";
@@ -17188,6 +17204,9 @@ async function handleReadChat(h, args) {
17188
17204
  nativeSource: nativeHistory.source,
17189
17205
  sourcePath: nativeHistory.sourcePath,
17190
17206
  sourceMtimeMs: nativeHistory.sourceMtimeMs,
17207
+ nativeHistoryCoverage,
17208
+ partialReason,
17209
+ unavailableReason,
17191
17210
  nativeMessages,
17192
17211
  ptyMessages: returnedMessages,
17193
17212
  returnedMessages: selectedMessages,
@@ -17200,6 +17219,7 @@ async function handleReadChat(h, args) {
17200
17219
  providerType,
17201
17220
  provider,
17202
17221
  nativeSource: nativeHistory.source,
17222
+ nativeHistoryCoverage,
17203
17223
  nativeMessageCount: nativeMessages.length,
17204
17224
  safeMapping,
17205
17225
  freshEnough
@@ -17212,6 +17232,9 @@ async function handleReadChat(h, args) {
17212
17232
  nativeSource: nativeHistory.source,
17213
17233
  sourcePath: nativeHistory.sourcePath,
17214
17234
  sourceMtimeMs: nativeHistory.sourceMtimeMs,
17235
+ nativeHistoryCoverage,
17236
+ partialReason,
17237
+ unavailableReason,
17215
17238
  nativeMessages,
17216
17239
  ptyMessages: returnedMessages,
17217
17240
  returnedMessages,
@@ -17277,13 +17300,16 @@ async function handleReadChat(h, args) {
17277
17300
  const lookup = history.lookup === "workspace" ? "workspace" : "session";
17278
17301
  const historyMessages = Array.isArray(history?.messages) ? normalizeNativeHistoryMessages(agentStr, history.messages) : [];
17279
17302
  const historyProviderSessionId = typeof history?.providerSessionId === "string" ? history.providerSessionId : readHistorySessionIdFromMessages(historyMessages) || historySessionId;
17303
+ const nativeHistoryCoverage = typeof history?.nativeHistoryCoverage === "string" ? history.nativeHistoryCoverage : void 0;
17304
+ const partialReason = typeof history?.partialReason === "string" ? history.partialReason : void 0;
17305
+ const unavailableReason = typeof history?.unavailableReason === "string" ? history.unavailableReason : void 0;
17280
17306
  const safeMapping = supportsCliNativeTranscript(agentStr, provider) ? hasSafeNativeHistoryMapping({
17281
17307
  historySessionId: lookup === "workspace" ? void 0 : historySessionId,
17282
17308
  providerSessionId: lookup === "workspace" ? void 0 : historyProviderSessionId,
17283
17309
  workspace,
17284
17310
  nativeMessages: historyMessages
17285
17311
  }) : false;
17286
- const nativeSelected = supportsCliNativeTranscript(agentStr, provider) && history.source === "provider-native" && historyMessages.length > 0 && safeMapping;
17312
+ const nativeSelected = supportsCliNativeTranscript(agentStr, provider) && history.source === "provider-native" && historyMessages.length > 0 && nativeHistoryCoverage !== "partial" && nativeHistoryCoverage !== "unavailable" && safeMapping;
17287
17313
  const messageSource = buildCliMessageSourceProvenance({
17288
17314
  selected: nativeSelected ? "native-history" : "pty-parser",
17289
17315
  provider: agentStr,
@@ -17292,6 +17318,7 @@ async function handleReadChat(h, args) {
17292
17318
  providerType: agentStr,
17293
17319
  provider,
17294
17320
  nativeSource: history.source,
17321
+ nativeHistoryCoverage,
17295
17322
  nativeMessageCount: historyMessages.length,
17296
17323
  safeMapping,
17297
17324
  freshEnough: true
@@ -17299,6 +17326,9 @@ async function handleReadChat(h, args) {
17299
17326
  nativeSource: history.source,
17300
17327
  sourcePath: history.sourcePath,
17301
17328
  sourceMtimeMs: history.sourceMtimeMs,
17329
+ nativeHistoryCoverage,
17330
+ partialReason,
17331
+ unavailableReason,
17302
17332
  nativeMessages: historyMessages,
17303
17333
  returnedMessages: historyMessages,
17304
17334
  safeMapping,