|
Entropic 2.3.8
Local-first agentic inference engine
|
Thread-safe hook registration and dispatch. More...
#include <entropic/core/hook_registry.h>
Public Member Functions | |
| 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. | |
| int | fire_pre (entropic_hook_point_t point, const char *context_json, char **out_json) |
| Fire pre-hooks. | |
| void | fire_post (entropic_hook_point_t point, const char *context_json, char **out_json) |
| Fire post-hooks. | |
| void | fire_info (entropic_hook_point_t point, const char *context_json) |
| Fire informational hooks (no modify, no cancel). | |
| size_t | hook_count (entropic_hook_point_t point) const |
| Get the number of registered hooks for a point. | |
Thread-safe hook registration and dispatch.
Owns a vector of HookEntry per hook point. Registration and deregistration take a write lock. Dispatch takes a read lock and a snapshot of the entry list (so hooks can register/deregister other hooks from within a callback without deadlock).
Definition at line 48 of file hook_registry.h.
| entropic_error_t entropic::HookRegistry::deregister_hook | ( | entropic_hook_point_t | point, |
| entropic_hook_callback_t | callback, | ||
| void * | user_data | ||
| ) |
Deregister a hook callback.
Matches on (point, callback, user_data) triple. Idempotent — returns ENTROPIC_OK if no match found.
| point | Hook point. |
| callback | Callback to remove. |
| user_data | user_data from registration. |
| point | Hook point. |
| callback | Callback to match. |
| user_data | user_data to match. |
Definition at line 78 of file hook_registry.cpp.
| void entropic::HookRegistry::fire_info | ( | entropic_hook_point_t | point, |
| const char * | context_json | ||
| ) |
Fire informational hooks (no modify, no cancel).
| point | The hook point. |
| context_json | Context JSON. @threadsafety Read-locks, then dispatches on snapshot. |
| point | Hook point. |
| context_json | Context JSON. |
Definition at line 234 of file hook_registry.cpp.
| void entropic::HookRegistry::fire_post | ( | entropic_hook_point_t | point, |
| const char * | context_json, | ||
| char ** | out_json | ||
| ) |
Fire post-hooks.
Fire post-hooks with result transformation chaining.
Returns transformed result.
| point | The hook point. |
| context_json | Input result JSON. |
| out_json | Output: transformed JSON (caller frees), or NULL. @threadsafety Read-locks, then dispatches on snapshot. |
| point | Hook point. |
| context_json | Input result JSON. |
| out_json | Output: accumulated transformed JSON, or NULL. |
Definition at line 185 of file hook_registry.cpp.
| int entropic::HookRegistry::fire_pre | ( | entropic_hook_point_t | point, |
| const char * | context_json, | ||
| char ** | out_json | ||
| ) |
Fire pre-hooks.
Fire pre-hooks with modification chaining and cancellation.
Returns modified context or cancellation.
| point | The hook point. |
| context_json | Input context JSON. |
| out_json | Output: modified JSON (caller frees), or NULL. |
| point | Hook point. |
| context_json | Input context JSON. |
| out_json | Output: accumulated modified JSON, or NULL. |
Definition at line 126 of file hook_registry.cpp.
| size_t entropic::HookRegistry::hook_count | ( | entropic_hook_point_t | point | ) | const |
Get the number of registered hooks for a point.
| point | Hook point. |
| point | Hook point. |
Definition at line 266 of file hook_registry.cpp.
| entropic_error_t entropic::HookRegistry::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.
| point | Hook point enum value. |
| callback | Function pointer. |
| user_data | Opaque consumer data. |
| priority | Execution order (0 = first, ascending). |
| point | Hook point. |
| callback | Function pointer. |
| user_data | Opaque pointer. |
| priority | Execution order (ascending). |
Definition at line 41 of file hook_registry.cpp.