/**
 * Linkage helpers for {@link SessionStore} — pure functions over raw store
 * maps so they can be reused by both {@link InMemorySessionStore} and
 * {@link DiskSessionStore}.
 *
 * See session-hierarchy.md §10.4 (Parent-Child Linkage) and §14.3 (drill
 * primitive). Ancestry walks are cycle-guarded via visited-set; detection
 * surfaces as {@link AncestryCycleError}.
 */
import type { SessionId } from '../../types/ids/index.js';
import type { SubSession } from '../../types/session/sub-session.js';
/**
 * Read shape required by the pure linkage helpers. Both in-memory and disk
 * stores project their internal state into this view before delegating.
 */
export interface LinkageView {
    findChildSubSessions(parentSessionId: SessionId): readonly SubSession[];
    findParentSubSession(childSessionId: SessionId): SubSession | null;
}
/**
 * Returns direct children of `sessionId` (one level). Pure over `view`.
 */
export declare function getChildren(view: LinkageView, sessionId: SessionId): readonly SubSession[];
/**
 * Walks parent sub-session links and returns the session id chain from root
 * to `sessionId` inclusive. Guards against cycles via a visited-set — in
 * a healthy store the invariant holds and the guard never fires; a cycle
 * indicates corruption (session-hierarchy.md §4.5 enforces acyclicity on
 * write).
 */
export declare function getAncestry(view: LinkageView, sessionId: SessionId): readonly SessionId[];
/**
 * Pairs {@link SubSession} children with a stable order (spawnedAt ascending,
 * then id as a deterministic tiebreaker). Callers that need a different
 * ordering can re-sort.
 */
export declare function orderChildren(children: readonly SubSession[]): readonly SubSession[];
//# sourceMappingURL=linkage.d.ts.map