interplane.Get Omega
Read in your language

spark-rsi

Resilient systems interface and fault-tolerant agent communication

Brought by drakestapleton

branch main Branches Tags History

spark-rsi / src / models.rs

121 lines · 3333 bytes Raw Blame History
1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Serialize, Deserialize)]
4pub struct TelemetrySnapshot {
5 pub repo_path: String,
6 pub git_branch: String,
7 pub git_clean: bool,
8 pub uncommitted_files: Vec<String>,
9 pub crumbs_detected: usize,
10 pub tests_passing: bool,
11 pub soul_tension: SoulTension,
12 pub timestamp: String,
13}
14
15#[derive(Debug, Clone, Serialize, Deserialize)]
16pub struct SoulTension {
17 pub drive_score: f64,
18 pub humanity_score: f64,
19 pub drive_terms_matched: Vec<String>,
20 pub humanity_terms_matched: Vec<String>,
21 pub tension_ratio: f64,
22 pub state: String,
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
26#[serde(rename_all = "snake_case")]
27pub enum ProposalKind {
28 Refactor,
29 Documentation,
30 Optimization,
31 UnslopSanitization,
32 InvariantFix,
33}
34
35#[derive(Debug, Clone, Serialize, Deserialize)]
36pub struct ImprovementProposal {
37 pub id: String,
38 pub title: String,
39 pub description: String,
40 pub target_file: String,
41 pub proposed_patch: String,
42 pub kind: ProposalKind,
43 pub created_at: String,
44 pub sandbox_path: Option<String>,
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize)]
48pub struct InvariantReport {
49 pub passed: bool,
50 pub unslop_clean: bool,
51 pub em_dash_detected: usize,
52 pub en_dash_detected: usize,
53 pub forbidden_buzzwords_detected: Vec<String>,
54 pub antithesis_tropes_detected: Vec<String>,
55 pub zero_disk_secrets_clean: bool,
56 pub secret_leaks: Vec<String>,
57 pub compilation_passed: bool,
58 pub compilation_error: Option<String>,
59 pub tests_passed: bool,
60 pub test_output_summary: Option<String>,
61 pub notes: Vec<String>,
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize)]
65pub struct BalanceVerdict {
66 pub kernel: String,
67 pub mode: String,
68 pub drive: f64,
69 pub humanity: f64,
70 pub ratio: f64,
71 pub score: f64,
72 pub verdict: String,
73 pub guidance: String,
74}
75
76#[derive(Debug, Clone, Serialize, Deserialize)]
77pub struct RatificationRecord {
78 pub proposal_id: String,
79 pub commit_hash: Option<String>,
80 pub author: String,
81 pub cortex_receipt_id: Option<String>,
82 pub cortex_recorded: bool,
83 pub timestamp: String,
84 pub status: String,
85 pub message: String,
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
89pub struct RsiConfig {
90 pub target_repo: String,
91 pub cortex_url: String,
92 pub cortex_space: String,
93 pub mojo_kernel_path: String,
94 pub loop_interval_secs: u64,
95 pub sandbox_root: String,
96}
97
98impl Default for RsiConfig {
99 fn default() -> Self {
100 Self {
101 target_repo: ".".to_string(),
102 cortex_url: "http://127.0.0.1:18080".to_string(),
103 cortex_space: "atlas-memory".to_string(),
104 mojo_kernel_path: "mojo/balance_bin".to_string(),
105 loop_interval_secs: 60,
106 sandbox_root: "/tmp/spark-rsi-sandbox".to_string(),
107 }
108 }
109}
110
111#[derive(Debug, Clone, Serialize, Deserialize)]
112pub struct RsiCycleResult {
113 pub cycle_id: String,
114 pub telemetry: TelemetrySnapshot,
115 pub proposal: Option<ImprovementProposal>,
116 pub invariants: Option<InvariantReport>,
117 pub balance: Option<BalanceVerdict>,
118 pub ratification: Option<RatificationRecord>,
119 pub success: bool,
120 pub elapsed_ms: f64,
121}