import type { AgentContextRequest, AgentContextApplicationStorage, AgentContextApplicationRecord } from './context-director.js'; import type { AgentContextOutcomeStatus } from './types.js'; type Application = Pick & Partial; interface UsageItem { readonly applicationId?: string; readonly candidateId: string; readonly title?: string; readonly delivery: 'manifest' | 'full'; readonly whyApplied?: string; } export interface ContextQuerySample { readonly owner: string; readonly elapsedMs: number; readonly status: 'ok' | 'partial' | 'error'; } export interface ContextUsageSnapshot { readonly available: boolean; readonly days: 7; readonly sampleLimit: number; readonly trackingStartedAt?: string; readonly truncated: boolean; readonly requests: number; readonly hits: number; readonly hitRate: number | null; readonly limitedRequests: number; readonly fullDeliveries: number; readonly recommendations: number; readonly feedbackCount: number; readonly feedbackRate: number | null; readonly successes: number; readonly corrections: number; readonly failures: number; readonly ignored: number; readonly overridden: number; readonly successRate: number | null; readonly p95Ms: number | null; readonly lastQueryMs: number | null; readonly recentTasks: readonly { readonly episodeId: string; readonly task: string; readonly phase?: string; readonly occurredAt: string; readonly counted: boolean; readonly elapsedMs: number; readonly candidateCount: number; readonly limited: boolean; readonly items: readonly (UsageItem & { readonly title: string; readonly whyApplied: string; readonly outcome?: AgentContextOutcomeStatus; })[]; }[]; readonly samples?: ContextUsageSnapshot['recentTasks']; } /** Bounded observations of actual task requests; Dashboard reads never create samples. */ export declare class ContextUsageTracker { private readonly storage; private readonly now; private queue; constructor(storage: AgentContextApplicationStorage, now?: () => Date); record(input: { readonly request: AgentContextRequest; readonly episodeId: string; readonly samples: readonly ContextQuerySample[]; readonly candidates: readonly { readonly owner: string; readonly id: string; }[]; readonly applications: readonly Application[]; }): Promise; recordExpansion(request: AgentContextRequest, owner: string, candidateId: string, title: string): Promise; snapshot(owner: string, projectId: string, applications: readonly Application[] | ((ids: readonly string[]) => Promise)): Promise; private read; private update; } export {}; //# sourceMappingURL=context-usage.d.ts.map