feat: add context overflow detection and automatic history shrinking in agent loop

Implement context manager integration that detects API errors indicating context length exceeded, then automatically shrinks message history and retries the request. Add new messages API functions (remove_range, get_object, replace_at) and a new R_ERROR_CONTEXT_TOO_LONG error code to support this functionality.
This commit is contained in:
2026-01-28 19:15:02 +00:00
parent 09e3f62a34
commit 216627e777
5 changed files with 62 additions and 1 deletions
+1
View File
@@ -17,6 +17,7 @@ SRC_CORE = $(SRCDIR)/r_error.c \
$(SRCDIR)/messages.c \
$(SRCDIR)/agent.c \
$(SRCDIR)/bash_executor.c \
$(SRCDIR)/context_manager.c \
$(SRCDIR)/main.c
SRC_TOOLS = $(TOOLSDIR)/tools_init.c \