Skip to main content

feagi_npu_plasticity/
lib.rs

1// Copyright 2025 Neuraville Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4// Manual `n % divisor == 0` used instead of `n.is_multiple_of(divisor)` for stable Rust
5// compatibility (is_multiple_of is unstable on older stable toolchains).
6#![allow(clippy::manual_is_multiple_of)]
7/*
8 * Copyright 2025 Neuraville Inc.
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 */
13
14//! # FEAGI Plasticity Module
15//!
16//! This crate implements synaptic plasticity algorithms for FEAGI:
17//! - STDP (Spike-Timing-Dependent Plasticity)
18//! - Memory formation with pattern detection
19//! - Memory neuron lifecycle management
20//! - Neuron ID allocation system
21//!
22//! ## Architecture
23//! - High-performance Rust implementation
24//! - SIMD-friendly data structures
25//! - Thread-safe operations
26//! - RTOS-compatible design
27
28/// Crate version from Cargo.toml
29pub const VERSION: &str = env!("CARGO_PKG_VERSION");
30
31pub mod executor; // Abstraction layer for different execution models
32pub mod memory_neuron_array;
33pub mod memory_stats_cache;
34pub mod neuron_id_manager;
35pub mod pattern_detector;
36pub mod service;
37pub mod stdp;
38pub mod stdp_core; // Platform-agnostic STDP (no_std compatible)
39                   // pub mod lifecycle_manager;  // DEPRECATED: Use AsyncPlasticityExecutor instead
40
41// Re-export key types
42pub use executor::{AsyncPlasticityExecutor, PlasticityExecutor};
43// pub use lifecycle_manager::PlasticityLifecycleManager;  // DEPRECATED
44pub use memory_neuron_array::{MemoryNeuronArray, MemoryNeuronLifecycleConfig, MemoryNeuronStats};
45pub use memory_stats_cache::{
46    create_memory_stats_cache, get_area_stats, get_stats_snapshot, init_memory_area,
47    on_neuron_created, on_neuron_deleted, remove_memory_area, MemoryAreaStats, MemoryStatsCache,
48};
49pub use neuron_id_manager::{AllocationStats, NeuronIdManager, NeuronType};
50pub use pattern_detector::{BatchPatternDetector, PatternConfig, PatternDetector, TemporalPattern};
51pub use service::{PlasticityCommand, PlasticityConfig, PlasticityService, ReplayFrame};
52pub use stdp::{compute_activity_factors, compute_timing_factors, STDPConfig};