/** * YAML Frontmatter Parser for MAMA OS Standalone * * Parses YAML frontmatter from markdown rule files and filters rules * by agent context (agentId, tier, channel, keywords). Used by the * prompt enhancer to inject only relevant rules into system prompts. */ /** * Filtering criteria embedded in rule frontmatter. * Each field uses OR logic internally; AND logic across fields. */ export interface AppliesTo { /** Agent IDs this rule applies to */ agentId?: string[]; /** Tier levels this rule applies to */ tier?: number[]; /** Channel IDs this rule applies to */ channel?: string[]; /** Keywords that activate this rule */ keywords?: string[]; } /** * Runtime context used to match rules against the current agent state. */ export interface RuleContext { /** Current agent identifier */ agentId?: string; /** Current tier level */ tier?: number; /** Current channel identifier */ channelId?: string; /** Active keywords for the current request */ keywords?: string[]; } /** * Result of parsing a markdown file with optional YAML frontmatter. */ export interface ParsedRule { /** Filtering criteria, or null for universal rules (applies to all) */ appliesTo: AppliesTo | null; /** Markdown content with frontmatter stripped */ content: string; /** Original full content including frontmatter (for hashing) */ rawContent: string; } /** * Parse YAML frontmatter from a markdown rule file. * * Detects `---` delimited YAML block at the start of the file, * extracts the `applies_to` field (snake_case in YAML → camelCase in TS), * and returns the markdown content with frontmatter stripped. * * On malformed YAML, logs a warning and returns `appliesTo: null` * (treating the rule as universal). * * @param markdownContent - Full markdown file content including frontmatter * @returns Parsed rule with filtering criteria and cleaned content */ export declare function parseFrontmatter(markdownContent: string): ParsedRule; /** * Check whether a rule's `appliesTo` criteria match the given context. * * Logic: * - If `appliesTo` is null → true (universal rule, always matches) * - If `context` is undefined → true (no filtering applied) * - OR within each field: e.g., `agentId: ['dev', 'reviewer']` matches either * - AND across fields: all present fields must match * - Fields missing from `appliesTo` are skipped (not checked) * * @param appliesTo - Rule filtering criteria (null = universal) * @param context - Current agent runtime context (undefined = no filtering) * @returns true if the rule should be included */ export declare function matchesContext(appliesTo: AppliesTo | null, context: RuleContext | undefined): boolean; //# sourceMappingURL=yaml-frontmatter.d.ts.map