Agent Armor API Reference
    Preparing search index...

    Interface Detector

    The interface every detector (pattern-based, ML, or custom) implements.

    interface Detector {
        category: TrapCategory;
        id: string;
        name: string;
        sanitize(content: string, threats: Threat[]): string;
        sanitizeEdits?(content: string, threats: Threat[]): TextEdit[];
        scan(content: string, options?: DetectorOptions): DetectorResult;
        scanAsync?(
            content: string,
            options?: DetectorOptions,
        ): Promise<DetectorResult>;
    }

    Implemented by

    Index
    category: TrapCategory

    Which trap category this detector addresses

    id: string

    Unique identifier for this detector

    name: string

    Human-readable name

    • Return sanitized content with threats neutralized. content is the original scanned text, never text another detector has already edited, so the threats' offsets are valid in it. Each detector's change is merged with the others' and applied once.

      Parameters

      • content: string
      • threats: Threat[]

      Returns string

    • Optional: the edits sanitize would make, as spans of the original text. Each edit's replacement should cover only its own span. Without this, the pipeline compares sanitize's output with the original to find one edit per finding.

      Parameters

      • content: string
      • threats: Threat[]

      Returns TextEdit[]