mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-31 09:51:52 +00:00
12 lines
407 B
JavaScript
12 lines
407 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.updated_at < cutoff);
|
|
}
|