Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic_hooks.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
12#include "engine_handle.h"
13
14#include <entropic/entropic.h>
16
17static auto logger = entropic::log::get("facade.hooks");
18
31 return &handle->hook_registry;
32}
33
41extern "C" ENTROPIC_EXPORT entropic_error_t
43 entropic_handle_t handle,
44 entropic_hook_point_t hook_point,
46 void* user_data,
47 int priority) {
48
49 if (!handle) {
51 }
52 if (!callback) {
54 }
55
56 return get_registry(handle)->register_hook(
57 hook_point, callback, user_data, priority);
58}
59
67extern "C" ENTROPIC_EXPORT entropic_error_t
69 entropic_handle_t handle,
70 entropic_hook_point_t hook_point,
72 void* user_data) {
73
74 if (!handle) {
76 }
77
78 return get_registry(handle)->deregister_hook(
79 hook_point, callback, user_data);
80}
Thread-safe hook registration and dispatch.
entropic_error_t register_hook(entropic_hook_point_t point, entropic_hook_callback_t callback, void *user_data, int priority)
Register a hook callback at a hook point.
entropic_error_t deregister_hook(entropic_hook_point_t point, entropic_hook_callback_t callback, void *user_data)
Deregister a hook callback.
Private definition of the entropic_engine struct.
Public C API for the Entropic inference engine.
static entropic::HookRegistry * get_registry(entropic_handle_t handle)
Resolve HookRegistry from engine handle.
ENTROPIC_EXPORT entropic_error_t entropic_deregister_hook(entropic_handle_t handle, entropic_hook_point_t hook_point, entropic_hook_callback_t callback, void *user_data)
Deregister a previously registered hook callback.
ENTROPIC_EXPORT entropic_error_t entropic_register_hook(entropic_handle_t handle, entropic_hook_point_t hook_point, entropic_hook_callback_t callback, void *user_data, int priority)
Register a hook callback for a hook point.
entropic_error_t
Error codes returned by all C API functions.
Definition error.h:35
@ ENTROPIC_ERROR_INVALID_ARGUMENT
NULL pointer, empty string, out-of-range value.
Definition error.h:37
@ ENTROPIC_ERROR_INVALID_HANDLE
NULL or destroyed handle (v1.8.9)
Definition error.h:55
int(* entropic_hook_callback_t)(entropic_hook_point_t hook_point, const char *context_json, char **modified_json, void *user_data)
Hook callback function type.
Definition hooks.h:134
entropic_hook_point_t
Hook points in the engine lifecycle.
Definition hooks.h:34
spdlog initialization and logger access.
ENTROPIC_EXPORT std::shared_ptr< spdlog::logger > get(const std::string &name)
Get or create a named logger.
Definition logging.cpp:211
Engine handle struct — owns all subsystems.
entropic::HookRegistry hook_registry
Hook dispatch.