import type { ToolDef } from './types.js'; /** * The optional meaning-based check (`scan --classifier-url … --classifier-model …`). * * WARDEN's gates are rules: offline, deterministic, and blind to a paraphrase no rule names. This * asks a model the user chose — a local one (Ollama, vLLM, LM Studio) or a hosted one — whether * each tool's text crosses its authority boundary. This is an independent inspection; a historical * HISTOR classifier result does not substitute for the complete review required here. * * It is OFF unless both flags are given, it sends the tool definitions to that endpoint, and its * verdicts are advisory unless `--classifier-blocks`. The tool text is the attack, so it is fenced * by a per-request random marker it cannot forge, and the model's answer is validated as * untrusted: malformed answers fail inspection; enforcing callers also require complete coverage. */ export declare const CLASSIFIER_CATEGORIES: readonly ['instruction_to_model', 'exfiltration', 'secret_request', 'concealment', 'cross_tool']; export type ClassifierCategory = (typeof CLASSIFIER_CATEGORIES)[number]; declare const SEVERITIES: readonly ['low', 'medium', 'high']; /** A tool's whole inspected text (originals plus normalized readings) and its field count. Measured on * 251,413 real tools HISTOR observed: 99.95% fit; past it the inspection is incomplete, never clean. */ export declare const MAX_TOOL_CHARS = 32000, MAX_TOOL_FIELDS = 600; export declare const CLASSIFIER_BATCH = 8; /** Tools share one request only up to this much payload; a large tool is sent alone. */ export declare const CLASSIFIER_BATCH_CHARS = 48000; export declare const CLASSIFIER_SYSTEM_PROMPT: string; export interface ClassifierOptions { /** OpenAI-compatible base URL, e.g. http://localhost:11434/v1 or https://api.deepseek.com/v1 */ url: string; model: string; /** From WARDEN_CLASSIFIER_API_KEY; never a command-line flag, never printed. */ apiKey?: string; timeoutMs?: number; /** Optional provider-supported reasoning budget. Omitted means the provider's default. */ reasoningEffort?: 'none' | 'low' | 'medium' | 'high'; /** Enforcing callers reject truncation, missing coverage, uncertainty and ungrounded evidence. */ requireComplete?: boolean; /** Explicit diagnostic opt-in: response contains untrusted tool text; never credentials/headers. */ onResponse?: (content: string, tools: readonly ToolDef[], metadata: { finishReason: string; promptTokens?: number; completionTokens?: number; }) => void; } export interface ClassifierFinding { /** Trusted input index; also distinguishes identical tool names in data-only evaluations. */ index: number; tool: string; categories: ClassifierCategory[]; severity: (typeof SEVERITIES)[number]; reason: string; quote: string; /** Host-resolved field names; quote is a source preview, not a model-authored span. */ evidenceFields?: string[]; /** Recorded for diagnostics; a confirmed attack cannot downgrade its host-enforced severity. */ modelSeverity?: (typeof SEVERITIES)[number]; } export declare class ClassifierError extends Error { } export declare function toolPayload(tools: readonly ToolDef[]): { payload: Array>; truncated: number; }; /** Malformed output is an inspection failure, never an empty/clean answer. */ export declare function parseFindings(content: string, payload: Array<{ name?: unknown; }>, requireComplete?: boolean): ClassifierFinding[]; export interface ClassifierInspection { findings: ClassifierFinding[]; incomplete: Array<{ index: number; tool: string; error: string; }>; retried: number; } export declare function isSemanticallyClean(review: ClassifierInspection | undefined, tool: ToolDef): boolean; /** A bad decision invalidates only its own input. Missing/duplicate decisions are never clean. */ export declare function parseInspection(content: string, payload: Array>, requireComplete?: boolean): ClassifierInspection; /** Isolate incomplete inputs and retry each once alone. Never convert failures into clean verdicts. */ export declare function inspectTools(input: readonly ToolDef[], opts: ClassifierOptions): Promise; /** Compatibility API: callers needing per-tool availability use inspectTools(). */ export declare function classifyTools(tools: readonly ToolDef[], opts: ClassifierOptions): Promise; export declare const classifyBatch: typeof classifyTools; export {}; //# sourceMappingURL=classifier.d.ts.map