/** * Leaper Agent - Prompt Builder * * Stateless utility functions for assembling system prompts from config, * skills, workspace context files, and environment metadata. * Translated from Python agent/prompt_builder.py. */ import type { LeaperConfig } from '../types.js'; /** * Assemble the full system prompt from config, skills, and context files. * * @param config - Leaper agent configuration. * @param skills - Array of skill descriptors to include. * @param contextFiles - Pre-loaded context file contents (key = filename). * If omitted the prompt uses the base prompt only. */ export declare function buildSystemPrompt(config: LeaperConfig, skills: Array<{ name: string; description: string; triggers: string[]; }>, contextFiles?: Record): string; /** * Format a list of skills into a concise prompt section. * * Each skill is rendered as a bullet with its name, description, and the * trigger phrases that activate it. */ export declare function buildSkillsPrompt(skills: Array<{ name: string; description: string; triggers: string[]; }>): string; /** * Return a brief string describing the current runtime environment: * OS, working directory, date, and timezone. */ export declare function buildEnvironmentHints(): string; /** * Scan a workspace directory for known context files, load their contents, * and return a map of filename -> sanitised content. * * Files that cannot be read are silently skipped. * Files that fail the security scan are replaced with a warning notice. */ export declare function buildContextFilesPrompt(cwd: string): Promise>; /** * Load SOUL.md from the workspace root, strip YAML frontmatter, sanitise, * and return the content. Returns null when the file is absent. */ export declare function loadSoulMd(cwd: string): Promise; /** * Truncate content to at most `maxChars` characters, appending a * "...[truncated]" suffix when the content is shortened. */ export declare function truncateContent(content: string, maxChars: number): string; /** * Strip a leading YAML frontmatter block (--- ... ---) from Markdown content. * Returns the original string unchanged if no frontmatter is detected. */ export declare function stripYamlFrontmatter(content: string): string; /** * Security scan for a context file. * * Checks for: * - Invisible / direction-override Unicode characters (stripped). * - Known prompt-injection text patterns. * * When injection patterns are detected the function returns a warning * placeholder instead of the file content, preventing the attack from * reaching the model. * * @param content - Raw file content. * @param filename - Filename used in warning messages. * @returns Sanitised content, or a security warning string. */ export declare function scanContextContent(content: string, filename: string): string; /** * Synchronously check whether a path exists and is a file. * Exposed for convenience but not part of the primary async API. */ export declare function fileExistsSync(filePath: string): boolean; //# sourceMappingURL=prompt-builder.d.ts.map