Entropic 2.3.8
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:
63 void* user_data,
64 int priority);
65
82 void* user_data);
83
93 int fire_pre(
95 const char* context_json,
96 char** out_json);
97
106 void fire_post(
108 const char* context_json,
109 char** out_json);
110
118 void fire_info(
120 const char* context_json);
121
129 size_t hook_count(entropic_hook_point_t point) const;
130
131private:
139 static bool is_valid_point(entropic_hook_point_t point);
140
148 std::vector<HookEntry> snapshot(entropic_hook_point_t point) const;
149
151 std::array<std::vector<HookEntry>, ENTROPIC_HOOK_COUNT_> entries_;
152
154 mutable std::array<std::shared_mutex, ENTROPIC_HOOK_COUNT_> mutexes_;
155};
156
157} // 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:35
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:134
entropic_hook_point_t
Hook points in the engine lifecycle.
Definition hooks.h:34
@ ENTROPIC_HOOK_COUNT_
Sentinel — not a valid hook point.
Definition hooks.h:89
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)