/** * Agent registry: data-driven loading of subagent definitions. * * Replaces the hardcoded `SubagentMode` enum + `MODE_TOOLS` map with frontmatter * `.md` files (see agent-frontmatter.ts). Definitions are discovered from, in * increasing order of precedence: * * 1. builtin embedded templates (EMBEDDED_AGENT_PROMPTS) * 2. package-manifest paths from hoocode.agents in package.json * 3. claude-user ~/.claude/agents/*.md (D7 native import) * 4. user ~/.hoocode/agents/*.md * 5. ancestor-walk /.agents/agents/*.md * 6. claude-project /.claude/agents/*.md (D7 native import) * 7. project /.hoocode/agents/*.md * 8. cli paths injected via --agent * * Higher-precedence sources override lower ones by name. Overrides are recorded * as collision diagnostics. Loading never throws; problems surface as * diagnostics, matching skills.ts. */ import { type AgentDefinition } from "./agent-frontmatter.js"; import type { ResourceDiagnostic } from "./diagnostics.js"; /** Registry of agent definitions keyed by name. */ export declare class AgentRegistry { private agents; private diagnostics; /** * Add or override a definition. Later registrations win (used both by the * loader for precedence and as an escape hatch for programmatic agents). * Overriding an existing name records a collision diagnostic. */ register(def: AgentDefinition): void; get(name: string): AgentDefinition | undefined; has(name: string): boolean; list(): AgentDefinition[]; /** Diagnostics accumulated during loading/registration. */ getDiagnostics(): ResourceDiagnostic[]; /** Append externally-produced diagnostics (e.g. from a parse step). */ addDiagnostics(diagnostics: ResourceDiagnostic[]): void; } export interface LoadAgentRegistryOptions { /** Working directory for project-local agents. */ cwd: string; /** User agent config directory (contains `agents/` subdir). Defaults to getAgentDir(). */ agentDir?: string; /** Include embedded built-in agents. Defaults to true. */ includeBuiltins?: boolean; /** Discover `.claude/agents/` directories for native Claude Code import (D7). Defaults to true. */ includeClaude?: boolean; /** * Explicit agent definition paths (files or directories), resolved relative * to `cwd` (with `~` expansion). Mirrors `skillPaths`/`promptPaths` on the * skills and prompt-template loaders. These override all discovered sources * by name but yield to CLI-injected `--agent` paths. */ agentPaths?: string[]; } /** Build an AgentRegistry from all configured locations, applying precedence. */ export declare function loadAgentRegistry(options: LoadAgentRegistryOptions): AgentRegistry; /** * Format a list of agent definitions as an XML block for inclusion in a system * prompt, mirroring the `` format used by formatSkillsForPrompt. * Only intended for display when the Task tool is active. */ /** * Condense a (possibly multi-line, bulleted) agent description into a single * useful one-liner. * * Built-in agent descriptions open with a boilerplate header ("Use this * subagent ONLY when:") followed by "when to use" bullets and a "DO NOT use" * section. Taking the first line alone yields that identical header for every * agent, so instead surface the first meaningful bullets (or the first prose * line) from the positive "when to use" region. */ export declare function summarizeAgentDescription(description: string): string; export declare function formatAgentsForPrompt(agents: AgentDefinition[]): string; //# sourceMappingURL=agent-registry.d.ts.map