/** * Batched WorkGraph containment queries backed by the canonical tasks.parent_id * hierarchy. * * This service intentionally reads only the `tasks` table. Saga membership and * other non-containment links remain relation-backed and are not consulted here. * * @task T10577 * @saga T10538 */ import type { WorkGraphContainmentAncestorsResult, WorkGraphContainmentChildrenResult, WorkGraphContainmentQueryService, WorkGraphReadyFrontierOptions, WorkGraphReadyFrontierResult, WorkGraphSubtreeSummaryOptions, WorkGraphSubtreeSummaryResult, WorkGraphTraversalOptions, WorkGraphTraversalResult, WorkGraphTreeOptions, WorkGraphTreeResult } from '@cleocode/contracts'; export interface SqliteWorkGraphContainmentReader { prepare(sql: string): { all(...params: readonly unknown[]): unknown[]; }; } /** SQLite implementation of batched containment lookups for WorkGraph callers. */ export declare class SqliteWorkGraphContainmentQueryService implements WorkGraphContainmentQueryService { #private; constructor(db: SqliteWorkGraphContainmentReader); /** * Load ancestor chains for many roots using a single recursive CTE over * `tasks.parent_id`. * * Results are ordered root-first within each ancestor chain. */ getAncestors(rootIds: readonly string[]): readonly WorkGraphContainmentAncestorsResult[]; /** * Load direct children for many parents using one `parent_id IN (...)` query. * Descendants are intentionally not expanded here. */ getChildren(parentIds: readonly string[]): readonly WorkGraphContainmentChildrenResult[]; /** * Read a paginated descendant tree using one recursive CTE. * * The final row order is breadth-first and stable, and `limit + 1` rows are * fetched so callers can page without issuing per-node child lookups. */ tree(options: WorkGraphTreeOptions): WorkGraphTreeResult; /** * Summarize direct and full-subtree descendant counts for one root. * * Percentages are intentionally tied to the full subtree denominator and the * optional direct projection comparison lets callers detect stale cached child * rollups without trusting any derived storage column. */ summarizeSubtree(options: WorkGraphSubtreeSummaryOptions): WorkGraphSubtreeSummaryResult; /** * Group runnable frontier descendants by dependency readiness while preserving * gate metadata for verification diagnostics. */ readyFrontier(options: WorkGraphReadyFrontierOptions): WorkGraphReadyFrontierResult; /** Traverse descendant containment from a root with cursor/limit and max depth support. */ traverse(options: WorkGraphTraversalOptions): WorkGraphTraversalResult; } /** Create a WorkGraph containment query service over an already-open SQLite DB. */ export declare function createSqliteWorkGraphContainmentQueryService(db: SqliteWorkGraphContainmentReader): WorkGraphContainmentQueryService; //# sourceMappingURL=containment.d.ts.map