Skip to main content

CapabilityRef

Struct CapabilityRef 

Source
pub struct CapabilityRef { /* private fields */ }
Expand description

A reference to a capability implementation plus per-agent JSON.

This is the one semantic model for “a capability attached to an agent”: the Framework activates it, the product persists it (the historical AgentCapabilityConfig attachment row and BuiltInCapabilityDefinition provisioning entry are this type), and worker resolution consumes it. It serializes as {"ref": "<id>", "config": {…}} everywhere.

IDs are open strings rather than variants in a central enum. They must use a stable identifier made from ASCII letters, digits, _, -, ., or :, start with a letter or _, and fit within 128 bytes. The __everruns_ namespace is reserved.

Configuration defaults to {} and must be a JSON object. Boundaries that accept new values (Framework agent build, product write paths) enforce both rules via CapabilityRef::validate; the referenced implementation owns the inner schema.

Configuration is redacted from Debug, but it is not a secret store: hosts may persist or otherwise inspect it. Put credentials in a provider-owned secret mechanism and pass only a non-secret handle here.

Implementations§

Source§

impl CapabilityRef

Source

pub fn new(id: impl Into<CapabilityId>) -> Self

Reference a stable capability ID with default ({}) configuration.

Source

pub fn with_config(id: impl Into<CapabilityId>, config: Value) -> Self

Reference a capability ID with explicit configuration.

Source

pub fn config(self, config: impl Into<Value>) -> Self

Attach implementation-defined per-agent JSON configuration.

Validation is deferred to the consuming boundary (e.g. the Framework’s AgentBuilder::build) so capability values remain easy to compose and pass through application configuration layers.

Source

pub fn id(&self) -> &str

The stable capability identifier.

Source

pub fn capability_id(&self) -> &str

The stable capability identifier (alias of CapabilityRef::id).

Source

pub fn typed_id(&self) -> &CapabilityId

The typed capability identifier.

Source

pub fn config_value(&self) -> &Value

The implementation-defined JSON configuration.

Source

pub fn config_mut(&mut self) -> &mut Value

Mutable access to the configuration (host hydration paths).

Source

pub fn set_config(&mut self, config: impl Into<Value>)

Replace the configuration in place.

Source

pub fn set_id(&mut self, id: impl Into<CapabilityId>)

Replace the identifier in place (host alias-canonicalization paths).

Source

pub fn into_parts(self) -> (CapabilityId, Value)

Split the reference into its identity and configuration.

Source

pub fn validate(&self) -> Result<(), CapabilityError>

Validate the identifier grammar and the JSON object config boundary.

Trait Implementations§

Source§

impl Clone for CapabilityRef

Source§

fn clone(&self) -> CapabilityRef

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 CapabilityRef

Source§

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

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

impl<'de> Deserialize<'de> for CapabilityRef

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 CapabilityRef

Source§

impl From<&str> for CapabilityRef

Source§

fn from(id: &str) -> Self

Converts to this type from the input type.
Source§

impl From<CapabilityId> for CapabilityRef

Source§

fn from(id: CapabilityId) -> Self

Converts to this type from the input type.
Source§

impl From<CapabilityRef> for CapabilitySpec

Source§

fn from(reference: CapabilityRef) -> Self

Converts to this type from the input type.
Source§

impl From<String> for CapabilityRef

Source§

fn from(id: String) -> Self

Converts to this type from the input type.
Source§

impl IntoCapability for CapabilityRef

Source§

fn into_capability(self) -> CapabilitySpec

Consume the value and return its normalized specification.
Source§

impl PartialEq for CapabilityRef

Source§

fn eq(&self, other: &CapabilityRef) -> 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 CapabilityRef

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 CapabilityRef

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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.