General Improvements
This commit is contained in:
parent
f1c7317fab
commit
9824a32add
15 changed files with 1376 additions and 48 deletions
176
src/enums.rs
176
src/enums.rs
|
|
@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
|
|||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ToDoMode {
|
||||
Discussion,
|
||||
Finalized,
|
||||
|
|
@ -34,6 +35,7 @@ impl std::str::FromStr for ToDoMode {
|
|||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ToDoStatus {
|
||||
Pending,
|
||||
InProgress,
|
||||
|
|
@ -44,6 +46,10 @@ pub enum ToDoStatus {
|
|||
Failed,
|
||||
PendingApproval,
|
||||
Draft,
|
||||
/// Agent succeeded and reported mutations; awaiting mutation review/approval.
|
||||
ChangesPending,
|
||||
/// Mutations have been approved; awaiting application and validation.
|
||||
ChangesApproved,
|
||||
}
|
||||
|
||||
impl Default for ToDoStatus {
|
||||
|
|
@ -64,6 +70,8 @@ impl fmt::Display for ToDoStatus {
|
|||
ToDoStatus::Failed => write!(f, "failed"),
|
||||
ToDoStatus::Draft => write!(f, "draft"),
|
||||
ToDoStatus::PendingApproval => write!(f, "pending_approval"),
|
||||
ToDoStatus::ChangesPending => write!(f, "changes_pending"),
|
||||
ToDoStatus::ChangesApproved => write!(f, "changes_approved"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -81,6 +89,8 @@ impl std::str::FromStr for ToDoStatus {
|
|||
"failed" => Ok(ToDoStatus::Failed),
|
||||
"draft" => Ok(ToDoStatus::Draft),
|
||||
"pending_approval" => Ok(ToDoStatus::PendingApproval),
|
||||
"changes_pending" => Ok(ToDoStatus::ChangesPending),
|
||||
"changes_approved" => Ok(ToDoStatus::ChangesApproved),
|
||||
_ => Err(format!("unknown status: {}", s)),
|
||||
}
|
||||
}
|
||||
|
|
@ -262,6 +272,172 @@ impl std::fmt::Display for ToDoSource {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for ToDoSource {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
"user" => Ok(ToDoSource::User),
|
||||
"planner" => Ok(ToDoSource::Planner),
|
||||
"automation" => Ok(ToDoSource::Automation),
|
||||
"delegation" => Ok(ToDoSource::Delegation),
|
||||
_ => Err(format!("unknown todo source: {}", s)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ExecutionKind {
|
||||
Manual,
|
||||
Planner,
|
||||
Build,
|
||||
TestEvaluation,
|
||||
TestImplementation,
|
||||
Documentation,
|
||||
Explore,
|
||||
}
|
||||
|
||||
impl Default for ExecutionKind {
|
||||
fn default() -> Self {
|
||||
ExecutionKind::Manual
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ExecutionKind {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
ExecutionKind::Manual => write!(f, "manual"),
|
||||
ExecutionKind::Planner => write!(f, "planner"),
|
||||
ExecutionKind::Build => write!(f, "build"),
|
||||
ExecutionKind::TestEvaluation => write!(f, "test_evaluation"),
|
||||
ExecutionKind::TestImplementation => write!(f, "test_implementation"),
|
||||
ExecutionKind::Documentation => write!(f, "documentation"),
|
||||
ExecutionKind::Explore => write!(f, "explore"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for ExecutionKind {
|
||||
type Err = String;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
"manual" => Ok(ExecutionKind::Manual),
|
||||
"planner" => Ok(ExecutionKind::Planner),
|
||||
"build" => Ok(ExecutionKind::Build),
|
||||
"test_evaluation" => Ok(ExecutionKind::TestEvaluation),
|
||||
"test_implementation" => Ok(ExecutionKind::TestImplementation),
|
||||
"documentation" => Ok(ExecutionKind::Documentation),
|
||||
"explore" => Ok(ExecutionKind::Explore),
|
||||
_ => Err(format!("unknown execution kind: {}", s)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Lifecycle stage of a mutation set reported by an agent.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum MutationLifecycle {
|
||||
/// Agent generated mutations but they have not yet been staged for review.
|
||||
Generated,
|
||||
/// Mutations are staged and ready for human or agent-flow review.
|
||||
Staged,
|
||||
/// Mutations have been reviewed (may follow with approve/reject).
|
||||
Reviewed,
|
||||
/// Mutations have been approved for application.
|
||||
Approved,
|
||||
/// Mutations have been applied to the working tree.
|
||||
Applied,
|
||||
/// Applied mutations have passed validation (tests, checks).
|
||||
Validated,
|
||||
/// Mutations have been committed.
|
||||
Committed,
|
||||
/// Mutations were rejected.
|
||||
Rejected,
|
||||
}
|
||||
|
||||
impl Default for MutationLifecycle {
|
||||
fn default() -> Self {
|
||||
MutationLifecycle::Generated
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for MutationLifecycle {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
MutationLifecycle::Generated => write!(f, "generated"),
|
||||
MutationLifecycle::Staged => write!(f, "staged"),
|
||||
MutationLifecycle::Reviewed => write!(f, "reviewed"),
|
||||
MutationLifecycle::Approved => write!(f, "approved"),
|
||||
MutationLifecycle::Applied => write!(f, "applied"),
|
||||
MutationLifecycle::Validated => write!(f, "validated"),
|
||||
MutationLifecycle::Committed => write!(f, "committed"),
|
||||
MutationLifecycle::Rejected => write!(f, "rejected"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for MutationLifecycle {
|
||||
type Err = String;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
"generated" => Ok(MutationLifecycle::Generated),
|
||||
"staged" => Ok(MutationLifecycle::Staged),
|
||||
"reviewed" => Ok(MutationLifecycle::Reviewed),
|
||||
"approved" => Ok(MutationLifecycle::Approved),
|
||||
"applied" => Ok(MutationLifecycle::Applied),
|
||||
"validated" => Ok(MutationLifecycle::Validated),
|
||||
"committed" => Ok(MutationLifecycle::Committed),
|
||||
"rejected" => Ok(MutationLifecycle::Rejected),
|
||||
_ => Err(format!("unknown mutation lifecycle: {}", s)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Controls how task completion depends on mutation lifecycle.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum CompletionPolicy {
|
||||
/// Mutations are auto-applied without review; task completes after validation.
|
||||
AutoApply,
|
||||
/// Mutations require human/agent-flow approval before application.
|
||||
ApprovalRequired,
|
||||
/// Mutations are recorded but never applied (sandbox-only).
|
||||
DryRun,
|
||||
/// No mutations expected; task completes when agent succeeds.
|
||||
DocumentationOnly,
|
||||
}
|
||||
|
||||
impl Default for CompletionPolicy {
|
||||
fn default() -> Self {
|
||||
CompletionPolicy::ApprovalRequired
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for CompletionPolicy {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
CompletionPolicy::AutoApply => write!(f, "auto_apply"),
|
||||
CompletionPolicy::ApprovalRequired => write!(f, "approval_required"),
|
||||
CompletionPolicy::DryRun => write!(f, "dry_run"),
|
||||
CompletionPolicy::DocumentationOnly => write!(f, "documentation_only"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for CompletionPolicy {
|
||||
type Err = String;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
"auto_apply" => Ok(CompletionPolicy::AutoApply),
|
||||
"approval_required" => Ok(CompletionPolicy::ApprovalRequired),
|
||||
"dry_run" => Ok(CompletionPolicy::DryRun),
|
||||
"documentation_only" => Ok(CompletionPolicy::DocumentationOnly),
|
||||
_ => Err(format!("unknown completion policy: {}", s)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum TestStrategy {
|
||||
|
|
|
|||
Loading…
Reference in a new issue