pub trait ConfigVisitor: Send + Sync {
// Required method
fn name(&self) -> &str;
// Provided methods
fn visit_plugins(
&self,
_mgr: &Arc<PluginManager>,
_plugins: &[PluginConfig],
) -> Result<(), VisitorError> { ... }
fn visit_global(
&self,
_mgr: &Arc<PluginManager>,
_yaml: &Value,
) -> Result<(), VisitorError> { ... }
fn visit_default(
&self,
_mgr: &Arc<PluginManager>,
_entity_type: &str,
_yaml: &Value,
) -> Result<(), VisitorError> { ... }
fn visit_policy_bundle(
&self,
_mgr: &Arc<PluginManager>,
_tag: &str,
_yaml: &Value,
) -> Result<(), VisitorError> { ... }
fn visit_route(
&self,
_mgr: &Arc<PluginManager>,
_yaml: &Value,
_parsed: &RouteEntry,
) -> Result<(), VisitorError> { ... }
}Expand description
Extension point for external orchestrators to participate in unified
config loading. Register via PluginManager::register_visitor;
invoked during PluginManager::load_config_yaml.
All methods have default no-op implementations — a visitor only overrides the sections it cares about.
Required Methods§
Provided Methods§
Sourcefn visit_plugins(
&self,
_mgr: &Arc<PluginManager>,
_plugins: &[PluginConfig],
) -> Result<(), VisitorError>
fn visit_plugins( &self, _mgr: &Arc<PluginManager>, _plugins: &[PluginConfig], ) -> Result<(), VisitorError>
Visit the typed plugin declarations from the root plugins:
block. Called once per visitor, immediately after cpex-core’s
own plugin instantiation completes and before any hierarchy
section is walked. Visitors that need a per-name registry of
hook / capability / on_error metadata can populate it here
without re-parsing the YAML — cpex-core has already validated
the block (no duplicate names, etc.) by this point.
Sourcefn visit_global(
&self,
_mgr: &Arc<PluginManager>,
_yaml: &Value,
) -> Result<(), VisitorError>
fn visit_global( &self, _mgr: &Arc<PluginManager>, _yaml: &Value, ) -> Result<(), VisitorError>
Visit the top-level global: block. yaml is the raw value at
that path, or Value::Null if global: is absent.
Sourcefn visit_default(
&self,
_mgr: &Arc<PluginManager>,
_entity_type: &str,
_yaml: &Value,
) -> Result<(), VisitorError>
fn visit_default( &self, _mgr: &Arc<PluginManager>, _entity_type: &str, _yaml: &Value, ) -> Result<(), VisitorError>
Visit one entry in global.defaults. Called once per
(entity_type, default_block) pair. yaml is the raw value at
global.defaults.<entity_type>.
Sourcefn visit_policy_bundle(
&self,
_mgr: &Arc<PluginManager>,
_tag: &str,
_yaml: &Value,
) -> Result<(), VisitorError>
fn visit_policy_bundle( &self, _mgr: &Arc<PluginManager>, _tag: &str, _yaml: &Value, ) -> Result<(), VisitorError>
Visit one entry in global.policies (a named tag bundle).
Called once per (tag, policy_group) pair. yaml is the raw
value at global.policies.<tag>.
Sourcefn visit_route(
&self,
_mgr: &Arc<PluginManager>,
_yaml: &Value,
_parsed: &RouteEntry,
) -> Result<(), VisitorError>
fn visit_route( &self, _mgr: &Arc<PluginManager>, _yaml: &Value, _parsed: &RouteEntry, ) -> Result<(), VisitorError>
Visit one route entry. yaml is the raw value at routes[i]
(so orchestrator can find its own block like apl:); parsed
is the typed RouteEntry cpex-core deserialized (so the
orchestrator can read tool/resource/prompt/llm,
meta.scope, meta.tags, etc. without re-parsing).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".