Skip to main content

Module message_time

Module message_time 

Source
Expand description

When each message happened: the host-only _synaps_at key.

API history (role/content JSON) has no per-message time, so a transcript rebuilt from it (resume, attach, /resync, compaction) could only show “now”. The host stamps every NEW message with its own time, in memory, under AT_KEY (RFC 3339 UTC). Like every _synaps_* key it never reaches a provider (continuation::WireMessages), and persistence keeps it beside the message, never inside (session_journal::MESSAGE_AT_KEY).

Stamping never re-stamps and never touches settled history: a Stamper only looks at messages appended since its last pass (its floor), from the tail backward, and stops at the first message that already has a time. Messages loaded without a time (legacy sessions) stay without one and render with an empty time, never “now”.

Structs§

MessageClock
Where message times come from. Defaults to the wall clock; tests inject their own to “advance time” between a turn and a rebuild. One thin pointer: it rides in SessionConfig (an Attach payload).
Stamper
Stamps what was appended to one history since the previous pass.

Constants§

AT_KEY
The in-memory message time key.

Functions§

format_time
The stored form of a time: RFC 3339, UTC, whole seconds.
message_time
The recorded time of a message, if any.
stamp_new
Stamp messages[floor..] that lack a time with at, walking back from the tail and stopping at the first message that has one. Returns how many were stamped. O(new messages).