pub struct WeaverEngine { /* private fields */ }Expand description
ECC-powered codebase modeling service.
Manages modeling sessions, drives confidence evaluation via the causal graph, and records modeling decisions in the Meta-Loom.
Implementations§
Source§impl WeaverEngine
impl WeaverEngine
Sourcepub fn new(
causal_graph: Arc<CausalGraph>,
hnsw: Arc<HnswService>,
embedding_provider: Arc<dyn EmbeddingProvider>,
) -> Self
pub fn new( causal_graph: Arc<CausalGraph>, hnsw: Arc<HnswService>, embedding_provider: Arc<dyn EmbeddingProvider>, ) -> Self
Create a new WeaverEngine with the given dependencies.
Sourcepub fn new_with_mock(
causal_graph: Arc<CausalGraph>,
hnsw: Arc<HnswService>,
) -> Self
pub fn new_with_mock( causal_graph: Arc<CausalGraph>, hnsw: Arc<HnswService>, ) -> Self
Create a WeaverEngine with a mock embedding provider (for tests).
Sourcepub fn set_impulse_queue(&mut self, queue: Arc<ImpulseQueue>)
pub fn set_impulse_queue(&mut self, queue: Arc<ImpulseQueue>)
Set the impulse queue for emitting meta-loom signals.
Sourcepub fn knowledge_base(&self) -> &Arc<WeaverKnowledgeBase>
pub fn knowledge_base(&self) -> &Arc<WeaverKnowledgeBase>
Get a reference to the knowledge base.
Sourcepub fn embedding_provider(&self) -> &Arc<dyn EmbeddingProvider>
pub fn embedding_provider(&self) -> &Arc<dyn EmbeddingProvider>
Get a reference to the embedding provider.
Sourcepub fn causal_graph(&self) -> &Arc<CausalGraph>
pub fn causal_graph(&self) -> &Arc<CausalGraph>
Get a reference to the causal graph.
Sourcepub fn hnsw(&self) -> &Arc<HnswService>
pub fn hnsw(&self) -> &Arc<HnswService>
Get a reference to the HNSW service.
Sourcepub fn ingest_graph_file(
&self,
path: &Path,
) -> Result<IngestResult, WeaverError>
pub fn ingest_graph_file( &self, path: &Path, ) -> Result<IngestResult, WeaverError>
Ingest a graph JSON file (git-history, module-deps, or decisions).
Reads a .weftos/graph/*.json file, creates causal graph nodes for
each entry, creates edges between related nodes, and inserts
embeddings into the HNSW index for each node’s text representation.
Sourcepub fn ingest_graph_file_tracked(
&mut self,
path: &Path,
) -> Result<IngestResult, WeaverError>
pub fn ingest_graph_file_tracked( &mut self, path: &Path, ) -> Result<IngestResult, WeaverError>
Ingest a graph file with strategy tracking and confidence history.
Wraps [ingest_graph_file] with before/after confidence measurement,
recording the result in the StrategyTracker and
ConfidenceHistory.
Sourcepub fn compute_confidence(&self) -> ConfidenceReport
pub fn compute_confidence(&self) -> ConfidenceReport
Compute confidence based on graph coverage.
Examines the causal graph to determine what fraction of nodes have edges (both incoming and outgoing), the edge density, and identifies orphan nodes that lack causal connections.
Sourcepub fn export_model_to_file(
&self,
domain: &str,
min_confidence: f64,
path: &Path,
) -> Result<ExportedModel, WeaverError>
pub fn export_model_to_file( &self, domain: &str, min_confidence: f64, path: &Path, ) -> Result<ExportedModel, WeaverError>
Export the current model state to a JSON file at the given path.
Produces a weave-model.json that includes the causal graph nodes,
edges, confidence report, and metadata.
Sourcepub fn import_model_from_file(
&self,
domain: &str,
path: &Path,
) -> Result<(), WeaverError>
pub fn import_model_from_file( &self, domain: &str, path: &Path, ) -> Result<(), WeaverError>
Import a model from a JSON file.
Sourcepub fn start_session(
&self,
domain: &str,
context: Option<&str>,
_goal: Option<&str>,
) -> Result<String, String>
pub fn start_session( &self, domain: &str, context: Option<&str>, _goal: Option<&str>, ) -> Result<String, String>
Start a new modeling session.
Sourcepub fn get_session(&self, domain: &str) -> Option<ModelingSession>
pub fn get_session(&self, domain: &str) -> Option<ModelingSession>
Get a snapshot of a session.
Sourcepub fn list_sessions(&self) -> Vec<String>
pub fn list_sessions(&self) -> Vec<String>
List all session domains.
Sourcepub fn add_source(
&self,
domain: &str,
source_type: &str,
_root: Option<&PathBuf>,
) -> Result<(), String>
pub fn add_source( &self, domain: &str, source_type: &str, _root: Option<&PathBuf>, ) -> Result<(), String>
Add a data source to a session.
Sourcepub fn evaluate_confidence(
&self,
domain: &str,
) -> Result<ConfidenceReport, String>
pub fn evaluate_confidence( &self, domain: &str, ) -> Result<ConfidenceReport, String>
Evaluate confidence for a session domain.
Sourcepub fn tick(&self, budget: Duration) -> TickResult
pub fn tick(&self, budget: Duration) -> TickResult
Process a single cognitive tick.
Called by the CognitiveTick service during each tick cycle. Budget-aware: yields if budget is exhausted.
Sourcepub fn export_model(
&self,
domain: &str,
min_confidence: f64,
) -> Result<ExportedModel, String>
pub fn export_model( &self, domain: &str, min_confidence: f64, ) -> Result<ExportedModel, String>
Export the model for a domain.
Sourcepub fn import_model(
&self,
domain: &str,
model: ExportedModel,
) -> Result<(), String>
pub fn import_model( &self, domain: &str, model: ExportedModel, ) -> Result<(), String>
Import a previously exported model.
Sourcepub fn handle_command(&self, cmd: WeaverCommand) -> WeaverResponse
pub fn handle_command(&self, cmd: WeaverCommand) -> WeaverResponse
Handle a WeaverCommand received via IPC.
Sourcepub fn meta_loom_events(&self, domain: &str) -> Vec<MetaLoomEvent>
pub fn meta_loom_events(&self, domain: &str) -> Vec<MetaLoomEvent>
Get meta-loom events for a domain.
Sourcepub fn on_tick(&mut self, budget_ms: u32) -> CognitiveTickResult
pub fn on_tick(&mut self, budget_ms: u32) -> CognitiveTickResult
Handle a cognitive tick — process pending work within budget.
Called by the CognitiveTick service each cycle. Performs git polling, file change detection, pending ingestion, and periodic confidence recomputation, all within the supplied time budget.
Sourcepub fn enable_git_polling(&mut self, repo_path: PathBuf, branch: String)
pub fn enable_git_polling(&mut self, repo_path: PathBuf, branch: String)
Enable git polling for a repository path and branch.
Sourcepub fn enable_file_watching(&mut self, root: PathBuf, patterns: Vec<String>)
pub fn enable_file_watching(&mut self, root: PathBuf, patterns: Vec<String>)
Enable file watching for source files under a root directory.
Sourcepub fn cached_confidence(&self) -> Option<&ConfidenceReport>
pub fn cached_confidence(&self) -> Option<&ConfidenceReport>
Get the cached confidence report from the last recomputation.
Sourcepub fn git_poller(&self) -> Option<&GitPoller>
pub fn git_poller(&self) -> Option<&GitPoller>
Get a reference to the git poller, if enabled.
Sourcepub fn file_watcher(&self) -> Option<&FileWatcher>
pub fn file_watcher(&self) -> Option<&FileWatcher>
Get a reference to the file watcher, if enabled.
Sourcepub fn total_ticks(&self) -> u64
pub fn total_ticks(&self) -> u64
Total ticks processed.
Sourcepub fn confidence_history(&self) -> &ConfidenceHistory
pub fn confidence_history(&self) -> &ConfidenceHistory
Get a reference to the confidence history.
Sourcepub fn confidence_history_mut(&mut self) -> &mut ConfidenceHistory
pub fn confidence_history_mut(&mut self) -> &mut ConfidenceHistory
Get a mutable reference to the confidence history.
Sourcepub fn strategy_tracker(&self) -> &StrategyTracker
pub fn strategy_tracker(&self) -> &StrategyTracker
Get a reference to the strategy tracker.
Sourcepub fn strategy_tracker_mut(&mut self) -> &mut StrategyTracker
pub fn strategy_tracker_mut(&mut self) -> &mut StrategyTracker
Get a mutable reference to the strategy tracker.
Sourcepub fn tick_history(&self) -> &TickHistory
pub fn tick_history(&self) -> &TickHistory
Get a reference to the tick history.
Sourcepub fn set_tick_interval_ms(&mut self, ms: u32)
pub fn set_tick_interval_ms(&mut self, ms: u32)
Set the current tick interval (for recommendation calculations).
Sourcepub fn recommend_tick_interval(&self) -> TickRecommendation
pub fn recommend_tick_interval(&self) -> TickRecommendation
Analyze recent tick history and recommend interval adjustment.
Looks at recent change frequency to determine if the tick interval should be faster, slower, or idle. Thresholds:
- Frequent changes (>10/min): recommend 200ms (fast).
- Moderate changes (1-10/min): recommend 1000ms (default).
- Rare changes (<1/min): recommend 3000ms (slow).
- No changes for 100+ ticks: recommend 5000ms (idle mode).
Trait Implementations§
Source§impl SystemService for WeaverEngine
impl SystemService for WeaverEngine
Source§fn service_type(&self) -> ServiceType
fn service_type(&self) -> ServiceType
Source§fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl !Freeze for WeaverEngine
impl !RefUnwindSafe for WeaverEngine
impl Send for WeaverEngine
impl Sync for WeaverEngine
impl Unpin for WeaverEngine
impl UnsafeUnpin for WeaverEngine
impl !UnwindSafe for WeaverEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more