harn_vm/agent_sessions/
types.rs1use super::*;
2
3impl LiveClientMode {
4 pub(super) fn as_str(&self) -> &'static str {
5 match self {
6 Self::Observer => "observer",
7 Self::Controller => "controller",
8 }
9 }
10}
11
12#[derive(Clone, Debug, PartialEq, Eq)]
13pub struct LiveSessionClient {
14 pub client_id: String,
15 pub mode: LiveClientMode,
16 pub attached_at: String,
17 pub last_seen_at: String,
18 pub prompt_injection: bool,
19 pub permission_routing: bool,
20 pub metadata: serde_json::Value,
21}
22
23#[derive(Clone, Debug, PartialEq, Eq)]
24pub struct AttachLiveClient {
25 pub client_id: String,
26 pub mode: LiveClientMode,
27 pub takeover: bool,
28 pub prompt_injection: bool,
29 pub permission_routing: bool,
30 pub metadata: serde_json::Value,
31}
32
33#[derive(Clone, Debug, PartialEq, Eq)]
34pub struct LiveClientChange {
35 pub client: Option<LiveSessionClient>,
36 pub previous_controller_id: Option<String>,
37 pub active_controller_id: Option<String>,
38 pub clients: Vec<LiveSessionClient>,
39}
40
41#[derive(Clone, Debug, PartialEq, Eq)]
42pub struct SessionAncestry {
43 pub parent_id: Option<String>,
44 pub child_ids: Vec<String>,
45 pub root_id: String,
46}
47
48#[derive(Clone, Debug, PartialEq, Eq)]
49pub struct SessionTruncateResult {
50 pub kept_turn_count: usize,
51 pub removed_turn_count: usize,
52 pub new_tip_turn_id: Option<String>,
53}
54
55#[derive(Clone, Debug, PartialEq, Eq)]
56pub struct SessionCheckpointSummary {
57 pub checkpoint_id: String,
58 pub before_message_count: usize,
59 pub after_message_count: usize,
60 pub fs_snapshot_ids: Vec<String>,
61}
62
63#[derive(Clone, Debug)]
64pub struct SessionTurnCheckpoint {
65 pub checkpoint_id: String,
66 pub completed_at: String,
67 pub before_transcript: VmValue,
68 pub after_transcript: VmValue,
69 pub before_message_count: usize,
70 pub after_message_count: usize,
71 pub fs_snapshot_ids: Vec<String>,
72}
73
74#[derive(Clone, Debug)]
75pub struct SessionRedoEntry {
76 pub checkpoint: SessionTurnCheckpoint,
77 pub redo_fs_snapshot_ids: Vec<String>,
78}
79
80#[derive(Clone, Debug, PartialEq, Eq)]
81pub enum SessionCheckpointError {
82 UnknownSession,
83 NoCheckpoint,
84 NoRedo,
85}
86
87#[derive(Clone, Debug, PartialEq, Eq)]
88pub struct SessionCheckpointOutcome {
89 pub status: &'static str,
90 pub checkpoint: SessionCheckpointSummary,
91 pub redo_fs_snapshot_ids: Vec<String>,
92}
93
94#[derive(Clone, Debug, PartialEq, Eq)]
95pub struct ReminderInjectionReport {
96 pub reminder_id: String,
97 pub deduped_count: usize,
98}