/** * AgentPrompt — Developer-facing class for structured prompt assembly. * * Provides a chainable API for composing agent prompts with automatic * security sandwiching, priority-based ordering, and XML-tagged rendering. * * @example * ```ts * const prompt = new AgentPrompt() * .role('You are a helpful customer support agent.') * .instructions('Help customers with billing and account issues.') * .guardrails('Never share internal pricing or discount formulas.') * .knowledge(async () => fetchKnowledgeBase()) * .tools(myToolSet); * * const systemPrompt = await prompt.render(); * ``` * * @module */ import type { ToolSet } from '../tools/Tool.js'; import type { GlossaryTerm, VoiceRulesConfig, PolicyProfile } from './types.js'; import { PromptAssembly } from './PromptAssembly.js'; import type { AssemblyDebugInfo } from './PromptAssembly.js'; /** * Configuration for the AgentPrompt constructor. */ export interface AgentPromptConfig { /** Security policy profile. Defaults to 'minimal'. */ policy?: PolicyProfile; /** Whether to wrap sections in XML tags. Defaults to true. */ xmlTags?: boolean; /** Maximum token budget for the rendered prompt. */ maxTokens?: number; /** Disable automatic security core and reminder sections. Defaults to false. */ disableSecurity?: boolean; } /** * Developer-facing prompt builder with a chainable API. * * Internally creates a {@link PromptAssembly}, injects security core (priority 0) * and security reminder (priority 1000), then freezes security bands. * * All chainable methods accept either a static string or an async function * that resolves to a string. */ export declare class AgentPrompt { private readonly _assembly; private readonly renderOptions; constructor(config?: AgentPromptConfig); /** * Sets the agent's role description. Priority 10, non-shrinkable. */ role(content: string | (() => Promise)): this; /** * Sets the agent's instructions. Priority 15, non-shrinkable. */ instructions(content: string | (() => Promise)): this; /** * Sets guardrail rules. Priority 20, non-shrinkable. */ guardrails(content: string | (() => Promise)): this; /** * Sets voice/personality description. Priority 25, shrinkable. */ voice(content: string | (() => Promise)): this; /** * Injects knowledge context. Priority 30, shrinkable. */ knowledge(content: string | (() => Promise)): this; /** * Sets business/domain rules. Priority 35, shrinkable. */ rules(content: string | (() => Promise)): this; /** * Adds a glossary of domain terms. Priority 38, shrinkable. * Terms are auto-formatted into a structured list. */ glossary(terms: GlossaryTerm[]): this; /** * Generates tool descriptions from a ToolSet. Priority 40, shrinkable. */ tools(toolSet: ToolSet): this; /** * Sets voice/TTS output rules. Priority 45, shrinkable. * Uses the same formatting logic as PromptTemplateBuilder.formatVoiceRules. */ voiceRules(config: VoiceRulesConfig): this; /** * Adds example interactions or few-shot prompts. Priority 50, shrinkable. */ examples(content: string | (() => Promise)): this; /** * Adds an arbitrary named section. Defaults to priority 60, shrinkable. */ section(type: string, content: string | (() => Promise), priority?: number): this; /** * Resolves all sections and renders the prompt to a string. */ render(): Promise; /** * Returns debug information about the assembly's current state. */ debug(): Promise; /** * Exposes the underlying PromptAssembly for runtime injection. */ get assembly(): PromptAssembly; }