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