.TH "ttypt/libren.h" 3 "axil-auren" \" -*- nroff -*- .ad l .nh .SH NAME ttypt/libren.h \- Public API for the Ren agent loop, tool registry, Tier-0 reflex hooks, history compaction, and UI driver plugins\&. .SH SYNOPSIS .br .PP \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br \fR#include \fP .br .SS "Data Structures" .in +1c .ti -1c .RI "struct \fBren_context\fP" .br .ti -1c .RI "struct \fBren_ui_driver\fP" .br .ti -1c .RI "struct \fBren_module\fP" .br .in -1c .SS "Macros" .in +1c .ti -1c .RI "#define \fBREN_DEFAULT_TOOL_OUTPUT_CHARS\fP 32768" .br .in -1c .SS "Typedefs" .in +1c .ti -1c .RI "typedef struct \fBren_context\fP \fBren_context_t\fP" .br .ti -1c .RI "typedef int(* \fBren_tool_func\fP) (const char *args, char **out_result)" .br .ti -1c .RI "typedef int(* \fBren_tier0_func\fP) (const char *prompt, char **out_op, char **out_output, char **out_spoken)" .br .ti -1c .RI "typedef char *(* \fBren_context_func\fP) (void)" .br .ti -1c .RI "typedef int(* \fBren_compact_func\fP) (\fBren_context_t\fP *ctx, size_t target_bytes, const char *reason)" .br .ti -1c .RI "typedef void(* \fBren_event_cb\fP) (const char *event_type, const char *arg1, const char *arg2, void *userdata)" .br .ti -1c .RI "typedef struct \fBren_ui_driver\fP \fBren_ui_driver_t\fP" .br .ti -1c .RI "typedef struct \fBren_module\fP \fBren_module_t\fP" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "void \fBren_init\fP (\fBren_context_t\fP *ctx)" .br .ti -1c .RI "void \fBren_free\fP (\fBren_context_t\fP *ctx)" .br .ti -1c .RI "void \fBren_reset\fP (\fBren_context_t\fP *ctx)" .br .ti -1c .RI "int \fBren_chat\fP (\fBren_context_t\fP *ctx, const char *prompt, const char *host, int port)" .br .ti -1c .RI "int \fBren_chat_ex\fP (\fBren_context_t\fP *ctx, const char *prompt, const char *host, int port, \fBren_event_cb\fP cb, void *userdata)" .br .ti -1c .RI "int \fBren_compact_default\fP (\fBren_context_t\fP *ctx, size_t target_bytes)" .br .ti -1c .RI "void \fBren_register_tool\fP (const char *name, const char *usage, \fBren_tool_func\fP fn)" .br .ti -1c .RI "void \fBren_register_tool_with_schema\fP (const char *name, const char *usage, const char *schema_json, \fBren_tool_func\fP fn)" .br .ti -1c .RI "void \fBren_register_prompt_hint\fP (const char *hint)" .br .ti -1c .RI "void \fBren_register_tier0\fP (\fBren_tier0_func\fP fn)" .br .ti -1c .RI "void \fBren_register_context_provider\fP (\fBren_context_func\fP fn)" .br .ti -1c .RI "void \fBren_register_compactor\fP (\fBren_compact_func\fP fn)" .br .ti -1c .RI "void \fBren_set_system_prompt\fP (const char *prompt)" .br .ti -1c .RI "void \fBren_set_model\fP (const char *model)" .br .ti -1c .RI "void \fBren_discover_project_context\fP (void)" .br .ti -1c .RI "void \fBren_set_abort_flag\fP (volatile sig_atomic_t *flag)" .br .ti -1c .RI "void \fBren_set_pre_output_cb\fP (void(*fn)(void))" .br .ti -1c .RI "void \fBren_register_ui_driver\fP (const \fBren_ui_driver_t\fP *driver)" .br .ti -1c .RI "const \fBren_ui_driver_t\fP * \fBren_get_ui_driver\fP (void)" .br .ti -1c .RI "void \fBren_steer\fP (const char *text)" .br .ti -1c .RI "void \fBren_abort\fP (void)" .br .ti -1c .RI "int \fBren_is_interrupted\fP (void)" .br .ti -1c .RI "int \fBren_load_module\fP (const char *path)" .br .ti -1c .RI "int \fBren_call_tool\fP (const char *name, const char *args, char **out_result)" .br .ti -1c .RI "void \fBren_xy_install\fP (void)" .br .in -1c .SH "Detailed Description" .PP Public API for the Ren agent loop, tool registry, Tier-0 reflex hooks, history compaction, and UI driver plugins\&. .SH "Macro Definition Documentation" .PP .SS "#define REN_DEFAULT_TOOL_OUTPUT_CHARS 32768" Default per-tool-result character budget before truncation\&. .SH "Typedef Documentation" .PP .SS "typedef int(* ren_compact_func) (\fBren_context_t\fP *ctx, size_t target_bytes, const char *reason)" Optional history compactor hook registered by a xylem extension\&. Called when max_history_chars is exceeded ("limit") or when upstream rejects the payload for context length ("overflow")\&. Returns >0 if ctx->history was reduced, 0 to fall back to \fBren_compact_default()\fP, or <0 on error (also falls back safely on overflow)\&. .SS "typedef char *(* ren_context_func) (void)" Optional dynamic context provider registered by an extension module\&. Returns a heap-allocated summary string (caller frees) or NULL\&. .SS "typedef struct \fBren_context\fP \fBren_context_t\fP" Conversation session state passed across \fBren_chat()\fP turns\&. .SS "typedef void(* ren_event_cb) (const char *event_type, const char *arg1, const char *arg2, void *userdata)" Streaming event callback for socket IPC / TTS streaming / UI drivers\&. \fRevent_type\fP is one of: "TIER0", "TOKEN", "TOOL", "TOOL_RESULT", "CLAUSE", "STEER", "DONE"\&. .SS "typedef struct \fBren_module\fP \fBren_module_t\fP" Descriptor for a dynamically registered Ren tool module\&. .SS "typedef int(* ren_tier0_func) (const char *prompt, char **out_op, char **out_output, char **out_spoken)" Optional Tier-0 reflex solver hook registered by an extension module\&. Returns 1 if Tier-0 deterministically handled the prompt (populates *out_op, *out_output, *out_spoken — caller frees them), or 0 to fall through to Tier-1 LLM\&. .SS "typedef int(* ren_tool_func) (const char *args, char **out_result)" Tool execution callback: returns 0 on success, <0 on error; caller frees *out_result\&. .SS "typedef struct \fBren_ui_driver\fP \fBren_ui_driver_t\fP" Interactive frontend UI driver descriptor\&. .SH "Function Documentation" .PP .SS "void ren_abort (void )" Request immediate abort of the currently running turn\&. .SS "int ren_call_tool (const char * name, const char * args, char ** out_result)" Invoke a registered tool directly by \fRname\fP with \fRargs\fP\&. .SS "int ren_chat (\fBren_context_t\fP * ctx, const char * prompt, const char * host, int port)" Run one agent turn against the Auren server at \fRhost\fP : \fRport\fP\&. .SS "int ren_chat_ex (\fBren_context_t\fP * ctx, const char * prompt, const char * host, int port, \fBren_event_cb\fP cb, void * userdata)" Run one agent turn with streaming \fRcb\fP notifications\&. .SS "int ren_compact_default (\fBren_context_t\fP * ctx, size_t target_bytes)" Built-in atomic oldest-group history compactor (usable directly by extensions)\&. .SS "void ren_discover_project_context (void )" Auto-discover AGENTS\&.md / project context files in the working directory\&. .SS "void ren_free (\fBren_context_t\fP * ctx)" Free heap memory owned by \fRctx\fP\&. .SS "const \fBren_ui_driver_t\fP * ren_get_ui_driver (void )" Return the currently registered UI driver, or NULL\&. .SS "void ren_init (\fBren_context_t\fP * ctx)" Initialize a \fBren_context_t\fP to empty defaults\&. .SS "int ren_is_interrupted (void )" Return non-zero if an abort has been signaled\&. .SS "int ren_load_module (const char * path)" Dynamically load a libxylem Ren extension module from \fRpath\fP\&. .SS "void ren_register_compactor (\fBren_compact_func\fP fn)" Register a custom conversation history compactor hook\&. .SS "void ren_register_context_provider (\fBren_context_func\fP fn)" Register a dynamic per-turn system-context provider hook\&. .SS "void ren_register_prompt_hint (const char * hint)" Append a standing system-prompt hint string\&. .SS "void ren_register_tier0 (\fBren_tier0_func\fP fn)" Register a Tier-0 deterministic reflex solver hook\&. .SS "void ren_register_tool (const char * name, const char * usage, \fBren_tool_func\fP fn)" Register a tool with plain-text usage instructions\&. .SS "void ren_register_tool_with_schema (const char * name, const char * usage, const char * schema_json, \fBren_tool_func\fP fn)" Register a tool with an explicit JSON Schema for structured arguments\&. .SS "void ren_register_ui_driver (const \fBren_ui_driver_t\fP * driver)" Register an interactive UI driver implementation\&. .SS "void ren_reset (\fBren_context_t\fP * ctx)" Clear conversation history in \fRctx\fP without releasing its identity\&. .SS "void ren_set_abort_flag (volatile sig_atomic_t * flag)" Bind an external signal-safe abort flag pointer\&. .SS "void ren_set_model (const char * model)" Override the target model name for subsequent chat turns\&. .SS "void ren_set_pre_output_cb (void(* fn )(void))" Register a callback invoked immediately before stdout output begins\&. .SS "void ren_set_system_prompt (const char * prompt)" Override the base system prompt string\&. .SS "void ren_steer (const char * text)" Queue a mid-turn steering message for the active agent loop\&. .SS "void ren_xy_install (void )" Register libren symbols on the libxylem bus\&. .SH "Author" .PP Generated automatically by Doxygen for axil-auren from the source code\&.