Maintain a fixed-width beam of promising programs; expand one per step, prune by fitness+diversity.
"""Beam Search Proposer component — the SEARCH/REPLACE diff (with full-rewrite fallback) operator."""
from __future__ import annotations
from ...components.proposer import DiffProposer
class BeamSearchProposer(DiffProposer):
"""One LLM call -> a SEARCH/REPLACE diff applied to the parent (SkyDiscover's solution generator),
with mandatory no-op detection. Expanding a beam member produces one child.
beam_search runs the DEFAULT ``DiscoveryController`` (it registers no custom controller), whose
diff-mode ``_parse_llm_response`` applies diffs by WHOLE-LINE matching (``apply_diff``) and is
STRICT: a response with no SEARCH/REPLACE block, or a block that does not match the parent, is a
parse error → retried/discarded, never a full rewrite and never an evaluated parent-duplicate. So
whole-line is on but the full-rewrite fallback is OFF — identical to topk/best_of_n."""
diff_wholeline = True