(state: SessionState, msg: WithParts)
| 10 | import { countTokens } from "../token-utils" |
| 11 | |
| 12 | export const isMessageCompacted = (state: SessionState, msg: WithParts): boolean => { |
| 13 | if (!isMessageWithInfo(msg)) { |
| 14 | return false |
| 15 | } |
| 16 | |
| 17 | if (msg.info.time.created < state.lastCompaction) { |
| 18 | return true |
| 19 | } |
| 20 | const pruneEntry = state.prune.messages.byMessageId.get(msg.info.id) |
| 21 | if (pruneEntry && pruneEntry.activeBlockIds.length > 0) { |
| 22 | return true |
| 23 | } |
| 24 | return false |
| 25 | } |
| 26 | |
| 27 | interface PersistedPruneMessagesState { |
| 28 | byMessageId: Record<string, PrunedMessageEntry> |
no test coverage detected