Skip to main content

systemprompt_models/brain/
proposal.rs

1//! Proposals produced by analyses: config diffs or fact actions that a
2//! person approves or rejects; nothing self-applies.
3//!
4//! Copyright (c) systemprompt.io — Business Source License 1.1.
5//! See <https://systemprompt.io> for licensing details.
6
7use chrono::{DateTime, Utc};
8use serde::{Deserialize, Serialize};
9use systemprompt_identifiers::{BrainProposalId, UserId};
10
11/// What a proposal would change.
12#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
13#[serde(rename_all = "snake_case")]
14pub enum ProposalKind {
15    ConfigDiff,
16    FactActions,
17}
18
19/// Where a proposal stands.
20#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
21#[serde(rename_all = "snake_case")]
22pub enum ProposalStatus {
23    Open,
24    Approved,
25    Rejected,
26}
27
28/// A proposal an analysis drafts, before it is stored.
29#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
30pub struct ProposalDraft {
31    pub analysis: String,
32    pub kind: ProposalKind,
33    pub summary: String,
34    // JSON: the proposed diff or action list is analysis-specific.
35    pub body: serde_json::Value,
36}
37
38/// A stored proposal.
39#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
40pub struct BrainProposal {
41    pub id: BrainProposalId,
42    pub analysis: String,
43    pub kind: ProposalKind,
44    pub status: ProposalStatus,
45    pub summary: String,
46    // JSON: the proposed diff or action list is analysis-specific.
47    pub body: serde_json::Value,
48    pub created_at: DateTime<Utc>,
49    pub decided_by: Option<UserId>,
50    pub decided_at: Option<DateTime<Utc>>,
51}