Skip to main content

WeaverEngine

Struct WeaverEngine 

Source
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

Source

pub fn new( causal_graph: Arc<CausalGraph>, hnsw: Arc<HnswService>, embedding_provider: Arc<dyn EmbeddingProvider>, ) -> Self

Create a new WeaverEngine with the given dependencies.

Source

pub fn new_with_mock( causal_graph: Arc<CausalGraph>, hnsw: Arc<HnswService>, ) -> Self

Create a WeaverEngine with a mock embedding provider (for tests).

Source

pub fn set_impulse_queue(&mut self, queue: Arc<ImpulseQueue>)

Set the impulse queue for emitting meta-loom signals.

Source

pub fn knowledge_base(&self) -> &Arc<WeaverKnowledgeBase>

Get a reference to the knowledge base.

Source

pub fn embedding_provider(&self) -> &Arc<dyn EmbeddingProvider>

Get a reference to the embedding provider.

Source

pub fn causal_graph(&self) -> &Arc<CausalGraph>

Get a reference to the causal graph.

Source

pub fn hnsw(&self) -> &Arc<HnswService>

Get a reference to the HNSW service.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn import_model_from_file( &self, domain: &str, path: &Path, ) -> Result<(), WeaverError>

Import a model from a JSON file.

Source

pub fn start_session( &self, domain: &str, context: Option<&str>, _goal: Option<&str>, ) -> Result<String, String>

Start a new modeling session.

Source

pub fn stop_session(&self, domain: &str) -> Result<(), String>

Stop a modeling session.

Source

pub fn resume_session(&self, domain: &str) -> Result<(), String>

Resume a stopped session.

Source

pub fn get_session(&self, domain: &str) -> Option<ModelingSession>

Get a snapshot of a session.

Source

pub fn list_sessions(&self) -> Vec<String>

List all session domains.

Source

pub fn add_source( &self, domain: &str, source_type: &str, _root: Option<&PathBuf>, ) -> Result<(), String>

Add a data source to a session.

Source

pub fn evaluate_confidence( &self, domain: &str, ) -> Result<ConfidenceReport, String>

Evaluate confidence for a session domain.

Source

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.

Source

pub fn export_model( &self, domain: &str, min_confidence: f64, ) -> Result<ExportedModel, String>

Export the model for a domain.

Source

pub fn import_model( &self, domain: &str, model: ExportedModel, ) -> Result<(), String>

Import a previously exported model.

Source

pub fn handle_command(&self, cmd: WeaverCommand) -> WeaverResponse

Handle a WeaverCommand received via IPC.

Source

pub fn meta_loom_events(&self, domain: &str) -> Vec<MetaLoomEvent>

Get meta-loom events for a domain.

Source

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.

Source

pub fn enable_git_polling(&mut self, repo_path: PathBuf, branch: String)

Enable git polling for a repository path and branch.

Source

pub fn enable_file_watching(&mut self, root: PathBuf, patterns: Vec<String>)

Enable file watching for source files under a root directory.

Source

pub fn cached_confidence(&self) -> Option<&ConfidenceReport>

Get the cached confidence report from the last recomputation.

Source

pub fn git_poller(&self) -> Option<&GitPoller>

Get a reference to the git poller, if enabled.

Source

pub fn file_watcher(&self) -> Option<&FileWatcher>

Get a reference to the file watcher, if enabled.

Source

pub fn total_ticks(&self) -> u64

Total ticks processed.

Source

pub fn confidence_history(&self) -> &ConfidenceHistory

Get a reference to the confidence history.

Source

pub fn confidence_history_mut(&mut self) -> &mut ConfidenceHistory

Get a mutable reference to the confidence history.

Source

pub fn strategy_tracker(&self) -> &StrategyTracker

Get a reference to the strategy tracker.

Source

pub fn strategy_tracker_mut(&mut self) -> &mut StrategyTracker

Get a mutable reference to the strategy tracker.

Source

pub fn tick_history(&self) -> &TickHistory

Get a reference to the tick history.

Source

pub fn set_tick_interval_ms(&mut self, ms: u32)

Set the current tick interval (for recommendation calculations).

Source

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

Source§

fn name(&self) -> &str

Human-readable service name.
Source§

fn service_type(&self) -> ServiceType

Service type category.
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,

Start the service.
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,

Stop the service.
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,

Perform a health check.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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