/**
 * Entity Split Service (Domain Layer)
 *
 * R5 of the conversation entity collision fix. Inverse of `entity_merge.ts`:
 * takes an entity that was over-merged (typically by the pre-v1.2 heuristic
 * `name_key:title` path for session-scoped schemas), selects a subset of its
 * observations via a declarative predicate, and re-points those observations
 * onto a new entity. Symmetric with the shipped merge flow —
 * observation *content* is never modified; only the `entity_id` foreign key
 * is re-bound (see `docs/subsystems/observation_architecture.md` reconciled
 * with `docs/subsystems/entity_merge.md` § 4.3).
 *
 * Schema-agnostic: the service never branches on entity_type. Predicates
 * operate on fields every observation row carries (entity_id, observed_at,
 * source_id, fields blob) so adding a new session-scoped schema needs no
 * code change here.
 */
/**
 * Declarative predicate describing which observations of the source entity
 * should be re-pointed onto the new entity. Start small and schema-agnostic;
 * every predicate form reads a column that every observation row carries.
 */
export interface SplitPredicate {
    /**
     * Select observations whose `observed_at` is >= this ISO-8601 timestamp.
     * Primary use case: "everything from this session forward moved to a new
     * entity because two sessions got merged by title".
     */
    observed_at_gte?: string;
    /**
     * Select observations whose `source_id` is one of the listed sources.
     * Useful when a single over-merged entity collected observations from
     * distinct sources that should live on separate entities.
     */
    source_id_in?: string[];
    /**
     * Select observations whose `fields.<field>` equals the given value (or
     * begins with the given prefix when `value_starts_with` is supplied). The
     * comparison is string-equals / string-prefix; no type coercion.
     */
    observation_field_equals?: {
        field: string;
        value?: string;
        value_starts_with?: string;
    };
}
export interface SplitEntityParams {
    sourceEntityId: string;
    userId: string;
    predicate: SplitPredicate;
    /**
     * Schema + caller-supplied fields for the new entity. The resolver-level
     * identity is derived by caller (they know which `conversation_id` / other
     * canonical_name_field now applies). Canonical_name is required so the
     * deterministic entity_id derivation matches {@link generateEntityId}.
     */
    newEntity: {
        entity_type: string;
        canonical_name: string;
        /** Optional target entity_id override (e.g. a pre-existing entity). */
        target_entity_id?: string;
    };
    /** Required for replay safety; reuse with a different predicate is an error. */
    idempotencyKey: string;
    reason?: string;
    splitBy: string;
}
export interface SplitResult {
    split_id: string;
    source_entity_id: string;
    new_entity_id: string;
    observations_moved: number;
    split_at: string;
    replayed: boolean;
}
export declare class EntityNotFoundError extends Error {
    constructor(message: string);
}
export declare class EntityAlreadyMergedError extends Error {
    constructor(message: string);
}
export declare class SplitPredicateMatchedNothingError extends Error {
    constructor(message: string);
}
export declare class SplitPredicateMatchedAllError extends Error {
    constructor(message: string);
}
export declare class IdempotencyMismatchError extends Error {
    constructor(message: string);
}
export declare function splitEntity(params: SplitEntityParams): Promise<SplitResult>;
//# sourceMappingURL=entity_split.d.ts.map