MCPcopy Create free account
hub / github.com/Noumena-Network/code / getDateChangeAttachments

Function getDateChangeAttachments

src/utils/attachments.ts:1421–1450  ·  view source on GitHub ↗
(
  messages: Message[] | undefined,
)

Source from the content-addressed store, hash-verified

1419 * Exported for testing — regression guard for the cache-clear removal.
1420 */
1421export 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
1452function getUltrathinkEffortAttachment(input: string | null): Attachment[] {
1453 if (!isUltrathinkEnabled() || !input || !hasUltrathinkKeyword(input)) {

Callers 1

getAttachmentsFunction · 0.85

Calls 4

getLocalISODateFunction · 0.85
getLastEmittedDateFunction · 0.85
setLastEmittedDateFunction · 0.85
getKairosActiveFunction · 0.85

Tested by

no test coverage detected