Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

ValidationConfig

Defined in: packages/engine/src/constants/Configuration.ts:245

Bounds on untrusted input: expression length and nesting depth.

readonly allowTrailingPunctuation: boolean;

Defined in: packages/engine/src/constants/Configuration.ts:273

Read one ? or . at the end of a line that is complete without it as the end of a sentence, so what is 5 km in miles? answers as what is 5 km in miles does. Never after in, to, as or =, where ? already means something (5 cm in ? lists the units a length converts to), and never for a doubled .. or ??.

Disabled by default for strict parsing, since a . straight after digits is then read as a full stop: 1.5. answers 1.5. Enable for a chat or tool host whose lines are sentences. Costs nothing on a line that parses whole.


readonly autoBalanceParens: boolean;

Defined in: packages/engine/src/constants/Configuration.ts:261

Auto-balance unmatched parentheses by appending missing closing parens or prepending missing opening parens. When disabled, unbalanced expressions cause parse errors instead of being silently corrected.

Disabled by default for strict parsing. Enable for forgiving user input (e.g., chat-style calculators where users often omit closing parens). Has zero overhead when disabled, the O(n) paren-count scan is skipped.


readonly maxComplexity: number;

Defined in: packages/engine/src/constants/Configuration.ts:249

Maximum expression complexity score (tokens + functionCalls×5 + nestingDepth×10). Protects against deeply nested or combinatorially complex expressions.


readonly maxExpressionLength: number;

Defined in: packages/engine/src/constants/Configuration.ts:247

Maximum expression length in characters. Prevents excessively long strings from entering the pipeline.


readonly maxNestingDepth: number;

Defined in: packages/engine/src/constants/Configuration.ts:251

Maximum parentheses nesting depth. Prevents stack overflow in the recursive-descent parser.