Skip to main content

AplConfigVisitor

Struct AplConfigVisitor 

Source
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:

  1. Code-supplied via register_pdp (or AplOptions.pdps) — the host built the resolver in code and hands it in.
  2. Config-supplied via global.apl.pdp[] blocks in the unified config — the visitor sees the block, looks up a factory by kind, and constructs the resolver during visit_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

Source

pub fn new( dispatch_cache: Arc<DispatchCache>, session_store: Arc<dyn SessionStore>, manager: Weak<PluginManager>, ) -> Self

Source

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).

Source

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.

Source

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.

Source

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

Source§

fn name(&self) -> &str

Stable identifier for diagnostics — included in error contexts if a visitor method returns Err. Convention: short kebab-case matching the orchestrator’s YAML key (e.g. "apl", "rego").
Source§

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

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

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

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

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).

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

Source§

type Output = T

Should always be Self
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