NAME
ttypt/libren.h - Public API for the Ren agent loop, tool registry, Tier-0 reflex hooks, history compaction, and UI driver plugins.
SYNOPSIS
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include <signal.h>
#include <ttypt/xy.h>
Data Structures
Macros
Typedefs
Functions
Detailed Description
Public API for the Ren agent loop, tool registry, Tier-0 reflex hooks, history compaction, and UI driver plugins.
Macro Definition Documentation
#define REN_DEFAULT_TOOL_OUTPUT_CHARS 32768
Default per-tool-result character budget before truncation.
Typedef Documentation
typedef int(* ren_compact_func) (ren_context_t *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 ren_compact_default(), or <0 on error (also falls back safely on overflow).
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.
typedef struct ren_context ren_context_t
Conversation session state passed across ren_chat() turns.
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. event_type is one of: "TIER0", "TOKEN", "TOOL", "TOOL_RESULT", "CLAUSE", "STEER", "DONE".
typedef struct ren_module ren_module_t
Descriptor for a dynamically registered Ren tool module.
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.
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.
typedef struct ren_ui_driver ren_ui_driver_t
Interactive frontend UI driver descriptor.
Function Documentation
void ren_abort (void )
Request immediate abort of the currently running turn.
int ren_call_tool (const char * name, const char * args, char ** out_result)
Invoke a registered tool directly by name with args.
int ren_chat (ren_context_t * ctx, const char * prompt, const char * host, int port)
Run one agent turn against the Auren server at host : port.
int ren_chat_ex (ren_context_t * ctx, const char * prompt, const char * host, int port, ren_event_cb cb, void * userdata)
Run one agent turn with streaming cb notifications.
int ren_compact_default (ren_context_t * ctx, size_t target_bytes)
Built-in atomic oldest-group history compactor (usable directly by extensions).
void ren_discover_project_context (void )
Auto-discover AGENTS.md / project context files in the working directory.
void ren_free (ren_context_t * ctx)
Free heap memory owned by ctx.
const ren_ui_driver_t * ren_get_ui_driver (void )
Return the currently registered UI driver, or NULL.
void ren_init (ren_context_t * ctx)
Initialize a ren_context_t to empty defaults.
int ren_is_interrupted (void )
Return non-zero if an abort has been signaled.
int ren_load_module (const char * path)
Dynamically load a libxylem Ren extension module from path.
void ren_register_compactor (ren_compact_func fn)
Register a custom conversation history compactor hook.
void ren_register_context_provider (ren_context_func fn)
Register a dynamic per-turn system-context provider hook.
void ren_register_prompt_hint (const char * hint)
Append a standing system-prompt hint string.
void ren_register_tier0 (ren_tier0_func fn)
Register a Tier-0 deterministic reflex solver hook.
void ren_register_tool (const char * name, const char * usage, ren_tool_func fn)
Register a tool with plain-text usage instructions.
void ren_register_tool_with_schema (const char * name, const char * usage, const char * schema_json, ren_tool_func fn)
Register a tool with an explicit JSON Schema for structured arguments.
void ren_register_ui_driver (const ren_ui_driver_t * driver)
Register an interactive UI driver implementation.
void ren_reset (ren_context_t * ctx)
Clear conversation history in ctx without releasing its identity.
void ren_set_abort_flag (volatile sig_atomic_t * flag)
Bind an external signal-safe abort flag pointer.
void ren_set_model (const char * model)
Override the target model name for subsequent chat turns.
void ren_set_pre_output_cb (void(* fn )(void))
Register a callback invoked immediately before stdout output begins.
void ren_set_system_prompt (const char * prompt)
Override the base system prompt string.
void ren_steer (const char * text)
Queue a mid-turn steering message for the active agent loop.
void ren_xy_install (void )
Register libren symbols on the libxylem bus.
Author
Generated automatically by Doxygen for axil-auren from the source code.