use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct AgentId(String);
impl AgentId {
#[must_use]
pub fn from_string(value: impl Into<String>) -> Self {
Self(value.into())
}
#[must_use]
pub fn as_str(&self) -> &str {
&self.0
}
}
impl Default for AgentId {
fn default() -> Self {
Self("main".to_string())
}
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct SessionId(String);
impl SessionId {
#[must_use]
pub fn new() -> Self {
Self(format!("session_{}", Uuid::new_v4()))
}
#[must_use]
pub fn from_string(value: impl Into<String>) -> Self {
Self(value.into())
}
#[must_use]
pub fn as_str(&self) -> &str {
&self.0
}
}
impl Default for SessionId {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct RunId(String);
impl RunId {
#[must_use]
pub fn new() -> Self {
Self(format!("run_{}", Uuid::new_v4()))
}
#[must_use]
pub fn from_string(value: impl Into<String>) -> Self {
Self(value.into())
}
#[must_use]
pub fn as_str(&self) -> &str {
&self.0
}
}
impl Default for RunId {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct ConversationId(String);
impl ConversationId {
#[must_use]
pub fn new() -> Self {
Self(format!("conv_{}", Uuid::new_v4()))
}
#[must_use]
pub fn from_string(value: impl Into<String>) -> Self {
Self(value.into())
}
#[must_use]
pub fn as_str(&self) -> &str {
&self.0
}
}
impl Default for ConversationId {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct CheckpointId(String);
impl CheckpointId {
#[must_use]
pub fn new() -> Self {
Self(format!("ckpt_{}", Uuid::new_v4()))
}
#[must_use]
pub fn from_string(value: impl Into<String>) -> Self {
Self(value.into())
}
#[must_use]
pub fn as_str(&self) -> &str {
&self.0
}
}
impl Default for CheckpointId {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct SubagentAttemptId(String);
impl SubagentAttemptId {
#[must_use]
pub fn new() -> Self {
Self(format!("subattempt_{}", Uuid::new_v4()))
}
#[must_use]
pub fn from_string(value: impl Into<String>) -> Self {
Self(value.into())
}
#[must_use]
pub fn as_str(&self) -> &str {
&self.0
}
}
impl Default for SubagentAttemptId {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct TaskId(String);
impl TaskId {
#[must_use]
pub fn new() -> Self {
Self(format!("task_{}", Uuid::new_v4()))
}
#[must_use]
pub fn from_string(value: impl Into<String>) -> Self {
Self(value.into())
}
#[must_use]
pub fn as_str(&self) -> &str {
&self.0
}
}
impl Default for TaskId {
fn default() -> Self {
Self::new()
}
}