klieo-runlog 3.3.1

Tier 2 observability โ€” RunLog aggregate + replay engine for klieo agents.
Documentation
#![deny(rustdoc::broken_intra_doc_links)]
//! `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 capture;
pub mod capture_sink;
pub mod capture_store;
pub mod compaction;
pub mod divergence;
pub mod error;
pub mod fingerprint;
pub mod pricing;
pub mod projector;
pub mod replay;
pub mod replay_llm;
pub mod store;
#[cfg(feature = "sqlite")]
pub mod store_sqlite;
#[cfg(feature = "test-utils")]
pub mod test_utils;
pub mod types;

pub use crate::capture::Capture;
pub use crate::capture_sink::RunLogCaptureSink;
pub use crate::capture_store::{gc_captures, load_capture, persist_capture, CAPTURE_BUCKET};
#[cfg(feature = "compaction-llm")]
pub use crate::compaction::LlmCompaction;
pub use crate::compaction::{CompactionPolicy, DeterministicCompaction};
pub use crate::divergence::{
    replay_with_divergence, DivergenceReport, ReplayMode, ReproVerdict, StepDivergence,
};
pub use crate::error::RunLogError;
pub use crate::fingerprint::request_fingerprint;
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::replay_llm::ReplayLlmClient;
pub use crate::store::{InMemoryRunLogStore, RunLogQuery, RunLogStore};
#[cfg(feature = "sqlite")]
pub use crate::store_sqlite::SqliteRunLogStore;
pub use crate::types::{Cost, LlmIo, RunLog, RunStatus, Step, StepKind, Usage};