Skip to main content

ProactiveExplorer

Struct ProactiveExplorer 

Source
pub struct ProactiveExplorer { /* private fields */ }
Expand description

Classifies queries and generates world-knowledge SKILL.md files on demand.

Constructed by the agent builder when config.skills.proactive_exploration.enabled = true. Attach an evaluator via the constructor to apply the quality gate (Feature B, #3319) to generated skills.

§Examples

use std::path::PathBuf;
use std::sync::Arc;
use zeph_skills::proactive::ProactiveExplorer;
use zeph_skills::generator::SkillGenerator;

let generator = SkillGenerator::new(provider, PathBuf::from("/tmp/skills"));
let explorer = ProactiveExplorer::new(generator, None, PathBuf::from("/tmp/skills"), 8_000, 30_000, vec![]);
if let Some(domain) = explorer.classify("how do I use docker volumes?") {
    if !explorer.has_knowledge(registry, &domain) {
        explorer.explore(&domain).await.ok();
    }
}

Implementations§

Source§

impl ProactiveExplorer

Source

pub fn new( generator: SkillGenerator, evaluator: Option<Arc<SkillEvaluator>>, output_dir: PathBuf, max_chars: usize, timeout_ms: u64, excluded_domains: Vec<String>, ) -> Self

Create a new explorer.

  • generator: drives SKILL.md generation.
  • evaluator: optional quality gate (Feature B).
  • output_dir: where generated skills are written.
  • max_chars: approximate target size hint passed in the generation prompt.
  • timeout_ms: per-exploration timeout covering the full generate → write path.
  • excluded_domains: domain slugs to skip (e.g. ["rust"]).
Source

pub fn timeout_ms(&self) -> u64

Expose the configured timeout so callers can set tokio::time::timeout correctly.

Source

pub fn classify(&self, query: &str) -> Option<DomainLabel>

Classify query against the keyword map.

Returns None when no keyword in the query matches a known domain. Returns the first matching DomainLabel otherwise.

Source

pub fn has_knowledge( &self, registry: &SkillRegistry, domain: &DomainLabel, ) -> bool

Return true if the registry already contains a skill for domain.

Source

pub fn is_excluded(&self, domain: &DomainLabel) -> bool

Return true if domain is in the configured exclusion list.

Source

pub async fn explore(&self, domain: &DomainLabel) -> Result<(), SkillError>

Generate and persist a SKILL.md for domain.

Applies the evaluator gate when configured. On evaluator rejection returns Ok(()) with an info-level log — rejection is not an error.

§Errors

Returns SkillError if SKILL.md generation or the filesystem write fails.

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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