Entropic 2.11.1
Local-first agentic inference engine
Loading...
Searching...
No Matches
hook_registry.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
17#pragma once
18
21
22#include <array>
23#include <shared_mutex>
24#include <vector>
25
26namespace entropic {
27
37
49public:
64 void* user_data,
65 int priority);
66
84 void* user_data);
85
96 int fire_pre(
98 const char* context_json,
99 char** out_json);
100
110 void fire_post(
112 const char* context_json,
113 char** out_json);
114
123 void fire_info(
125 const char* context_json);
126
135 size_t hook_count(entropic_hook_point_t point) const;
136
137private:
145 static bool is_valid_point(entropic_hook_point_t point);
146
154 std::vector<HookEntry> snapshot(entropic_hook_point_t point) const;
155
157 std::array<std::vector<HookEntry>, ENTROPIC_HOOK_COUNT_> entries_;
158
160 mutable std::array<std::shared_mutex, ENTROPIC_HOOK_COUNT_> mutexes_;
161};
162
163} // namespace entropic
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.
size_t hook_count(entropic_hook_point_t point) const
Get the number of registered hooks for a point.
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.
entropic_error_t deregister_hook(entropic_hook_point_t point, entropic_hook_callback_t callback, void *user_data)
Deregister a hook callback.
void fire_info(entropic_hook_point_t point, const char *context_json)
Fire informational hooks (no modify, no cancel).
Error types for cross-.so error reporting.
entropic_error_t
Error codes returned by all C API functions.
Definition error.h:37
Hook point enum and callback types for engine lifecycle hooks.
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:139
entropic_hook_point_t
Hook points in the engine lifecycle.
Definition hooks.h:39
@ ENTROPIC_HOOK_COUNT_
Sentinel — not a valid hook point.
Definition hooks.h:94
Activate model on GPU (WARM → ACTIVE).
A single registered hook entry.
entropic_hook_callback_t callback
Function pointer.
void * user_data
Opaque consumer data.
int priority
Execution order (ascending)