import type { ClassifierConfig } from "./types"; export type PromptInjectionClassifierRunner = { predictProbability(text: string, options?: { signal?: AbortSignal; }): Promise; }; export declare const DEFAULT_MODEL_PATH: string; /** * Initialise the global tokenizer vocabulary from a JSON file. * Expected format: { "token": id, ... } — standard HuggingFace vocab.json. * * Call this once at startup before the first classification call. * If never called, the classifier uses character-level fallback tokenization. */ /** * Returns the token IDs for a pre-tokenized text using the configured strategy: * 1. WordPiece (if a vocabulary was loaded via loadClassifierVocabulary) * 2. Character fallback (deterministic, no hash collisions) */ export declare function tokenizerStrategy(): "wordpiece" | "char-fallback"; export declare function loadClassifierVocabulary(vocabPath: string): boolean; export declare class OnnxPromptInjectionClassifier implements PromptInjectionClassifierRunner { private readonly modelPath; private readonly lazySession; private initError; private initialized; private readonly ownTokenizerLabel; constructor(config?: ClassifierConfig); private initialize; /** * Returns whether the ONNX model loaded successfully. */ isAvailable(): boolean; getInitializationError(): Error | null; /** * Describes which tokenizer is active so callers can warn if * the character fallback is being used in production. */ getTokenizerInfo(): { strategy: string; vocabSource: string; modelPath: string; }; predictProbability(text: string, options?: { signal?: AbortSignal; }): Promise; } export declare function extractClassifierInputText(body: unknown): string; /** * Classifier that combines heuristic signal detection into a calibrated * probability score. Implements the same interface as the ONNX classifier * so it slots in as a drop-in replacement when the ONNX model is unavailable. */ export declare class HeuristicClassifier implements PromptInjectionClassifierRunner { predictProbability(text: string): Promise; }