/** * [WHO]: checkHandoffSafety — handoff classifier for auto mode sub-agent security review (CC §XII.1) * [FROM]: Depends on @catui/agent-core for AgentMessage, ./agent-definition for AgentPermissionMode * [TO]: Consumed by ./agent-tool (sync execution path, step 15) * [HERE]: core/sub-agent/agent-handoff-safety.ts - Security review per CC §XII.1 (ES8) * [COVENANT]: Change classifier → update agent-tool handler */ import type { AgentMessage } from "@catui/agent-core"; import type { AgentTool } from "@catui/agent-core"; import type { AgentPermissionMode } from "./agent-definition.js"; /** * Check whether a sub-agent's output is safe to hand back to the parent. * Matches CC's ES8 function (handoff classifier) exactly. * * Per CC §XII.1: * - Only runs in "auto" permission mode * - Uses a classifier model to review sub-agent operations * - If flagged → returns a SECURITY WARNING prefix * - If classifier unavailable → returns warning but doesn't block * * @param agentMessages The sub-agent's message history * @param tools The tools available to the sub-agent * @param permissionMode The permission mode of the parent agent * @param abortSignal Optional abort signal for the classifier call * @param subagentType The type of sub-agent that was spawned * @param totalToolUseCount Total tool calls made by the sub-agent * @returns Security warning string if flagged, null if safe */ export declare function checkHandoffSafety(agentMessages: AgentMessage[], tools: AgentTool[], permissionMode: AgentPermissionMode, abortSignal?: AbortSignal, subagentType?: string, totalToolUseCount?: number): Promise; /** * Check if a fork can be spawned from the current context. * Per CC §XII.3: * - Fork workers cannot spawn forks (isForkWorker check) * - Team teammates cannot spawn other teammates (isTeamContext + name check) * - In-process teammates cannot spawn background agents (isInProcessTeam check) * * @returns Error message if blocked, null if allowed */ export declare function checkRecursionLimits(isForkWorker: boolean, isTeamContext: boolean, isInProcessTeam: boolean, hasName: boolean, wantsBackground: boolean): string | null;