mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-11-03 19:34:24 +00:00
12 lines
406 B
JavaScript
12 lines
406 B
JavaScript
/**
|
|
* @param {import('./schema.js').MemoryRecord[]} memories
|
|
* @param {{ retentionMs: number, now?: number }} options
|
|
* @returns {import('./schema.js').MemoryRecord[]}
|
|
*/
|
|
export function selectPrunableMemories(memories, options) {
|
|
const now = options.now ?? Date.now();
|
|
const cutoff = now - options.retentionMs;
|
|
|
|
return memories.filter((memory) => !memory.pinned && memory.last_seen < cutoff);
|
|
}
|