1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
use std::collections::HashMap;
use crate::ids::{AgentId, FileId, RunId, ThreadId};
use crate::message::RunStatus;
#[derive(Clone, Debug)]
pub struct AgentRecord {
pub agent_id: AgentId,
pub agent_name: String,
pub file_ids: Vec<FileId>,
pub thread_ids: Vec<ThreadId>,
}
impl AgentRecord {
pub fn new(agent_id: AgentId, agent_name: String) -> Self {
Self {
agent_id,
agent_name,
file_ids: Vec::new(),
thread_ids: Vec::new(),
}
}
}
#[derive(Clone, Debug)]
pub struct ThreadRecord {
pub agent_id: AgentId,
pub thread_id: ThreadId,
pub most_recent_run_id: Option<RunId>,
pub most_recent_run_status: Option<RunStatus>,
}
#[derive(Clone, Debug, Default)]
pub struct OrchestratorState {
pub agents: HashMap<AgentId, AgentRecord>,
pub threads: HashMap<ThreadId, ThreadRecord>,
pub active_agent: Option<AgentId>,
pub active_thread: Option<ThreadId>,
}
impl OrchestratorState {
pub fn dispatch_state(&self) -> DispatchState {
DispatchState {
active_agent: self.active_agent.clone(),
active_thread: self.active_thread.clone(),
}
}
}
#[derive(Clone, Debug, Default)]
pub struct DispatchState {
pub active_agent: Option<AgentId>,
pub active_thread: Option<ThreadId>,
}