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
impl ProactiveExplorer
Sourcepub fn new(
generator: SkillGenerator,
evaluator: Option<Arc<SkillEvaluator>>,
output_dir: PathBuf,
max_chars: usize,
timeout_ms: u64,
excluded_domains: Vec<String>,
) -> Self
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"]).
Sourcepub fn timeout_ms(&self) -> u64
pub fn timeout_ms(&self) -> u64
Expose the configured timeout so callers can set tokio::time::timeout correctly.
Sourcepub fn classify(&self, query: &str) -> Option<DomainLabel>
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.
Sourcepub fn has_knowledge(
&self,
registry: &SkillRegistry,
domain: &DomainLabel,
) -> bool
pub fn has_knowledge( &self, registry: &SkillRegistry, domain: &DomainLabel, ) -> bool
Return true if the registry already contains a skill for domain.
Sourcepub fn is_excluded(&self, domain: &DomainLabel) -> bool
pub fn is_excluded(&self, domain: &DomainLabel) -> bool
Return true if domain is in the configured exclusion list.
Sourcepub async fn explore(&self, domain: &DomainLabel) -> Result<(), SkillError>
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.