pub struct AplConfigVisitor { /* private fields */ }Expand description
APL implementation of cpex_core::visitor::ConfigVisitor. Construct
once per host with the shared infrastructure (dispatch cache, session
store, manager handle) and register with PluginManager::register_visitor
before calling load_config_yaml.
PDPs come from two sources, both feeding the same internal
PdpRouter:
- Code-supplied via
register_pdp(orAplOptions.pdps) — the host built the resolver in code and hands it in. - Config-supplied via
global.apl.pdp[]blocks in the unified config — the visitor sees the block, looks up a factory bykind, and constructs the resolver duringvisit_global.
Factories are registered up front by kind name ("cedar-direct",
"opa", …). The visitor knows nothing about specific PDP
backends; everything dispatches through PdpFactory.
Implementations§
Source§impl AplConfigVisitor
impl AplConfigVisitor
pub fn new( dispatch_cache: Arc<DispatchCache>, session_store: Arc<dyn SessionStore>, manager: Weak<PluginManager>, ) -> Self
Sourcepub fn register_pdp(&self, resolver: Arc<dyn PdpResolver>)
pub fn register_pdp(&self, resolver: Arc<dyn PdpResolver>)
Register a code-supplied PDP resolver. Equivalent to declaring a
PDP in the unified config but for hosts that prefer wiring
resolvers in Rust. Resolvers are pushed into the internal
PdpRouter; the first registration per dialect wins (matches
PdpRouter::register semantics).
Sourcepub fn register_pdp_factory(&mut self, factory: Arc<dyn PdpFactory>)
pub fn register_pdp_factory(&mut self, factory: Arc<dyn PdpFactory>)
Register a PDP factory by its kind(). Called during
register_apl setup; the visitor uses these to instantiate
resolvers from global.apl.pdp[] config blocks.
Sourcepub fn register_session_store_factory(
&mut self,
factory: Arc<dyn SessionStoreFactory>,
)
pub fn register_session_store_factory( &mut self, factory: Arc<dyn SessionStoreFactory>, )
Register a SessionStoreFactory by its kind(). Called during
register_apl setup; the visitor uses these to swap in the
config-selected session store when it sees a
global.apl.session_store block.
Sourcepub fn with_base_capabilities(self, caps: HashSet<String>) -> Self
pub fn with_base_capabilities(self, caps: HashSet<String>) -> Self
Replace the baseline capability set granted to every installed
AplRouteHandler. Default covers read-only attributes APL
predicates commonly touch (subject, role, labels, delegation,
agent). Tighten this when the deployment’s policy plugins
don’t need broad reads — every cap removed is one fewer
extension slot a buggy predicate can leak through.
Trait Implementations§
Source§impl ConfigVisitor for AplConfigVisitor
impl ConfigVisitor for AplConfigVisitor
Source§fn name(&self) -> &str
fn name(&self) -> &str
"apl", "rego").Source§fn visit_plugins(
&self,
_mgr: &Arc<PluginManager>,
plugins: &[PluginConfig],
) -> Result<(), VisitorError>
fn visit_plugins( &self, _mgr: &Arc<PluginManager>, plugins: &[PluginConfig], ) -> Result<(), VisitorError>
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.Source§fn visit_global(
&self,
mgr: &Arc<PluginManager>,
yaml: &Value,
) -> Result<(), VisitorError>
fn visit_global( &self, mgr: &Arc<PluginManager>, yaml: &Value, ) -> Result<(), VisitorError>
global: block. yaml is the raw value at
that path, or Value::Null if global: is absent.Source§fn 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>
global.defaults. Called once per
(entity_type, default_block) pair. yaml is the raw value at
global.defaults.<entity_type>.Source§fn 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>
global.policies (a named tag bundle).
Called once per (tag, policy_group) pair. yaml is the raw
value at global.policies.<tag>.Source§fn 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>
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).