//! Plugin Framework — Phase-92
//!
//! Provides a generic plugin infrastructure for extending `ai_db` with
//! external capabilities that are process-isolated, removable, and upgradeable.
//!
//! # Architecture
//!
//! ```text
//! ┌────────────────────────────────────────────────────────────────┐
//! │                        ai_db Core                             │
//! │  ┌──────────────────────────────────────────────────────────┐ │
//! │  │                    PluginManager                         │ │
//! │  │  ┌──────────┐  ┌──────────┐  ┌──────────┐              │ │
//! │  │  │ Plugin A  │  │ Plugin B  │  │ Plugin C  │ ...         │ │
//! │  │  │ (Indexer) │  │(Processor)│  │ (Custom)  │             │ │
//! │  │  └─────┬─────┘  └─────┬─────┘  └─────┬─────┘            │ │
//! │  │        │              │              │                   │ │
//! │  │        └──────────────┼──────────────┘                   │ │
//! │  │                       │ HTTP Protocol                    │ │
//! │  └───────────────────────┼──────────────────────────────────┘ │
//! │                          │                                    │
//! └──────────────────────────┼────────────────────────────────────┘
//!                            │
//!         ┌──────────────────┼──────────────────┐
//!         │                  │                  │
//!    ┌────▼─────┐     ┌─────▼────┐     ┌──────▼─────┐
//!    │ PageIndex │     │ Custom   │     │ Future     │
//!    │ Plugin    │     │ Plugin   │     │ Plugin     │
//!    │ (Python)  │     │ (Any)    │     │ (Any)      │
//!    └──────────┘     └──────────┘     └────────────┘
//! ```
//!
//! # Design Principles
//!
//! 1. **Process isolation**: Plugins run in separate processes, communicating via HTTP.
//! 2. **Removable**: Any plugin can be unregistered without affecting the core.
//! 3. **Upgradeable**: Plugins can be updated independently of `ai_db`.
//! 4. **Graceful degradation**: Plugin unavailability returns `None`, never crashes.
//! 5. **Zero compile-time dependency**: The core compiles without any plugins.
//!
//! # Key Components
//!
//! - [`PluginManifest`]: Static metadata declaring a plugin's identity and capabilities.
//! - [`PluginInfo`]: Runtime state of a registered plugin.
//! - [`PluginManager`]: Central lifecycle manager (register/health/call).
//! - [`PluginsConfig`]: `.plugins.json` configuration format.
//! - [`PluginConfigWatcher`]: Hot-reload file change detector.
//!
//! # Quick Start
//!
//! ```rust,ignore
//! use aifastdb_core::plugin::{PluginManager, PluginManagerConfig, PluginsConfig};
//!
//! // Create manager
//! let manager = PluginManager::new(PluginManagerConfig::default());
//!
//! // Register a plugin (auto-discovers via HTTP)
//! manager.register("http://localhost:8800").await?;
//!
//! // Safe call with graceful degradation
//! if let Some(result) = manager.try_index("pageindex", "pdf", &request).await {
//!     println!("Indexed: {:?}", result);
//! }
//!
//! // Load from config file
//! let config = PluginsConfig::load(".plugins.json")?;
//! for entry in config.enabled_plugins() {
//!     manager.register(&entry.endpoint).await?;
//! }
//! ```

pub mod types;
pub mod protocol;
pub mod manager;
pub mod config;

// Re-export primary types
pub use types::{
    PluginError, PluginResult,
    PluginType, PluginCapability, PluginStatus,
    PluginManifest, PluginInfo, PluginCallOptions,
};

pub use protocol::{
    SUPPORTED_API_VERSION,
    HealthResponse, CapabilitiesResponse,
    IndexRequest, IndexResponse,
    ProcessRequest, ProcessResponse,
    PluginCallRequest, PluginCallResponse,
};

pub use manager::{PluginManager, PluginManagerConfig};

pub use config::{
    PluginsConfig, PluginEntry, PluginConfigWatcher,
};
