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>,
) -> OwnerApprovalRequest
pub fn plain( summary: impl Into<String>, subject: impl Into<String>, risk: ApprovalRisk, warnings: Vec<String>, ) -> OwnerApprovalRequest
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,
) -> OwnerApprovalRequest
pub fn for_call( call: &ToolCall, info: &ToolInfo, why: &str, ) -> OwnerApprovalRequest
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"))
}Sourcepub fn for_tool(
tool: &str,
arguments: &Value,
info: &ToolInfo,
why: &str,
) -> OwnerApprovalRequest
pub fn for_tool( tool: &str, arguments: &Value, info: &ToolInfo, why: &str, ) -> OwnerApprovalRequest
OwnerApprovalRequest::for_call from a tool name and arguments
(Value::Null when there are none).
Trait Implementations§
Source§impl Clone for OwnerApprovalRequest
impl Clone for OwnerApprovalRequest
Source§fn clone(&self) -> OwnerApprovalRequest
fn clone(&self) -> OwnerApprovalRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OwnerApprovalRequest
impl Debug for OwnerApprovalRequest
Source§impl<'de> Deserialize<'de> for OwnerApprovalRequest
impl<'de> Deserialize<'de> for OwnerApprovalRequest
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<OwnerApprovalRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<OwnerApprovalRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for OwnerApprovalRequest
impl PartialEq for OwnerApprovalRequest
Source§impl Serialize for OwnerApprovalRequest
impl Serialize for OwnerApprovalRequest
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for OwnerApprovalRequest
Auto Trait Implementations§
impl Forget for OwnerApprovalRequest
impl Freeze for OwnerApprovalRequestwhere
*const u8 is !null: Freeze,
PhantomData<EffectKey>: Freeze,
PhantomData<u8>: Freeze,
PhantomData<String>: Freeze,
*const ApprovalCard is !null: Freeze,
PhantomData<ApprovalCard>: Freeze,
impl Move for OwnerApprovalRequest
impl RefUnwindSafe for OwnerApprovalRequest
impl Send for OwnerApprovalRequest
impl Sync for OwnerApprovalRequest
impl Unpin for OwnerApprovalRequest
impl UnsafeUnpin for OwnerApprovalRequestwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<EffectKey>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
*const ApprovalCard is !null: UnsafeUnpin,
PhantomData<ApprovalCard>: UnsafeUnpin,
impl UnwindSafe for OwnerApprovalRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more