import type { ScanContext, ScanDecision, Violation, PIIConfig } from "../types.js"; export type OutputSink = "sql" | "shell" | "html" | "template"; export interface OutputScanConfig { /** * PII handling. Pass a `PIIConfig` to control action/locale, or `false` * to skip PII scanning entirely. Default: mask. */ pii?: PIIConfig | false; /** * Canary token(s) injected into the system prompt via `injectCanary()`. * If any appears verbatim in the output → `system_prompt_leak` (block). */ canaryTokens?: string | string[]; /** * Restrict the structured-injection check to specific downstream sinks. * E.g. `["sql"]` when the output only ever flows into a query builder. * Default: all sinks. */ sinks?: OutputSink[]; /** Selectively disable checks. All enabled by default. */ checks?: { secrets?: boolean; injection?: boolean; systemPromptLeak?: boolean; jailbreak?: boolean; }; /** Override the byte cap on the scanned region. Default 256 KB. */ maxBytes?: number; } export interface OutputScanResult { /** No blocking violation found. */ safe: boolean; decision: ScanDecision; /** * Output with PII masked and secrets redacted to `[REDACTED_SECRET]`. * Unlike `scanIngested`, this is NOT emptied on block — the caller * usually still needs to log or display the sanitized text. Gate on * `safe` / `decision` before forwarding it to a downstream sink. */ sanitized: string; violations: Violation[]; meta: { scanDurationMs: number; checksRun: string[]; }; } /** * Scanner for LLM output. Stateless; safe to reuse across calls. */ export declare class OutputScanner { private readonly config; private readonly pii; constructor(config?: OutputScanConfig); scan(output: string, context?: ScanContext): Promise; } /** * One-shot helper. Scan a model response before acting on it. * * @example * ```ts * import { scanOutput } from "ai-shield-core"; * * const reply = await llm.generate(prompt); * const r = await scanOutput(reply, { canaryTokens: canary, sinks: ["sql"] }); * if (!r.safe) { * audit.warn("unsafe model output", r.violations); * return genericFallback(); // do not run r.sanitized as SQL * } * showToUser(r.sanitized); // PII masked, secrets redacted * ``` */ export declare function scanOutput(output: string, config?: OutputScanConfig, context?: ScanContext): Promise; //# sourceMappingURL=output.d.ts.map