// Type contracts for the chunking layer (Epic #189, Issue #195). Chunks are the unit of
// retrieval — each row in the `chunks` table references exactly one parsed_unit (the
// citation hop entrypoint) and carries `safeExcerptHash` (SHA-256 hex) instead of raw
// text so the row is safe to copy across the trust boundary. Raw text is reconstructable
// at retrieval time via parsed_unit → document → bytes.
//
// `tokenEstimator` is injected so future tokenizer upgrades (#196, #199) can swap in a
// real tokenizer (e.g. tiktoken) without rewiring callers. The default estimator in
// `token-estimator.ts` is intentionally crude (~4 chars per token) — see that file's
// header for the documented limitation.
import { KnowledgeStoreError } from "../errors.js";
// Defaults documented inline so a caller passing `{}` gets predictable behaviour.
export const DEFAULT_MAX_TOKENS = 400;
export const DEFAULT_MIN_TOKENS = 64;
export const DEFAULT_OVERLAP_TOKENS = 32;
export const CHUNKING_STRATEGY_VERSION = "issue-195-v1";
// Distinct from KnowledgeStoreError so a test asserting "chunking guard fail-closed" cannot
// accidentally accept any other error class. Extends KnowledgeStoreError so callers that
// only catch the parent class still see the failure.
export class ChunkingError extends KnowledgeStoreError {
    name = "ChunkingError";
}
