Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::IdentityManager Class Reference

Manages the lifecycle of all identities in the engine. More...

#include <entropic/core/identity_manager.h>

Public Member Functions

 IdentityManager (const IdentityManagerConfig &config)
 Construct with configuration.
 
void set_grammar_interface (const GrammarValidationInterface &iface)
 Set grammar validation interface.
 
void set_mcp_interface (const MCPKeyInterface &iface)
 Set MCP key management interface.
 
size_t load_static (const std::vector< IdentityConfig > &identities)
 Load static identities from config loader.
 
entropic_error_t create (const IdentityConfig &config)
 Create a new dynamic identity.
 
entropic_error_t update (const std::string &name, const IdentityConfig &config)
 Update an existing dynamic identity.
 
entropic_error_t destroy (const std::string &name)
 Destroy a dynamic identity.
 
const IdentityConfigget (const std::string &name) const
 Get identity config by name.
 
bool has (const std::string &name) const
 Check if an identity exists.
 
std::vector< std::string > list () const
 List all identity names.
 
std::vector< const IdentityConfig * > list_routable () const
 List only routable identities (for classification prompt).
 
size_t count () const
 Get the total number of identities.
 
size_t count_dynamic () const
 Get the number of dynamic identities.
 
bool is_router_dirty () const
 Check if the router classification prompt needs rebuilding.
 
void clear_router_dirty ()
 Clear the dirty flag (called after router prompt rebuild).
 
void set_in_use_checker (bool(*checker)(const std::string &name, void *user_data), void *user_data)
 Set the in-use checker callback.
 
void set_cache_invalidator (void(*cb)(void *user_data), void *user_data)
 Set a callback invoked whenever an identity changes.
 

Detailed Description

Manages the lifecycle of all identities in the engine.

Lifecycle:
IdentityManager mgr(config);
mgr.set_grammar_interface(grammar_iface);
mgr.set_mcp_interface(mcp_iface);
mgr.load_static(static_identities);
mgr.create(dynamic_config);
auto* id = mgr.get("npc_guard");
mgr.update("npc_guard", new_config);
mgr.destroy("npc_guard");
Manages the lifecycle of all identities in the engine.
Version
1.9.6

Definition at line 108 of file identity_manager.h.

Constructor & Destructor Documentation

◆ IdentityManager()

entropic::IdentityManager::IdentityManager ( const IdentityManagerConfig config)
explicit

Construct with configuration.

Parameters
configIdentity manager configuration.
Version
1.9.6
Parameters
configIdentity manager configuration.

Definition at line 135 of file identity_manager.cpp.

Member Function Documentation

◆ clear_router_dirty()

void entropic::IdentityManager::clear_router_dirty ( )

Clear the dirty flag (called after router prompt rebuild).

Clear the dirty flag.

Version
1.9.6

Definition at line 394 of file identity_manager.cpp.

◆ count()

size_t entropic::IdentityManager::count ( ) const

Get the total number of identities.

Returns
Total count (static + dynamic).
Version
1.9.6
Returns
Total count (static + dynamic).

Definition at line 355 of file identity_manager.cpp.

◆ count_dynamic()

size_t entropic::IdentityManager::count_dynamic ( ) const

Get the number of dynamic identities.

Returns
Dynamic identity count only.
Version
1.9.6
Returns
Dynamic identity count only.

Definition at line 366 of file identity_manager.cpp.

◆ create()

entropic_error_t entropic::IdentityManager::create ( const IdentityConfig config)

Create a new dynamic identity.

Parameters
configIdentity 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.
Version
1.9.6
Parameters
configIdentity configuration.
Returns
ENTROPIC_OK on success.

Definition at line 195 of file identity_manager.cpp.

◆ destroy()

entropic_error_t entropic::IdentityManager::destroy ( const std::string &  name)

Destroy a dynamic identity.

Parameters
nameIdentity 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).
Version
1.9.6
Parameters
nameIdentity name to destroy.
Returns
ENTROPIC_OK on success.

Definition at line 262 of file identity_manager.cpp.

◆ get()

const IdentityConfig * entropic::IdentityManager::get ( const std::string &  name) const

Get identity config by name.

Parameters
nameIdentity name.
Returns
Pointer to config, or nullptr if not found.
Version
1.9.6

Pointer valid until identity is destroyed or updated. Read via shared_lock.

Parameters
nameIdentity name.
Returns
Pointer to config, or nullptr if not found.

Definition at line 288 of file identity_manager.cpp.

◆ has()

bool entropic::IdentityManager::has ( const std::string &  name) const

Check if an identity exists.

Parameters
nameIdentity name.
Returns
true if identity exists.
Version
1.9.6
Parameters
nameIdentity name.
Returns
true if identity exists.

Definition at line 304 of file identity_manager.cpp.

◆ is_router_dirty()

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.
Version
1.9.6
Returns
true if identity mutations have occurred since last clear.

Definition at line 385 of file identity_manager.cpp.

◆ list()

std::vector< std::string > entropic::IdentityManager::list ( ) const

List all identity names.

Returns
Vector of identity names (static + dynamic).
Version
1.9.6
Returns
Vector of identity names (static + dynamic).

Definition at line 317 of file identity_manager.cpp.

◆ list_routable()

std::vector< const IdentityConfig * > entropic::IdentityManager::list_routable ( ) const

List only routable identities (for classification prompt).

List only routable identities for classification prompt.

Returns
Vector of pointers to routable identity configs.
Version
1.9.6

Routable = routable==true && interstitial==false. Pointers valid until next create/update/destroy.

Returns
Vector of pointers to routable identity configs.

Definition at line 336 of file identity_manager.cpp.

◆ load_static()

size_t entropic::IdentityManager::load_static ( const std::vector< IdentityConfig > &  identities)

Load static identities from config loader.

Parameters
identitiesVector of static identity configs.
Returns
Number of identities loaded.
Version
1.9.6

Called once at engine startup. Static identities have origin=STATIC and cannot be destroyed via destroy().

Parameters
identitiesVector of static identity configs.
Returns
Number of identities loaded.

Definition at line 170 of file identity_manager.cpp.

◆ set_cache_invalidator()

void entropic::IdentityManager::set_cache_invalidator ( void(*)(void *user_data)  cb,
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)

Parameters
cbCallback (nullable).
user_dataOpaque pointer forwarded to cb. @utility
Version
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
cbCallback invoked on identity change (nullable).
user_dataForwarded to cb.

Definition at line 426 of file identity_manager.cpp.

◆ set_grammar_interface()

void entropic::IdentityManager::set_grammar_interface ( const GrammarValidationInterface iface)

Set grammar validation interface.

Parameters
ifaceGrammar validation callbacks.
Version
1.9.6
Parameters
ifaceGrammar validation callbacks.

Definition at line 146 of file identity_manager.cpp.

◆ set_in_use_checker()

void entropic::IdentityManager::set_in_use_checker ( bool(*)(const std::string &name, void *user_data)  checker,
void *  user_data 
)

Set the in-use checker callback.

Parameters
checkerFunction returning true if name is in active delegation.
user_dataOpaque pointer forwarded to checker.
Version
1.9.6
Parameters
checkerFunction returning true if name is in active delegation.
user_dataOpaque pointer forwarded to checker.

Definition at line 407 of file identity_manager.cpp.

◆ set_mcp_interface()

void entropic::IdentityManager::set_mcp_interface ( const MCPKeyInterface iface)

Set MCP key management interface.

Parameters
ifaceMCP key callbacks.
Version
1.9.6
Parameters
ifaceMCP key callbacks.

Definition at line 157 of file identity_manager.cpp.

◆ update()

entropic_error_t entropic::IdentityManager::update ( const std::string &  name,
const IdentityConfig config 
)

Update an existing dynamic identity.

Parameters
nameIdentity name to update.
configNew 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.
Version
1.9.6
Parameters
nameIdentity name to update.
configNew configuration (name field must match).
Returns
ENTROPIC_OK on success.

Definition at line 228 of file identity_manager.cpp.


The documentation for this class was generated from the following files: