Skip to main content

Class: InMemoryPersonaLoader

Defined in: packages/agentos/src/cognition/substrate/personas/InMemoryPersonaLoader.ts:60

Serves a fixed list of persona definitions. The constructor checks the list's structure (see assertInlinePersonaDefinitions), normalizes each definition the way the file-system loader does (sentiment presets become metaprompts) and stores its own copies, so edits the caller makes to its objects after construction never reach the runtime; load results are copies too, so a caller cannot change a stored definition through them. initialize() accepts any PersonaLoaderConfig (the source is the list, not personaSource); refreshPersonas() is a no-op because the set is fixed. Used by AgentOS.create({ personas }) and exported for callers composing their own sources.

Implements​

Constructors​

Constructor​

new InMemoryPersonaLoader(definitions): InMemoryPersonaLoader

Defined in: packages/agentos/src/cognition/substrate/personas/InMemoryPersonaLoader.ts:65

Parameters​

definitions​

IPersonaDefinition[]

Returns​

InMemoryPersonaLoader

Properties​

loaderId​

readonly loaderId: string

Defined in: packages/agentos/src/cognition/substrate/personas/InMemoryPersonaLoader.ts:61

Methods​

initialize()​

initialize(_config): Promise<void>

Defined in: packages/agentos/src/cognition/substrate/personas/InMemoryPersonaLoader.ts:72

Async

Initializes the persona loader with the given configuration.

Parameters​

_config​

PersonaLoaderConfig

Returns​

Promise<void>

A promise that resolves when the loader is initialized.

Throws​

If initialization fails (e.g., invalid configuration, source not accessible).

Implementation of​

IPersonaLoader.initialize


loadAllPersonaDefinitions()​

loadAllPersonaDefinitions(): Promise<IPersonaDefinition[]>

Defined in: packages/agentos/src/cognition/substrate/personas/InMemoryPersonaLoader.ts:84

Returns copies, in the order given at construction.

Returns​

Promise<IPersonaDefinition[]>

Implementation of​

IPersonaLoader.loadAllPersonaDefinitions


loadPersonaById()​

loadPersonaById(personaId): Promise<IPersonaDefinition | undefined>

Defined in: packages/agentos/src/cognition/substrate/personas/InMemoryPersonaLoader.ts:77

Returns a copy; edits to a load result never reach the stored definition.

Parameters​

personaId​

string

Returns​

Promise<IPersonaDefinition | undefined>

Implementation of​

IPersonaLoader.loadPersonaById


refreshPersonas()​

refreshPersonas(): Promise<void>

Defined in: packages/agentos/src/cognition/substrate/personas/InMemoryPersonaLoader.ts:90

The set is fixed at construction; refreshing is a no-op.

Returns​

Promise<void>

Implementation of​

IPersonaLoader.refreshPersonas