Skip to main content

smith_protocol/
reasoning.rs

1//! Reasoning session types for client-facing APIs
2//! These are minimal types for Phase 1 cleanup - full reasoning logic stays in service
3
4use chrono::{DateTime, Utc};
5use serde::{Deserialize, Serialize};
6use uuid::Uuid;
7
8/// Minimal reasoning session type for client visibility  
9#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct ReasoningSession {
11    /// Unique identifier for this session
12    pub id: Uuid,
13    /// The original goal/query for this session  
14    pub goal: String,
15    /// Current state of the session
16    pub state: SessionState,
17    /// All reasoning steps in chronological order
18    pub steps: Vec<ReasoningStep>,
19    /// Maximum number of reasoning iterations allowed
20    pub max_iterations: usize,
21    /// Current iteration count
22    pub current_iteration: usize,
23    /// Timestamp when session was created  
24    pub created_at: DateTime<Utc>,
25    /// Timestamp when session was last updated
26    pub updated_at: DateTime<Utc>,
27    /// Start time of session
28    pub start_time: DateTime<Utc>,
29    /// Optional end time
30    pub end_time: Option<DateTime<Utc>>,
31}
32
33/// Current state of a reasoning session
34#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
35pub enum SessionState {
36    /// Session is actively being processed
37    Active,
38    /// Session completed successfully
39    Completed,
40    /// Session failed with an error
41    Failed,
42    /// Session was cancelled by user
43    Cancelled,
44    /// Session timed out
45    Timeout,
46}
47
48/// A single reasoning step within a session
49#[derive(Debug, Clone, Serialize, Deserialize)]
50pub struct ReasoningStep {
51    /// Unique identifier for this step
52    pub id: Uuid,
53    /// Type/category of this reasoning step
54    pub step_type: ReasoningStepType,
55    /// Human-readable description of what this step does
56    pub description: String,
57    /// Content of the step
58    pub content: String,
59    /// Timestamp when this step was created
60    pub timestamp: DateTime<Utc>,
61    /// Optional metadata for this step
62    pub metadata: std::collections::HashMap<String, String>,
63}
64
65/// Types of reasoning steps
66#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
67pub enum ReasoningStepType {
68    /// Initial problem analysis
69    Analysis,
70    /// Planning phase
71    Planning,
72    /// Code generation/modification
73    Implementation,
74    /// Testing or validation
75    Verification,
76    /// Error handling or debugging
77    Debugging,
78    /// Final review or cleanup
79    Review,
80    /// Reasoning/thinking step
81    Reason,
82    /// Action/execution step
83    Act,
84    /// Observation/monitoring step
85    Observe,
86    /// Conclusion step
87    Conclude,
88}