Skip to content

ValidateCandidate

ValidateCandidate = (candidate) => Result<ValidatedCandidate, EngineError>

Defined in: packages/engine/src/lib/planner/stage.ts:66

Heals and validates a candidate against the original request, the same way the Engine validates the candidate it ships. Results are cached per candidate object for the request, so validating inside a stage costs nothing extra when the same candidate reaches the Engine. A failure that healing cannot absorb (for example a missing userMessage) is an Err; nothing throws.

Because results are cached by object identity, a candidate must not change once it is validated: a stage that produces a different plan returns a new object. PlannerCandidate is deeply readonly to enforce this.

PlannerCandidate

Result<ValidatedCandidate, EngineError>