Skip to main content

@maiar-ai/core / PromptRegistry

Class: PromptRegistry

Defined in: packages/core/src/runtime/managers/prompt.ts:17

A lightweight registry that manages Liquid prompt templates.

Responsibilities: • Discover prompt files under a directory (typically a plugin's prompts/ folder) and register them under a namespaced ID (e.g. "plugin-text/generate_text"). • Render a template by ID, performing Liquid interpolation with the supplied context. • Allow host applications to add post-render extensions or full overrides.

Constructors​

new PromptRegistry()​

new PromptRegistry(): PromptRegistry

Defined in: packages/core/src/runtime/managers/prompt.ts:21

Returns​

PromptRegistry

Methods​

registerDirectory()​

registerDirectory(namespace, dir): void

Defined in: packages/core/src/runtime/managers/prompt.ts:33

Add a directory of .liquid templates. Each file becomes an ID: ${namespace}/${fileNameWithoutExt} (slashes normalised).

Parameters​

namespace​

string

dir​

string | string[]

Returns​

void


render()​

render<T>(id, ctx): Promise<string>

Defined in: packages/core/src/runtime/managers/prompt.ts:52

Type Parameters​

• T extends Record<string, unknown> = Record<string, unknown>

Parameters​

id​

string

ctx​

T = ...

Returns​

Promise<string>


list()​

list(): object[]

Defined in: packages/core/src/runtime/managers/prompt.ts:76

Dump registry info for explorers / debugging.

Returns​

object[]