import { T as TriggerSourceName, O as OperatorContext, C as CandidateEvent, b as OperatorResponse, a as ChannelName, R as RelevanceScore, S as SurfacingMessage } from './types-GeEw7wzC.js';

/**
 * Produces CandidateEvents from a data domain.
 *
 * Domain examples:
 * - IntelTriggerSource → scans unread MarketIntelItem rows
 * - PipelineTriggerSource → reads active Engagements for gap/stall signals
 * - FinanceTriggerSource → checks AR age, BAS exposure, overdue invoices
 * - FamilyTriggerSource → reads school calendar events and swim meets
 *
 * The pipeline calls all registered sources and merges results. Sources
 * MUST NOT throw on empty results — return an empty array instead.
 */
interface TriggerSource {
    readonly name: TriggerSourceName;
    fetchCandidates(operatorContext: OperatorContext, since: Date): Promise<CandidateEvent[]>;
}
/**
 * Scores a CandidateEvent against the current OperatorContext.
 *
 * The reference implementation (RuleBasedRelevanceScorer) is fast and
 * deterministic — no LLM call. An LLM-augmented scorer (Batch 3) will
 * handle nuanced cross-domain reasoning that rules cannot capture.
 */
interface RelevanceScorer {
    score(candidate: CandidateEvent, operatorContext: OperatorContext): Promise<RelevanceScore>;
}
/**
 * Formats a scored CandidateEvent into a channel-specific message and
 * delivers it.
 *
 * `format` is synchronous — callers can inspect the message before
 * committing to delivery. `send` is async and returns a delivery receipt.
 *
 * Implementations: TelegramSurfacingChannel (Batch 1), push/email/dashboard
 * channels (Batch 4).
 */
interface SurfacingChannel {
    readonly name: ChannelName;
    format(candidate: CandidateEvent, score: RelevanceScore, operatorContext: OperatorContext): SurfacingMessage;
    send(message: SurfacingMessage): Promise<{
        delivered: boolean;
        deliveredAt?: Date;
        error?: string;
    }>;
}
/**
 * Records operator responses and adjusts per-source calibration multipliers.
 *
 * The in-memory stub (MemoryCalibrationLearner) is suitable for tests and
 * ephemeral processes. Batch 2 replaces it with a Prisma-backed adapter
 * that persists multipliers in AgentMemory CALIBRATION records.
 *
 * Multiplier semantics:
 *   acted          → +0.10 (signal is relevant — boost this source)
 *   dismissed      → -0.05 (reduce but do not silence)
 *   more_like_this → +0.20 (strong positive — boost more aggressively)
 *   less_like_this → -0.15 (weak negative — reduce without overcorrecting)
 *
 * Multiplier is clamped to [0.0, 2.0]. Default (no history) is 1.0.
 */
interface CalibrationLearner {
    record(operatorId: string, sourceName: TriggerSourceName, candidate: CandidateEvent, response: OperatorResponse): Promise<void>;
    getCalibration(operatorId: string, sourceName: TriggerSourceName): Promise<number>;
}

export type { CalibrationLearner as C, RelevanceScorer as R, SurfacingChannel as S, TriggerSource as T };
