fix: use hermes_yaml with yaml fallback; add model column to default config

PyYAML is no longer installed in the Hermes venv since recent updates —
/sl failed at runtime with ModuleNotFoundError: No module named 'yaml'.
Now uses the core hermes_yaml module, falling back to PyYAML when present.
This commit is contained in:
git_alhan committed 2026-09-28 14:57:39 +03:00
1 parent d45bfbee2a
commit 992e17d458
2 files changed
+11 -4

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
__pycache__/
docs/.bak/
+9 -4
View File
@@ -171,8 +171,9 @@ def _ensure_default_config() -> None:
# Used by /sl slash command. Survives `hermes update`.
columns:
- {field: last_active, width: 10, label: Active}
- {field: title, width: 42, label: Title}
- {field: last_active, width: 7, label: Active}
- {field: title, width: 28, label: Title}
- {field: model, width: 14, label: Model}
- {field: message_count, width: 4, label: Msgs}
- {field: cache_read_tokens, width: 6, label: Hit}
- {field: input_tokens, width: 6, label: Miss}
@@ -191,14 +192,18 @@ columns:
def _handle_sl(raw_args: str) -> Optional[str]:
"""Handle /sl [limit] — show recent sessions with custom columns."""
import yaml
try:
from hermes_yaml import safe_load as yaml_safe_load
except ImportError:
import yaml
yaml_safe_load = yaml.safe_load
config_path = _hermes_home() / "session_list_config.yaml"
# Load column config
try:
if config_path.exists():
cfg = yaml.safe_load(config_path.read_text(encoding="utf-8"))
cfg = yaml_safe_load(config_path.read_text(encoding="utf-8"))
columns = cfg.get("columns", [])
else:
columns = []