export type JsonObject = Record<string, unknown>;
export type FilterStage = 'request_pre' | 'request_map' | 'request_post' | 'request_finalize' | 'response_pre' | 'response_map' | 'response_post' | 'response_finalize';
export interface FilterContext {
    requestId?: string;
    model?: string;
    endpoint?: string;
    provider?: string;
    profile?: string;
    stage: FilterStage;
    stream?: boolean;
    toolFilterHints?: ToolFilterHints;
    debug?: {
        emit?: (event: string, data: unknown) => void;
    };
}
export interface FilterResult<T = JsonObject> {
    ok: boolean;
    data: T;
    warnings?: string[];
    metrics?: Record<string, unknown>;
}
export interface Filter<T = JsonObject> {
    readonly name: string;
    readonly stage: FilterStage;
    apply(input: T, ctx: FilterContext): Promise<FilterResult<T>> | FilterResult<T>;
}
export type ToolFilterAction = 'allow' | 'block' | 'rewrite';
export interface ToolFilterDecision {
    name: string;
    action: ToolFilterAction;
    reason?: string;
    category?: string;
}
export interface ToolFilterHints {
    requestedDecisions?: ToolFilterDecision[];
    categories?: {
        vision?: boolean;
        mcp?: boolean;
        webSearch?: boolean;
        codeExecution?: boolean;
        fileSearch?: boolean;
        dataAnalysis?: boolean;
    };
    categoryOverrides?: {
        vision?: 'allow' | 'block' | 'require_content';
        mcp?: 'allow' | 'block';
    };
    decided?: ToolFilterDecision[];
}
export interface FieldMapRule {
    sourcePath: string;
    targetPath: string;
    type?: 'string' | 'number' | 'boolean' | 'object' | 'array';
    transform?: string;
}
export interface FieldMapConfig {
    request?: FieldMapRule[];
    response?: FieldMapRule[];
}
export interface WhitelistConfig {
    allow: string[];
}
export interface BlacklistConfig {
    deny: string[];
}
export interface AddFieldsConfig {
    fields: Record<string, unknown>;
}
