(messages: ReadonlyArray<Message>)
| 2249 | * are gone from the compacted transcript, so re-surfacing is valid again. |
| 2250 | */ |
| 2251 | export function collectSurfacedMemories(messages: ReadonlyArray<Message>): { |
| 2252 | paths: Set<string> |
| 2253 | totalBytes: number |
| 2254 | } { |
| 2255 | const paths = new Set<string>() |
| 2256 | let totalBytes = 0 |
| 2257 | for (const m of messages) { |
| 2258 | if (m.type === 'attachment' && m.attachment.type === 'relevant_memories') { |
| 2259 | for (const mem of m.attachment.memories) { |
| 2260 | paths.add(mem.path) |
| 2261 | totalBytes += mem.content.length |
| 2262 | } |
| 2263 | } |
| 2264 | } |
| 2265 | return { paths, totalBytes } |
| 2266 | } |
| 2267 | |
| 2268 | /** |
| 2269 | * Reads a set of relevance-ranked memory files for injection as |
no test coverage detected