import type { KnowledgeService } from './service.js';
import type { ArtifactFetchMode } from '@pellux/goodvibes-sdk/platform/artifacts/types';
import { type KnowledgeInjection } from '../state/knowledge-injection.js';
import type { MemoryAddOptions, MemoryBundle, MemoryDoctorReport, MemoryImportResult, MemoryLink, MemoryRecord, MemoryReviewPatch, MemoryScope, MemorySearchFilter, MemorySemanticSearchResult } from '../state/memory-store.js';
import type { MemoryVectorStats } from '../state/memory-vector-store.js';
import type { MemoryRegistry } from '../state/memory-registry.js';
export type { ArtifactFetchMode } from '@pellux/goodvibes-sdk/platform/artifacts/types';
export type { KnowledgeInjection, } from '../state/knowledge-injection.js';
export type { KnowledgeInjectionIngestMode, KnowledgeInjectionProvenance, KnowledgeInjectionRetention, KnowledgeInjectionTrustTier, KnowledgeInjectionUseAs, } from './internal.js';
type UsageListInput = Parameters<KnowledgeService['listUsageRecords']>[1];
type SourceQueryInput = Parameters<KnowledgeService['querySources']>[0];
type NodeQueryInput = Parameters<KnowledgeService['queryNodes']>[0];
type IssueQueryInput = Parameters<KnowledgeService['queryIssues']>[0];
type NeighborInput = Parameters<KnowledgeService['getNeighbors']>[2];
type RecordUsageInput = Parameters<KnowledgeService['recordUsage']>[0];
type IngestUrlInput = Parameters<KnowledgeService['ingestUrl']>[0];
type IngestArtifactInput = Parameters<KnowledgeService['ingestArtifact']>[0];
type ImportBookmarksInput = Parameters<KnowledgeService['importBookmarksFromFile']>[0];
type ImportUrlsInput = Parameters<KnowledgeService['importUrlsFromFile']>[0];
type BookmarkSeedsInput = Parameters<KnowledgeService['ingestBookmarkSeeds']>[0];
type ConnectorInput = Parameters<KnowledgeService['ingestConnectorInput']>[0];
type ProjectionRenderInput = Parameters<KnowledgeService['renderProjection']>[0];
type ProjectionMaterializeInput = Parameters<KnowledgeService['materializeProjection']>[0];
type PacketTask = Parameters<KnowledgeService['buildPacket']>[0];
type PacketWriteScope = Parameters<KnowledgeService['buildPacket']>[1];
type PacketLimit = Parameters<KnowledgeService['buildPacket']>[2];
type PacketOptions = Parameters<KnowledgeService['buildPacket']>[3];
type ScheduleSaveInput = Parameters<KnowledgeService['saveSchedule']>[0];
type ConsolidationDecision = Parameters<KnowledgeService['decideConsolidationCandidate']>[1];
type ConsolidationDecisionInput = Parameters<KnowledgeService['decideConsolidationCandidate']>[2];
type RunJobInput = Parameters<KnowledgeService['runJob']>[1];
type CandidateListInput = Parameters<KnowledgeService['listConsolidationCandidates']>[1];
type RemoteKnowledgeFetchMode = Extract<ArtifactFetchMode, 'public-only' | 'allow-private-hosts'>;
export interface KnowledgeApiUrlIngestInput extends Omit<IngestUrlInput, 'allowPrivateHosts' | 'metadata'> {
    readonly fetchMode?: RemoteKnowledgeFetchMode;
    readonly metadata?: Record<string, unknown>;
}
export interface KnowledgeApiArtifactIngestInput extends Omit<IngestArtifactInput, 'allowPrivateHosts' | 'metadata'> {
    readonly fetchMode?: RemoteKnowledgeFetchMode;
    readonly metadata?: Record<string, unknown>;
}
export interface MemoryExplainResult {
    readonly injections: readonly KnowledgeInjection[];
    readonly prompt: string | null;
}
export interface MemoryApi {
    add(input: MemoryAddOptions): Promise<MemoryRecord>;
    search(filter?: MemorySearchFilter): readonly MemoryRecord[];
    searchSemantic(filter?: MemorySearchFilter): readonly MemorySemanticSearchResult[];
    vectorStats(): MemoryVectorStats;
    rebuildVectors(): MemoryVectorStats;
    rebuildVectorsAsync(): Promise<MemoryVectorStats>;
    doctor(): Promise<MemoryDoctorReport>;
    reviewQueue(limit?: number): readonly MemoryRecord[];
    exportBundle(filter?: MemorySearchFilter): MemoryBundle;
    importBundle(bundle: MemoryBundle): Promise<MemoryImportResult>;
    get(id: string): MemoryRecord | null;
    getAll(): readonly MemoryRecord[];
    link(fromId: string, toId: string, relation: string): Promise<MemoryLink | null>;
    linksFor(id: string): readonly MemoryLink[];
    update(id: string, patch: {
        scope?: MemoryScope;
        summary?: string;
        detail?: string;
        tags?: string[];
    }): MemoryRecord | null;
    review(id: string, patch: MemoryReviewPatch): MemoryRecord | null;
    delete(id: string): boolean;
    explain(task: string, writeScope?: readonly string[], limit?: number): MemoryExplainResult;
}
export type MemoryApiRegistry = Pick<MemoryRegistry, 'add' | 'doctor' | 'delete' | 'exportBundle' | 'get' | 'getAll' | 'importBundle' | 'link' | 'linksFor' | 'rebuildVectors' | 'rebuildVectorsAsync' | 'review' | 'reviewQueue' | 'search' | 'searchSemantic' | 'update' | 'vectorStats'>;
export interface CreateKnowledgeApiOptions {
    readonly memoryRegistry?: MemoryApiRegistry;
}
export interface KnowledgeApi {
    readonly status: {
        get(): ReturnType<KnowledgeService['getStatus']>;
        lint(): ReturnType<KnowledgeService['lint']>;
        reindex(): ReturnType<KnowledgeService['reindex']>;
    };
    readonly sources: {
        list(limit?: number): ReturnType<KnowledgeService['listSources']>;
        query(input?: SourceQueryInput): ReturnType<KnowledgeService['querySources']>;
    };
    readonly graph: {
        nodes: {
            list(limit?: number): ReturnType<KnowledgeService['listNodes']>;
            query(input?: NodeQueryInput): ReturnType<KnowledgeService['queryNodes']>;
        };
        issues: {
            list(limit?: number): ReturnType<KnowledgeService['listIssues']>;
            query(input?: IssueQueryInput): ReturnType<KnowledgeService['queryIssues']>;
        };
        extractions: {
            list(limit?: number, sourceId?: string): ReturnType<KnowledgeService['listExtractions']>;
            get(id: string): ReturnType<KnowledgeService['getExtraction']>;
            getBySourceId(sourceId: string): ReturnType<KnowledgeService['getSourceExtraction']>;
        };
        items: {
            get(id: string): ReturnType<KnowledgeService['getItem']>;
            getMany(ids: readonly string[]): ReturnType<KnowledgeService['getItems']>;
            neighbors(kind: Parameters<KnowledgeService['getNeighbors']>[0], id: string, input?: NeighborInput): ReturnType<KnowledgeService['getNeighbors']>;
            search(query: string, limit?: number): ReturnType<KnowledgeService['search']>;
        };
    };
    readonly usage: {
        list(limit?: number, input?: UsageListInput): ReturnType<KnowledgeService['listUsageRecords']>;
        record(input: RecordUsageInput): ReturnType<KnowledgeService['recordUsage']>;
    };
    readonly connectors: {
        list(): ReturnType<KnowledgeService['listConnectors']>;
        get(id: string): ReturnType<KnowledgeService['getConnector']>;
        doctor(id: string): ReturnType<KnowledgeService['doctorConnector']>;
        register(connector: Parameters<KnowledgeService['registerConnector']>[0], options?: Parameters<KnowledgeService['registerConnector']>[1]): void;
    };
    readonly ingest: {
        url(input: KnowledgeApiUrlIngestInput): ReturnType<KnowledgeService['ingestUrl']>;
        artifact(input: KnowledgeApiArtifactIngestInput): ReturnType<KnowledgeService['ingestArtifact']>;
        bookmarksFile(input: ImportBookmarksInput): ReturnType<KnowledgeService['importBookmarksFromFile']>;
        urlsFile(input: ImportUrlsInput): ReturnType<KnowledgeService['importUrlsFromFile']>;
        bookmarkSeeds(input: BookmarkSeedsInput): ReturnType<KnowledgeService['ingestBookmarkSeeds']>;
        withConnector(connectorId: Parameters<KnowledgeService['ingestWithConnector']>[0], input: Parameters<KnowledgeService['ingestWithConnector']>[1], sessionId?: Parameters<KnowledgeService['ingestWithConnector']>[2]): ReturnType<KnowledgeService['ingestWithConnector']>;
        connectorInput(input: ConnectorInput): ReturnType<KnowledgeService['ingestConnectorInput']>;
    };
    readonly packets: {
        build(task: PacketTask, writeScope?: PacketWriteScope, limit?: PacketLimit, options?: PacketOptions): ReturnType<KnowledgeService['buildPacket']>;
        buildSync(task: PacketTask, writeScope?: PacketWriteScope, limit?: PacketLimit, options?: PacketOptions): ReturnType<KnowledgeService['buildPacketSync']>;
        buildPrompt(task: PacketTask, writeScope?: PacketWriteScope, limit?: PacketLimit, options?: PacketOptions): ReturnType<KnowledgeService['buildPromptPacket']>;
        buildPromptSync(task: PacketTask, writeScope?: PacketWriteScope, limit?: PacketLimit, options?: PacketOptions): ReturnType<KnowledgeService['buildPromptPacketSync']>;
    };
    readonly projections: {
        listTargets(limit?: number): ReturnType<KnowledgeService['listProjectionTargets']>;
        render(input: ProjectionRenderInput): ReturnType<KnowledgeService['renderProjection']>;
        materialize(input: ProjectionMaterializeInput): ReturnType<KnowledgeService['materializeProjection']>;
    };
    readonly jobs: {
        list(): ReturnType<KnowledgeService['listJobs']>;
        get(id: string): ReturnType<KnowledgeService['getJob']>;
        runs(limit?: number, jobId?: string): ReturnType<KnowledgeService['listJobRuns']>;
        run(id: string, input?: RunJobInput): ReturnType<KnowledgeService['runJob']>;
        schedules: {
            list(limit?: number): ReturnType<KnowledgeService['listSchedules']>;
            get(id: string): ReturnType<KnowledgeService['getSchedule']>;
            save(input: ScheduleSaveInput): ReturnType<KnowledgeService['saveSchedule']>;
            delete(id: string): ReturnType<KnowledgeService['deleteSchedule']>;
            setEnabled(id: string, enabled: boolean): ReturnType<KnowledgeService['setScheduleEnabled']>;
        };
    };
    readonly consolidation: {
        candidates(limit?: number, input?: CandidateListInput): ReturnType<KnowledgeService['listConsolidationCandidates']>;
        getCandidate(id: string): ReturnType<KnowledgeService['getConsolidationCandidate']>;
        reports(limit?: number): ReturnType<KnowledgeService['listConsolidationReports']>;
        getReport(id: string): ReturnType<KnowledgeService['getConsolidationReport']>;
        decide(candidateId: string, decision: ConsolidationDecision, input?: ConsolidationDecisionInput): ReturnType<KnowledgeService['decideConsolidationCandidate']>;
    };
    readonly memory?: MemoryApi;
}
export declare function createMemoryApi(memoryRegistry: MemoryApiRegistry): MemoryApi;
export declare function createKnowledgeApi(knowledgeService: KnowledgeService, options?: CreateKnowledgeApiOptions): KnowledgeApi;
//# sourceMappingURL=knowledge-api.d.ts.map