Make sleep own durable memory promotion
This commit is contained in:
parent
868e242ce4
commit
5df282e6b4
13 changed files with 130 additions and 44 deletions
|
|
@ -128,10 +128,19 @@ function applyTypedOperation(
|
|||
state.speechReceipts.updatedAt = operation.receipt.sentAt;
|
||||
closeCasesForReceipt(state.moderationCursor, operation.receipt);
|
||||
return;
|
||||
case "append_distilled_memory":
|
||||
upsertBy(state.thoughtMemory.memories, operation.memory, (entry) => entry.memoryId);
|
||||
case "record_short_term_memory":
|
||||
upsertBy(state.thoughtMemory.shortTerm, operation.memory, (entry) => entry.memoryId);
|
||||
state.thoughtMemory.shortTerm = state.thoughtMemory.shortTerm
|
||||
.sort((left, right) => left.updatedAt.localeCompare(right.updatedAt))
|
||||
.slice(-48);
|
||||
state.thoughtMemory.updatedAt = operation.memory.updatedAt;
|
||||
return;
|
||||
case "prune_short_term_memories":
|
||||
state.thoughtMemory.shortTerm = state.thoughtMemory.shortTerm.filter(
|
||||
(entry) => !operation.sourceMemoryIds.includes(entry.memoryId),
|
||||
);
|
||||
state.thoughtMemory.updatedAt = operation.prunedAt;
|
||||
return;
|
||||
case "merge_incubation_support":
|
||||
upsertBy(state.thoughtMemory.incubation, operation.thread, (entry) => entry.threadId);
|
||||
state.thoughtMemory.updatedAt = operation.thread.updatedAt;
|
||||
|
|
@ -158,6 +167,9 @@ function applyTypedOperation(
|
|||
state.thoughtMemory.memories = state.thoughtMemory.memories.filter(
|
||||
(entry) => !operation.sourceMemoryIds.includes(entry.memoryId) || entry.memoryId === operation.memory.memoryId,
|
||||
);
|
||||
state.thoughtMemory.shortTerm = state.thoughtMemory.shortTerm.filter(
|
||||
(entry) => !operation.sourceMemoryIds.includes(entry.memoryId),
|
||||
);
|
||||
state.thoughtMemory.updatedAt = operation.appliedAt;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue