import type { AgentSpec } from "./agent-spec.js"; /** * v1.3.2 §5 — `validateAgent`: static validation of the actor collaboration graph. * * Mirrors `skill-parser`'s `validateSkill` finding shape ({code, message, * field}) and adds `agent` (the node id) for graph-scoped findings. The graph * algorithms come from the shared core (`util/graph`, §9.2) so * `validateWorkflow` reuses the same cycle/reachability primitives. * * Decision record (PRD §5): * 1. EMPIRICALLY CORRECTED — running on the live bundle showed * `collaborators`/`used_by` are a PEER mesh (specialists consult each * other), not a delegation/spawn tree. The Chief spawns specialists * (agents-as-tools); specialists do not recursively spawn one another, so * a collaborator cycle is NOT an infinite-delegation bug. We therefore * check referential integrity + self-references, and report multi-node * cycles as a single informational warning, not errors. (The shared * detectCycles core remains the error-grade check for workflow-manager, * where `depends_on` IS a true acyclic DAG.) * 2. Scope is caller-assembled: pass bundle + a single org's actors for the * adopt gate / runtime; pass the bundle subset for the CI ship check. */ export interface AgentFinding { code: string; message: string; /** node id "/" when the finding is scoped to one actor. */ agent?: string; field?: string; } export interface AgentValidationResult { ok: boolean; errors: AgentFinding[]; warnings: AgentFinding[]; } export interface ValidateAgentsOptions { /** Known skill names — when set, `skills_used` refs are resolved against it. */ knownSkills?: Set; /** Collaboration depth warning threshold. Default 5 (Claude subagent precedent). */ maxDelegationDepth?: number; /** Reachability roots for orphan detection. Default: every `tier: leader`. */ roots?: string[]; } export declare function validateAgents(specs: AgentSpec[], opts?: ValidateAgentsOptions): AgentValidationResult;