( messages: Message[] | undefined, )
| 1419 | * Exported for testing — regression guard for the cache-clear removal. |
| 1420 | */ |
| 1421 | export function getDateChangeAttachments( |
| 1422 | messages: Message[] | undefined, |
| 1423 | ): Attachment[] { |
| 1424 | const currentDate = getLocalISODate() |
| 1425 | const lastDate = getLastEmittedDate() |
| 1426 | |
| 1427 | if (lastDate === null) { |
| 1428 | // First turn — just record, no attachment needed |
| 1429 | setLastEmittedDate(currentDate) |
| 1430 | return [] |
| 1431 | } |
| 1432 | |
| 1433 | if (currentDate === lastDate) { |
| 1434 | return [] |
| 1435 | } |
| 1436 | |
| 1437 | setLastEmittedDate(currentDate) |
| 1438 | |
| 1439 | // Assistant mode: flush yesterday's transcript to the per-day file so |
| 1440 | // the /dream skill (1–5am local) finds it even if no compaction fires |
| 1441 | // today. Fire-and-forget; writeSessionTranscriptSegment buckets by |
| 1442 | // message timestamp so a multi-day gap flushes each day correctly. |
| 1443 | if (feature('KAIROS')) { |
| 1444 | if (getKairosActive() && messages !== undefined) { |
| 1445 | sessionTranscriptModule?.flushOnDateChange(messages, currentDate) |
| 1446 | } |
| 1447 | } |
| 1448 | |
| 1449 | return [{ type: 'date_change', newDate: currentDate }] |
| 1450 | } |
| 1451 | |
| 1452 | function getUltrathinkEffortAttachment(input: string | null): Attachment[] { |
| 1453 | if (!isUltrathinkEnabled() || !input || !hasUltrathinkKeyword(input)) { |
no test coverage detected