#[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
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: CallModeThe daemon’s call mode, or the mode derived from scope when an older
daemon omits it. Providers must refuse CallMode::Unknown.
peer: RouteBindPeerThe 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_peeris sent only when this module’s manifest listsobserved-peer/v1incapabilities.provides. It is then always present, possibly with statusunobserved; only anobservedstatus carries the peer’s identity. -
operator_appis sent only when the manifest listsoperator-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 withoperator.confirm. Released daemons switch this policy off, so they never send it yet. -
calleris sent only forcaller-attestation/v1. Automatic provider permission grants require a well-formed caller with claimownandfirst_party: true. An absent or incomplete caller establishes no first-party mark. -
peer_buildis sent only forpeer-build/v1, when the opener isreserved:callosumand its phone build claim was exactlyproduction. Otherwise it is absent; the opener’s rawbuild_classis 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
impl RouteBindRequest
Sourcepub fn new(
handle: RouteHandle,
target: RouteTarget,
identity: BindIdentity,
) -> Self
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.
Sourcepub fn with_peer(self, peer: RouteBindPeer) -> Self
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.
Sourcepub fn peer_build(&self) -> Option<&str>
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.
Sourcepub fn with_principal(self, principal: Principal) -> Self
pub fn with_principal(self, principal: Principal) -> Self
Set Self::principal.
Sourcepub fn with_consumer_capabilities(
self,
consumer_capabilities: Vec<String>,
) -> Self
pub fn with_consumer_capabilities( self, consumer_capabilities: Vec<String>, ) -> Self
Sourcepub fn with_role_versions(self, role_versions: BTreeMap<String, String>) -> Self
pub fn with_role_versions(self, role_versions: BTreeMap<String, String>) -> Self
Set Self::role_versions.
Sourcepub fn with_admission_facts(self, admission_facts: Value) -> Self
pub fn with_admission_facts(self, admission_facts: Value) -> Self
Sourcepub fn with_scope(self, scope: ScopeStamp) -> Self
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.
Sourcepub fn with_call_mode(self, call_mode: CallMode) -> Self
pub fn with_call_mode(self, call_mode: CallMode) -> Self
Set Self::call_mode, overriding the mode derived from the scope.