Skip to main content

Module session_keys

Module session_keys 

Source
Expand description

Session key normalization shared across infra and memory backends.

Channel orchestration uses two identifiers derived from a ChannelMessage: one ends up as a JSONL filename (via SessionStore::session_path) and as an in-memory HashMap key for the conversation history cache, while the same identifier is also passed to Memory::store/Memory::recall as the session_id filter. Because filesystem-safe sanitization is applied when writing the JSONL file, every other layer must use the same sanitized form to keep lookups consistent across daemon restarts and persisted backends.

Functionsยง

sanitize_session_key
Replace every character outside [A-Za-z0-9_-] with _. Idempotent.