Skip to main content

ScopeAttributes

Struct ScopeAttributes 

Source
#[non_exhaustive]
pub struct ScopeAttributes { pub agent_id: Option<String>, pub on_behalf_of_agent: Option<String>, pub delegates: bool, pub flow_id: Option<String>, pub flow_version: Option<u64>, pub flow_code_hash: Option<String>, pub flow_install_id: Option<String>, pub run_id: Option<String>, }
Expand description

The authority-controlled attributes the daemon copies into scope stamps, subject to each field’s target capability gate. Only an owner module named in the daemon config’s scope_authority_owners list (by default the module that owns agent sessions) may set them; a scope owned by any other module must leave them empty.

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.
§agent_id: Option<String>

The agent the scope’s session belongs to. Identity, never permission.

§on_behalf_of_agent: Option<String>

Attribution only, never authority. A provider may use this to choose identity-scoped presentation (bot choice, read budgets, bound repositories) and for logging. It must never treat this as authority to act as that agent, hand out the agent’s per-agent handles or consent on its strength, or treat it as agent_id.

Set only by a scope-authority owner and validated with agent_id’s token rule. Mutually exclusive with agent_id, delegates and flow_id; run_id requires agent_id and is therefore excluded too. Adding, changing or removing this within an epoch increments the content version and closes routes with scope_delegation_changed. Bind stamps include it only for targets providing SCOPE_ON_BEHALF_OF_CAPABILITY; describe replies include it only for callers providing that capability.

§delegates: bool

Whether a provider may act as agent_id. Refused without agent_id.

§flow_id: Option<String>

This scope belongs to the named flow, an automated workflow run on an agent’s behalf. Set only by an authority owner (see above), validated with validate_flow_id, and stamped verbatim. It needs neither agent_id nor delegates. Providers treat a module other than the owner that opens a route under a flow scope as the flow’s carrier.

Like an agent_id change, changing this within the same scope epoch is accepted: the scope’s content version increases (the number providers compare to notice a change), and every route under the scope is closed with the reason scope_delegation_changed, so no live route keeps the old identity. A target must provide FLOW_SCOPES_CAPABILITY or crate::call_mode::CALL_MODES_CAPABILITY before the daemon may send a bind stamped with this field. Decoding it alone is not enough: the target must also apply flow behaviour instead of agent behaviour.

§flow_version: Option<u64>

The approved installed version, from 1 through 2^53 - 1. Together with flow_code_hash and flow_install_id, requires flow_id and is immutable within an epoch (scope_flow_identity_changed). Stamped only for readers providing FLOW_IDENTITY_SCOPES_CAPABILITY.

§flow_code_hash: Option<String>

SHA-256 of the approved flow code: exactly 64 lowercase hex characters. Present together with flow_version and flow_install_id, under the same authority, immutability and capability rules.

§flow_install_id: Option<String>

Opaque installed-flow token, validated with validate_flow_install_id. Present together with flow_version and flow_code_hash, under the same authority, immutability and capability rules.

§run_id: Option<String>

Identifies one run carried out on behalf of agent_id. Requires agent_id, forbids flow_id, and uses validate_run_id’s token rule. Adding, changing or removing it within an epoch increments the scope’s content version and closes routes under the scope with scope_delegation_changed. The daemon sends this field in a bind only to a target module providing AGENT_RUN_SCOPES_CAPABILITY or crate::call_mode::CALL_MODES_CAPABILITY. A delegating run scope is accepted as a record, but binds only to a target providing the latter.

Implementations§

Source§

impl ScopeAttributes

Source

pub fn new() -> Self

Source

pub fn with_agent_id(self, agent_id: Option<String>) -> Self

Source

pub fn with_on_behalf_of_agent(self, on_behalf_of_agent: Option<String>) -> Self

Source

pub fn with_delegates(self, delegates: bool) -> Self

Source

pub fn with_flow_id(self, flow_id: Option<String>) -> Self

Source

pub fn with_flow_version(self, flow_version: Option<u64>) -> Self

Source

pub fn with_flow_code_hash(self, flow_code_hash: Option<String>) -> Self

Source

pub fn with_flow_install_id(self, flow_install_id: Option<String>) -> Self

Source

pub fn with_run_id(self, run_id: Option<String>) -> Self

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Clone for ScopeAttributes

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 ScopeAttributes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ScopeAttributes

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ScopeAttributes

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ScopeAttributes

Source§

impl PartialEq for ScopeAttributes

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ScopeAttributes

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ScopeAttributes

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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