1use serde::{Deserialize, Serialize};
4use std::collections::HashMap;
5use chrono::{DateTime, Utc};
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct Task {
10 pub id: String,
11 pub request: String,
12 pub status: TaskStatus,
13 pub created_at: DateTime<Utc>,
14 pub updated_at: DateTime<Utc>,
15 pub result: Option<TaskResult>,
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub enum TaskStatus {
20 Pending,
21 InProgress,
22 Completed,
23 Failed,
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct TaskResult {
29 pub success: bool,
30 pub summary: String,
31 pub details: Option<String>,
32 pub execution_time: Option<u64>,
33 pub task_plan: Option<TaskPlan>,
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
38pub struct TaskPlan {
39 pub understanding: String,
40 pub approach: String,
41 pub complexity: TaskComplexity,
42 pub estimated_steps: Option<u32>,
43 pub requirements: Vec<String>,
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
47pub enum TaskComplexity {
48 Simple, Moderate, Complex, }
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55pub struct ExecutionContext {
56 pub task_id: String,
57 pub plan: TaskPlan,
58 pub current_step: u32,
59 pub results: Vec<ExecutionStep>,
60 pub variables: HashMap<String, serde_json::Value>,
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
64pub struct ExecutionStep {
65 pub step_number: u32,
66 pub action: Action,
67 pub result: Option<StepResult>,
68 pub timestamp: DateTime<Utc>,
69}
70
71#[derive(Debug, Clone, Serialize, Deserialize)]
72pub struct Action {
73 pub action_type: ActionType,
74 pub reasoning: String,
75 pub confidence: f32,
76}
77
78#[derive(Debug, Clone, Serialize, Deserialize)]
79pub enum ActionType {
80 UseTool {
81 tool_name: String,
82 arguments: HashMap<String, serde_json::Value>,
83 },
84 Think {
85 reasoning: String,
86 },
87 Complete {
88 summary: String,
89 },
90 AskClarification {
91 question: String,
92 },
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
96pub struct StepResult {
97 pub success: bool,
98 pub output: serde_json::Value,
99 pub error: Option<String>,
100 pub execution_time: u64,
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize)]
105pub struct ExecutionDecision {
106 pub action_type: ActionType,
107 pub reasoning: String,
108 pub confidence: f32,
109}
110
111#[derive(Debug, Clone)]
113pub struct ExecutionResult {
114 pub success: bool,
115 pub summary: String,
116 pub details: String,
117 pub execution_time: u64,
118}