Interface IPersonaLoader

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

interface IPersonaLoader {
    initialize(config): Promise<void>;
    loadPersonaById(personaId): Promise<undefined | IPersonaDefinition>;
    loadAllPersonaDefinitions(): Promise<IPersonaDefinition[]>;
    refreshPersonas?(): Promise<void>;
}

Implemented by

Methods

  • Async

    Initializes the persona loader with the given configuration.

    Parameters

    Returns Promise<void>

    A promise that resolves when the loader is initialized.

    Throws

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

  • Async

    Loads a single persona definition by its unique ID.

    Parameters

    • personaId: string

      The ID of the persona to load.

    Returns Promise<undefined | IPersonaDefinition>

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

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