Coverage for src/lilbee/modelhub/install_state.py: 100%
14 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-09-28 17:20 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-09-28 17:20 +0000
1"""The single definition of where a native model ref loads from."""
3from __future__ import annotations
5from enum import StrEnum
7from lilbee.modelhub.registry import ModelRegistry
8from lilbee.providers.model_ref import is_loose_model_file
11class InstallState(StrEnum):
12 """Where a native model ref loads from."""
14 REGISTERED = "registered"
15 LOOSE_FILE = "loose_file"
16 MISSING = "missing"
19def install_state(ref: str, registry: ModelRegistry) -> InstallState:
20 """Where *ref* loads from: a registry manifest, a loose GGUF file, or nowhere.
22 A loose file loads in the TUI, the CLI and the fleet, but no model listing
23 shows it and the HTTP chat route cannot resolve it.
24 """
25 if registry.is_installed(ref):
26 return InstallState.REGISTERED
27 if is_loose_model_file(ref):
28 return InstallState.LOOSE_FILE
29 return InstallState.MISSING