36 lines
1.1 KiB
TypeScript

/**
* Rule evaluation - barrel exports
*/
import type { WorkflowMovement, WorkflowState } from '../../models/types.js';
import { RuleEvaluator } from './RuleEvaluator.js';
import { AggregateEvaluator } from './AggregateEvaluator.js';
export { RuleEvaluator, type RuleMatch, type RuleEvaluatorContext } from './RuleEvaluator.js';
export { AggregateEvaluator } from './AggregateEvaluator.js';
// ---- Function facades for consumers that prefer the function API ----
import type { RuleMatch, RuleEvaluatorContext } from './RuleEvaluator.js';
/**
* Detect matched rule for a movement's response.
* Function facade over RuleEvaluator class.
*/
export async function detectMatchedRule(
step: WorkflowMovement,
agentContent: string,
tagContent: string,
ctx: RuleEvaluatorContext,
): Promise<RuleMatch | undefined> {
return new RuleEvaluator(step, ctx).evaluate(agentContent, tagContent);
}
/**
* Evaluate aggregate conditions.
* Function facade over AggregateEvaluator class.
*/
export function evaluateAggregateConditions(step: WorkflowMovement, state: WorkflowState): number {
return new AggregateEvaluator(step, state).evaluate();
}