// retoor <retoor@molodetz.nl>
#ifndef R_CONTEXT_MANAGER_H
#define R_CONTEXT_MANAGER_H
#include "messages.h"
#include "r_error.h"
/**
* Shrinks the context of the given messages to fit within model limits.
* Uses a smart trimming algorithm:
* 1. Truncates the middle of large messages (preserving start and end).
* 2. Removes oldest conversation pairs (user/assistant) if needed.
* 3. Never touches the 'system' message or the very last user message.
*
* Returns R_SUCCESS if shrinkage was performed, or error if not possible.
*/
r_status_t context_manager_shrink(messages_handle msgs);
#endif