#[non_exhaustive]pub struct CallOrigin {
pub carrier: Principal,
pub call_key: String,
pub message_position: Option<MessagePosition>,
pub schema_pin: Option<String>,
}Expand description
Who really asked for a call that another module relays.
When a module forwards a tool call on behalf of a different caller, the
provider sees the forwarding module as the route’s principal and the
forwarder’s own call_key. This records the caller behind it, so the
provider can attribute the call in its logs and ledgers.
It is a claim made by the forwarding module, not something the daemon checks: a provider may record it but must never grant or refuse anything because of it. Authority stays with the route’s own principal.
#[non_exhaustive] so a later member is an additive change; build it with
CallOrigin::new.
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.carrier: PrincipalThe original caller, in the same form the daemon stamps on a route.
call_key: StringThe original caller’s key for the call, with the same bounds as
ToolCallRequest::call_key; check it with validate_call_origin.
message_position: Option<MessagePosition>Where the call sits in the model message that asked for it, when the
forwarder knows. None means unknown, never “first” or “alone”.
schema_pin: Option<String>The schema pin the original caller recorded for this call, when the
forwarder knows it, with the same bounds as
ToolCallRequest::schema_pin. A provider that keys records on the
original caller’s call reports this pin as the one it served, so a
reader can check that pin against the views the provider published.
Like the rest of the origin, it is a claim, never authority.
Implementations§
Source§impl CallOrigin
impl CallOrigin
Sourcepub fn new(carrier: Principal, call_key: impl Into<String>) -> Self
pub fn new(carrier: Principal, call_key: impl Into<String>) -> Self
An origin naming carrier as the caller and call_key as its key, with
no message position.
Sourcepub fn with_message_position(self, position: MessagePosition) -> Self
pub fn with_message_position(self, position: MessagePosition) -> Self
Set where the call sits in the model message that asked for it.
Sourcepub fn with_schema_pin(self, pin: impl Into<String>) -> Self
pub fn with_schema_pin(self, pin: impl Into<String>) -> Self
Set the schema pin the original caller recorded for this call.