pub struct ThreadTurn {
pub turn_id: String,
pub role: String,
pub content: String,
pub timestamp: Option<i64>,
}Expand description
One turn fed into crate::Mnemo::ingest_thread (Phase 12.7a).
The caller supplies turn_id (opaque, for idempotence), role
(the transcript’s author tag; no interpretation), and content
(UTF-8 text; chunked at 8 KB, or truncated at 16 KB when role == "tool"). The ingest path assigns _mnemo.seq monotonically within
the destination thread and embeds through the registered embedder.
Tool messages whose content exceeds THREAD_TOOL_RESULT_TRUNCATE_BYTES
are stored truncated. Other roles over THREAD_TURN_CHUNK_BYTES
are chunked.
Fields§
§turn_id: StringOpaque per-turn id from the source transcript (e.g. a Claude
Code message uuid). Used for ingest_thread’s idempotence
check: a turn whose turn_id already exists in the target
thread is skipped.
role: StringAuthor role verbatim from the transcript ("user",
"assistant", "system", "tool", …). "tool" triggers
the 16 KB truncation branch; all other roles go through the
8 KB chunking branch.
content: StringUTF-8 message content.
timestamp: Option<i64>Optional caller-supplied creation timestamp (unix seconds).
If None, the ingest path uses now_secs() so the record’s
created_at still sorts the thread in order. Transcripts
that carry a per-turn timestamp should pass it through so a
future thread export --by-time can honour it.