Skip to main content

resolve_draft_source_kind

Function resolve_draft_source_kind 

Source
pub fn resolve_draft_source_kind(
    plan: DraftSourcePlan,
    embedded_head_loaded: bool,
    dflash_loaded: bool,
) -> Result<DraftSourceKind, String>
Expand description

The uniform draft-source selection law. Pure — no env, no engine, no family types — so it is CPU-gateable and so every spec family answers “which source” the same way.

THE LAW, in precedence order:

  1. A LOADED DFlash2 drafter IS the source. The operator asked for it by name (a set drafter flag that cannot load is already a loud boot failure, never a silent fallback), and the family’s embedded head is deliberately NOT loaded for this source — it is a full trunk layer of VRAM.
  2. Otherwise the embedded head, and only when the PLAN declares an embedded source: a loaded head under a plan that does not declare Embedded is a load-path bug, not a draft source, and it is refused by name rather than drafted from.
  3. Otherwise there is no draft source and speculative decode must refuse before drafting.