import { type FactDto } from "@superblocksteam/shared";
import { type Logger } from "../../util/logger.js";
import type { AutoConnectingRpcClient } from "../../server-rpc/index.js";
import type { PromptContextIntegration } from "@superblocksteam/library-shared/types";
type PartitionedFacts = {
    alwaysInject: FactDto[];
    onDemand: FactDto[];
};
export type LoadedFacts = {
    org: FactDto[];
    user: FactDto[];
    integrations: Record<string, FactDto[]>;
};
export type FactsPromptSections = {
    systemPromptSection: string;
    userMessageSection: string;
    onDemandSkillIndex: string;
    facts: LoadedFacts;
};
/**
 * Manages knowledge/facts loading, caching, and tracking for a chat session.
 * - Caches facts with TTL to reduce RPC calls
 * - Tracks which facts have been sent to UI to only push net-new knowledge
 * - Provides on-demand fact retrieval for skill-based loading
 */
export declare class KnowledgeManager {
    private cache;
    private sentFactIds;
    /** Cache of individual facts by ID for on-demand retrieval */
    private factById;
    private isCacheValid;
    private getCached;
    private setCache;
    /**
     * Get a fact by ID from the cache.
     * Only returns facts that have been previously loaded and cached.
     * Used by SkillFileHandler to serve on-demand fact content.
     */
    getFactById(factId: string): FactDto | undefined;
    /**
     * Partition facts by access type for separate handling.
     */
    private partitionByAccessType;
    /**
     * Load all facts for an organization (both ALWAYS_INJECT and ON_DEMAND).
     * Facts are fetched in a single RPC call and partitioned client-side.
     */
    loadOrgFacts(rpcClient: AutoConnectingRpcClient, organizationId: string, logger: Logger): Promise<PartitionedFacts>;
    /**
     * Load all facts for an integration (both ALWAYS_INJECT and ON_DEMAND).
     * Facts are fetched in a single RPC call and partitioned client-side.
     */
    loadIntegrationFacts(rpcClient: AutoConnectingRpcClient, integrationId: string, logger: Logger): Promise<PartitionedFacts>;
    /**
     * Load all facts for a user (both ALWAYS_INJECT and ON_DEMAND).
     * Facts are fetched in a single RPC call and partitioned client-side.
     */
    loadUserFacts(rpcClient: AutoConnectingRpcClient, userId: string, logger: Logger): Promise<PartitionedFacts>;
    /**
     * Merge and de-duplicate integrations by id.
     * This is so we can load all facts when a user might have not tagged something
     * but Clark put it in the plan.
     */
    private mergeIntegrations;
    private summarizeLoadedFactsForLogs;
    loadFactsPromptSections({ rpcClient, organizationId, userId, promptIntegrations, planIntegrations, logger, }: {
        rpcClient: AutoConnectingRpcClient;
        organizationId: string;
        userId: string;
        logger: Logger;
        promptIntegrations: PromptContextIntegration[];
        planIntegrations?: PromptContextIntegration[];
    }): Promise<FactsPromptSections>;
    /**
     * Given loaded facts, returns only the facts that haven't been sent to UI yet.
     * Also marks these facts as sent.
     */
    getNetNewFacts(facts: LoadedFacts): LoadedFacts;
    hasAnyFacts(facts: LoadedFacts): boolean;
    /**
     * Filter LoadedFacts to only include ALWAYS_INJECT facts.
     * Used to show only always-inject facts in the initial knowledge UI message.
     */
    filterAlwaysInjectFacts(facts: LoadedFacts): LoadedFacts;
}
export {};
//# sourceMappingURL=knowledge-manager.d.ts.map