pub struct ApprovalCore { /* private fields */ }Expand description
Channel-agnostic approval semantics over a shared HostState. Cheap to
clone (just an Arc). One per adapter, or shared.
Implementations§
Source§impl ApprovalCore
impl ApprovalCore
Sourcepub fn new(host: Arc<HostState>) -> ApprovalCore
pub fn new(host: Arc<HostState>) -> ApprovalCore
Build a core over the shared host state.
Sourcepub fn host(&self) -> &Arc<HostState> ⓘ
pub fn host(&self) -> &Arc<HostState> ⓘ
The shared host this core resolves against (adapters that still need
direct host access — e.g. the iMessage code-eviction sweep — borrow it
here rather than holding a second Arc).
Sourcepub fn is_eligible_pending(approval: &HostApprovalRequest) -> bool
pub fn is_eligible_pending(approval: &HostApprovalRequest) -> bool
True iff approval is a pending, eligible row an in-process channel
adapter can actually resolve. Three conditions, all required (MC-7 —
unchanged from #403):
status == Pending— resolved rows stay in the map markedResolved.!action.starts_with("ws.method:")— exclude the v2-deferred blocking high-risk-method gate rows.client_id.is_none()— SYSTEM-LEVEL rows only. A session-owned row (client_id: Some(...)) hits the cross-session fan-out branch and comes back still-Pending without resolving; the orchestrator is not a WS session and cannot own such a row, so it must never prompt for one.
Sourcepub async fn eligible_pending(&self) -> Vec<HostApprovalRequest>
pub async fn eligible_pending(&self) -> Vec<HostApprovalRequest>
Snapshot the host’s approvals and return only the eligible-pending ones. The shared eligible-pending query every adapter consumes (outbound prompt minting, disambiguation, code lookup).
Sourcepub async fn is_id_eligible_pending(&self, approval_id: &str) -> bool
pub async fn is_id_eligible_pending(&self, approval_id: &str) -> bool
Whether approval_id is currently an eligible-pending row. Used by an
adapter to confirm a named code still maps to an actionable approval
before resolving.
Sourcepub async fn resolve(
&self,
principal: &str,
approval_id: &str,
resolution: &str,
) -> ResolveOutcome
pub async fn resolve( &self, principal: &str, approval_id: &str, resolution: &str, ) -> ResolveOutcome
Resolve approval_id in-process via the UNTOUCHED
HostState::resolve_approval first-writer-wins guard. The
system-raised principal string is supplied by the calling adapter — it
is NOT hardcoded here (each adapter passes its own transport principal;
the literal lives in the adapter, never in this channel-free core).
Returns a ResolveOutcome so the adapter knows whether the row
actually moved (evict its mapping only on ResolveOutcome::Resolved).
Trait Implementations§
Source§impl Clone for ApprovalCore
impl Clone for ApprovalCore
Source§fn clone(&self) -> ApprovalCore
fn clone(&self) -> ApprovalCore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ApprovalCore
impl !UnwindSafe for ApprovalCore
impl Freeze for ApprovalCore
impl Send for ApprovalCore
impl Sync for ApprovalCore
impl Unpin for ApprovalCore
impl UnsafeUnpin for ApprovalCore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
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