/** * Anti-Hallucination Validation Rules * * Implements CLEO's anti-hallucination requirements: * - Title and description both required and different * - No future timestamps * - No duplicate task descriptions * - Unique IDs across active and archived task data * - Valid status transitions * - Hierarchy constraints (configurable max depth, configurable max siblings; 0 = unlimited) */ /** * Validation error from anti-hallucination checks */ export interface RuleViolation { rule: string; field: string; message: string; severity: 'error' | 'warning'; } /** * Task-like object for validation (doesn't need full Task type) */ interface TaskLike { id?: string; title?: string; description?: string; status?: string; createdAt?: string; updatedAt?: string | null; completedAt?: string | null; cancelledAt?: string | null; parentId?: string | null; type?: string; } /** * Validate that title and description are both present and different. * This is a critical anti-hallucination check. */ export declare function validateTitleDescription(title?: string, description?: string): RuleViolation[]; /** * Validate that timestamps are not in the future */ export declare function validateTimestamps(task: TaskLike): RuleViolation[]; /** * Validate ID uniqueness across all tasks (todo + archive) */ export declare function validateIdUniqueness(taskId: string, existingIds: Set): RuleViolation[]; /** * Validate no duplicate task descriptions */ export declare function validateNoDuplicateDescription(description: string, existingDescriptions: string[], _excludeTaskId?: string): RuleViolation[]; /** * Validate hierarchy constraints. * Accepts optional limits to override defaults (from config). */ export declare function validateHierarchy(parentId: string | null | undefined, tasks: Array<{ id: string; parentId?: string | null; type?: string; }>, _taskType?: string, limits?: { maxDepth?: number; maxSiblings?: number; }): RuleViolation[]; /** * Validate status transition */ export declare function validateStatusTransition(currentStatus: string, newStatus: string): RuleViolation[]; /** * Run all validation rules on a task being created */ export declare function validateNewTask(task: TaskLike, existingIds: Set, existingDescriptions: string[], existingTasks: Array<{ id: string; parentId?: string | null; type?: string; }>, limits?: { maxDepth?: number; maxSiblings?: number; }): RuleViolation[]; /** * Check if violations contain any errors (not just warnings) */ export declare function hasErrors(violations: RuleViolation[]): boolean; export {}; //# sourceMappingURL=validation-rules.d.ts.map