import type { CapsuleSet, CapsuleSetId, KnowledgeCapsuleId, KnowledgeSourceId, KnowledgeSourceScopeKind } from "@oscharko-dev/keiko-contracts";
import { type AddCapsuleSourceInput } from "./source-lifecycle.js";
import type { KnowledgeStore } from "./store.js";
export type CompositionErrorCode = "empty-source-batch" | "duplicate-source-in-batch" | "source-already-linked" | "empty-capsule-list" | "duplicate-capsule-in-batch";
export declare class CompositionError extends Error {
    readonly code: CompositionErrorCode;
    constructor(code: CompositionErrorCode, message: string);
}
export interface ComposedRetrievalScope {
    readonly capsuleSetId: CapsuleSetId;
    readonly capsuleIds: readonly KnowledgeCapsuleId[];
    readonly sourceIds: readonly KnowledgeSourceId[];
    readonly alwaysQueryCapsuleIds: readonly KnowledgeCapsuleId[];
    readonly sourceRoutingByCapsule: ReadonlyMap<KnowledgeCapsuleId, string>;
}
export interface RetrievalCapsuleSummary {
    readonly id: KnowledgeCapsuleId;
    readonly displayName: string;
    readonly sourceCount: number;
    readonly alwaysQuery: boolean;
}
export interface RetrievalSourceSummary {
    readonly id: KnowledgeSourceId;
    readonly displayName: string;
    readonly capsuleId: KnowledgeCapsuleId;
    readonly scopeKind: KnowledgeSourceScopeKind;
}
export interface RetrievalScopeDisclosure {
    readonly capsuleSetId: CapsuleSetId;
    readonly capsuleSummaries: readonly RetrievalCapsuleSummary[];
    readonly sourceSummaries: readonly RetrievalSourceSummary[];
}
export type CapsuleMembershipChangeKind = "add-source" | "remove-source" | "compose-set";
export interface CapsuleMembershipChange {
    readonly id: string;
    readonly capsuleId: KnowledgeCapsuleId;
    readonly changeKind: CapsuleMembershipChangeKind;
    readonly sourceId: KnowledgeSourceId | undefined;
    readonly detailsJson: string | undefined;
    readonly occurredAt: number;
}
export interface AddSourcesToCapsuleResult {
    readonly capsuleId: KnowledgeCapsuleId;
    readonly addedSourceIds: readonly KnowledgeSourceId[];
}
export interface ComposeCapsulesOptions {
    readonly displayName: string;
    readonly description?: string;
    readonly capsuleIds: readonly KnowledgeCapsuleId[];
    readonly tags?: readonly string[];
}
export declare function buildComposedRetrievalScope(store: KnowledgeStore, capsuleSetId: CapsuleSetId): ComposedRetrievalScope;
export declare function describeRetrievalScope(scope: ComposedRetrievalScope, store: KnowledgeStore): RetrievalScopeDisclosure;
export declare function addSourcesToCapsule(store: KnowledgeStore, capsuleId: KnowledgeCapsuleId, inputs: readonly AddCapsuleSourceInput[]): AddSourcesToCapsuleResult;
export declare function composeCapsules(store: KnowledgeStore, opts: ComposeCapsulesOptions): CapsuleSet;
export declare function listCapsuleMembershipChanges(store: KnowledgeStore, capsuleId: KnowledgeCapsuleId): readonly CapsuleMembershipChange[];
//# sourceMappingURL=composition.d.ts.map