import type { SecurityRule } from "../data/rules/types.js"; export type SecurePromptVerdict = "NO_MOD" | "LIGHT_MOD" | "HEAVY_MOD"; export interface SecurePromptRequirement { ruleId: string; title: string; requirement: string; severity: SecurityRule["severity"]; } export interface SecurePromptResult { verdict: SecurePromptVerdict; reason: string; intentSummary: string; detectedStack: string[]; detectedSurfaces: string[]; securityRequirements: SecurePromptRequirement[]; ambiguities: string[]; originalPrompt: string; /** The single markdown directive block returned to the host LLM. */ markdown: string; } /** Triage thresholds — tune here, never inline. */ export declare const TRIAGE_CONFIG: { /** Distinct security terms at/above this → prompt counts as security-aware. */ readonly securityAwareTerms: 3; /** Specificity score at/above this → prompt counts as specific (not vague). */ readonly specificityThreshold: 4; /** Prompts shorter than this many words are vague regardless of other signals. */ readonly minWords: 6; /** Matched rules surfaced as requirements are capped at this many. */ readonly maxRequirements: 8; /** Clarifying questions (HEAVY_MOD only) are capped at this many. */ readonly maxAmbiguities: 3; }; /** * A lowercased haystack searched in two forms: raw (so hyphenated tokens like * "next-auth" match) and hyphen/underscore-normalized (so user phrasings like * "sign-in"/"RLS-enabled"/"log_in" match space-joined tokens like "sign in"). */ interface Haystack { raw: string; norm: string; } /** True if the token appears (word-boundary) in either form of the haystack. */ export declare function includesToken(haystack: Haystack | string, token: string): boolean; /** Detect technologies named in the prompt (and optional client-provided context). */ export declare function detectPromptStack(rawPrompt: string, context?: string): string[]; /** * Detect security-sensitive attack surfaces implied by the prompt. Surfaces describe * what the user is BUILDING, so they are derived from the prompt text only — the * optional `context` (which names the stack, not the task) deliberately does not * manufacture surfaces, preserving the NO_MOD "do no harm" path for non-security * prompts even when a host always attaches project context. */ export declare function detectPromptSurfaces(rawPrompt: string, context?: string): string[]; /** Rank rules against the detected stack + surfaces; severity first, cap at maxRequirements. */ export declare function matchRulesForPrompt(stack: string[], surfaces: string[], rules: SecurityRule[]): SecurePromptRequirement[]; /** * Analyze a raw coding prompt BEFORE code generation and return a structured * enhancement directive. Fully deterministic: same prompt = same directive. */ export declare function securePrompt(rawPrompt: string, opts?: { context?: string; rules?: SecurityRule[]; }): SecurePromptResult; export {};