Skip to main content

RouteBindRequest

Struct RouteBindRequest 

Source
#[non_exhaustive]
pub struct RouteBindRequest { pub handle: RouteHandle, pub target: RouteTarget, pub identity: BindIdentity, pub principal: Option<Principal>, pub consumer_capabilities: Option<Vec<String>>, pub role_versions: Option<BTreeMap<String, String>>, pub admission_facts: Option<Value>, pub scope: Option<ScopeStamp>, pub call_mode: CallMode, pub peer: RouteBindPeer, }
Expand description

Route-bind request delivered on channel 0.

#[non_exhaustive] so it can gain fields in a later release without breaking the handlers that read it. The SDK builds it from the daemon’s bind; code outside this crate (a module’s own tests of its on_bind) builds one with RouteBindRequest::new and the with_* setters.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§handle: RouteHandle§target: RouteTarget§identity: BindIdentity§principal: Option<Principal>§consumer_capabilities: Option<Vec<String>>

Consumer-declared reverse-request families and provider-contract capabilities for this bind. For example, tool-result/v1 declares that a consumer understands the tool-provider content result format. This is an unverified declaration, not a privilege grant; providers treat an absent field as no declared capability. Known MCP method-family values today are “elicitation”, “sampling”, and “roots”.

§role_versions: Option<BTreeMap<String, String>>

The versions of provider roles the consumer declared it speaks on this route, role name to version ({"tool-provider": "v1"}), as the daemon forwarded them. A declaration, not a verified privilege: use it to pick which version of a role’s wire shape to speak. None means the consumer declared none (a legacy consumer, or a daemon that predates the field); it is never an empty map.

§admission_facts: Option<Value>

Opaque admission facts relayed by subc from its configured carrier.

§scope: Option<ScopeStamp>

The daemon’s stamp of the scope the route was admitted under (owner, ref, epoch, kind, attributes), copied from the bind unchanged. It is the daemon’s, never the opener’s. attributes.on_behalf_of_agent is attribution only, never authority, consent or access to per-agent handles. A target must declare scope-on-behalf-of/v1 to receive that field. The stamp is fixed for the route’s life: a change that revokes authority closes the route. None means the route was opened without a scope, or by a daemon that predates scopes.

§call_mode: CallMode

The daemon’s call mode, or the mode derived from scope when an older daemon omits it. Providers must refuse CallMode::Unknown.

§peer: RouteBindPeer

The daemon’s facts about the connection that opened this route, read from the same bind. Like the scope stamp, they are the daemon’s, never the opener’s.

  • observed_peer is sent only when this module’s manifest lists observed-peer/v1 in capabilities.provides. It is then always present, possibly with status unobserved; only an observed status carries the peer’s identity.

  • operator_app is sent only when the manifest lists operator-app/v1, the daemon’s operator-app policy for this platform is switched on, and the daemon recognised the connection as an operator app when it was made. It records that recognition at connection time. It is not authority: a write on the person’s behalf still asks the daemon with operator.confirm. Released daemons switch this policy off, so they never send it yet.

  • caller is sent only for caller-attestation/v1. Automatic provider permission grants require a well-formed caller with claim own and first_party: true. An absent or incomplete caller establishes no first-party mark.

  • peer_build is sent only for peer-build/v1, when the opener is reserved:callosum and its phone build claim was exactly production. Otherwise it is absent; the opener’s raw build_class is never relayed.

The peer keys decode together. If they don’t decode, the bind still reaches ModuleHandler::on_bind with all absent and a warning is logged, so a handler that admits only on operator_app refuses it.

Implementations§

Source§

impl RouteBindRequest

Source

pub fn new( handle: RouteHandle, target: RouteTarget, identity: BindIdentity, ) -> Self

A bind with the members every bind has and every optional one absent: no principal, no consumer capabilities, no role versions, no admission facts and no scope. The call mode is classic. Set fields with the with_* methods.

Source

pub fn with_peer(self, peer: RouteBindPeer) -> Self

Set Self::peer to synthetic daemon facts, for testing a handler. It checks nothing: a real bind’s facts come only from the daemon.

Source

pub fn peer_build(&self) -> Option<&str>

The daemon’s attested phone build fact, present only for peer-build/v1. A supporting daemon sends only production, otherwise the key is absent.

Source

pub fn with_principal(self, principal: Principal) -> Self

Source

pub fn with_consumer_capabilities( self, consumer_capabilities: Vec<String>, ) -> Self

Source

pub fn with_role_versions(self, role_versions: BTreeMap<String, String>) -> Self

Source

pub fn with_admission_facts(self, admission_facts: Value) -> Self

Source

pub fn with_scope(self, scope: ScopeStamp) -> Self

Set Self::scope and derive its call mode. To override the derived mode, call Self::with_call_mode afterwards.

Source

pub fn with_call_mode(self, call_mode: CallMode) -> Self

Set Self::call_mode, overriding the mode derived from the scope.

Trait Implementations§

Source§

impl Clone for RouteBindRequest

Source§

fn clone(&self) -> Self

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 RouteBindRequest

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more