/** * Tree Builder - Constructs hierarchical call tree from trace events */ import { TraceEvent } from './timeline.js'; import { SourceClauseMap } from './clauses.js'; export interface TreeNode { id: string; goal: string; clauseHead?: string; clauseNumber?: string; callStep: number; exitStep?: number; status: 'success' | 'failure' | 'pending'; children: TreeNode[]; finalBinding?: string; subgoals?: Array<{ label: string; goal: string; }>; } /** * Tree Builder class - constructs call tree from trace events */ export declare class TreeBuilder { private events; private sourceClauseMap?; private timeline?; private nodes; private nodeCounter; private callStack; private stepToNode; private stepCounter; constructor(events: TraceEvent[], sourceClauseMap?: SourceClauseMap | undefined, timeline?: any[] | undefined); /** * Check if a predicate is part of tracer infrastructure and should be filtered */ private isTracerPredicate; /** * Build the complete tree from trace events */ build(): TreeNode | null; /** * Backfill clause information from EXIT events to nodes * CALL events don't have clause info, only EXIT events do */ private backfillClauseInfo; /** * Generate node ID (A-Z, AA-AZ, BA-BZ, ...) */ private generateNodeId; /** * Process CALL event - create new node */ private processCall; /** * Extract subgoals from a clause body */ private extractSubgoals; /** * Process EXIT event - mark node as successful */ private processExit; /** * Discard the failed clause attempt for the goal at the given level. * Removes the node's descendants (the work done by the clause that failed) * and clears its clause info so it is re-derived from the next CALL/EXIT. */ private discardFailedAttempt; /** * Process FAIL event - mark node as failed */ private processFail; /** * Extract binding by comparing CALL and EXIT goals */ private extractBinding; /** * Split arguments respecting parentheses and brackets */ private splitArguments; } //# sourceMappingURL=tree.d.ts.map