Skip to main content

Interface: IPersonaLoader

Defined in: packages/agentos/src/cognition/substrate/personas/IPersonaLoader.ts:49

Defines the contract for a service that loads persona definitions. Implementations are responsible for retrieving persona configuration data and transforming it into valid IPersonaDefinition objects.

Interface​

IPersonaLoader

Methods​

initialize()​

initialize(config): Promise<void>

Defined in: packages/agentos/src/cognition/substrate/personas/IPersonaLoader.ts:57

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).


loadAllPersonaDefinitions()​

loadAllPersonaDefinitions(): Promise<IPersonaDefinition[]>

Defined in: packages/agentos/src/cognition/substrate/personas/IPersonaLoader.ts:76

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).


loadPersonaById()​

loadPersonaById(personaId): Promise<IPersonaDefinition | undefined>

Defined in: packages/agentos/src/cognition/substrate/personas/IPersonaLoader.ts:67

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).


refreshPersonas()?​

optional refreshPersonas(): Promise<void>

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

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.