import { type AutomationScheduleDefinition } from '@pellux/goodvibes-sdk/platform/automation/schedules';
import { ArtifactStore } from '@pellux/goodvibes-sdk/platform/artifacts/index';
import type { MemoryRegistry } from '../state/index.js';
import type { RuntimeEventBus } from '../runtime/events/index.js';
import { KnowledgeConnectorRegistry } from '@pellux/goodvibes-sdk/platform/knowledge/connectors';
import { KnowledgeStore } from '@pellux/goodvibes-sdk/platform/knowledge/store';
import type { KnowledgeBatchIngestResult, KnowledgeBookmarkSeed, KnowledgeConnector, KnowledgeConnectorDoctorReport, KnowledgeConsolidationCandidateRecord, KnowledgeConsolidationReportRecord, KnowledgeEdgeRecord, KnowledgeExtractionRecord, KnowledgeIssueRecord, KnowledgeJobMode, KnowledgeJobRecord, KnowledgeJobRunRecord, KnowledgeMaterializedProjection, KnowledgeItemView, KnowledgeNodeRecord, KnowledgePacket, KnowledgePacketDetail, KnowledgeProjectionBundle, KnowledgeProjectionTarget, KnowledgeProjectionTargetKind, KnowledgeScheduleRecord, KnowledgeSearchResult, KnowledgeSourceRecord, KnowledgeSourceType, KnowledgeStatus, KnowledgeUsageRecord } from '@pellux/goodvibes-sdk/platform/knowledge/types';
export interface KnowledgeServiceConfig {
    readonly configManager?: {
        getControlPlaneConfigDir?: () => string;
    };
    readonly memoryRegistry: Pick<MemoryRegistry, 'add' | 'getAll' | 'getStore'>;
    readonly runtimeBus?: RuntimeEventBus | null;
}
export interface KnowledgeServiceStatus extends KnowledgeStatus {
    readonly note: string;
}
export declare class KnowledgeService {
    private readonly store;
    private readonly artifactStore;
    private readonly connectorRegistry;
    private readonly options;
    private readonly projectionService;
    private readonly scheduleService;
    private runtimeBus;
    constructor(store: KnowledgeStore, artifactStore: ArtifactStore, connectorRegistry: KnowledgeConnectorRegistry | undefined, options: KnowledgeServiceConfig);
    private getIngestContext;
    private getPacketContext;
    private getConsolidationContext;
    attachRuntimeBus(runtimeBus: RuntimeEventBus | null | undefined): void;
    getStatus(): Promise<KnowledgeServiceStatus>;
    listUsageRecords(limit?: number, input?: {
        readonly targetKind?: KnowledgeUsageRecord['targetKind'];
        readonly targetId?: string;
        readonly usageKind?: KnowledgeUsageRecord['usageKind'];
    }): readonly KnowledgeUsageRecord[];
    listConsolidationCandidates(limit?: number, input?: {
        readonly status?: KnowledgeConsolidationCandidateRecord['status'];
        readonly subjectKind?: KnowledgeConsolidationCandidateRecord['subjectKind'];
        readonly subjectId?: string;
    }): readonly KnowledgeConsolidationCandidateRecord[];
    getConsolidationCandidate(id: string): KnowledgeConsolidationCandidateRecord | null;
    listConsolidationReports(limit?: number): readonly KnowledgeConsolidationReportRecord[];
    getConsolidationReport(id: string): KnowledgeConsolidationReportRecord | null;
    listSchedules(limit?: number): readonly KnowledgeScheduleRecord[];
    getSchedule(id: string): KnowledgeScheduleRecord | null;
    listSources(limit?: number): KnowledgeSourceRecord[];
    querySources(input?: {
        readonly limit?: number;
        readonly offset?: number;
        readonly status?: string;
        readonly connectorId?: string;
        readonly sourceType?: string;
        readonly tag?: string;
        readonly query?: string;
    }): {
        total: number;
        items: KnowledgeSourceRecord[];
    };
    listNodes(limit?: number): KnowledgeNodeRecord[];
    queryNodes(input?: {
        readonly limit?: number;
        readonly offset?: number;
        readonly kind?: string;
        readonly status?: string;
        readonly query?: string;
    }): {
        total: number;
        items: KnowledgeNodeRecord[];
    };
    listIssues(limit?: number): KnowledgeIssueRecord[];
    queryIssues(input?: {
        readonly limit?: number;
        readonly offset?: number;
        readonly severity?: string;
        readonly status?: string;
        readonly code?: string;
        readonly query?: string;
    }): {
        total: number;
        items: KnowledgeIssueRecord[];
    };
    listExtractions(limit?: number, sourceId?: string): KnowledgeExtractionRecord[];
    getExtraction(id: string): KnowledgeExtractionRecord | null;
    getSourceExtraction(sourceId: string): KnowledgeExtractionRecord | null;
    listConnectors(): readonly KnowledgeConnector[];
    getConnector(id: string): KnowledgeConnector | null;
    doctorConnector(id: string): Promise<KnowledgeConnectorDoctorReport | null>;
    registerConnector(connector: KnowledgeConnector, options?: {
        replace?: boolean;
    }): void;
    getItem(id: string): KnowledgeItemView | null;
    getItems(ids: readonly string[]): KnowledgeItemView[];
    recordUsage(input: {
        readonly targetKind: KnowledgeUsageRecord['targetKind'];
        readonly targetId: string;
        readonly usageKind: KnowledgeUsageRecord['usageKind'];
        readonly task?: string;
        readonly sessionId?: string;
        readonly score?: number;
        readonly metadata?: Record<string, unknown>;
    }): Promise<KnowledgeUsageRecord>;
    getNeighbors(kind: 'source' | 'node', id: string, input?: {
        readonly relation?: string;
        readonly limit?: number;
    }): {
        readonly edges: readonly KnowledgeEdgeRecord[];
        readonly sources: readonly KnowledgeSourceRecord[];
        readonly nodes: readonly KnowledgeNodeRecord[];
    };
    ingestUrl(input: {
        readonly url: string;
        readonly title?: string;
        readonly tags?: readonly string[];
        readonly folderPath?: string;
        readonly sessionId?: string;
        readonly sourceType?: KnowledgeSourceType;
        readonly connectorId?: string;
        readonly allowPrivateHosts?: boolean;
        readonly metadata?: Record<string, unknown>;
    }): Promise<{
        source: KnowledgeSourceRecord;
        artifactId?: string;
        extraction?: KnowledgeExtractionRecord;
        issues: readonly KnowledgeIssueRecord[];
    }>;
    ingestArtifact(input: {
        readonly artifactId?: string;
        readonly path?: string;
        readonly uri?: string;
        readonly title?: string;
        readonly tags?: readonly string[];
        readonly folderPath?: string;
        readonly sessionId?: string;
        readonly sourceType?: KnowledgeSourceType;
        readonly connectorId?: string;
        readonly allowPrivateHosts?: boolean;
        readonly metadata?: Record<string, unknown>;
    }): Promise<{
        source: KnowledgeSourceRecord;
        artifactId?: string;
        extraction?: KnowledgeExtractionRecord;
        issues: readonly KnowledgeIssueRecord[];
    }>;
    importBookmarksFromFile(input: {
        readonly path: string;
        readonly sessionId?: string;
        readonly allowPrivateHosts?: boolean;
    }): Promise<KnowledgeBatchIngestResult>;
    importUrlsFromFile(input: {
        readonly path: string;
        readonly sessionId?: string;
        readonly allowPrivateHosts?: boolean;
    }): Promise<KnowledgeBatchIngestResult>;
    ingestBookmarkSeeds(seeds: readonly KnowledgeBookmarkSeed[], sessionId?: string, sourceType?: KnowledgeSourceType, connectorId?: string, allowPrivateHosts?: boolean): Promise<KnowledgeBatchIngestResult>;
    ingestWithConnector(connectorId: string, input: unknown, sessionId?: string, allowPrivateHosts?: boolean): Promise<KnowledgeBatchIngestResult>;
    ingestConnectorInput(input: {
        readonly connectorId: string;
        readonly input?: unknown;
        readonly content?: string;
        readonly path?: string;
        readonly sessionId?: string;
        readonly allowPrivateHosts?: boolean;
    }): Promise<KnowledgeBatchIngestResult>;
    listProjectionTargets(limit?: number): Promise<KnowledgeProjectionTarget[]>;
    renderProjection(input: {
        readonly kind: KnowledgeProjectionTargetKind;
        readonly id?: string;
        readonly limit?: number;
    }): Promise<KnowledgeProjectionBundle>;
    materializeProjection(input: {
        readonly kind: KnowledgeProjectionTargetKind;
        readonly id?: string;
        readonly limit?: number;
        readonly filename?: string;
    }): Promise<KnowledgeMaterializedProjection>;
    reindex(): Promise<{
        status: KnowledgeStatus;
        issues: readonly KnowledgeIssueRecord[];
    }>;
    search(query: string, limit?: number): KnowledgeSearchResult[];
    buildPacket(task: string, writeScope?: readonly string[], limit?: number, options?: {
        readonly detail?: KnowledgePacketDetail;
        readonly budgetLimit?: number;
    }): Promise<KnowledgePacket>;
    buildPacketSync(task: string, writeScope?: readonly string[], limit?: number, options?: {
        readonly detail?: KnowledgePacketDetail;
        readonly budgetLimit?: number;
    }): KnowledgePacket | null;
    buildPromptPacketSync(task: string, writeScope?: readonly string[], limit?: number, options?: {
        readonly detail?: KnowledgePacketDetail;
        readonly budgetLimit?: number;
    }): string | null;
    buildPromptPacket(task: string, writeScope?: readonly string[], limit?: number, options?: {
        readonly detail?: KnowledgePacketDetail;
        readonly budgetLimit?: number;
    }): Promise<string | null>;
    listJobs(): readonly KnowledgeJobRecord[];
    getJob(id: string): KnowledgeJobRecord | null;
    saveSchedule(input: {
        readonly id?: string;
        readonly jobId: string;
        readonly label?: string;
        readonly enabled?: boolean;
        readonly schedule: AutomationScheduleDefinition;
        readonly metadata?: Record<string, unknown>;
    }): Promise<KnowledgeScheduleRecord>;
    deleteSchedule(id: string): Promise<boolean>;
    setScheduleEnabled(id: string, enabled: boolean): Promise<KnowledgeScheduleRecord | null>;
    decideConsolidationCandidate(id: string, decision: 'accept' | 'reject' | 'supersede', input?: {
        readonly decidedBy?: string;
        readonly memoryClass?: string;
        readonly scope?: string;
        readonly detail?: string;
    }): Promise<KnowledgeConsolidationCandidateRecord>;
    listJobRuns(limit?: number, jobId?: string): readonly KnowledgeJobRunRecord[];
    runJob(id: string, input?: {
        readonly mode?: KnowledgeJobMode;
        readonly sourceIds?: readonly string[];
        readonly limit?: number;
    }): Promise<KnowledgeJobRunRecord>;
    private runJobByKind;
    private deferUsage;
    private syncReviewedMemory;
    private dispose;
    lint(): Promise<readonly KnowledgeIssueRecord[]>;
    private emitIfReady;
}
export declare function buildCuratedKnowledgePromptSync(service: Pick<KnowledgeService, 'buildPromptPacketSync'>, task: string, writeScope?: readonly string[]): string | null;
//# sourceMappingURL=service.d.ts.map