summaryrefslogtreecommitdiff
path: root/makima/src/db/models.rs
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-01-15 22:55:04 +0000
committersoryu <soryu@soryu.co>2026-01-16 01:12:03 +0000
commitb69dc962cd99aa8b478b7c5facbd56bfb63eda27 (patch)
tree9922f60b0da646eaf00165d5348b25e822dfd7b0 /makima/src/db/models.rs
parent6ee2e75834bff187b8c262e0798ef365bc21cd59 (diff)
downloadsoryu-b69dc962cd99aa8b478b7c5facbd56bfb63eda27.tar.gz
soryu-b69dc962cd99aa8b478b7c5facbd56bfb63eda27.zip
Add Task Contract Type for one-off adhoc tasks (#2)
Diffstat (limited to 'makima/src/db/models.rs')
-rw-r--r--makima/src/db/models.rs37
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,
+}