Skip to main content

systemprompt_logging/trace/
models.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use serde_json::Value;
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct TraceEvent {
7    pub event_type: String,
8    pub timestamp: DateTime<Utc>,
9    pub details: String,
10    pub user_id: Option<String>,
11    pub session_id: Option<String>,
12    pub task_id: Option<String>,
13    pub context_id: Option<String>,
14    pub metadata: Option<String>,
15}
16
17#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize)]
18pub struct AiRequestSummary {
19    pub total_cost_cents: i64,
20    pub total_tokens: i64,
21    pub total_input_tokens: i64,
22    pub total_output_tokens: i64,
23    pub request_count: i64,
24    pub total_latency_ms: i64,
25}
26
27#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize)]
28pub struct McpExecutionSummary {
29    pub execution_count: i64,
30    pub total_execution_time_ms: i64,
31}
32
33#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize)]
34pub struct ExecutionStepSummary {
35    #[serde(rename = "step_count")]
36    pub total: i64,
37    #[serde(rename = "completed_count")]
38    pub completed: i64,
39    #[serde(rename = "failed_count")]
40    pub failed: i64,
41    #[serde(rename = "pending_count")]
42    pub pending: i64,
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
46pub struct TaskInfo {
47    pub task_id: String,
48    pub context_id: String,
49    pub agent_name: Option<String>,
50    pub status: String,
51    pub created_at: DateTime<Utc>,
52    pub started_at: Option<DateTime<Utc>>,
53    pub completed_at: Option<DateTime<Utc>>,
54    pub execution_time_ms: Option<i32>,
55    pub error_message: Option<String>,
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
59pub struct ExecutionStep {
60    pub step_id: String,
61    pub step_type: Option<String>,
62    pub title: Option<String>,
63    pub status: String,
64    pub duration_ms: Option<i32>,
65    pub error_message: Option<String>,
66}
67
68#[derive(Debug, Clone, Serialize, Deserialize)]
69pub struct AiRequestInfo {
70    pub id: String,
71    pub provider: String,
72    pub model: String,
73    pub max_tokens: Option<i32>,
74    pub input_tokens: Option<i32>,
75    pub output_tokens: Option<i32>,
76    pub cost_cents: i32,
77    pub latency_ms: Option<i32>,
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize)]
81pub struct McpToolExecution {
82    pub mcp_execution_id: String,
83    pub tool_name: String,
84    pub server_name: String,
85    pub status: String,
86    pub execution_time_ms: Option<i32>,
87    pub error_message: Option<String>,
88    pub input: String,
89    pub output: Option<String>,
90}
91
92#[derive(Debug, Clone, Serialize, Deserialize)]
93pub struct ConversationMessage {
94    pub role: String,
95    pub content: String,
96    pub sequence_number: i32,
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
100pub struct ToolLogEntry {
101    pub timestamp: DateTime<Utc>,
102    pub level: String,
103    pub module: String,
104    pub message: String,
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize)]
108pub struct TaskArtifact {
109    pub artifact_id: String,
110    pub artifact_type: String,
111    pub name: Option<String>,
112    pub source: Option<String>,
113    pub tool_name: Option<String>,
114    pub part_kind: Option<String>,
115    pub text_content: Option<String>,
116    pub data_content: Option<Value>,
117}