(uuid: UUID)
| 402 | const receivedMessageUuidsOrder: UUID[] = [] |
| 403 | |
| 404 | function trackReceivedMessageUuid(uuid: UUID): boolean { |
| 405 | if (receivedMessageUuids.has(uuid)) { |
| 406 | return false // duplicate |
| 407 | } |
| 408 | receivedMessageUuids.add(uuid) |
| 409 | receivedMessageUuidsOrder.push(uuid) |
| 410 | // Evict oldest entries when at capacity |
| 411 | if (receivedMessageUuidsOrder.length > MAX_RECEIVED_UUIDS) { |
| 412 | const toEvict = receivedMessageUuidsOrder.splice( |
| 413 | 0, |
| 414 | receivedMessageUuidsOrder.length - MAX_RECEIVED_UUIDS, |
| 415 | ) |
| 416 | for (const old of toEvict) { |
| 417 | receivedMessageUuids.delete(old) |
| 418 | } |
| 419 | } |
| 420 | return true // new UUID |
| 421 | } |
| 422 | |
| 423 | type PromptValue = string | ContentBlockParam[] |
| 424 |
no test coverage detected