/** * Runs background PII scrub work through the shared batch queue and task scheduler. * Content/ruleset markers make successful work idempotent. Persist pseudonym assignments * before completion markers; failures retain quarantine and report through * runtime.reportError. Without a model, deterministic coverage may complete but unresolved * residue fails. */ import type { IAgentRuntime } from "../types/runtime.js"; import { Service } from "../types/service.js"; /** * Service responsible for running the corpus PII scrub asynchronously on the * core task queue. Mirrors {@link EmbeddingGenerationService}. */ export declare class PiiScrubService extends Service { static serviceType: string; capabilityDescription: string; private batchQueue; private drainStart; private stopping; private stopPromise; private readonly scrubRequestHandler; private static readonly SCRUB_DRAIN_TASK; static start(runtime: IAgentRuntime): Promise; initialize(): Promise; /** Starts the drain task once; a failed start is retried by the next request. */ private startDrain; private handleScrubRequest; /** * Process one item: idempotency skip -> seam escalation -> mark-done. Throws * on any failure so BatchQueue applies retry / `onExhausted`, and CRUCIALLY * does not write the done-marker on failure (the item is retried, never * silently marked scrubbed). */ private scrubItem; /** * Assemble the context pack + pseudonym-assignment slice for one item from * the persisted encrypted corpus map and the runtime's retrieval surfaces * (documents / memories / entity resolution when a knowledge-graph service * is registered). Failures propagate — a tampered or wrong-key map artifact * must quarantine the item, never degrade to a context-free scrub that * would mint inconsistent pseudonyms. */ private assembleContextStage; /** * Structural probe for the agent-side knowledge-graph service (core cannot * import `@elizaos/agent`). An absent service means entity resolution is * structurally unavailable, which `assembleContextPack` records in * `sourcesQueried` — a configuration fact, not a silent degrade. */ private entityResolverFromRuntime; /** Emit FAILED + report the error after retries are exhausted. */ private emitFailure; stop(): Promise; private finishStop; getQueueSize(): number; getQueueStats(): { high: number; normal: number; low: number; total: number; }; clearQueue(): void; } export default PiiScrubService;