// Type contracts for the indexing orchestrator (Epic #189, Issue #196). The orchestrator
// composes #194 discovery, #195 chunking, and #192 embedding capability into a single
// streaming pipeline that produces `vectors` rows for a capsule. Every state change emits
// one `IndexingEvent`; consumers (UI surfaces, evidence ledger, CLI) read the event stream
// rather than polling the database.
//
// The progress channel is an event union (not a number) so a consumer can branch on the
// `kind` discriminant and surface domain-specific UI per state — matching the pattern the
// discovery layer (#194) and the verification orchestrator (#7) already use elsewhere in
// the codebase.
import { KnowledgeStoreError } from "../errors.js";
// ─── Defaults (declared up-front so callers can reason about behaviour) ──────
// Hard caps tracked in the orchestrator. The contract scope (#196) requires:
//   * batch size cap = 64 chunks per embedding flush
//   * concurrent in-flight batches ≤ 4
// Lower defaults are not exposed because they bias toward "more requests, smaller batches"
// which costs more roundtrips without saving memory in our pipeline.
export const DEFAULT_INDEXING_BATCH_SIZE = 64;
export const DEFAULT_INDEXING_CONCURRENCY = 4;
// Distinct from KnowledgeStoreError so a test asserting "indexing failed" cannot
// accidentally accept any other store error. Extends KnowledgeStoreError so callers that
// catch the parent class still see the failure.
export class IndexingError extends KnowledgeStoreError {
    name = "IndexingError";
    code;
    constructor(code, message, options) {
        super(message, options);
        this.code = code;
    }
}
