Skip to main content

Class: PersonaLoader

Defined in: packages/agentos/src/cognition/substrate/personas/PersonaLoader.ts:58

Implements IPersonaLoader to load persona definitions from the file system. Assumes persona definitions are stored as individual JSON files.

Implements​

Implements​

Constructors​

Constructor​

new PersonaLoader(): PersonaLoader

Defined in: packages/agentos/src/cognition/substrate/personas/PersonaLoader.ts:64

Returns​

PersonaLoader

Properties​

loaderId​

readonly loaderId: string

Defined in: packages/agentos/src/cognition/substrate/personas/PersonaLoader.ts:62

Methods​

initialize()​

initialize(config): Promise<void>

Defined in: packages/agentos/src/cognition/substrate/personas/PersonaLoader.ts:74

Async

Initializes the persona loader with the given configuration.

Parameters​

config​

PersonaLoaderConfig

The configuration for loading personas.

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/PersonaLoader.ts:165

Async

Loads all available persona definitions from the configured source.

Returns​

Promise<IPersonaDefinition[]>

A promise that resolves with an array of all loaded persona definitions. Returns an empty array if no personas are found.

Throws​

If loading fails (e.g., source inaccessible, multiple parsing errors).

Implementation of​

IPersonaLoader.loadAllPersonaDefinitions


loadPersonaById()​

loadPersonaById(personaId): Promise<IPersonaDefinition | undefined>

Defined in: packages/agentos/src/cognition/substrate/personas/PersonaLoader.ts:155

Async

Loads a single persona definition by its unique ID.

Parameters​

personaId​

string

The ID of the persona to load.

Returns​

Promise<IPersonaDefinition | undefined>

A promise that resolves with the persona definition if found, or undefined otherwise.

Throws​

If loading fails for reasons other than the persona not being found (e.g., parsing error, source error).

Implementation of​

IPersonaLoader.loadPersonaById


refreshPersonas()​

refreshPersonas(): Promise<void>

Defined in: packages/agentos/src/cognition/substrate/personas/PersonaLoader.ts:170

Async

Optional: Reloads persona definitions. Useful if personas can change dynamically.

Returns​

Promise<void>

A promise that resolves when personas have been reloaded.

Throws​

If reloading fails.

Implementation of​

IPersonaLoader.refreshPersonas


shutdown()​

shutdown(): Promise<void>

Defined in: packages/agentos/src/cognition/substrate/personas/PersonaLoader.ts:215

Returns​

Promise<void>