//! # `folk-api`
//!
//! Plugin contract for Folk: every plugin in Folk depends on this crate
//! and **only** on this crate. The server core (`folk-core`) provides the
//! concrete implementations of [`Executor`], [`RpcRegistrar`],
//! [`HealthRegistry`], and [`MetricsRegistry`].
//!
//! ## Writing a plugin
//!
//! Most plugins should:
//!
//! 1. Implement [`ServerPlugin`] (not [`Plugin`] directly) for a long-running
//!    background task.
//! 2. Wrap the implementation in [`ServerPluginWrapper`].
//! 3. Implement [`PluginFactory`] to construct the plugin from config.
//! 4. Export `pub fn folk_plugin_factory() -> Box<dyn PluginFactory>`.
//!
//! See `folk-spec/adr/0006-plugin-api-shape.md` for the full design rationale,
//! and `folk-plugin-http` for a complete working example (phase 6).

pub mod context;
pub mod executor;
pub mod factory;
pub mod health;
pub mod metrics;
pub mod plugin;
pub mod response;
pub mod rpc;
pub mod server_plugin;

pub use context::PluginContext;
pub use executor::{Executor, value_to_chunks};
pub use factory::PluginFactory;
pub use health::{HealthCheckFn, HealthRegistry, HealthStatus};
pub use metrics::{Counter, CounterVec, Gauge, GaugeVec, Histogram, HistogramVec, MetricsRegistry};
pub use plugin::Plugin;
pub use response::{ResponseChunk, WorkerError};
pub use rpc::{BoxFuture, RpcHandler, RpcMethodDef, RpcRegistrar};
pub use server_plugin::{ServerPlugin, ServerPluginWrapper};

/// The Folk API version. Equals this crate's `Cargo.toml` `version` field.
///
/// Used for diagnostics and the `folk --version` output. There is no runtime
/// version negotiation; see `folk-spec/adr/0004-no-capability-negotiation.md`.
pub const FOLK_API_VERSION: &str = env!("CARGO_PKG_VERSION");
