pub struct RuntimeScope {
pub caller_id: Option<String>,
pub tenant_id: Option<String>,
pub claims: BTreeMap<String, Value>,
}Expand description
Per-execution identity surface (Parslee-ai/car#187 phase 3).
Constructed by the dispatcher from caller-identity surfaces on
the inbound ActionProposal; threaded through Runtime::execute_*
so downstream layers (memgine, state, audit log) can route on
caller_id / tenant_id. See the module docstring for what’s
enforced in this PR vs. deferred.
Designed to be cheap to clone — small fixed fields plus a
BTreeMap of arbitrary claims. The dispatcher typically builds
one per inbound message, so allocations are bounded.
Default returns the unscoped (all-None) value. The runtime
treats this as “no identity” — same legacy behaviour as the
pre-#187 path. The non-scoped Runtime::execute_with_cancel
entry point internally passes &RuntimeScope::default() so
existing in-process callers see no behaviour change.
Fields§
§caller_id: Option<String>Verified subject when the dispatcher’s AuthValidator
returned an Identity, else the cooperative
a2a_caller.caller_id hint, else None. Empty string
(Some("")) is never produced — the dispatcher normalizes
to None before building the scope.
tenant_id: Option<String>Tenant scoping key. Either the verified-claim tenant id, the
cooperative-peer hint from Message.metadata, or None. The
downstream memgine / state filters key on this — distinct
from caller_id because one tenant can have many callers
(humans + their agents) and the isolation boundary is the
tenant, not the individual caller.
claims: BTreeMap<String, Value>Bag of verified token claims forwarded by the dispatcher.
subject itself is already on caller_id; this carries the
surrounding metadata (iss, aud, org_id, roles, etc.)
in a structured form so audit logs don’t have to re-parse
the inbound message.
Stored as a BTreeMap for stable iteration order in event
logs and deterministic serialization. The dispatcher decides
which claims to forward; this type makes no guarantees about
which keys are present.
Implementations§
Source§impl RuntimeScope
impl RuntimeScope
Sourcepub fn new(caller_id: Option<String>, tenant_id: Option<String>) -> Self
pub fn new(caller_id: Option<String>, tenant_id: Option<String>) -> Self
Build a scope from caller_id + tenant_id only, with no
extra claims. Used by tests and by callers that don’t yet
surface a full claim set.
Sourcepub fn is_unscoped(&self) -> bool
pub fn is_unscoped(&self) -> bool
True when the scope carries no identity at all — equivalent
to the Default shape. The car-a2a dispatcher’s default-deny
check uses this: if auth is on but the scope is unscoped,
reject before dispatch.
Trait Implementations§
Source§impl Clone for RuntimeScope
impl Clone for RuntimeScope
Source§fn clone(&self) -> RuntimeScope
fn clone(&self) -> RuntimeScope
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 RuntimeScope
impl Debug for RuntimeScope
Source§impl Default for RuntimeScope
impl Default for RuntimeScope
Source§fn default() -> RuntimeScope
fn default() -> RuntimeScope
Source§impl<'de> Deserialize<'de> for RuntimeScope
impl<'de> Deserialize<'de> for RuntimeScope
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for RuntimeScope
impl RefUnwindSafe for RuntimeScope
impl Send for RuntimeScope
impl Sync for RuntimeScope
impl Unpin for RuntimeScope
impl UnsafeUnpin for RuntimeScope
impl UnwindSafe for RuntimeScope
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<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