import { FullExecutionContext } from "@inkeep/agents-core";

//#region src/domains/run/context/contextCache.d.ts
interface CacheEntry {
  contextConfigId: string;
  contextVariableKey: string;
  conversationId: string;
  value: unknown;
  requestHash?: string;
  tenantId: string;
}
/**
 * Context cache with request hash-based invalidation and graceful error handling.
 *
 * Implements conversation-scoped caching with smart cache invalidation based on
 * request hash changes. All cache errors are treated as cache misses to ensure
 * system reliability.
 */
declare class ContextCache {
  private executionContext;
  constructor(executionContext: FullExecutionContext);
  /**
   * Get cached context data for a conversation
   */
  get({
    conversationId,
    contextConfigId,
    contextVariableKey,
    requestHash
  }: {
    conversationId: string;
    contextConfigId: string;
    contextVariableKey: string;
    requestHash?: string;
  }): Promise<CacheEntry | null>;
  /**
   * Set cached context data for a conversation
   */
  set(entry: CacheEntry): Promise<void>;
  /**
   * Clear cache entries for a specific conversation
   */
  clearConversation(tenantId: string, projectId: string, conversationId: string): Promise<void>;
  /**
   * Clear all cache entries for a specific context configuration
   */
  clearContextConfig(tenantId: string, projectId: string, contextConfigId: string): Promise<void>;
  /**
   * Clean up expired or orphaned cache entries
   */
  cleanup(): Promise<void>;
  invalidateInvocationDefinitions(tenantId: string, projectId: string, conversationId: string, contextConfigId: string, definitionIds: string[]): Promise<void>;
  invalidateHeaders(tenantId: string, projectId: string, conversationId: string, contextConfigId: string): Promise<void>;
}
//#endregion
export { CacheEntry, ContextCache };