pub struct ActionContext {
pub action: String,
pub payload_summary: String,
pub payload_body: Option<String>,
pub attributes: BTreeMap<String, Value>,
}Expand description
Everything a Check needs to make its decision about a proposed action.
The core never inspects attributes; only checks do. That is what keeps the
context domain-neutral: OAP’s diff_lines / spec_statuses / max_spec_risk
and chancery’s fact_sheet_id / investor_id all live in attributes,
read only by the checks that understand them.
Fields§
§action: StringThe action being proposed, e.g. "email.send", "workspace.write_file".
(OAP’s tool_name.)
payload_summary: StringA canonical string form of the payload, for scanning. (OAP’s
arguments_summary.)
payload_body: Option<String>The full content under review, when there is one. (OAP’s
proposed_file_content.)
attributes: BTreeMap<String, Value>Everything domain-specific, keyed by name. Checks read what they need.
Implementations§
Source§impl ActionContext
impl ActionContext
Sourcepub fn new(action: impl Into<String>) -> ActionContext
pub fn new(action: impl Into<String>) -> ActionContext
A context for action with an empty payload and no attributes.
Sourcepub fn with_summary(self, summary: impl Into<String>) -> ActionContext
pub fn with_summary(self, summary: impl Into<String>) -> ActionContext
Builder: set the payload summary (the string checks scan).
Sourcepub fn with_body(self, body: impl Into<String>) -> ActionContext
pub fn with_body(self, body: impl Into<String>) -> ActionContext
Builder: set the payload body (the full content under review).
Sourcepub fn with_attr(self, key: impl Into<String>, value: Value) -> ActionContext
pub fn with_attr(self, key: impl Into<String>, value: Value) -> ActionContext
Builder: insert a domain attribute.
Trait Implementations§
Source§impl Clone for ActionContext
impl Clone for ActionContext
Source§fn clone(&self) -> ActionContext
fn clone(&self) -> ActionContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more