pub struct OwnerApprovalRequest {
pub effects: Vec<EffectKey>,
pub summary: String,
pub subject: String,
pub risk: ApprovalRisk,
pub warnings: Vec<String>,
pub card: Option<Box<ApprovalCard>>,
}Expand description
What the owner is asked to approve.
Fields§
§effects: Vec<EffectKey>The effects the call would have. A denial records them in
crate::RunState::declined.
summary: StringWhat the owner sees.
subject: StringThe exact action string that stored grants are matched against (for
example a command line, or METHOD url).
risk: ApprovalRisk§warnings: Vec<String>§card: Option<Box<ApprovalCard>>What the card says, as typed facts each channel renders. Plain
words only, never authority: grants match subject. None shows
summary and warnings as they are.
Implementations§
Source§impl OwnerApprovalRequest
impl OwnerApprovalRequest
Sourcepub fn plain(
summary: impl Into<String>,
subject: impl Into<String>,
risk: ApprovalRisk,
warnings: Vec<String>,
) -> Self
pub fn plain( summary: impl Into<String>, subject: impl Into<String>, risk: ApprovalRisk, warnings: Vec<String>, ) -> Self
A request with no declared effects and no card: the owner sees
summary and warnings, and stored grants match subject.
Sourcepub fn for_call(call: &ToolCall, info: &ToolInfo, why: &str) -> Self
pub fn for_call(call: &ToolCall, info: &ToolInfo, why: &str) -> Self
The request to ask the owner about call, the way
aidaemon_policies::ApprovalPolicy asks: the call’s declared effects
(from info), its tool and arguments as the subject grants match,
ApprovalRisk::Critical for a destructive tool and
ApprovalRisk::High otherwise, and a card naming the action (a
command line collapsed under its title, else the tool with its
arguments collapsed). why ends the summary when it is not empty.
A hook asks with it through crate::ToolDecision::ask:
use aidaemon_core::{OwnerApprovalRequest, ToolCall, ToolDecision, ToolInfo};
fn decide(call: &ToolCall, info: &ToolInfo) -> ToolDecision {
ToolDecision::ask(OwnerApprovalRequest::for_call(call, info, "it spends money"))
}