1use serde::{Deserialize, Serialize};
2use uuid::Uuid;
3
4#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
6pub struct AgentId(String);
7
8impl AgentId {
9 #[must_use]
11 pub fn from_string(value: impl Into<String>) -> Self {
12 Self(value.into())
13 }
14
15 #[must_use]
17 pub fn as_str(&self) -> &str {
18 &self.0
19 }
20}
21
22impl Default for AgentId {
23 fn default() -> Self {
24 Self("main".to_string())
25 }
26}
27
28#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
30pub struct SessionId(String);
31
32impl SessionId {
33 #[must_use]
35 pub fn new() -> Self {
36 Self(format!("session_{}", Uuid::new_v4()))
37 }
38
39 #[must_use]
41 pub fn from_string(value: impl Into<String>) -> Self {
42 Self(value.into())
43 }
44
45 #[must_use]
47 pub fn as_str(&self) -> &str {
48 &self.0
49 }
50}
51
52impl Default for SessionId {
53 fn default() -> Self {
54 Self::new()
55 }
56}
57
58#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
60pub struct RunId(String);
61
62impl RunId {
63 #[must_use]
65 pub fn new() -> Self {
66 Self(format!("run_{}", Uuid::new_v4()))
67 }
68
69 #[must_use]
71 pub fn from_string(value: impl Into<String>) -> Self {
72 Self(value.into())
73 }
74
75 #[must_use]
77 pub fn as_str(&self) -> &str {
78 &self.0
79 }
80}
81
82impl Default for RunId {
83 fn default() -> Self {
84 Self::new()
85 }
86}
87
88#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
90pub struct ConversationId(String);
91
92impl ConversationId {
93 #[must_use]
95 pub fn new() -> Self {
96 Self(format!("conv_{}", Uuid::new_v4()))
97 }
98
99 #[must_use]
101 pub fn from_string(value: impl Into<String>) -> Self {
102 Self(value.into())
103 }
104
105 #[must_use]
107 pub fn as_str(&self) -> &str {
108 &self.0
109 }
110}
111
112impl Default for ConversationId {
113 fn default() -> Self {
114 Self::new()
115 }
116}
117
118#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
120pub struct CheckpointId(String);
121
122impl CheckpointId {
123 #[must_use]
125 pub fn new() -> Self {
126 Self(format!("ckpt_{}", Uuid::new_v4()))
127 }
128
129 #[must_use]
131 pub fn from_string(value: impl Into<String>) -> Self {
132 Self(value.into())
133 }
134
135 #[must_use]
137 pub fn as_str(&self) -> &str {
138 &self.0
139 }
140}
141
142impl Default for CheckpointId {
143 fn default() -> Self {
144 Self::new()
145 }
146}
147
148#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
154pub struct SubagentAttemptId(String);
155
156impl SubagentAttemptId {
157 #[must_use]
159 pub fn new() -> Self {
160 Self(format!("subattempt_{}", Uuid::new_v4()))
161 }
162
163 #[must_use]
165 pub fn from_string(value: impl Into<String>) -> Self {
166 Self(value.into())
167 }
168
169 #[must_use]
171 pub fn as_str(&self) -> &str {
172 &self.0
173 }
174}
175
176impl Default for SubagentAttemptId {
177 fn default() -> Self {
178 Self::new()
179 }
180}
181
182#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
184pub struct TaskId(String);
185
186impl TaskId {
187 #[must_use]
189 pub fn new() -> Self {
190 Self(format!("task_{}", Uuid::new_v4()))
191 }
192
193 #[must_use]
195 pub fn from_string(value: impl Into<String>) -> Self {
196 Self(value.into())
197 }
198
199 #[must_use]
201 pub fn as_str(&self) -> &str {
202 &self.0
203 }
204}
205
206impl Default for TaskId {
207 fn default() -> Self {
208 Self::new()
209 }
210}