pub struct ApprovalGate {
pub enabled: bool,
pub methods: HashSet<String>,
pub timeout: Duration,
}Expand description
Builder for constructing a ServerState with embedder-supplied
dependencies. Embedders (e.g. tokhn-daemon) use this to inject
their own memgine handle and other shared infrastructure; the
Approval-gate policy for high-risk WS methods.
Every method in methods must be acknowledged via
host.resolve_approval before the dispatcher will route the
request to its handler. The dispatcher waits up to timeout for
a resolution; on timeout (or any non-approve resolution) the
request fails with JSON-RPC error -32003.
Default: gate enabled, the macOS-automation surface
(automation.run_applescript, automation.shortcuts.run,
messages.send, mail.send, vision.ocr), 60-second timeout.
car-server --no-approvals (or embedders calling
ServerStateConfig::with_approval_gate with enabled=false)
turns it off — only appropriate when no untrusted caller can
reach the WS port.
Fields§
§enabled: boolMaster switch. When false, every method dispatches without
raising an approval — the pre-2026-05 behaviour.
methods: HashSet<String>Methods that require approval. Match is by exact method-name
string against the JSON-RPC method field.
timeout: DurationHow long to wait for the user to resolve the approval before timing out and surfacing an error to the caller.
Implementations§
Source§impl ApprovalGate
impl ApprovalGate
Trait Implementations§
Source§impl Clone for ApprovalGate
impl Clone for ApprovalGate
Source§fn clone(&self) -> ApprovalGate
fn clone(&self) -> ApprovalGate
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 ApprovalGate
impl Debug for ApprovalGate
Auto Trait Implementations§
impl Freeze for ApprovalGate
impl RefUnwindSafe for ApprovalGate
impl Send for ApprovalGate
impl Sync for ApprovalGate
impl Unpin for ApprovalGate
impl UnsafeUnpin for ApprovalGate
impl UnwindSafe for ApprovalGate
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,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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