* Compute the initial paste ID by finding the max ID used in existing messages. * This handles --continue/--resume scenarios where we need to avoid ID collisions.
(messages: Message[])
| 1737 | * This handles --continue/--resume scenarios where we need to avoid ID collisions. |
| 1738 | */ |
| 1739 | function getInitialPasteId(messages: Message[]): number { |
| 1740 | let maxId = 0; |
| 1741 | for (const message of messages) { |
| 1742 | if (message.type === 'user') { |
| 1743 | // Check image paste IDs |
| 1744 | if (message.imagePasteIds) { |
| 1745 | for (const id of message.imagePasteIds) { |
| 1746 | if (id > maxId) maxId = id; |
| 1747 | } |
| 1748 | } |
| 1749 | // Check text paste references in message content |
| 1750 | if (Array.isArray(message.message.content)) { |
| 1751 | for (const block of message.message.content) { |
| 1752 | if (block.type === 'text') { |
| 1753 | const refs = parseReferences(block.text); |
| 1754 | for (const ref of refs) { |
| 1755 | if (ref.id > maxId) maxId = ref.id; |
| 1756 | } |
| 1757 | } |
| 1758 | } |
| 1759 | } |
| 1760 | } |
| 1761 | } |
| 1762 | return maxId + 1; |
| 1763 | } |
| 1764 | function buildBorderText(showFastIcon: boolean, showFastIconHint: boolean, fastModeCooldown: boolean): BorderTextOptions | undefined { |
| 1765 | if (!showFastIcon) return undefined; |
| 1766 | const fastSeg = showFastIconHint ? `${getFastIconString(true, fastModeCooldown)} ${chalk.dim('/fast')}` : getFastIconString(true, fastModeCooldown); |
no test coverage detected