Skip to main content

codetether_rlm/context_trace/
event_meta.rs

1use super::ContextEvent;
2
3impl ContextEvent {
4    /// Get the token count for this event.
5    pub fn tokens(&self) -> usize {
6        match self {
7            Self::SystemPrompt { tokens, .. }
8            | Self::GrepResult { tokens, .. }
9            | Self::LlmQueryResult { tokens, .. }
10            | Self::AssistantCode { tokens, .. }
11            | Self::ExecutionOutput { tokens, .. }
12            | Self::Final { tokens, .. }
13            | Self::ToolCall { tokens, .. }
14            | Self::ToolResult { tokens, .. } => *tokens,
15        }
16    }
17
18    /// Get a human-readable label for this event type.
19    pub fn label(&self) -> &'static str {
20        match self {
21            Self::SystemPrompt { .. } => "system_prompt",
22            Self::GrepResult { .. } => "grep_result",
23            Self::LlmQueryResult { .. } => "llm_query_result",
24            Self::AssistantCode { .. } => "assistant_code",
25            Self::ExecutionOutput { .. } => "execution_output",
26            Self::Final { .. } => "final",
27            Self::ToolCall { .. } => "tool_call",
28            Self::ToolResult { .. } => "tool_result",
29        }
30    }
31}