import type { AgentScope, ChildThinkingLevel } from "../core/types.js"; import { type MemoryScope } from "../engine/memory.js"; /** Local mirror of the harness `HarnessAgent`. Not present in src/core/types.ts. */ export interface AgentCard { name: string; description: string; tools?: string[]; model?: string; thinking?: ChildThinkingLevel | string; /** C5: persistent memory scope (frontmatter `memory: project|local|user`). */ memory?: MemoryScope; /** Model class hint (frontmatter `model_class`, e.g. cheap/balanced/capable). */ modelClass?: string; /** * C1 nested subagents: strict allowlist (frontmatter `allowed_subagents`, * CSV agent names or `all`). An agent NOT on the list is refused — there is * NEVER a fallback to another agent. Undefined/empty = no declarative * allowlist (nesting must then be enabled with an explicit dispatch option). */ allowedSubagents?: string[]; prompt: string; source: "project" | "user"; filePath: string; } export type AgentSource = AgentCard["source"]; /** * Resolves the agent directories to scan for a given source kind. * `(cwd, source) => dirs[]`. Injectable — replaces the harness `getAgentDir()` * / `readableZobResourcePaths()` calls (which depend on @earendil-works/pi-*). */ export type ResolveAgentDirs = (cwd: string, source: AgentSource) => string[]; /** * Parse YAML-like frontmatter delimited by `---\n ... \n---\n`. Fields are * simple `key: value` pairs (quotes stripped). The trailing body becomes the * prompt. Malformed / absent frontmatter degrades to `{ frontmatter: {}, body }`. */ export declare function parseFrontmatter(raw: string): { frontmatter: Record; body: string; }; /** Load all `*.md` agents from a single directory. Unreadable files are skipped. */ export declare function loadAgentsFromDir(dir: string, source: AgentSource): AgentCard[]; /** * Discover agents by scope, using the injectable `resolveAgentDirs`. * * - `scope === "project"` → project dirs only. * - `scope === "user"` → user dirs only. * - `scope === "both"` → user first, then project (user → project order). * * Deduplicates case-insensitively by `name.toLowerCase()` — **last wins** via * a Map, so a project agent overrides a user agent of the same name. */ export declare function discoverAgents(cwd: string, scope: AgentScope, resolveAgentDirs?: ResolveAgentDirs): AgentCard[]; /** Plain-text listing for the CLI / debugging. */ export declare function formatAgentList(agents: AgentCard[]): string;