@adhdev/daemon-core 0.8.39 → 0.8.40

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/session-host-core",
3
- "version": "0.8.39",
3
+ "version": "0.8.40",
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.40",
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);