Skip to main content

Watcher

Trait Watcher 

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

Source

fn info(&self) -> WatcherInfo

Returns information about this watcher.

Source

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.

Source

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.

Source

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.

Source

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

Implementors§