include/entropic/core/identity_manager.h¶
include/entropic/core/identity_manager.h
entropic::GrammarValidationInterface
Grammar validation callbacks injected by the facade.
bool(* entropic::GrammarValidationInterface::has_grammar) (const std::string &key, void *user_data)
Check if a grammar key exists in the registry.
void* entropic::GrammarValidationInterface::user_data
Opaque pointer (GrammarRegistry*)
entropic::IdentityManager
Manages the lifecycle of all identities in the engine.
entropic::IdentityManager::IdentityManager(const IdentityManagerConfig &config)
Construct with configuration.
- Parameters
config— Identity manager configuration.
void entropic::IdentityManager::set_grammar_interface(const GrammarValidationInterface &iface)
Set grammar validation interface.
- Parameters
iface— Grammar validation callbacks.
void entropic::IdentityManager::set_mcp_interface(const MCPKeyInterface &iface)
Set MCP key management interface.
- Parameters
iface— MCP key callbacks.
size_t entropic::IdentityManager::load_static(const std::vector< IdentityConfig > &identities)
Load static identities from config loader.
Called once at engine startup. Static identities have origin=STATIC and cannot be destroyed via destroy().
- Parameters
identities— Vector of static identity configs.
- Returns
- Number of identities loaded.
entropic_error_t entropic::IdentityManager::create(const IdentityConfig &config)
Create a new dynamic identity.
- Parameters
config— Identity configuration.
- Returns
- ENTROPIC_OK on success. ENTROPIC_ERROR_INVALID_CONFIG if validation fails. ENTROPIC_ERROR_LIMIT_REACHED if max_identities exceeded. ENTROPIC_ERROR_ALREADY_EXISTS if name already taken.
entropic_error_t entropic::IdentityManager::update(const std::string &name, const IdentityConfig &config)
Update an existing dynamic identity.
- Parameters
name— Identity name to update.config— New configuration (name field must match).
- Returns
- ENTROPIC_OK on success. ENTROPIC_ERROR_IDENTITY_NOT_FOUND if identity doesn't exist. ENTROPIC_ERROR_PERMISSION_DENIED if identity is static. ENTROPIC_ERROR_INVALID_CONFIG if validation fails.
entropic_error_t entropic::IdentityManager::destroy(const std::string &name)
Destroy a dynamic identity.
- Parameters
name— Identity name to destroy.
- Returns
- ENTROPIC_OK on success. ENTROPIC_ERROR_IDENTITY_NOT_FOUND if identity doesn't exist. ENTROPIC_ERROR_PERMISSION_DENIED if identity is static. ENTROPIC_ERROR_IN_USE if identity is currently active in a delegation (locked_tier matches name).
const IdentityConfig * entropic::IdentityManager::get(const std::string &name) const
Get identity config by name.
Pointer valid until identity is destroyed or updated. Read via shared_lock.
- Parameters
name— Identity name.
- Returns
- Pointer to config, or nullptr if not found.
bool entropic::IdentityManager::has(const std::string &name) const
Check if an identity exists.
- Parameters
name— Identity name.
- Returns
- true if identity exists.
std::vector< std::string > entropic::IdentityManager::list() const
List all identity names.
- Returns
- Vector of identity names (static + dynamic).
std::vector< const IdentityConfig * > entropic::IdentityManager::list_routable() const
List only routable identities (for classification prompt).
List only routable identities for classification prompt. Routable = routable==true && interstitial==false. Pointers valid until next create/update/destroy.
- Returns
- Vector of pointers to routable identity configs.
size_t entropic::IdentityManager::count() const
Get the total number of identities.
- Returns
- Total count (static + dynamic).
size_t entropic::IdentityManager::count_dynamic() const
Get the number of dynamic identities.
- Returns
- Dynamic identity count only.
bool entropic::IdentityManager::is_router_dirty() const
Check if the router classification prompt needs rebuilding.
- Returns
- true if create/update/destroy has been called since last clear.
- true if identity mutations have occurred since last clear.
void entropic::IdentityManager::clear_router_dirty()
Clear the dirty flag (called after router prompt rebuild).
Clear the dirty flag.
void entropic::IdentityManager::set_in_use_checker(bool(*checker)(const std::string &name, void *user_data), void *user_data)
Set the in-use checker callback.
- Parameters
checker— Function returning true if name is in active delegation.user_data— Opaque pointer forwarded to checker.
void entropic::IdentityManager::set_cache_invalidator(void(*cb)(void *user_data), void *user_data)
Set a callback invoked whenever an identity changes.
Register a cache-invalidation callback. Fires after create/update/destroy + reload_from_disk. Consumers use this to invalidate prompt caches keyed on identity content. (P1-7, 2.0.6-rc16) Fires on every identity create / update / destroy / reload. Facade wires this to ModelOrchestrator::clear_all_prompt_caches so cached KV prefixes never outlive a system-prompt change. (P1-7, 2.0.6-rc16)
- Parameters
cb— Callback (nullable).user_data— Opaque pointer forwarded to cb.cb— Callback invoked on identity change (nullable).user_data— Forwarded to cb.
entropic::IdentityManagerConfig
Configuration for the identity manager.
size_t entropic::IdentityManagerConfig::max_identities
Maximum total identities (static + dynamic)
bool entropic::IdentityManagerConfig::allow_dynamic
Master toggle for dynamic identity creation.
entropic::MCPKeyInterface
MCP key management callbacks injected by the facade.
void(* entropic::MCPKeyInterface::register_identity) (const std::string &name, void *user_data)
Register an empty key set for an identity.
void(* entropic::MCPKeyInterface::grant) (const std::string &name, const std::string &pattern, int level, void *user_data)
Grant a key pattern to an identity.
bool(* entropic::MCPKeyInterface::is_enforced) (const std::string &name, void *user_data)
Check if an identity has a key set registered.
void(* entropic::MCPKeyInterface::unregister_identity) (const std::string &name, void *user_data)
Remove an identity's key set.
void* entropic::MCPKeyInterface::user_data
Opaque pointer (MCPAuthorizationManager*)