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
impl CapabilityRef
Sourcepub fn new(id: impl Into<CapabilityId>) -> Self
pub fn new(id: impl Into<CapabilityId>) -> Self
Reference a stable capability ID with default ({}) configuration.
Sourcepub fn with_config(id: impl Into<CapabilityId>, config: Value) -> Self
pub fn with_config(id: impl Into<CapabilityId>, config: Value) -> Self
Reference a capability ID with explicit configuration.
Sourcepub fn config(self, config: impl Into<Value>) -> Self
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.
Sourcepub fn capability_id(&self) -> &str
pub fn capability_id(&self) -> &str
The stable capability identifier (alias of CapabilityRef::id).
Sourcepub fn typed_id(&self) -> &CapabilityId
pub fn typed_id(&self) -> &CapabilityId
The typed capability identifier.
Sourcepub fn config_value(&self) -> &Value
pub fn config_value(&self) -> &Value
The implementation-defined JSON configuration.
Sourcepub fn config_mut(&mut self) -> &mut Value
pub fn config_mut(&mut self) -> &mut Value
Mutable access to the configuration (host hydration paths).
Sourcepub fn set_config(&mut self, config: impl Into<Value>)
pub fn set_config(&mut self, config: impl Into<Value>)
Replace the configuration in place.
Sourcepub fn set_id(&mut self, id: impl Into<CapabilityId>)
pub fn set_id(&mut self, id: impl Into<CapabilityId>)
Replace the identifier in place (host alias-canonicalization paths).
Sourcepub fn into_parts(self) -> (CapabilityId, Value)
pub fn into_parts(self) -> (CapabilityId, Value)
Split the reference into its identity and configuration.
Sourcepub fn validate(&self) -> Result<(), CapabilityError>
pub fn validate(&self) -> Result<(), CapabilityError>
Validate the identifier grammar and the JSON object config boundary.
Trait Implementations§
Source§impl Clone for CapabilityRef
impl Clone for CapabilityRef
Source§fn clone(&self) -> CapabilityRef
fn clone(&self) -> CapabilityRef
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more