import { MappingStore } from './mapping-store.js'; import { OllamaClient } from './ollama-client.js'; /** Represents the outcome of the NER (Ollama) phase. */ export type NerStatus = 'ready' | 'warming_up' | 'disabled'; export interface ProcessResult { maskedText: string; nerStatus: NerStatus; } /** * Main orchestrator. Coordinates regex-based masking and optional Ollama LLM NER. * * @param store - Optional pre-constructed MappingStore (useful for session reuse) * @param ollamaClientOverride - Pass an OllamaClient (or null) to override auto-creation. * Used in tests to inject mocks without vi.mock hoisting. */ export declare class Engine { private readonly store; private readonly ollamaClient; constructor(store?: MappingStore, ollamaClientOverride?: OllamaClient | null); getStore(): MappingStore; /** * Pseudonymize sensitive data in the given text. * * Phase 1 (regex | hybrid): Apply pattern-based masking for structured data * (PESEL, IBAN, email, phone). * Phase 2 (llm | hybrid): Call Ollama NER to detect PERSON / ORG names. * If Ollama is unavailable, this phase is silently skipped. * * Returns the masked text as a plain string (backward-compatible). * Use processWithStatus() to also get the NER status. */ process(text: string, extraLiterals?: string[]): Promise; /** * Same as process() but also returns the NER phase outcome: * 'ready' — Ollama responded, PERSON/ORG entities were detected and masked * 'warming_up' — Ollama timed out (cold start); retry in a few seconds * 'disabled' — NER not attempted (engines=regex, or Ollama connection refused) */ processWithStatus(text: string, extraLiterals?: string[]): Promise; private applyCustomLiterals; /** * Mask every pattern match that clears the sensitivity threshold. * * Candidates from all rules are collected first and overlaps resolved by * confidence, then substitutions are applied right-to-left so earlier * offsets stay valid. Applying rules one after another instead would let * whichever rule happens to run first claim a span it scores worst on. */ private applyRegexRules; /** * Split text into sentence-boundary chunks with 1-sentence overlap. * Visible for testing. */ static splitIntoChunks(text: string, maxLen?: number): string[]; private applyLlmNer; /** * Restore all [TAG:N] tokens in text to their original values. * Tokens not found in the store are left unchanged. */ revert(text: string): string; } //# sourceMappingURL=engine.d.ts.map