/** * SONA Optimizer — keyword categories, tunables, and stateless matching helpers * Split out of sona-optimizer.ts (file-size sweep). Pure move: these constants * and functions never touched `this` in the SONAOptimizer class, so they move * verbatim; call sites in the class now call them directly instead of via * `this.`. * * @module v1/cli/memory/sona-optimizer */ import type { LearnedPattern } from './sona-optimizer-types.js'; export declare const DEFAULT_PERSISTENCE_PATH = ".swarm/sona-patterns.json"; export declare const PATTERN_VERSION = "1.0.0"; export declare const MIN_CONFIDENCE = 0.1; export declare const MAX_CONFIDENCE = 0.99; export declare const CONFIDENCE_INCREMENT = 0.1; export declare const CONFIDENCE_DECREMENT = 0.15; export declare const DECAY_RATE = 0.01; export declare const MAX_PATTERNS = 1000; /** * Common agent types for routing */ export declare const _AGENT_TYPES: string[]; /** * Task keywords for pattern extraction */ export declare const KEYWORD_CATEGORIES: Record; /** * Check if word is a stop word */ export declare function isStopWord(word: string): boolean; /** * Extract meaningful keywords from task description */ export declare function extractKeywords(task: string): string[]; /** * Create a unique pattern key from keywords and agent */ export declare function createPatternKey(keywords: string[], agent: string): string; /** * Match keywords to agent using category heuristics */ export declare function matchKeywordsToAgent(keywords: string[]): { agent: string; confidence: number; matchedKeywords: string[]; } | null; /** * Get alternative agent suggestions */ export declare function getAlternatives(keywords: string[], excludeAgent: string): Array<{ agent: string; score: number; }>; /** * Validate pattern structure with strict bounds. * SECURITY: confidence/keywords/agent fields must be bounds-checked to * defeat poisoning. typeof NaN === 'number' and typeof Infinity === 'number' * pass the loose typeof check; without bounds, an attacker who writes * sona-patterns.json (poisoned bundle, malicious test fixture, co-located * compromise) can inject `confidence: 1e308` to deterministically win * every routing decision via findBestPatternMatch's `score = matchRatio * * confidence`. Mirrors the pattern in intelligence.ts:loadFromDisk. */ export declare function validatePattern(pattern: unknown): pattern is LearnedPattern; //# sourceMappingURL=sona-optimizer-keywords.d.ts.map