import { Definitions } from './definition';
import { DataSourceBase } from './data-sources';
import type { BaseWorkflowInstance } from './workflow-instance';
export declare namespace Typings {
    type Props = {
        name: string;
        description?: string;
        sources: DataSourceBase[];
    };
    const Primitive: "knowledge";
}
/** Metadata associated with a knowledge base search passage, used for citation tracking. */
export type KnowledgePassageMetadata = {
    /** The file key/path of the source document */
    file?: string;
    /** The title of the source document or page */
    title?: string;
    /** The URL of the source document or page */
    url?: string;
    /** The favicon URL of the source website */
    favicon?: string;
    /** A brief description of the source document */
    description?: string;
    /** The name of the knowledge base this passage belongs to */
    knowledgeBase?: string;
    /** The Botpress ID of the knowledge base */
    knowledgeBaseId?: string;
    /** The type of the data source (e.g. "document", "web-page") */
    dsType?: string;
    /** The ID of the data source this passage was ingested from */
    dsId?: string;
};
/** A single passage returned from a knowledge base search. */
export type KnowledgeSearchPassage = {
    /** The text content of the passage */
    content: string;
    /** Metadata about the source of this passage */
    metadata: KnowledgePassageMetadata;
};
/** Options for searching a knowledge base. */
export type KnowledgeSearchOptions = {
    /** Number of surrounding passages to include for context (1–20). @default 4 */
    contextDepth?: number;
    /** Maximum number of passages to return (1–50). @default 20 */
    limit?: number;
};
/** The result of searching one or more knowledge bases. */
export type KnowledgeSearchResult = {
    /** The matching passages found across the searched knowledge bases */
    passages: KnowledgeSearchPassage[];
};
export declare class BaseKnowledge implements Definitions.Primitive {
    readonly name: string;
    readonly sources: DataSourceBase[];
    readonly description?: string;
    constructor(props: Typings.Props);
    /**
     * Look up the KB ID from Botpress
     */
    private getKbId;
    /**
     * Refresh the knowledge base by triggering the built-in indexing workflow for all sources
     * This will fetch data from all data sources and update the knowledge base
     * @param force - If true, forces re-indexing of all data even if unchanged
     * @returns The indexing workflow instance, so callers can await its completion or
     *   inspect its status. The workflow runs asynchronously regardless.
     */
    refresh(options?: Partial<{
        force?: boolean;
    }>): Promise<BaseWorkflowInstance<'builtin_knowledge_indexing'>>;
    /**
     * Search this knowledge base for relevant passages.
     * Returns passages with metadata suitable for citation tracking.
     */
    search(query: string, options?: KnowledgeSearchOptions): Promise<KnowledgeSearchResult>;
    /**
     * Refresh a specific data source by its ID
     *
     * @param dsId - The ID of the data source to refresh
     * @param force - If true, forces re-indexing of all data even if unchanged
     * @returns The sync workflow instance for this source, so callers can await its
     *   completion or inspect its status. The workflow runs asynchronously regardless.
     */
    refreshSource(dsId: string, options?: Partial<{
        force?: boolean;
    }>): Promise<BaseWorkflowInstance<any>>;
}
//# sourceMappingURL=knowledge.d.ts.map