Skip to main content

PermissionCheckInput

Struct PermissionCheckInput 

Source
pub struct PermissionCheckInput {
    pub request: PermissionRequest,
    pub hook_decision: Option<HookPermission>,
    pub tool_check: Option<PermissionResult>,
    pub mode: PermissionMode,
}
Expand description

权限检查的完整输入上下文。

Agent loop 在工具执行前构造此结构,传入 PermissionEngine::check()

Fields§

§request: PermissionRequest

权限请求。

§hook_decision: Option<HookPermission>

Hook 系统的聚合决策(如果 PreToolUse hook 有返回)。

None 表示没有 Hook 参与或所有 Hook 都 passthrough。

§tool_check: Option<PermissionResult>

工具级权限检查结果。

None 表示工具未实现 check_permissions(等同于 Passthrough)。

§mode: PermissionMode

当前权限模式。

Implementations§

Source§

impl PermissionCheckInput

Source

pub fn new(request: PermissionRequest, mode: PermissionMode) -> Self

创建最小输入 — 只有请求和模式。

Source

pub fn with_hook_decision(self, decision: HookPermission) -> Self

设置 Hook 决策(builder 模式)。

Source

pub fn with_tool_check(self, result: PermissionResult) -> Self

设置工具检查结果(builder 模式)。

Trait Implementations§

Source§

impl Clone for PermissionCheckInput

Source§

fn clone(&self) -> PermissionCheckInput

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PermissionCheckInput

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.