/** * Injection Detection Hook — AfterTool hook that scans tool results for prompt injection. * * Scans results from content-reading tools (read_file, web_fetch, grep, glob) * for injection patterns. When detected, prepends a warning to the tool result * so the LLM knows the content may contain manipulation attempts. * * Usage: * ```typescript * const agent = new Agent({ * hooks: { * afterTool: [createInjectionDetectionHook()] * } * }); * ``` */ import type { AfterToolHook } from '../hooks/types.js'; import { type InjectionDetectionResult } from './injection-detection.js'; export interface InjectionHookOptions { /** Minimum severity to trigger a warning (default: 'medium') */ minSeverity?: 'low' | 'medium' | 'high'; /** Additional tool names to scan */ additionalTools?: string[]; /** Called when injection is detected (for logging/telemetry) */ onDetected?: (result: InjectionDetectionResult, toolName: string) => void; } /** * Create an afterTool hook that scans content-reading tool results for prompt injection. */ export declare function createInjectionDetectionHook(options?: InjectionHookOptions): AfterToolHook;