summaryrefslogtreecommitdiff
path: root/makima/src/db/models.rs
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-08 21:07:30 +0000
committersoryu <soryu@soryu.co>2026-02-08 21:07:30 +0000
commit3662b334dfd68cfdf00ed44ae88927c2e1b2aabe (patch)
treebff5ae1e189fb8bcc0211d97dab3b9acb4257038 /makima/src/db/models.rs
parent87fa8c4af66745bd30bc84b6c5ef657dd4dec002 (diff)
downloadsoryu-3662b334dfd68cfdf00ed44ae88927c2e1b2aabe.tar.gz
soryu-3662b334dfd68cfdf00ed44ae88927c2e1b2aabe.zip
Remove directive mechanism
Diffstat (limited to 'makima/src/db/models.rs')
-rw-r--r--makima/src/db/models.rs333
1 files changed, 0 insertions, 333 deletions
diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs
index 6045c7d..d0a0bd6 100644
--- a/makima/src/db/models.rs
+++ b/makima/src/db/models.rs
@@ -1446,16 +1446,6 @@ pub struct Contract {
/// Use `get_phase_config()` to get the parsed PhaseConfig.
#[serde(skip_serializing_if = "Option::is_none")]
pub phase_config: Option<serde_json::Value>,
- /// Directive ID if this contract is part of a directive's chain
- #[serde(skip_serializing_if = "Option::is_none")]
- pub directive_id: Option<Uuid>,
- /// Whether this contract is a directive orchestrator
- #[serde(default)]
- #[sqlx(default)]
- pub is_directive_orchestrator: bool,
- /// Reference to directive spawned by this orchestrator contract
- #[serde(skip_serializing_if = "Option::is_none")]
- pub spawned_directive_id: Option<Uuid>,
pub version: i32,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
@@ -2692,326 +2682,3 @@ mod tests {
}
// =============================================================================
-// Directive Types
-// =============================================================================
-
-/// Default autonomy level for directives
-fn default_autonomy_level() -> String {
- "guardrails".to_string()
-}
-
-/// Default empty JSON array
-fn default_json_array() -> serde_json::Value {
- serde_json::json!([])
-}
-
-/// Default empty JSON object
-fn default_json_object() -> serde_json::Value {
- serde_json::json!({})
-}
-
-/// Default confidence threshold (green)
-fn default_confidence_green() -> f64 {
- 0.85
-}
-
-/// Default confidence threshold (yellow)
-fn default_confidence_yellow() -> f64 {
- 0.60
-}
-
-/// Default max rework cycles
-fn default_max_rework_cycles() -> Option<i32> {
- Some(3)
-}
-
-/// Default max chain regenerations
-fn default_max_chain_regenerations() -> Option<i32> {
- Some(2)
-}
-
-/// Full directive row from the database.
-#[derive(Debug, Clone, FromRow, Serialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct Directive {
- pub id: Uuid,
- pub owner_id: Uuid,
- pub title: String,
- pub goal: String,
- #[sqlx(json)]
- pub requirements: serde_json::Value,
- #[sqlx(json)]
- pub acceptance_criteria: serde_json::Value,
- #[sqlx(json)]
- pub constraints: serde_json::Value,
- #[sqlx(json)]
- pub external_dependencies: serde_json::Value,
- pub status: String,
- pub autonomy_level: String,
- pub confidence_threshold_green: f64,
- pub confidence_threshold_yellow: f64,
- pub max_total_cost_usd: Option<f64>,
- pub max_wall_time_minutes: Option<i32>,
- pub max_rework_cycles: Option<i32>,
- pub max_chain_regenerations: Option<i32>,
- pub repository_url: Option<String>,
- pub local_path: Option<String>,
- pub base_branch: Option<String>,
- pub orchestrator_contract_id: Option<Uuid>,
- pub current_chain_id: Option<Uuid>,
- pub chain_generation_count: i32,
- pub total_cost_usd: f64,
- pub started_at: Option<DateTime<Utc>>,
- pub completed_at: Option<DateTime<Utc>>,
- pub version: i32,
- pub created_at: DateTime<Utc>,
- pub updated_at: DateTime<Utc>,
-}
-
-/// Summary of a directive for list views.
-#[derive(Debug, Clone, FromRow, Serialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct DirectiveSummary {
- pub id: Uuid,
- pub title: String,
- pub goal: String,
- pub status: String,
- pub autonomy_level: String,
- pub chain_count: i64,
- pub step_count: i64,
- pub total_cost_usd: f64,
- pub version: i32,
- pub created_at: DateTime<Utc>,
- pub updated_at: DateTime<Utc>,
-}
-
-/// Response for directive list endpoint.
-#[derive(Debug, Serialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct DirectiveListResponse {
- pub directives: Vec<DirectiveSummary>,
- pub total: i64,
-}
-
-/// Request to create a new directive.
-#[derive(Debug, Clone, Deserialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct CreateDirectiveRequest {
- pub title: String,
- pub goal: String,
- #[serde(default = "default_json_array")]
- pub requirements: serde_json::Value,
- #[serde(default = "default_json_array")]
- pub acceptance_criteria: serde_json::Value,
- #[serde(default = "default_json_array")]
- pub constraints: serde_json::Value,
- #[serde(default = "default_json_array")]
- pub external_dependencies: serde_json::Value,
- #[serde(default = "default_autonomy_level")]
- pub autonomy_level: String,
- #[serde(default = "default_confidence_green")]
- pub confidence_threshold_green: f64,
- #[serde(default = "default_confidence_yellow")]
- pub confidence_threshold_yellow: f64,
- pub max_total_cost_usd: Option<f64>,
- pub max_wall_time_minutes: Option<i32>,
- #[serde(default = "default_max_rework_cycles")]
- pub max_rework_cycles: Option<i32>,
- #[serde(default = "default_max_chain_regenerations")]
- pub max_chain_regenerations: Option<i32>,
- pub repository_url: Option<String>,
- pub local_path: Option<String>,
- pub base_branch: Option<String>,
-}
-
-/// Request to submit a chain plan for a directive.
-#[derive(Debug, Clone, Deserialize, Serialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct SubmitPlanRequest {
- pub plan: String,
-}
-
-/// Request to update an existing directive.
-#[derive(Debug, Clone, Deserialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct UpdateDirectiveRequest {
- pub title: Option<String>,
- pub goal: Option<String>,
- pub requirements: Option<serde_json::Value>,
- pub acceptance_criteria: Option<serde_json::Value>,
- pub constraints: Option<serde_json::Value>,
- pub external_dependencies: Option<serde_json::Value>,
- pub status: Option<String>,
- pub autonomy_level: Option<String>,
- pub confidence_threshold_green: Option<f64>,
- pub confidence_threshold_yellow: Option<f64>,
- pub max_total_cost_usd: Option<f64>,
- pub max_wall_time_minutes: Option<i32>,
- pub max_rework_cycles: Option<i32>,
- pub max_chain_regenerations: Option<i32>,
- pub repository_url: Option<String>,
- pub local_path: Option<String>,
- pub base_branch: Option<String>,
- /// Version for optimistic locking
- pub version: Option<i32>,
-}
-
-/// Lightweight contract summary attached to a chain step.
-#[derive(Debug, FromRow, Serialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct StepContractSummary {
- pub id: Uuid,
- pub name: String,
- pub contract_type: String,
- pub phase: String,
- pub status: String,
- pub task_count: i64,
- pub tasks_done: i64,
- pub tasks_running: i64,
- pub tasks_failed: i64,
-}
-
-/// Chain step enriched with optional contract summary.
-#[derive(Debug, Serialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct ChainStepWithContract {
- #[serde(flatten)]
- pub step: ChainStep,
- pub contract_summary: Option<StepContractSummary>,
-}
-
-/// Directive with its chains and steps for detail view.
-#[derive(Debug, Serialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct DirectiveWithChains {
- #[serde(flatten)]
- pub directive: Directive,
- pub orchestrator_contract_summary: Option<StepContractSummary>,
- pub chains: Vec<ChainWithSteps>,
-}
-
-/// Full row from directive_chains table.
-#[derive(Debug, Clone, FromRow, Serialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct DirectiveChain {
- pub id: Uuid,
- pub directive_id: Uuid,
- pub generation: i32,
- pub name: String,
- pub description: Option<String>,
- pub rationale: Option<String>,
- pub planning_model: Option<String>,
- pub status: String,
- pub total_steps: i32,
- pub completed_steps: i32,
- pub failed_steps: i32,
- pub current_confidence: Option<f64>,
- pub started_at: Option<DateTime<Utc>>,
- pub completed_at: Option<DateTime<Utc>>,
- pub version: i32,
- pub created_at: DateTime<Utc>,
- pub updated_at: DateTime<Utc>,
-}
-
-/// Full row from chain_steps table.
-#[derive(Debug, Clone, FromRow, Serialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct ChainStep {
- pub id: Uuid,
- pub chain_id: Uuid,
- pub name: String,
- pub description: Option<String>,
- pub step_type: String,
- pub contract_type: String,
- pub initial_phase: Option<String>,
- pub task_plan: Option<String>,
- pub phases: Option<Vec<String>>,
- pub depends_on: Option<Vec<Uuid>>,
- pub parallel_group: Option<String>,
- pub requirement_ids: Option<Vec<String>>,
- pub acceptance_criteria_ids: Option<Vec<String>>,
- #[sqlx(json)]
- pub verifier_config: serde_json::Value,
- pub status: String,
- pub contract_id: Option<Uuid>,
- pub supervisor_task_id: Option<Uuid>,
- pub monitoring_contract_id: Option<Uuid>,
- pub monitoring_task_id: Option<Uuid>,
- pub confidence_score: Option<f64>,
- pub confidence_level: Option<String>,
- pub evaluation_count: i32,
- pub rework_count: i32,
- pub last_evaluation_id: Option<Uuid>,
- pub editor_x: Option<f64>,
- pub editor_y: Option<f64>,
- pub order_index: i32,
- pub started_at: Option<DateTime<Utc>>,
- pub completed_at: Option<DateTime<Utc>>,
- pub created_at: DateTime<Utc>,
-}
-
-/// Chain with its steps for detail view.
-#[derive(Debug, Serialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct ChainWithSteps {
- #[serde(flatten)]
- pub chain: DirectiveChain,
- pub steps: Vec<ChainStepWithContract>,
-}
-
-/// Full row from directive_evaluations table.
-#[derive(Debug, Clone, FromRow, Serialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct DirectiveEvaluation {
- pub id: Uuid,
- pub directive_id: Uuid,
- pub chain_id: Option<Uuid>,
- pub step_id: Option<Uuid>,
- pub contract_id: Option<Uuid>,
- pub evaluation_type: String,
- pub evaluation_number: i32,
- pub evaluator: Option<String>,
- pub passed: bool,
- pub overall_score: Option<f64>,
- pub confidence_level: Option<String>,
- #[sqlx(json)]
- pub programmatic_results: serde_json::Value,
- #[sqlx(json)]
- pub llm_results: serde_json::Value,
- #[sqlx(json)]
- pub criteria_results: serde_json::Value,
- pub summary_feedback: String,
- pub rework_instructions: Option<String>,
- #[sqlx(json)]
- pub directive_snapshot: Option<serde_json::Value>,
- #[sqlx(json)]
- pub deliverables_snapshot: Option<serde_json::Value>,
- pub started_at: DateTime<Utc>,
- pub completed_at: Option<DateTime<Utc>>,
- pub created_at: DateTime<Utc>,
-}
-
-/// Full row from directive_events table.
-#[derive(Debug, Clone, FromRow, Serialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct DirectiveEvent {
- pub id: Uuid,
- pub directive_id: Uuid,
- pub chain_id: Option<Uuid>,
- pub step_id: Option<Uuid>,
- pub event_type: String,
- pub severity: String,
- #[sqlx(json)]
- pub event_data: Option<serde_json::Value>,
- pub actor_type: String,
- pub actor_id: Option<Uuid>,
- pub created_at: DateTime<Utc>,
-}
-
-/// Response for evaluation list endpoint.
-#[derive(Debug, Serialize, ToSchema)]
-#[serde(rename_all = "camelCase")]
-pub struct EvaluationListResponse {
- pub evaluations: Vec<DirectiveEvaluation>,
- pub total: i64,
-}