Skip to main content

Module speculative

Module speculative 

Source
Expand description

Speculative Execution Validator — pre-validates outputs before dispatch.

Ported from v2’s optimization/speculative_exec.py. Validates AI-generated code or text using a hierarchy of cheap checks:

  1. Bracket/brace balance check (< 1ms)
  2. Security heuristics — regex scan for SQLi, hardcoded secrets, dangerous calls
  3. (Future) Local LLM sanity check

Prevents invalid or unsafe outputs from reaching expensive downstream processes or the user.

Structs§

CheckResult
Result of a single validation check.
SpeculativeExecutor
Speculative executor — validates code/text candidates.
ValidationResult
Full validation result.