diff options
Diffstat (limited to 'makima/src/db/models.rs')
| -rw-r--r-- | makima/src/db/models.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs index 4419580..d792f2c 100644 --- a/makima/src/db/models.rs +++ b/makima/src/db/models.rs @@ -991,6 +991,9 @@ pub struct MergeCompleteCheckResponse { // Contract Types // ============================================================================= +/// Contract type constant for task (adhoc) contracts +pub const CONTRACT_TYPE_TASK: &str = "task"; + /// Contract type determines the workflow and required documents #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, ToSchema)] #[serde(rename_all = "lowercase")] @@ -1006,6 +1009,11 @@ pub enum ContractType { /// - Execute: implement according to specs /// - Review: verify against specifications Specification, + /// Task type for adhoc one-off tasks + /// - Single "execute" phase + /// - No supervisor created + /// - Auto-archives on completion + Task, } impl Default for ContractType { @@ -1019,6 +1027,7 @@ impl std::fmt::Display for ContractType { match self { ContractType::Simple => write!(f, "simple"), ContractType::Specification => write!(f, "specification"), + ContractType::Task => write!(f, "task"), } } } @@ -1030,6 +1039,7 @@ impl std::str::FromStr for ContractType { match s.to_lowercase().as_str() { "simple" => Ok(ContractType::Simple), "specification" => Ok(ContractType::Specification), + "task" => Ok(ContractType::Task), _ => Err(format!("Unknown contract type: {}", s)), } } @@ -1792,3 +1802,30 @@ pub struct ForkPoint { pub checkpoint: Option<TaskCheckpoint>, pub timestamp: DateTime<Utc>, } + +// ============================================================================= +// Adhoc Task Types (for one-off tasks without supervisor overhead) +// ============================================================================= + +/// Request payload for creating an adhoc (one-off) task. +/// Creates a minimal "task" type contract with a single task, no supervisor. +#[derive(Debug, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct AdhocTaskRequest { + /// Name/description of the task + pub name: String, + /// The plan/instructions for the task + pub plan: String, + /// Repository URL (optional) + pub repository_url: Option<String>, + /// Base branch to work from + pub base_branch: Option<String>, +} + +/// Response for adhoc task creation +#[derive(Debug, Serialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct AdhocTaskResponse { + pub contract: ContractSummary, + pub task: Task, +} |
