pub enum MessageKind {
Conversation,
Compaction,
ToolCall,
ToolResult,
HarnessNotice,
Unknown,
}Expand description
A single conversation turn persisted per session (the unit of message-level analytics).
PATTERN: adding a variant here is the whole cost of adding a message class. It reaches the
MCP schema through mcp_server::message_kind_values, the CLI through clap, and the default
result set through MessageKind::default_search_set, all derived from these variants.
Do not pair a new variant with an include_<variant> flag or an is_<variant> column.
Variants§
Conversation
Compaction
ToolCall
ToolResult
HarnessNotice
A message the harness injected into the transcript, addressed to the agent rather than written by the user or the model: Stop-hook feedback, PreToolUse blocks, local-command caveats and stdout, task notifications. Not user prose, so it is excluded from results by default, but it is the ONLY record of what a hook told an agent and what the agent did next, so it is stored rather than discarded.
Unknown
Implementations§
Source§impl MessageKind
impl MessageKind
Sourcepub const EXCLUDABLE_BY_DEFAULT: &'static [Self]
pub const EXCLUDABLE_BY_DEFAULT: &'static [Self]
Every class MessageFilters::kind_predicate can leave out when the caller names no
set: HarnessNotice always, Compaction under no_compaction. Together a small share of
any real index (2 % of 2.69 M rows measured), which is what lets a count over the default
predicate be written as count(everything) - count(these); the storage layer keeps a
partial index over exactly this set for the second term. Kept in ascending name order so
the SQL rendered from it is stable.
pub fn as_str(&self) -> &'static str
Sourcepub fn default_search_set() -> Vec<Self>
pub fn default_search_set() -> Vec<Self>
Classes returned when a caller names no set: everything the user or the model wrote,
plus tool traffic. HarnessNotice is excluded because it is the harness talking to the
agent, so including it by default would change every existing result and skew the
user-prose analytics (corrections, repeats, vocab) built on message content.
Sourcepub fn from_db_str(value: &str) -> Self
pub fn from_db_str(value: &str) -> Self
Parse a kind value read back from the index, mapping anything unrecognized to
MessageKind::Unknown.
DELIBERATELY UNLIKE Provider::from_db_str and Role::from_db_str, which
debug_assert! on an unrecognized spelling because theirs can only come from corruption.
This column is different in kind: Unknown is a real variant that exists precisely to
absorb spellings this build does not know, and older index versions legitimately store
values outside the current MessageKind::as_str set — reading them is exactly what the
self-healing migration path does. Asserting here turns “opened an older index” into a
panic; a proven case is cli_search_self_heals_v4_hybrid_missing_trigram_from_intact_messages
against rows storing kind = 'message'.
What this still fixes is the duplication: delegating to std::str::FromStr removes the second,
hand-maintained match list where a newly added variant could silently fall through to
Unknown forever. The round-trip test over every variant is what guards that.
Trait Implementations§
Source§impl Clone for MessageKind
impl Clone for MessageKind
impl Copy for MessageKind
Source§impl Debug for MessageKind
impl Debug for MessageKind
Source§impl<'de> Deserialize<'de> for MessageKind
impl<'de> Deserialize<'de> for MessageKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for MessageKind
impl Display for MessageKind
impl Eq for MessageKind
Source§impl FromStr for MessageKind
impl FromStr for MessageKind
Source§impl Hash for MessageKind
impl Hash for MessageKind
Source§impl PartialEq for MessageKind
impl PartialEq for MessageKind
Source§impl Serialize for MessageKind
impl Serialize for MessageKind
impl StructuralPartialEq for MessageKind
Source§impl ValueEnum for MessageKind
impl ValueEnum for MessageKind
Auto Trait Implementations§
impl Freeze for MessageKind
impl RefUnwindSafe for MessageKind
impl Send for MessageKind
impl Sync for MessageKind
impl Unpin for MessageKind
impl UnsafeUnpin for MessageKind
impl UnwindSafe for MessageKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more