/** * Injection Effectiveness Flush * * 세션의 injection_logs 레코드에서 effectiveness를 계산하고 저장합니다. * SessionEnd, Stop hook에서 공용으로 호출됩니다 (#92: PreCompact caller 제거). * * ADR-019: effectiveness = COUNT(DISTINCT matched_memory_id) / total_injected (0~1 범위 보장) * ADR-016 F1: hit_count는 보조 지표로 유지 (계산에 사용하지 않음) * 반환값의 reinforceTargets를 받아 호출자가 reinforce 여부를 결정합니다. * (네트워크 의존성 없음 → Stop hook의 경량 경로 재사용 가능) */ import type { MemoryDatabase } from '../db/database.js'; import type { createLogger } from '../utils/logger.js'; export interface FlushResult { /** effectiveness가 갱신된 레코드 수 */ updated: number; /** effectiveness > 0.3인 injection의 누적 memory ID 목록 (reinforce 후보) */ reinforceTargets: string[]; /** * 세션 평균 effectiveness (Sprint 7 H4). * updated > 0인 injection들의 단순 평균. updated=0이면 0. * Session metrics의 injectionEffectiveness 필드에 사용. */ avgEffectiveness: number; } /** * 세션 ID 기준으로 모든 injection_logs의 effectiveness를 재계산/저장합니다. * 동기 함수이며 네트워크 호출 없음. 실패 시 WARN 기록 후 부분 결과 반환. * * ADR-019 수식: * effectiveness = COUNT(DISTINCT matched_memory_ids) / total_injected * * 레거시 호환: matched_memory_ids가 NULL인 injection(flat array 포맷으로 기록된 구버전)은 * 고유 매칭 수가 0으로 집계됨. 기존 effectiveness 값을 유지하려면 hit_count=0일 때만 0 기록, * hit_count>0이면 매칭 흔적은 있으나 memory_id 소실 → NULL 유지 정책. */ export declare function flushInjectionEffectiveness(db: MemoryDatabase, sessionId: string | undefined, logger?: ReturnType): FlushResult; //# sourceMappingURL=injection-flush.d.ts.map