/** * Agentic QE v3 - QE Hooks for Pattern Learning * ADR-021: QE ReasoningBank for Pattern Learning * * Hook handlers that capture QE operations and feed patterns * into the ReasoningBank for learning. */ import type { EventBus } from '../kernel/interfaces.js'; import type { DomainName } from '../shared/types/index.js'; import { QEReasoningBank, QERoutingResult } from './qe-reasoning-bank.js'; /** * QE hook event names */ export declare const QE_HOOK_EVENTS: { readonly PreTestGeneration: "qe:pre-test-generation"; readonly PostTestGeneration: "qe:post-test-generation"; readonly TestExecutionResult: "qe:test-execution-result"; readonly PreCoverageAnalysis: "qe:pre-coverage-analysis"; readonly PostCoverageAnalysis: "qe:post-coverage-analysis"; readonly CoverageGapIdentified: "qe:coverage-gap-identified"; readonly QEAgentRouting: "qe:agent-routing"; readonly QEAgentCompletion: "qe:agent-completion"; readonly QualityScoreCalculated: "qe:quality-score"; readonly RiskAssessmentComplete: "qe:risk-assessment"; readonly PatternLearned: "qe:pattern-learned"; readonly PatternApplied: "qe:pattern-applied"; readonly PatternPromoted: "qe:pattern-promoted"; }; export type QEHookEvent = (typeof QE_HOOK_EVENTS)[keyof typeof QE_HOOK_EVENTS]; /** * Context passed to hook handlers */ export interface QEHookContext { /** Unique event ID */ eventId: string; /** Timestamp of the event */ timestamp: Date; /** Event-specific data */ data: Record; /** Source domain */ sourceDomain?: DomainName; /** Source agent ID */ sourceAgentId?: string; } /** * Result from hook handler */ export interface QEHookResult { /** Whether the hook succeeded */ success: boolean; /** Error message if failed */ error?: string; /** Data to pass to next handler */ data?: Record; /** Patterns learned from this event */ patternsLearned?: number; /** Routing recommendation if applicable */ routing?: QERoutingResult; /** Guidance generated */ guidance?: string[]; } /** * Hook handler function type */ export type QEHookHandler = (ctx: QEHookContext) => Promise; /** * Create QE hook handlers bound to a ReasoningBank */ export declare function createQEHookHandlers(reasoningBank: QEReasoningBank): Record; /** * QE Hook registry for managing and executing hooks */ export declare class QEHookRegistry { private readonly eventBus?; private handlers; private reasoningBank?; constructor(eventBus?: EventBus | undefined); /** * Initialize with a ReasoningBank */ initialize(reasoningBank: QEReasoningBank): void; /** * Register a hook handler */ register(event: QEHookEvent, handler: QEHookHandler): void; /** * Unregister a hook handler */ unregister(event: QEHookEvent, handler: QEHookHandler): void; /** * Emit a hook event */ emit(event: QEHookEvent, data: Record): Promise; /** * Get all registered events */ getRegisteredEvents(): QEHookEvent[]; /** * Clear all handlers */ clear(): void; } /** * Create a QE hook registry */ export declare function createQEHookRegistry(eventBus?: EventBus): QEHookRegistry; /** * Create and initialize a QE hook registry with a ReasoningBank */ export declare function setupQEHooks(reasoningBank: QEReasoningBank, eventBus?: EventBus): QEHookRegistry; //# sourceMappingURL=qe-hooks.d.ts.map