Skip to main content

bound_server_memory

Function bound_server_memory 

Source
pub fn bound_server_memory(memory: String) -> String
Expand description

Bound a server’s memory to MAX_SERVER_MEMORY_CHARS, keeping the newest content.

Memory accumulates chronologically (append_memory joins with a newline), so the tail is the recent state and the head is the stalest. Whole lines are dropped from the front, and the result is marked so the model can tell that history was lost. A single line longer than the cap is truncated char-safely rather than dropped entirely.