253 lines
7.1 KiB
Rust
253 lines
7.1 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
use std::fmt;
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum ToDoStatus {
|
|
Pending,
|
|
InProgress,
|
|
Completed,
|
|
Blocked,
|
|
ReadyForAgent,
|
|
Delegated,
|
|
Failed,
|
|
PendingApproval,
|
|
Draft,
|
|
}
|
|
|
|
impl Default for ToDoStatus {
|
|
fn default() -> Self {
|
|
ToDoStatus::Pending
|
|
}
|
|
}
|
|
|
|
impl fmt::Display for ToDoStatus {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
ToDoStatus::Pending => write!(f, "pending"),
|
|
ToDoStatus::InProgress => write!(f, "in_progress"),
|
|
ToDoStatus::Completed => write!(f, "completed"),
|
|
ToDoStatus::Blocked => write!(f, "blocked"),
|
|
ToDoStatus::ReadyForAgent => write!(f, "ready_for_agent"),
|
|
ToDoStatus::Delegated => write!(f, "delegated"),
|
|
ToDoStatus::Failed => write!(f, "failed"),
|
|
ToDoStatus::Draft => write!(f, "draft"),
|
|
ToDoStatus::PendingApproval => write!(f, "pending_approval"),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::str::FromStr for ToDoStatus {
|
|
type Err = String;
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
match s {
|
|
"pending" => Ok(ToDoStatus::Pending),
|
|
"in_progress" => Ok(ToDoStatus::InProgress),
|
|
"completed" => Ok(ToDoStatus::Completed),
|
|
"blocked" => Ok(ToDoStatus::Blocked),
|
|
"ready_for_agent" => Ok(ToDoStatus::ReadyForAgent),
|
|
"delegated" => Ok(ToDoStatus::Delegated),
|
|
"failed" => Ok(ToDoStatus::Failed),
|
|
"draft" => Ok(ToDoStatus::Draft),
|
|
"pending_approval" => Ok(ToDoStatus::PendingApproval),
|
|
_ => Err(format!("unknown status: {}", s)),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum TaskStatus {
|
|
Pending,
|
|
Running,
|
|
Completed,
|
|
Failed,
|
|
}
|
|
|
|
impl Default for TaskStatus {
|
|
fn default() -> Self {
|
|
TaskStatus::Pending
|
|
}
|
|
}
|
|
|
|
impl fmt::Display for TaskStatus {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
TaskStatus::Pending => write!(f, "pending"),
|
|
TaskStatus::Running => write!(f, "running"),
|
|
TaskStatus::Completed => write!(f, "completed"),
|
|
TaskStatus::Failed => write!(f, "failed"),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::str::FromStr for TaskStatus {
|
|
type Err = String;
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
match s {
|
|
"pending" => Ok(TaskStatus::Pending),
|
|
"running" => Ok(TaskStatus::Running),
|
|
"completed" => Ok(TaskStatus::Completed),
|
|
"failed" => Ok(TaskStatus::Failed),
|
|
_ => Err(format!("unknown status: {}", s)),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum ModelType {
|
|
Llm,
|
|
CodeGen,
|
|
Vision,
|
|
Audio,
|
|
Text,
|
|
Embedding,
|
|
}
|
|
|
|
impl fmt::Display for ModelType {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
ModelType::Llm => write!(f, "llm"),
|
|
ModelType::CodeGen => write!(f, "codegen"),
|
|
ModelType::Vision => write!(f, "vision"),
|
|
ModelType::Audio => write!(f, "audio"),
|
|
ModelType::Text => write!(f, "text"),
|
|
ModelType::Embedding => write!(f, "embedding"),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::str::FromStr for ModelType {
|
|
type Err = String;
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
match s {
|
|
"llm" => Ok(ModelType::Llm),
|
|
"codegen" => Ok(ModelType::CodeGen),
|
|
"vision" => Ok(ModelType::Vision),
|
|
"audio" => Ok(ModelType::Audio),
|
|
"text" => Ok(ModelType::Text),
|
|
"embedding" => Ok(ModelType::Embedding),
|
|
_ => Err(format!("unknown model type: {}", s)),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum DocType {
|
|
ApiDoc,
|
|
Readme,
|
|
CodeComment,
|
|
Architecture,
|
|
Other(String),
|
|
}
|
|
|
|
impl fmt::Display for DocType {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
DocType::ApiDoc => write!(f, "api_doc"),
|
|
DocType::Readme => write!(f, "readme"),
|
|
DocType::CodeComment => write!(f, "code_comment"),
|
|
DocType::Architecture => write!(f, "architecture"),
|
|
DocType::Other(s) => write!(f, "other:{}", s),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum PromptType {
|
|
Authority,
|
|
Confirm,
|
|
Select,
|
|
}
|
|
|
|
impl fmt::Display for PromptType {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
PromptType::Authority => write!(f, "authority"),
|
|
PromptType::Confirm => write!(f, "confirm"),
|
|
PromptType::Select => write!(f, "select"),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum PromptOption {
|
|
Accept,
|
|
Deny,
|
|
AcceptAlways,
|
|
Forbid,
|
|
Yes,
|
|
No,
|
|
OptionA,
|
|
OptionB,
|
|
OptionC,
|
|
}
|
|
|
|
impl fmt::Display for PromptOption {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
PromptOption::Accept => write!(f, "accept"),
|
|
PromptOption::Deny => write!(f, "deny"),
|
|
PromptOption::AcceptAlways => write!(f, "accept_always"),
|
|
PromptOption::Forbid => write!(f, "forbid"),
|
|
PromptOption::Yes => write!(f, "yes"),
|
|
PromptOption::No => write!(f, "no"),
|
|
PromptOption::OptionA => write!(f, "option_a"),
|
|
PromptOption::OptionB => write!(f, "option_b"),
|
|
PromptOption::OptionC => write!(f, "option_c"),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub enum TaskResultType {
|
|
Success,
|
|
Error,
|
|
Split,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum ToDoSource {
|
|
User,
|
|
Planner,
|
|
Automation,
|
|
Delegation,
|
|
}
|
|
|
|
impl Default for ToDoSource {
|
|
fn default() -> Self {
|
|
ToDoSource::User
|
|
}
|
|
}
|
|
|
|
impl std::fmt::Display for ToDoSource {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
match self {
|
|
ToDoSource::User => write!(f, "user"),
|
|
ToDoSource::Planner => write!(f, "planner"),
|
|
ToDoSource::Automation => write!(f, "automation"),
|
|
ToDoSource::Delegation => write!(f, "delegation"),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum TestStrategy {
|
|
Unit,
|
|
Integration,
|
|
E2e,
|
|
Property,
|
|
Manual,
|
|
}
|
|
|
|
impl std::fmt::Display for TestStrategy {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
match self {
|
|
TestStrategy::Unit => write!(f, "unit"),
|
|
TestStrategy::Integration => write!(f, "integration"),
|
|
TestStrategy::E2e => write!(f, "e2e"),
|
|
TestStrategy::Property => write!(f, "property"),
|
|
TestStrategy::Manual => write!(f, "manual"),
|
|
}
|
|
}
|
|
}
|