Clamp a requested step budget into a sane range.
(n)
| 77 | |
| 78 | /** Clamp a requested step budget into a sane range. */ |
| 79 | function clampSteps(n) { |
| 80 | const v = Number(n); |
| 81 | if (!Number.isFinite(v)) return AUTOPILOT_MAX_STEPS; |
| 82 | return Math.max(1, Math.min(50, Math.round(v))); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Kick off an Autopilot run for this instance. Returns immediately; the run loop |