( messages: Message[] | undefined, )
| 1467 | * Exported for testing — regression guard for the cache-clear removal. |
| 1468 | */ |
| 1469 | export function getDateChangeAttachments( |
| 1470 | messages: Message[] | undefined, |
| 1471 | ): Attachment[] { |
| 1472 | const currentDate = getLocalISODate() |
| 1473 | const lastDate = getLastEmittedDate() |
| 1474 | |
| 1475 | if (lastDate === null) { |
| 1476 | // First turn — just record, no attachment needed |
| 1477 | setLastEmittedDate(currentDate) |
| 1478 | return [] |
| 1479 | } |
| 1480 | |
| 1481 | if (currentDate === lastDate) { |
| 1482 | return [] |
| 1483 | } |
| 1484 | |
| 1485 | setLastEmittedDate(currentDate) |
| 1486 | |
| 1487 | // Assistant mode: flush yesterday's transcript to the per-day file so |
| 1488 | // the /dream skill (1–5am local) finds it even if no compaction fires |
| 1489 | // today. Fire-and-forget; writeSessionTranscriptSegment buckets by |
| 1490 | // message timestamp so a multi-day gap flushes each day correctly. |
| 1491 | if (feature('KAIROS')) { |
| 1492 | if (getKairosActive() && messages !== undefined) { |
| 1493 | sessionTranscriptModule?.flushOnDateChange(messages, currentDate) |
| 1494 | } |
| 1495 | } |
| 1496 | |
| 1497 | return [{ type: 'date_change', newDate: currentDate }] |
| 1498 | } |
| 1499 | |
| 1500 | function getUltrathinkEffortAttachment(input: string | null): Attachment[] { |
| 1501 | if (!isUltrathinkEnabled() || !input || !hasUltrathinkKeyword(input)) { |
no test coverage detected