pub trait Watcher: Send + Sync {
// Required methods
fn info(&self) -> WatcherInfo;
fn is_available(&self) -> bool;
fn find_sources(&self) -> Result<Vec<PathBuf>>;
fn parse_source(&self, path: &Path) -> Result<Vec<(Session, Vec<Message>)>>;
fn watch_paths(&self) -> Vec<PathBuf>;
}Expand description
A watcher for AI tool sessions.
Implementations of this trait can discover and parse session files from a specific AI coding tool. The trait is object-safe to allow storing multiple watcher implementations in a registry.
§Example
use lore_cli::capture::watchers::default_registry;
let registry = default_registry();
for watcher in registry.available_watchers() {
println!("{}: {}", watcher.info().name, watcher.info().description);
}Required Methods§
Sourcefn info(&self) -> WatcherInfo
fn info(&self) -> WatcherInfo
Returns information about this watcher.
Sourcefn is_available(&self) -> bool
fn is_available(&self) -> bool
Checks if this watcher is available.
A watcher is available if the tool it watches is installed and its session storage location exists on this system.
Sourcefn find_sources(&self) -> Result<Vec<PathBuf>>
fn find_sources(&self) -> Result<Vec<PathBuf>>
Finds all session sources (files or directories) to import.
Returns paths to individual session files or databases that can be
passed to parse_source.
Sourcefn parse_source(&self, path: &Path) -> Result<Vec<(Session, Vec<Message>)>>
fn parse_source(&self, path: &Path) -> Result<Vec<(Session, Vec<Message>)>>
Parses a session source and returns sessions with their messages.
Each session is returned with its associated messages as a tuple. A single source file may contain multiple sessions.
Sourcefn watch_paths(&self) -> Vec<PathBuf>
fn watch_paths(&self) -> Vec<PathBuf>
Returns paths to watch for changes.
Used by the daemon file watcher to monitor for new or modified sessions.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".