()
| 158 | const CONVERSATION_TTL_MS = 30 * 60 * 1000; // 30 minutes |
| 159 | |
| 160 | function evictStaleConversations(): void { |
| 161 | const now = Date.now(); |
| 162 | for (const [key, stored] of conversationStates) { |
| 163 | if (now - stored.lastAccessMs > CONVERSATION_TTL_MS) { |
| 164 | conversationStates.delete(key); |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | /** Length-prefix a message: [4-byte BE length][payload] */ |
| 170 | function lpEncode(data: Uint8Array): Buffer { |
no outgoing calls
no test coverage detected