//! Agent session layer for tidalDB. //! //! Provides session-scoped signals with aggressive decay, schema-declared //! policies, and FOR SESSION ranking context. An agent creates a session, //! writes preference hints and reward signals, then queries results shaped //! by that session — all without Redis, a feature store, or middleware. //! //! # Architecture //! //! - Active sessions live in a `DashMap>` in `TidalDb`. //! - Session signals are tracked in per-session `DashMap`, //! keyed by signal type name. //! - On `close_session`, the snapshot is archived to `closed_sessions` (and //! optionally to persistent storage in durable mode). //! - The `FOR SESSION` ranking boost is applied by `ProfileExecutor::score_with_session` //! using a `SessionContext` derived from the session snapshot. //! //! # Module structure //! //! | File | Concern | //! |------|---------| //! | `types` | Identity newtypes (`SessionId`, `AgentId`) and lightweight DTOs | //! | `signal_state` | Per-session decay math (`SessionHotState`, `SessionSignalState`) | //! | `audit` | Bounded audit log and `MAX_*` constants | //! | `policy` | Policy rule evaluation (`PolicyEvaluator`, violations) | //! | `state` | Live runtime state (`SessionState`, `SessionHandle`) | //! | `snapshot` | Full state dumps and `SessionContext` for ranking | //! | `serde` | Binary encode/decode for all session record types | pub mod audit; pub mod policy; pub mod serde; pub mod signal_state; pub mod snapshot; pub mod state; pub mod types; // ── Re-exports ──────────────────────────────────────────────────────────────── // Everything below preserves the flat `crate::session::Foo` import surface // that db/mod.rs, query/*, and ranking/* depend on. pub use audit::{AuditEntry, AuditLog, MAX_ANNOTATIONS, MAX_AUDIT_ENTRIES, MAX_CLOSED_SESSIONS}; pub use policy::{PolicyEvaluator, PolicyViolation, PolicyViolationKind}; pub use serde::{ deserialize_audit_log, deserialize_snapshot, deserialize_start_record, serialize_audit_log, serialize_snapshot, serialize_start_record, }; pub use signal_state::{ DEFAULT_SESSION_LAMBDA, SessionHotState, SessionSignalState, SignalSnapEntry, }; pub use snapshot::{SessionContext, SessionSnapshot, build_frozen_snapshot, build_snapshot}; pub use state::{SessionHandle, SessionState}; pub use types::{AgentId, SessionId, SessionInfo, SessionSummary};