x-pipe-rs 0.1.0

Composable recommendation/feed pipeline framework built on comp-cat-rs
Documentation
//! Composable recommendation and feed pipeline framework.
//!
//! `x-pipe-rs` provides a typed, composable pipeline for assembling
//! ranked feeds, inspired by the X algorithm's candidate-pipeline
//! architecture.  Every pipeline stage is a Kleisli arrow in the
//! [`Io`] monad from [`comp_cat_rs`]; composition is Kleisli
//! composition, which by `comp-cat-rs`'s collapse hierarchy is
//! a Kan extension.
//!
//! # Architecture
//!
//! A pipeline assembles six kinds of stages:
//!
//! 1. **[`Source`]** -- produce candidate items from backends
//! 2. **[`Hydrator`]** -- enrich candidates with additional data
//! 3. **[`Filter`]** -- remove candidates that fail criteria
//! 4. **[`Scorer`]** -- assign relevance scores
//! 5. **[`Selector`]** -- choose final candidates (dedup, diversity, budget)
//! 6. **[`SideEffect`]** -- observe without modifying (logging, metrics)
//!
//! Each trait converts to a [`Stage`], the universal Kleisli arrow
//! type.  Stages compose via [`Stage::then`] (Kleisli composition).
//! The final [`Pipeline`] is itself a single `Stage` from query to
//! scored results.
//!
//! # Categorical justification
//!
//! [`Stage`] forms a category whose morphisms are Kleisli arrows
//! `A -> Io<E, B>`.  Composition is associative with identity, and
//! by `collapse::monad_is_kan` every such composition is a pair of
//! Kan extensions.  [`Score`] implements [`JoinSemilattice`], making
//! score merging a colimit (left Kan extension).
//!
//! [`Io`]: comp_cat_rs::effect::io::Io
//! [`JoinSemilattice`]: comp_cat_rs::foundation::semilattice::JoinSemilattice

pub mod error;
pub mod filter;
pub mod hydrator;
pub mod pipeline;
pub mod score;
pub mod scorer;
pub mod selector;
pub mod side_effect;
pub mod source;
pub mod stage;

pub use error::PipelineError;
pub use filter::Filter;
pub use hydrator::Hydrator;
pub use pipeline::Pipeline;
pub use score::{Score, ScoredCandidate};
pub use scorer::Scorer;
pub use selector::{Budget, MaxItems, Selector};
pub use side_effect::SideEffect;
pub use source::Source;
pub use stage::Stage;