//! `klieo-runlog` — Tier 2 observability for klieo agents.
//!
//! This crate ships:
//! - A [`RunLog`] aggregate type (the spec §8.2 view: `run_id`,
//!   `agent`, `started_at`, `finished_at`, `status`, `steps`, `tokens`,
//!   `cost_estimate`).
//! - A pluggable [`RunLogStore`] trait. Default in-memory;
//!   SQLite behind `sqlite` feature.
//! - Deterministic [`compaction`](mod@compaction) (drop-by-rule). LLM-summarise
//!   compaction behind `compaction-llm` feature.
//! - A deterministic-only [`replay`](mod@replay) engine that re-runs recorded
//!   LLM + tool calls.
//!
//! ## Design: projection over `EpisodicMemory`, not a new trait
//!
//! `RunLog` is **not** a separate sink. It is a projection computed by walking
//! a `Vec<klieo_core::Episode>` returned from any
//! `EpisodicMemory::replay(run_id)`. The crate adds **zero traits** to
//! `klieo-core`. Plan #11 froze that surface.
//!
//! Typical wiring:
//! ```text
//!   EpisodicMemory --(replay)--> Vec<Episode> --(project)--> RunLog --(put)--> RunLogStore
//! ```
//!
//! ## Replay caveats
//!
//! [`replay`](mod@replay) is **deterministic-only**. It asserts that user-supplied
//! test-double `LlmClient` + `ToolInvoker` produce byte-identical outputs to
//! the recorded ones. Side effects that do not flow through these traits
//! (timestamps, randomness, network calls outside the recorded LLM/tool
//! calls) cannot be replayed.
#![deny(missing_docs)]

pub mod compaction;
pub mod error;
pub mod pricing;
pub mod projector;
pub mod replay;
pub mod store;
#[cfg(feature = "sqlite")]
pub mod store_sqlite;
#[cfg(feature = "test-utils")]
pub mod test_utils;
pub mod types;

#[cfg(feature = "compaction-llm")]
pub use crate::compaction::LlmCompaction;
pub use crate::compaction::{CompactionPolicy, DeterministicCompaction};
pub use crate::error::RunLogError;
pub use crate::pricing::{PriceTable, Rates, RatesError};
pub use crate::projector::{project, project_with_llm_io, project_with_price_table};
pub use crate::replay::replay;
pub use crate::store::{InMemoryRunLogStore, RunLogStore};
#[cfg(feature = "sqlite")]
pub use crate::store_sqlite::SqliteRunLogStore;
pub use crate::types::{Cost, LlmIo, RunLog, RunStatus, Step, StepKind, Usage};
