/** * Rule table — the single source of truth the classifier reads. * * Every rule is a triple: (pattern, data-class, authority-level) * plus a confidence weight. Rules over tool *names* and *descriptions* * use regex match; rules over *schemas* use heuristic shape detection * already implemented in `../fuzz/schema.ts`. * * Per docs/METHODOLOGY.md §"Confidence scoring": * - Tool name match — 0.7 (strong cue, gameable) * - Description match — 0.5 (helpful, often missing) * - Schema match — 0.4 (structural, gameable too) * - Side-effect verb in desc — 0.6 (raises authority by one step) * * Adding a rule? Update this file AND docs/METHODOLOGY.md's change-log * with date + reason. No silent drift. */ import type { AuthorityLevel, DataClass } from "./types.js"; /** Single rule predicting (data_class, authority_level) given a name/description match. */ export interface NameOrDescRule { /** Regex pattern (case-insensitive). */ pattern: RegExp; data_class: DataClass; /** * Authority floor — the rule asserts at least this authority level. * Final authority can be escalated by side-effect verbs. */ authority_floor: AuthorityLevel; /** Where this rule applies. */ scope: "name" | "description" | "either"; } /** Confidence weights per rule scope. */ export declare const NAME_MATCH_WEIGHT = 0.7; export declare const DESCRIPTION_MATCH_WEIGHT = 0.5; export declare const SCHEMA_MATCH_WEIGHT = 0.4; /** * Bonus added when fuzz results show the tool actually accepts adversarial * inputs (i.e. > 1 ok response in the fuzz stream). Caps confidence higher. */ export declare const FUZZ_INFORMED_BONUS = 0.1; /** Side-effect verbs that raise authority by one step when seen in description. */ export declare const SIDE_EFFECT_VERBS: RegExp[]; /** * Side-effect verbs strong enough to assert *destructive* directly * (matches push authority to "destructive", not just "write"). */ export declare const DESTRUCTIVE_VERBS: RegExp[]; /** * Side-effect verbs strong enough to assert *privileged* directly * (subprocess spawn / shell execution). */ export declare const PRIVILEGED_VERBS: RegExp[]; /** * Rule list. Ordered from most specific to most general — the * classifier evaluates all rules; this ordering is for human review. */ export declare const RULES: readonly NameOrDescRule[]; /** Return the higher of two authority levels (lattice join). */ export declare function maxAuthority(a: AuthorityLevel, b: AuthorityLevel): AuthorityLevel; /** Escalate authority by one step (read → write → destructive → privileged). */ export declare function escalateAuthority(a: AuthorityLevel): AuthorityLevel; //# sourceMappingURL=rules.d.ts.map