fix(compaction): align native lifecycle and reconcile replay notices

Refs: NAN-326, NAN-327
This commit is contained in:
chengyongru authored and chengyongru committed 2026-10-22 14:39:30 +08:00
1 parent f9257c3548
commit be43d2a5f8
8 files changed
+298 -78

No files matched your search

+6 -2
View File
@@ -178,8 +178,9 @@ export class ThreadTranscript {
registerInput(row: UIMessage, received = true): void {
if (row.role === "user" && row.turnId) this.knownTurns.add(row.turnId);
const identity = row.sessionMessage?.message_id
? `input:${row.sessionMessage.message_id}` : row.role === "user" && row.turnId
const identity = row.kind === "compaction" && row.compaction
? `compaction:${row.compaction.id}` : row.sessionMessage?.message_id
? `input:${row.sessionMessage.message_id}` : row.role === "user" && row.turnId
? `user:${row.turnId}` : row.turnId && row.turnSeq !== undefined
? `fact:${row.turnId}:${row.turnSeq}` : `replay:${row.id}`;
if (this.bySource.has(identity)) return;
@@ -200,6 +201,9 @@ export class ThreadTranscript {
for (const [first, last] of receipt.ranges) addRange(ranges, first, last);
members.set(receipt.turn_id, ranges);
}
if (event.event === "context_compaction") {
return { source: `compaction:${event.compaction_id}`, members, text: null };
}
if (event.event === "user_message") {
return { source: event.provenance?.session_message?.message_id
? `input:${event.provenance.session_message.message_id}` : turn ? `user:${turn}` : `replay:${event.projection_id}`,