@adhdev/daemon-core 0.8.39 → 0.8.41

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.
@@ -273,6 +273,7 @@ export interface CompactSessionEntry {
273
273
  currentPlan?: string;
274
274
  currentAutoApprove?: string;
275
275
  }
276
+ export type VersionUpdateReason = 'force_update_below' | 'major_minor_mismatch' | 'patch_mismatch' | 'daemon_ahead';
276
277
  /** Available provider information */
277
278
  export interface AvailableProviderInfo {
278
279
  type: string;
@@ -386,6 +387,8 @@ export interface CompactDaemonEntry {
386
387
  version?: string;
387
388
  serverVersion?: string;
388
389
  versionMismatch?: boolean;
390
+ versionUpdateRequired?: boolean;
391
+ versionUpdateReason?: VersionUpdateReason;
389
392
  terminalBackend?: TerminalBackendStatus;
390
393
  detectedIdes?: DetectedIdeInfo[];
391
394
  availableProviders?: AvailableProviderInfo[];
@@ -405,6 +408,8 @@ export interface CloudDaemonSummaryEntry {
405
408
  version?: string;
406
409
  serverVersion?: string;
407
410
  versionMismatch?: boolean;
411
+ versionUpdateRequired?: boolean;
412
+ versionUpdateReason?: VersionUpdateReason;
408
413
  terminalBackend?: TerminalBackendStatus;
409
414
  }
410
415
  /** Minimal daemon bootstrap payload used by dashboard WS to initiate P2P. */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/session-host-core",
3
- "version": "0.8.39",
3
+ "version": "0.8.41",
4
4
  "description": "ADHDev local session host core — session registry, protocol, buffers",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.8.39",
3
+ "version": "0.8.41",
4
4
  "description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -500,16 +500,11 @@ export async function handleSendChat(h: CommandHelpers, args: any): Promise<Comm
500
500
  const provider = h.getProvider(args?.agentType);
501
501
  const transport = getTargetTransport(h, provider);
502
502
  const dedupeKey = buildRecentSendKey(h, args, provider, text);
503
- const historySessionId = getHistorySessionId(h, args);
504
503
 
505
504
  const _logSendSuccess = (method: string, targetAgent?: string) => {
506
- h.historyWriter.appendNewMessages(
507
- targetAgent || provider?.type || getCurrentProviderType(h, 'unknown_agent'),
508
- [{ role: 'user', content: text, receivedAt: Date.now() }],
509
- undefined, // title
510
- args?.targetSessionId,
511
- historySessionId,
512
- );
505
+ // Sending and transcript persistence are intentionally decoupled.
506
+ // User turns should reach history through read_chat/runtime transcript sync,
507
+ // not by eagerly appending the outgoing input here.
513
508
  return { success: true, sent: true, method, targetAgent };
514
509
  };
515
510
 
@@ -217,9 +217,11 @@ export class ChatHistoryWriter {
217
217
  const lines = newMessages.map(m => JSON.stringify(m)).join('\n') + '\n';
218
218
  fs.appendFileSync(filePath, lines, 'utf-8');
219
219
 
220
- // Detect session switch — reset hash if message count decreases
220
+ // Detect session switch — only for unstable runtime-only histories.
221
+ // When we have a persistent history session key, replayed read_chat payloads
222
+ // must not clear dedupe state or old turns can be appended again.
221
223
  const prevCount = this.lastSeenCounts.get(dedupKey) || 0;
222
- if (messages.length < prevCount * 0.5 && prevCount > 3) {
224
+ if (!historySessionId && messages.length < prevCount * 0.5 && prevCount > 3) {
223
225
  seenHashes.clear();
224
226
  this.lastSeenSignatures.delete(dedupKey);
225
227
  this.lastSeenTurnSignatures.delete(dedupKey);
package/src/index.ts CHANGED
@@ -25,6 +25,7 @@ export type {
25
25
  CompactDaemonEntry,
26
26
  CloudDaemonSummaryEntry,
27
27
  DashboardBootstrapDaemonEntry,
28
+ VersionUpdateReason,
28
29
  CloudStatusReportPayload,
29
30
  DaemonStatusEventPayload,
30
31
  DashboardStatusEventPayload,
@@ -339,6 +339,12 @@ export interface CompactSessionEntry {
339
339
  currentAutoApprove?: string;
340
340
  }
341
341
 
342
+ export type VersionUpdateReason =
343
+ | 'force_update_below'
344
+ | 'major_minor_mismatch'
345
+ | 'patch_mismatch'
346
+ | 'daemon_ahead';
347
+
342
348
  /** Available provider information */
343
349
  export interface AvailableProviderInfo {
344
350
  type: string;
@@ -455,6 +461,8 @@ export interface CompactDaemonEntry {
455
461
  version?: string;
456
462
  serverVersion?: string;
457
463
  versionMismatch?: boolean;
464
+ versionUpdateRequired?: boolean;
465
+ versionUpdateReason?: VersionUpdateReason;
458
466
  terminalBackend?: TerminalBackendStatus;
459
467
  detectedIdes?: DetectedIdeInfo[];
460
468
  availableProviders?: AvailableProviderInfo[];
@@ -475,6 +483,8 @@ export interface CloudDaemonSummaryEntry {
475
483
  version?: string;
476
484
  serverVersion?: string;
477
485
  versionMismatch?: boolean;
486
+ versionUpdateRequired?: boolean;
487
+ versionUpdateReason?: VersionUpdateReason;
478
488
  terminalBackend?: TerminalBackendStatus;
479
489
  }
480
490