import { type HostFingerprint } from "./host-state-store.ts"; import { type ModelPerfProfile, type ModelPerfSample } from "./perf-profile.ts"; export interface ModelAdaptationRule { mode: string; text: string; addedAt: string; lastFiredAt: string; } export type ModelProtocolCalibration = { version: number; status?: "calibrated"; variant: string; calibratedAt: string; } | { version: number; status: "failed"; attemptedAt: string; variantsTried: string[]; }; export type ModelToolProbeVerdict = "native" | "text-protocol" | "none"; export type NativeToolProbeGrade = "task" | "echo-only" | "absent"; export interface ModelToolProbe { version: number; status: ModelToolProbeVerdict; probedAt: string; variant?: string; nativeGrade?: NativeToolProbeGrade; diagnostic?: string; } export interface ModelTeachStats { taught: number; recurrenceBefore: number; recurrenceAfter: number; } export interface ModelAdaptationProfile { rules: ModelAdaptationRule[]; protocol?: ModelProtocolCalibration; toolProbe?: ModelToolProbe; perf?: ModelPerfProfile; teachStats: Record; } export interface StoredModelAdaptation { model: string; profile: ModelAdaptationProfile; at: string; host: HostFingerprint; } export declare class ModelAdaptationStore { private readonly storage; constructor(filePath: string, options?: { fingerprint?: () => HostFingerprint; readOnly?: boolean; }); static forAgentDir(agentDir: string, options?: { fingerprint?: () => HostFingerprint; readOnly?: boolean; }): ModelAdaptationStore; /** * Load-mutate-write under a single exclusive lock so two concurrent stores (e.g. two sessions * sharing an agentDir) can't both read the old file and clobber each other's write. */ private store; /** Keep the complete profile read-modify-write transaction under the host-state lock. */ private mutateProfile; /** Persist the profile for a model on the CURRENT host. Best-effort, returns the entry. */ save(model: string, profile: ModelAdaptationProfile, at?: string): StoredModelAdaptation; /** Profile for a model on the current host; prunes retired rules before returning. */ get(model: string, now?: Date): ModelAdaptationProfile; /** Add or replace one standing rule, enforcing the per-model cap. */ addRule(model: string, rule: { mode: string; text: string; addedAt?: string; lastFiredAt?: string; }, now?: Date): StoredModelAdaptation; removeRule(model: string, mode: string, at?: Date): boolean; /** Update last-fired recency for an existing rule. No-op when absent. */ markRuleFired(model: string, mode: string, at?: Date): StoredModelAdaptation | undefined; setProtocol(model: string, protocol: ModelProtocolCalibration, at?: string): StoredModelAdaptation; setToolProbe(model: string, toolProbe: ModelToolProbe, at?: string): StoredModelAdaptation; recordPerfSample(model: string, sample: ModelPerfSample, at?: string): StoredModelAdaptation | undefined; removeProtocol(model: string, at?: Date): boolean; setTeachStats(model: string, mode: string, stats: ModelTeachStats, at?: string): StoredModelAdaptation; /** Profiles for the current host (default) or an explicit host id. */ getForHost(hostId?: string): StoredModelAdaptation[]; /** Every stored profile across all hosts (for cross-machine comparisons). */ getAll(): StoredModelAdaptation[]; } //# sourceMappingURL=adaptation-store.d.ts.map