import { LifecycleState, MemoryCategory, MemoryFile, MemoryFrontmatter } from './types.js';

interface LifecyclePolicy {
    promoteHeatThreshold: number;
    staleDecayThreshold: number;
    archiveDecayThreshold: number;
    protectedCategories: MemoryCategory[];
}
interface LifecycleSignals {
    /**
     * Optional relevance feedback in [-1, 1]. Negative values increase decay.
     * Positive values raise heat.
     */
    feedbackScore?: number;
    /**
     * Optional bounded prior derived from memory-action outcomes in [-1, 1].
     * This is intentionally low-impact to avoid circular amplification.
     */
    actionPriorScore?: number;
    /**
     * Optional causal impact score from CMC chain analysis in [0, 0.3].
     * Computed as 0.1 * incomingEdges + 0.15 * outgoingEdges, clamped.
     * Weight in heat/decay is intentionally low (0.05) to avoid circular amplification.
     */
    causalImpactScore?: number;
}
interface LifecycleDecision {
    currentState: LifecycleState;
    nextState: LifecycleState;
    heatScore: number;
    decayScore: number;
    changed: boolean;
    reason: string;
}
interface LifecycleValueInputs {
    confidence: number;
    access: number;
    recency: number;
    importance: number;
    feedback: number;
    disputedPenalty: number;
}
declare function clamp01(value: number): number;
declare function clampLifecycleThreshold(value: number): number;
declare function daysSince(value: string | undefined, nowMs: number): number;
declare function resolveLifecycleState(frontmatter: MemoryFrontmatter): LifecycleState;
declare function computeHeat(memory: Pick<MemoryFile, "frontmatter">, now: Date, signals?: LifecycleSignals): number;
declare function computeLifecycleValueInputs(memory: Pick<MemoryFile, "frontmatter">, now: Date, signals?: LifecycleSignals): LifecycleValueInputs;
declare function computeDecay(memory: Pick<MemoryFile, "frontmatter">, now: Date, signals?: LifecycleSignals): number;
declare function decideLifecycleTransition(memory: Pick<MemoryFile, "frontmatter">, policy: Partial<LifecyclePolicy>, now: Date, signals?: LifecycleSignals): LifecycleDecision;

export { type LifecycleDecision, type LifecyclePolicy, type LifecycleSignals, type LifecycleValueInputs, clamp01, clampLifecycleThreshold, computeDecay, computeHeat, computeLifecycleValueInputs, daysSince, decideLifecycleTransition, resolveLifecycleState };
