Skip to main content

remem/session_activity/
types.rs

1use serde::Serialize;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub struct SessionActivityKey {
5    pub source_root: String,
6    pub project: String,
7    pub session_id: String,
8}
9
10#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
11pub struct TurnAction {
12    pub index: i64,
13    pub kind: String,
14    pub tool_name: Option<String>,
15    pub summary: String,
16    pub event_row_id: Option<i64>,
17    pub files: Vec<String>,
18    pub outcome: Option<String>,
19    pub created_at_epoch: i64,
20}
21
22#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
23pub struct SessionTurn {
24    pub id: Option<i64>,
25    pub turn_index: i64,
26    pub user_message_id: i64,
27    pub user_said: String,
28    pub understanding_message_id: Option<i64>,
29    pub understanding: Option<String>,
30    pub understanding_source: Option<String>,
31    pub result_message_id: Option<i64>,
32    pub actions_summary: Option<String>,
33    pub result_status: String,
34    pub result_summary: Option<String>,
35    pub started_at_epoch: i64,
36    pub ended_at_epoch: Option<i64>,
37    pub capture_health: String,
38    pub actions: Vec<TurnAction>,
39    pub actions_truncated: bool,
40}
41
42#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
43pub struct ProjectionResult {
44    pub changed: bool,
45    pub source_digest: String,
46    pub turn_count: usize,
47}
48
49#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
50pub struct RawSessionActivity {
51    pub session_row_id: Option<i64>,
52    pub override_available: bool,
53    pub mmdd: Option<String>,
54    pub session_intent: Option<String>,
55    pub session_topic: Option<String>,
56    pub session_intent_source: Option<String>,
57    pub display_label: Option<String>,
58    pub source_root: String,
59    pub project: String,
60    pub session_id: String,
61    pub message_count: i64,
62    pub user_message_count: i64,
63    pub assistant_message_count: i64,
64    pub first_epoch: Option<i64>,
65    pub last_epoch: i64,
66    pub message_counts_truncated: bool,
67    pub projected_turn_count: i64,
68}
69
70#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
71pub struct RawSessionActivityPage {
72    pub data: Vec<RawSessionActivity>,
73    pub has_more: bool,
74    pub next_cursor: Option<String>,
75}
76
77#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
78pub struct SessionActivityItem {
79    pub source_root: String,
80    pub project: String,
81    pub session_id: String,
82    #[serde(flatten)]
83    pub turn: SessionTurn,
84}
85
86#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
87pub struct SessionActivityPage {
88    pub data: Vec<SessionActivityItem>,
89    pub has_more: bool,
90    pub next_before_id: Option<i64>,
91}
92
93#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
94pub struct ActivityCount {
95    pub key: String,
96    pub count: i64,
97}
98
99#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
100pub struct SessionActivityStats {
101    pub sessions: i64,
102    pub turns: i64,
103    pub actions: i64,
104    pub result_status: Vec<ActivityCount>,
105    pub capture_health: Vec<ActivityCount>,
106    pub projects: Vec<ActivityCount>,
107    pub tools: Vec<ActivityCount>,
108}