/** * WorkGraph containment reparent preflight checks. * * Evaluates proposed `tasks.parent_id` mutations before callers touch storage so * they can surface typed diagnostics for containment cycles, depth violations, * and hierarchy parent/type matrix breaches. * * @task T10578 * @saga T10538 */ import type { TaskType, WorkGraphHierarchyInputNode, WorkGraphHierarchyViolation } from '@cleocode/contracts'; import { type E_WORKGRAPH_PARENT_TYPE_MATRIX } from '@cleocode/contracts'; /** Stable error code for proposed containment cycles. */ export declare const E_WORKGRAPH_CONTAINMENT_CYCLE = "E_WORKGRAPH_CONTAINMENT_CYCLE"; /** Stable error code for proposals exceeding the configured containment depth. */ export declare const E_WORKGRAPH_MAX_DEPTH_EXCEEDED = "E_WORKGRAPH_MAX_DEPTH_EXCEEDED"; /** Stable error code for malformed reparent proposals. */ export declare const E_WORKGRAPH_REPARENT_TARGET_NOT_FOUND = "E_WORKGRAPH_REPARENT_TARGET_NOT_FOUND"; /** Cycle diagnostic returned by WorkGraph reparent preflight. */ export interface WorkGraphContainmentCycleFinding { readonly code: typeof E_WORKGRAPH_CONTAINMENT_CYCLE; readonly taskId: string; readonly parentId: string; /** Containment path showing the proposed cycle, starting and ending at `taskId`. */ readonly path: readonly string[]; readonly message: string; } /** Depth diagnostic returned by WorkGraph reparent preflight. */ export interface WorkGraphMaxDepthFinding { readonly code: typeof E_WORKGRAPH_MAX_DEPTH_EXCEEDED; readonly taskId: string; readonly parentId: string | null; /** Proposed containment depth, measured as edges from hierarchy root to task. */ readonly depth: number; readonly maxDepth: number; /** Proposed root-to-task containment path. */ readonly path: readonly string[]; readonly message: string; } /** Missing node diagnostic returned by WorkGraph reparent preflight. */ export interface WorkGraphReparentTargetNotFoundFinding { readonly code: typeof E_WORKGRAPH_REPARENT_TARGET_NOT_FOUND; readonly taskId: string; readonly parentId: string | null; readonly missingId: string; readonly message: string; } /** Parent/type matrix diagnostic adapted from the hierarchy validator. */ export type WorkGraphReparentParentTypeFinding = WorkGraphHierarchyViolation & { readonly code: typeof E_WORKGRAPH_PARENT_TYPE_MATRIX; }; /** Typed diagnostic returned by {@link preflightWorkGraphReparent}. */ export type WorkGraphReparentFinding = WorkGraphContainmentCycleFinding | WorkGraphMaxDepthFinding | WorkGraphReparentTargetNotFoundFinding | WorkGraphReparentParentTypeFinding; /** Input accepted by WorkGraph reparent preflight. */ export interface WorkGraphReparentPreflightInput { /** Current hierarchy snapshot. */ readonly nodes: readonly WorkGraphHierarchyInputNode[]; /** Node whose direct containment parent would change. */ readonly taskId: string; /** Proposed direct containment parent; null/undefined means reparent to root. */ readonly newParentId?: string | null; /** Maximum allowed containment depth. Defaults to CLEO's epic→task→subtask depth (2). */ readonly maxDepth?: number; } /** Result returned by WorkGraph reparent preflight. */ export interface WorkGraphReparentPreflightResult { readonly taskId: string; readonly proposedParentId: string | null; readonly allowed: boolean; readonly findings: readonly WorkGraphReparentFinding[]; } /** * Preflight a proposed WorkGraph containment reparent mutation. * * The function is storage-agnostic: callers pass the relevant hierarchy rows and * receive typed findings without mutating `tasks.parent_id`. It intentionally * combines graph checks with the existing hierarchy parent/type matrix so CLI, * API, and future adapters can return one deterministic diagnostic envelope. */ export declare function preflightWorkGraphReparent(input: WorkGraphReparentPreflightInput): WorkGraphReparentPreflightResult; /** Task type alias retained here to keep generated API docs linking this module to TaskType. */ export type WorkGraphReparentNodeType = TaskType; //# sourceMappingURL=reparent-preflight.d.ts.map