docs/index.html is a single classic <script>. Eight scars from bad
auto-merges (duplicated old/new versions of the same LLM-call sites left
side by side) made the script fail to PARSE, so nothing ran: the UI stuck
on "Initializing…", every link/handler dead, only the pre-registered
selfimprove/ledger poller still firing.
A parse error surfaces one at a time (the engine stops at the first), so
these were only visible once each prior one was fixed. Repaired:
- _safeLLMCallOnce: duplicate `response` decl + a leftover pre-refactor
fetch; restored backend-aware endpoint/headers (OpenRouter + Venice,
backend.key) and kept the cancellable AbortController.
- runLLMJudge: two function bodies concatenated (one nested, never closed).
- safeLLMCall: the whole function duplicated (old truncated head + new
loop that referenced an undefined `backend`); reunified into one
function with backend resolution, agent/server routing, model chain and
the fallback loop.
- runBenchmarks / autoApplyRecommendations: old "ANY LLM backend"
guard left un-closed before the new "reachable (key or local mode)"
guard — dropped the dead old guard / restored the missing brace.
- generateAnalysis auto-apply button, config-optimizer, self-improve and
CTF call sites: duplicated option objects / double catch collapsed to
the newer (_noFallback / cancellable) variant.
Verified on macOS: new regression test compiles every classic inline
<script> with node:vm (the RED baseline failed with "Identifier response
has already been declared"); full suite 646 green; headless-Chromium boot
now reaches "Connected", navigateTo is defined, zero uncaught errors.