* 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[])
| 2301 | * This handles --continue/--resume scenarios where we need to avoid ID collisions. |
| 2302 | */ |
| 2303 | function getInitialPasteId(messages: Message[]): number { |
| 2304 | let maxId = 0; |
| 2305 | for (const message of messages) { |
| 2306 | if (message.type === 'user') { |
| 2307 | // Check image paste IDs |
| 2308 | if (message.imagePasteIds) { |
| 2309 | for (const id of message.imagePasteIds) { |
| 2310 | if (id > maxId) maxId = id; |
| 2311 | } |
| 2312 | } |
| 2313 | // Check text paste references in message content |
| 2314 | if (Array.isArray(message.message.content)) { |
| 2315 | for (const block of message.message.content) { |
| 2316 | if (block.type === 'text') { |
| 2317 | const refs = parseReferences(block.text); |
| 2318 | for (const ref of refs) { |
| 2319 | if (ref.id > maxId) maxId = ref.id; |
| 2320 | } |
| 2321 | } |
| 2322 | } |
| 2323 | } |
| 2324 | } |
| 2325 | } |
| 2326 | return maxId + 1; |
| 2327 | } |
| 2328 | function buildBorderText(showFastIcon: boolean, showFastIconHint: boolean, fastModeCooldown: boolean): BorderTextOptions | undefined { |
| 2329 | if (!showFastIcon) return undefined; |
| 2330 | const fastSeg = showFastIconHint ? `${getFastIconString(true, fastModeCooldown)} ${chalk.dim('/fast')}` : getFastIconString(true, fastModeCooldown); |
no test coverage detected