import { PromptDefinition, PromptEditableConfig, PromptOverride } from '@happyvertical/smrt-prompts'; import { DatabaseInterface } from '@happyvertical/sql'; /** The minimal persona shape these helpers need. */ export interface PersonaLike { id?: string | null; tenantId?: string | null; instructions?: string; } /** * The registered prompt key a persona's instructions map to. * * @throws if the persona has no id (an unsaved persona has no stable key). */ export declare function personaInstructionsPromptKey(persona: PersonaLike): string; /** * Idempotently register the per-persona instructions prompt. * * The base template is always the empty string and the editability is fixed, so * repeated calls register an identical definition (the registry is idempotent * for matching definitions). The persona's real instructions are supplied by * the override layer, never by the base template — that keeps re-registration * stable even as instructions change. * * Pass `editable` to model a prompt whose template is locked; activation of a * proposal against such a key is then rejected by `validatePromptOverride`. */ export declare function ensurePersonaInstructionsPrompt(persona: PersonaLike, options?: { editable?: Partial; }): PromptDefinition; /** * Upsert a scoped `prompt_override` template for a registered prompt key. * * Loads the existing app/tenant override (by `tenantId`), updates its template, * or creates a new one. Always flows through `PromptOverride.save()`, so * `validatePromptOverride` still forbids overriding a non-editable template. * * The prompt key must already be registered (via * {@link ensurePersonaInstructionsPrompt} or `definePrompt`); this helper does * not register it, so it never silently relaxes a locked prompt's editability. * * @returns The persisted override. */ export declare function upsertPromptTemplateOverride(options: { db: DatabaseInterface; key: string; tenantId: string | null; template: string; }): Promise; /** * Write (or update) the tenant-scoped `prompt_override` that carries a persona's * instructions. * * Ensures the per-persona prompt key is registered, then upserts the override * template to `instructions ?? persona.instructions`. Flows through * `PromptOverride.save()`, so a non-editable template throws. * * @returns The persisted override. */ export declare function applyPersonaInstructions(options: { persona: PersonaLike; db: DatabaseInterface; instructions?: string; editable?: Partial; }): Promise; /** * Resolve a persona's effective instructions through the prompt system — * layering code default → config → app override → tenant (persona) override. * * @returns The rendered instructions text (empty string when nothing overrides * the neutral base template). */ export declare function resolvePersonaInstructions(options: { persona: PersonaLike; db: DatabaseInterface; variables?: Record; }): Promise; //# sourceMappingURL=persona-prompt.d.ts.map