From 3662b334dfd68cfdf00ed44ae88927c2e1b2aabe Mon Sep 17 00:00:00 2001 From: soryu Date: Sun, 8 Feb 2026 21:07:30 +0000 Subject: Remove directive mechanism --- makima/src/db/models.rs | 333 ------------------------------------------------ 1 file changed, 333 deletions(-) (limited to 'makima/src/db/models.rs') 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, - /// Directive ID if this contract is part of a directive's chain - #[serde(skip_serializing_if = "Option::is_none")] - pub directive_id: Option, - /// 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, pub version: i32, pub created_at: DateTime, pub updated_at: DateTime, @@ -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 { - Some(3) -} - -/// Default max chain regenerations -fn default_max_chain_regenerations() -> Option { - 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, - pub max_wall_time_minutes: Option, - pub max_rework_cycles: Option, - pub max_chain_regenerations: Option, - pub repository_url: Option, - pub local_path: Option, - pub base_branch: Option, - pub orchestrator_contract_id: Option, - pub current_chain_id: Option, - pub chain_generation_count: i32, - pub total_cost_usd: f64, - pub started_at: Option>, - pub completed_at: Option>, - pub version: i32, - pub created_at: DateTime, - pub updated_at: DateTime, -} - -/// 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, - pub updated_at: DateTime, -} - -/// Response for directive list endpoint. -#[derive(Debug, Serialize, ToSchema)] -#[serde(rename_all = "camelCase")] -pub struct DirectiveListResponse { - pub directives: Vec, - 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, - pub max_wall_time_minutes: Option, - #[serde(default = "default_max_rework_cycles")] - pub max_rework_cycles: Option, - #[serde(default = "default_max_chain_regenerations")] - pub max_chain_regenerations: Option, - pub repository_url: Option, - pub local_path: Option, - pub base_branch: Option, -} - -/// 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, - pub goal: Option, - pub requirements: Option, - pub acceptance_criteria: Option, - pub constraints: Option, - pub external_dependencies: Option, - pub status: Option, - pub autonomy_level: Option, - pub confidence_threshold_green: Option, - pub confidence_threshold_yellow: Option, - pub max_total_cost_usd: Option, - pub max_wall_time_minutes: Option, - pub max_rework_cycles: Option, - pub max_chain_regenerations: Option, - pub repository_url: Option, - pub local_path: Option, - pub base_branch: Option, - /// Version for optimistic locking - pub version: Option, -} - -/// 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, -} - -/// 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, - pub chains: Vec, -} - -/// 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, - pub rationale: Option, - pub planning_model: Option, - pub status: String, - pub total_steps: i32, - pub completed_steps: i32, - pub failed_steps: i32, - pub current_confidence: Option, - pub started_at: Option>, - pub completed_at: Option>, - pub version: i32, - pub created_at: DateTime, - pub updated_at: DateTime, -} - -/// 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, - pub step_type: String, - pub contract_type: String, - pub initial_phase: Option, - pub task_plan: Option, - pub phases: Option>, - pub depends_on: Option>, - pub parallel_group: Option, - pub requirement_ids: Option>, - pub acceptance_criteria_ids: Option>, - #[sqlx(json)] - pub verifier_config: serde_json::Value, - pub status: String, - pub contract_id: Option, - pub supervisor_task_id: Option, - pub monitoring_contract_id: Option, - pub monitoring_task_id: Option, - pub confidence_score: Option, - pub confidence_level: Option, - pub evaluation_count: i32, - pub rework_count: i32, - pub last_evaluation_id: Option, - pub editor_x: Option, - pub editor_y: Option, - pub order_index: i32, - pub started_at: Option>, - pub completed_at: Option>, - pub created_at: DateTime, -} - -/// 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, -} - -/// 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, - pub step_id: Option, - pub contract_id: Option, - pub evaluation_type: String, - pub evaluation_number: i32, - pub evaluator: Option, - pub passed: bool, - pub overall_score: Option, - pub confidence_level: Option, - #[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, - #[sqlx(json)] - pub directive_snapshot: Option, - #[sqlx(json)] - pub deliverables_snapshot: Option, - pub started_at: DateTime, - pub completed_at: Option>, - pub created_at: DateTime, -} - -/// 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, - pub step_id: Option, - pub event_type: String, - pub severity: String, - #[sqlx(json)] - pub event_data: Option, - pub actor_type: String, - pub actor_id: Option, - pub created_at: DateTime, -} - -/// Response for evaluation list endpoint. -#[derive(Debug, Serialize, ToSchema)] -#[serde(rename_all = "camelCase")] -pub struct EvaluationListResponse { - pub evaluations: Vec, - pub total: i64, -} -- cgit v1.2.3