Skip to main content

PluginConfig

Struct PluginConfig 

Source
pub struct PluginConfig {
Show 13 fields pub name: String, pub kind: String, pub description: Option<String>, pub author: Option<String>, pub version: Option<String>, pub hooks: Vec<String>, pub mode: PluginMode, pub priority: i32, pub on_error: OnError, pub capabilities: HashSet<String>, pub tags: Vec<String>, pub conditions: Vec<PluginCondition>, pub config: Option<Value>,
}
Expand description

Declared plugin configuration from the unified YAML config.

Controls how the framework loads, schedules, and gates the plugin. Corresponds to a single entry in the plugins: list in config YAML.

The manager holds the authoritative copy in PluginRef.trusted_config. The plugin receives its own copy for reading via Plugin::config().

§Examples

plugins:
  - name: apl-policy
    kind: builtin
    hooks: [tool_pre_invoke, tool_post_invoke]
    mode: sequential
    priority: 10
    on_error: fail
    capabilities: [read_security, append_labels]
    config:
      policy_file: apl/demo/hr_policy.yaml

Fields§

§name: String

Unique plugin name.

§kind: String

Plugin kind — determines how the framework loads it.

  • "builtin" — compiled into the runtime
  • "native://path/to/lib.so" — dlopen’d shared library
  • "wasm://path/to/plugin.wasm" — wasmtime sandbox
  • "python://module.path.ClassName" — PyO3 bridge
  • "external" — MCP/gRPC/Unix socket transport
§description: Option<String>

Human-readable description.

§author: Option<String>

Plugin author or team.

§version: Option<String>

Semantic version string.

§hooks: Vec<String>

Hook names this plugin handles.

§mode: PluginMode

Execution mode — determines scheduling behavior and authority.

§priority: i32

Execution priority — lower numbers execute first within each mode.

§on_error: OnError

Error handling behavior when the plugin fails.

§capabilities: HashSet<String>

Declared capabilities for extension visibility gating.

Controls which extensions the plugin can see and modify. Extensions not covered by declared capabilities appear as None in the filtered view.

§tags: Vec<String>

Tags for categorization and searchability.

§conditions: Vec<PluginCondition>

Legacy conditions for when the plugin should execute.

Each condition narrows the plugin’s scope by server, tenant, tool name, prompt name, etc. If any condition in the list matches, the plugin runs. If the list is empty (default), the plugin runs unconditionally.

Backward compatibility: Conditions are the legacy mechanism for scoping plugins. When the host uses the unified routing system (routes: in config YAML), routing rules handle scope matching and conditions on the plugin are ignored. The two mechanisms should not be used together on the same plugin.

§config: Option<Value>

Plugin-specific configuration (opaque to the framework).

Implementations§

Source§

impl PluginConfig

Source

pub fn passes_conditions(&self, extensions: &Extensions) -> bool

Whether this plugin’s conditions allow it to fire for the given request Extensions. Used in legacy mode (routing_enabled: false) to filter which plugins run per request — mirrors the Python implementation’s per-plugin condition filtering.

Semantics:

  • Empty conditions Vec → fire always (no restriction).
  • Non-empty → fire if ANY condition matches (OR across the list, AND within each individual condition).

Field-source mapping (see project memory project_conditions_field_mapping):

  • server_idsextensions.mcp.{tool|resource|prompt}.server_id
  • tenant_idsextensions.security.subject.claims["tenant"]
  • tools|prompts|resourcesextensions.meta.entity_name (when matching entity_type)
  • agentsextensions.agent.agent_id
  • user_patternsextensions.security.subject.id (glob match)
  • content_typesextensions.mcp.resource.mime_type

Trait Implementations§

Source§

impl Clone for PluginConfig

Source§

fn clone(&self) -> PluginConfig

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 PluginConfig

Source§

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

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

impl Default for PluginConfig

Source§

fn default() -> PluginConfig

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

impl<'de> Deserialize<'de> for PluginConfig

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 Serialize for PluginConfig

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

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more