termivar_scanner/decision_loop/
receipts.rs1use super::{
4 AdaptiveDecision, AttackPlan, BTreeSet, DecisionLoopCommand, DecisionSessionTransition,
5 EntityId, ExperienceWrite, KnowledgeWrite, RuleApplication, Serialize, VerificationReport,
6};
7
8#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
16pub struct DecisionReasoningCommitReceipt {
17 pub(super) subject: EntityId,
18 pub(super) planner_subject_revision: u64,
19 pub(super) planner_ontology_revision: u64,
20 pub(super) rule_applications: Vec<RuleApplication>,
21}
22
23impl DecisionReasoningCommitReceipt {
24 pub fn subject(&self) -> &EntityId {
26 &self.subject
27 }
28
29 pub fn planner_subject_revision(&self) -> u64 {
31 self.planner_subject_revision
32 }
33
34 pub fn planner_ontology_revision(&self) -> u64 {
36 self.planner_ontology_revision
37 }
38
39 pub fn rule_applications(&self) -> &[RuleApplication] {
41 &self.rule_applications
42 }
43}
44
45#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
47pub struct DecisionPlanningReport {
48 pub(super) rule_applications: Vec<RuleApplication>,
49 pub(super) plan: AttackPlan,
50 #[serde(skip_serializing)]
51 pub(super) policy_authorized_plan: AttackPlan,
52 pub(super) suppressed_actions: BTreeSet<String>,
53 #[serde(skip_serializing)]
54 pub(super) session_transition: DecisionSessionTransition,
55 pub(super) command: DecisionLoopCommand,
56}
57
58impl DecisionPlanningReport {
59 pub fn rule_applications(&self) -> &[RuleApplication] {
61 &self.rule_applications
62 }
63
64 pub fn plan(&self) -> &AttackPlan {
66 &self.plan
67 }
68
69 pub(crate) fn policy_authorized_plan(&self) -> &AttackPlan {
70 &self.policy_authorized_plan
71 }
72
73 pub fn suppressed_actions(&self) -> &BTreeSet<String> {
75 &self.suppressed_actions
76 }
77
78 pub fn session_transition(&self) -> &DecisionSessionTransition {
83 &self.session_transition
84 }
85
86 pub fn command(&self) -> &DecisionLoopCommand {
88 &self.command
89 }
90}
91
92#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
94pub struct DecisionOutcomeReport {
95 pub(super) verification: VerificationReport,
96 pub(super) adaptive: AdaptiveDecision,
97 pub(super) experience_write: ExperienceWrite,
98 pub(super) hypothesis_write: Option<KnowledgeWrite>,
99 #[serde(skip_serializing)]
100 pub(super) session_transition: DecisionSessionTransition,
101 pub(super) command: DecisionLoopCommand,
102}
103
104impl DecisionOutcomeReport {
105 pub fn verification(&self) -> &VerificationReport {
107 &self.verification
108 }
109
110 pub fn adaptive(&self) -> &AdaptiveDecision {
112 &self.adaptive
113 }
114
115 pub fn experience_write(&self) -> ExperienceWrite {
117 self.experience_write
118 }
119
120 pub fn hypothesis_write(&self) -> Option<KnowledgeWrite> {
123 self.hypothesis_write
124 }
125
126 pub fn session_transition(&self) -> &DecisionSessionTransition {
131 &self.session_transition
132 }
133
134 pub fn command(&self) -> &DecisionLoopCommand {
136 &self.command
137 }
138}