/** * Shared heuristic patterns for Brain decision-making. * * These regexes are used by both `DefaultBrainArbiter` (coordination/brain.ts) * and `quickDecide` (execution/autonomy-brain.ts) to detect the * blocked-resolved pattern: a question about a blocked task where the * context contains explicit evidence that the blocker has been resolved. * * Extracted to a single module to prevent drift between the two consumers. * If you add or remove a resolution marker, update BOTH the regex and the * tests in `tests/execution/brain-quickdecide.test.ts`. */ /** * Resolution markers: words that indicate a blocking dependency has been * explicitly resolved in the context. Word-boundary anchored to avoid * false positives on substrings (e.g. "unresolved" should NOT match). */ export declare const BLOCKED_RESOLVED_MARKERS: RegExp; /** * Competing-alternative guard: rejects questions that offer a choice * (e.g. "Should we unblock and continue or wait?"). When "or" is present, * the question is offering alternatives — not a simple unblock signal. */ export declare const COMPETING_ALTERNATIVE: RegExp; /** * Evaluate the blocked-resolved heuristic against a question/context pair. * * Returns `true` when: * 1. The question mentions "blocked" * 2. The question does NOT contain competing alternatives ("or") * 3. The context contains an explicit resolution marker * * Callers must additionally verify: * - `request.fallback === 'continue'` (caller declared continue safe) * - `!request.options?.length` (no structured choices to override) * * @param question - Lowercased question text * @param context - Lowercased context text */ export declare function isBlockedResolved(question: string, context: string, markers?: RegExp): boolean; /** * Toggles for the built-in pattern heuristics. * * These four patterns plus the low-risk fast path used to be unconditional: * an operator could change WHEN the expensive tiers run, but never turn off a * cheap guess that was firing wrongly for their workload. Each flag defaults * to `true`, so an absent config behaves exactly as before. */ export interface BrainHeuristicsConfig { /** `DefaultBrainArbiter`: auto-answer low-risk requests that carry a recommended option. */ lowRiskAutoAnswer?: boolean | undefined; /** "blocked … + explicit resolution marker in context" → continue. */ blockedResolved?: boolean | undefined; /** "deadlock" + failed work units in context → skip and continue. */ deadlockSkip?: boolean | undefined; /** "failed"/"retry" + demonstrably exhausted retries → mark failed and move on. */ retryExhausted?: boolean | undefined; /** Bare continue/proceed ping with no competing alternative → continue. */ continuePing?: boolean | undefined; /** * Replace the resolution markers the `blockedResolved` heuristic looks for. * Entries are matched as whole words, case-insensitively, and are regex * ESCAPED — this is a word list, not a pattern, so a stray `(` from config * cannot break decision-making. Empty/absent keeps the built-in list. */ blockedResolvedMarkers?: string[] | undefined; } /** Every heuristic on — the behaviour that predates `BrainHeuristicsConfig`. */ export declare const DEFAULT_BRAIN_HEURISTICS: Required>; /** Resolved, fully-populated heuristic settings. */ export interface ResolvedBrainHeuristics extends Required> { /** Compiled resolution markers for `isBlockedResolved`. */ blockedResolvedMarkers: RegExp; } /** * Build a whole-word, case-insensitive alternation from a marker word list. * Returns the built-in pattern when the list yields nothing usable. */ export declare function compileResolutionMarkers(words: readonly string[] | undefined): RegExp; /** Fill a partial heuristics config with the all-on defaults. */ export declare function resolveBrainHeuristics(cfg: BrainHeuristicsConfig | undefined): ResolvedBrainHeuristics; //# sourceMappingURL=brain-heuristics.d.ts.map