Skip to main content

systemprompt_analytics/models/cli/
agent.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use sqlx::FromRow;
4use systemprompt_identifiers::ContextId;
5
6#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
7pub struct AgentListRow {
8    pub agent_name: String,
9    pub task_count: i64,
10    pub completed_count: i64,
11    pub avg_execution_time_ms: i64,
12    pub total_cost_cents: i64,
13    pub last_active: DateTime<Utc>,
14}
15
16#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
17pub struct AgentStatsRow {
18    pub total_agents: i64,
19    pub total_tasks: i64,
20    pub completed_tasks: i64,
21    pub failed_tasks: i64,
22    pub avg_execution_time_ms: f64,
23}
24
25#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
26pub struct AgentAiStatsRow {
27    pub total_ai_requests: i64,
28    pub total_cost_cents: i64,
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
32pub struct AgentTaskRow {
33    pub started_at: DateTime<Utc>,
34    pub status: Option<String>,
35    pub execution_time_ms: Option<i32>,
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
39pub struct AgentStatusBreakdownRow {
40    pub status: String,
41    pub status_count: i64,
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
45pub struct AgentErrorRow {
46    pub error_type: Option<String>,
47    pub error_count: i64,
48}
49
50#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
51pub struct AgentHourlyRow {
52    pub task_hour: i32,
53    pub task_count: i64,
54}
55
56#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
57pub struct AgentSummaryRow {
58    pub total_tasks: i64,
59    pub completed: i64,
60    pub failed: i64,
61    pub avg_time: f64,
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
65pub struct ConversationListRow {
66    pub context_id: ContextId,
67    pub name: Option<String>,
68    pub task_count: i64,
69    pub message_count: i64,
70    pub created_at: DateTime<Utc>,
71    pub updated_at: DateTime<Utc>,
72}
73
74#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
75pub struct ConversationStatsRow {
76    pub total_contexts: i64,
77}
78
79#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
80pub struct TaskStatsRow {
81    pub total_tasks: i64,
82    pub avg_execution_time_ms: Option<f64>,
83}
84
85#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
86pub struct MessageCountRow {
87    pub total_messages: i64,
88}
89
90#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
91pub struct TimestampRow {
92    pub timestamp: DateTime<Utc>,
93}