36#include <shared_mutex>
38#include <unordered_map>
80 void (*
grant)(
const std::string& name,
const std::string& pattern,
140 size_t load_static(
const std::vector<IdentityConfig>& identities);
195 bool has(
const std::string& name)
const;
202 std::vector<std::string>
list()
const;
219 size_t count()
const;
272 void fire_cache_invalidator();
274 void (*cache_invalidator_)(
void*) =
nullptr;
275 void* cache_invalidator_data_ =
nullptr;
288 bool is_update)
const;
296 static std::string validate_name(
const std::string& name);
310 void unregister_mcp_keys(
const std::string& name);
316 std::unordered_map<std::string, IdentityConfig> identities_;
317 mutable std::shared_mutex identities_mutex_;
319 std::atomic<bool> router_dirty_{
false};
321 bool (*in_use_checker_)(
const std::string&,
void*) =
nullptr;
322 void* in_use_user_data_ =
nullptr;
Manages the lifecycle of all identities in the engine.
size_t count() const
Get the total number of identities.
void set_mcp_interface(const MCPKeyInterface &iface)
Set MCP key management interface.
size_t count_dynamic() const
Get the number of dynamic identities.
void set_cache_invalidator(void(*cb)(void *user_data), void *user_data)
Set a callback invoked whenever an identity changes.
const IdentityConfig * get(const std::string &name) const
Get identity config by name.
bool is_router_dirty() const
Check if the router classification prompt needs rebuilding.
entropic_error_t destroy(const std::string &name)
Destroy a dynamic identity.
void clear_router_dirty()
Clear the dirty flag (called after router prompt rebuild).
entropic_error_t update(const std::string &name, const IdentityConfig &config)
Update an existing dynamic identity.
size_t load_static(const std::vector< IdentityConfig > &identities)
Load static identities from config loader.
bool has(const std::string &name) const
Check if an identity exists.
void set_in_use_checker(bool(*checker)(const std::string &name, void *user_data), void *user_data)
Set the in-use checker callback.
std::vector< const IdentityConfig * > list_routable() const
List only routable identities (for classification prompt).
void set_grammar_interface(const GrammarValidationInterface &iface)
Set grammar validation interface.
entropic_error_t create(const IdentityConfig &config)
Create a new dynamic identity.
std::vector< std::string > list() const
List all identity names.
Error types for cross-.so error reporting.
entropic_error_t
Error codes returned by all C API functions.
Identity configuration – shared by static and dynamic identities.
Activate model on GPU (WARM → ACTIVE).
Grammar validation callbacks injected by the facade.
void * user_data
Opaque pointer (GrammarRegistry*)
bool(* has_grammar)(const std::string &key, void *user_data)
Check if a grammar key exists in the registry.
Full identity configuration.
Configuration for the identity manager.
size_t max_identities
Maximum total identities (static + dynamic)
bool allow_dynamic
Master toggle for dynamic identity creation.
MCP key management callbacks injected by the facade.
void(* unregister_identity)(const std::string &name, void *user_data)
Remove an identity's key set.
bool(* is_enforced)(const std::string &name, void *user_data)
Check if an identity has a key set registered.
void(* register_identity)(const std::string &name, void *user_data)
Register an empty key set for an identity.
void * user_data
Opaque pointer (MCPAuthorizationManager*)
void(* grant)(const std::string &name, const std::string &pattern, int level, void *user_data)
Grant a key pattern to an identity.