/** * agents — File-based agent definition loader. * * Loads reusable agent configurations from Markdown files with YAML frontmatter * in ~/.pi/agents/ (user-global) and .pi/agents/ (project-scoped). * * Each .md file defines one named agent: * * --- * name: rust-audit * description: Rust code audit specialist * allowWrite: false * allowBashWrite: false * model: small * outputFormat: structured * disallowedTools: * - Swarm * - SwarmCoordinator * --- * You are a Rust audit specialist... * * Layer: shared/ — pure Node.js, no pi or tui imports. */ import type { AgentFileDefinition, AgentProfile, FileAgentSource } from "./types.js"; /** * Clear the file agents cache. * Useful in tests and when agent files are modified at runtime. */ export declare function clearFileAgentsCache(): void; /** Parsed frontmatter key-value pairs. */ interface FrontmatterData { [key: string]: unknown; } /** * Load all file-based agent definitions. * * Resolution order: project agents (.pi/agents/) override user agents (~/.pi/agents/). * Returns a map of agent name → AgentProfile, ready for resolveProfile() integration. * * Results are cached per working directory. Call clearFileAgentsCache() to invalidate. */ export declare function loadFileAgents(cwd?: string): Map; /** * List all available file-based agent names with descriptions. * Useful for the /agents command. */ export declare function listFileAgents(cwd?: string): Array<{ name: string; description: string; source: FileAgentSource; }>; /** * Match a Swarm item to the most suitable file-based agent. * * Matching phases (ordered by specificity): * 1. Pattern match — across ALL agents, pick the one with the longest * (most specific) matching pattern. Longer pattern = higher specificity, * so `*.test.ts` beats `*.ts`. * 2. Keyword match — if no pattern matched, first keyword match wins. * * Returns the matched AgentProfile, or undefined if no match found. */ export declare function matchItemToAgent(item: string, agents: Map | undefined): AgentProfile | undefined; /** * Build a formatted listing of all available agents for inclusion in * the Swarm tool description, similar to CCB's AgentTool.prompt(). * * Groups agents into: * 1. Built-in profiles (accessible via `profile` parameter) * 2. File-based agents (accessible via `agentType` parameter) * * Each entry shows agentType/name, description, and match rules. */ export declare function buildAgentListing(fileAgents: Map | undefined, builtinProfiles?: Record): string; /** Exported for testing — parse frontmatter from raw text. */ export declare function parseFrontmatterForTest(raw: string): FrontmatterData | null; /** Exported for testing — parse a full .md file into an AgentFileDefinition. */ export declare function parseAgentFileForTest(filePath: string, raw: string, source: FileAgentSource): AgentFileDefinition | null; export {}; //# sourceMappingURL=agents.d.ts.map