import type { MemoryType, PrivacyScope } from '../../../shared/types/index.js'; export type AgentContextScopeLevel = 'session' | 'process' | 'project' | 'owner'; export type AgentContextStatus = 'ok' | 'empty' | 'degraded'; export interface AgentContextScope { ownerId: string; projectId?: string; processId?: string; sessionId?: string; } export interface AgentContextCandidate { id: string; content: string; type: MemoryType; relevance: number; importance: number; createdAt: string; provenanceConfidence: number; privacyScope: PrivacyScope; ownerId: string | null; projectId: string | null; processId: string | null; sessionId: string | null; topics?: string[]; } export interface AgentContextRecallSource { name: string; recall(input: { query: string; scope: AgentContextScope; limit: number; }): Promise; } export interface AgentContextSourceResult { items: AgentContextCandidate[]; degradedReason?: { code: 'search_fallback'; message: string; }; } export interface AgentTokenEstimator { estimate(text: string): number; } export interface AgentContextRecallRequest { query: string; scope: AgentContextScope; tokenBudget: number; maxItems?: number; now?: string; } export interface SelectedAgentContextItem extends AgentContextCandidate { score: number; scopeLevel: AgentContextScopeLevel; tokenEstimate: number; selectionReason: 'selected_by_score' | 'selected_for_diversity'; } export interface ExcludedAgentContextItem { id: string; reason: 'privacy_scope_mismatch' | 'scope_mismatch' | 'duplicate' | 'diversity_deferred' | 'token_budget_exceeded' | 'max_items_reached'; score: number; tokenEstimate: number; duplicateOf?: string; } export interface AgentContextRecallResult { status: AgentContextStatus; query: string; contextText: string; selected: SelectedAgentContextItem[]; excluded: ExcludedAgentContextItem[]; tokenUsage: { budget: number; used: number; remaining: number; }; degradedReasons: Array<{ source: string; code: 'source_failed' | 'search_fallback'; message: string; }>; } export interface AgentContextRecallServiceOptions { sources: AgentContextRecallSource[]; tokenEstimator?: AgentTokenEstimator; estimationErrorRatio?: number; perItemOverheadTokens?: number; } export declare class AgentContextRecallService { private readonly sources; private readonly tokenEstimator; private readonly estimationErrorRatio; private readonly perItemOverheadTokens; constructor(options: AgentContextRecallServiceOptions); buildContext(request: AgentContextRecallRequest): Promise; private estimateConservativeTokens; } //# sourceMappingURL=agent-context-recall-service.d.ts.map