agentic_workflow/intelligence/
dream.rs1use serde::Serialize;
2
3pub struct DreamEngine {
5 insights: Vec<DreamInsight>,
6}
7
8#[derive(Debug, Clone, Serialize)]
9pub struct DreamInsight {
10 pub workflow_id: String,
11 pub insight_type: InsightType,
12 pub message: String,
13 pub severity: String,
14}
15
16#[derive(Debug, Clone, Serialize)]
17pub enum InsightType {
18 DependencyHealth,
19 ConfigurationDrift,
20 ScheduleOptimization,
21 UnusedWorkflow,
22 SecurityConcern,
23}
24
25impl DreamEngine {
26 pub fn new() -> Self {
27 Self {
28 insights: Vec::new(),
29 }
30 }
31
32 pub fn add_insight(
34 &mut self,
35 workflow_id: &str,
36 insight_type: InsightType,
37 message: &str,
38 severity: &str,
39 ) {
40 self.insights.push(DreamInsight {
41 workflow_id: workflow_id.to_string(),
42 insight_type,
43 message: message.to_string(),
44 severity: severity.to_string(),
45 });
46 }
47
48 pub fn get_insights(&self) -> &[DreamInsight] {
50 &self.insights
51 }
52
53 pub fn insights_for_workflow(&self, workflow_id: &str) -> Vec<&DreamInsight> {
55 self.insights
56 .iter()
57 .filter(|i| i.workflow_id == workflow_id)
58 .collect()
59 }
60
61 pub fn clear(&mut self) {
63 self.insights.clear();
64 }
65}
66
67impl Default for DreamEngine {
68 fn default() -> Self {
69 Self::new()
70 }
71}