hermes-agent/gateway
Teknium 2e524272b1
refactor(model): extract shared switch_model() from CLI and gateway handlers
Phase 4 of the /model command overhaul.

Both the CLI (cli.py) and gateway (gateway/run.py) /model handlers
had ~50 lines of duplicated core logic: parsing, provider detection,
credential resolution, and model validation. This extracts that
pipeline into hermes_cli/model_switch.py.

New module exports:
- ModelSwitchResult: dataclass with all fields both handlers need
- CustomAutoResult: dataclass for bare '/model custom' results
- switch_model(): core pipeline — parse → detect → resolve → validate
- switch_to_custom_provider(): resolve endpoint + auto-detect model

The shared functions are pure (no I/O side effects). Each caller
handles its own platform-specific concerns:
- CLI: sets self.model/provider/etc, calls save_config_value(), prints
- Gateway: writes config.yaml directly, sets env vars, returns markdown

Net result: -244 lines from handlers, +234 lines in shared module.
The handlers are now ~80 lines each (down from ~150+) and can't drift
apart on core logic.
2026-03-24 07:08:07 -07:00
..
platforms fix: media delivery fails for file paths containing spaces (#2621) 2026-03-23 06:59:59 -07:00
__init__.py Enhance CLI with multi-platform messaging integration and configuration management 2026-02-02 19:01:51 -08:00
channel_directory.py feat: add SMS (Twilio) platform adapter 2026-03-17 03:14:53 -07:00
config.py fix(config): log warning instead of silently swallowing config.yaml errors (#2683) 2026-03-23 15:54:11 -07:00
delivery.py Merge origin/main into hermes/hermes-5d160594 2026-03-14 19:34:05 -07:00
hooks.py feat(hooks): emit session:end lifecycle event (#1725) 2026-03-17 04:17:44 -07:00
mirror.py fix(cli): respect HERMES_HOME in all remaining hardcoded ~/.hermes paths 2026-03-13 21:32:53 -07:00
pairing.py fix(cli): respect HERMES_HOME in all remaining hardcoded ~/.hermes paths 2026-03-13 21:32:53 -07:00
run.py refactor(model): extract shared switch_model() from CLI and gateway handlers 2026-03-24 07:08:07 -07:00
session.py feat(gateway): notify users when session auto-resets (#2519) 2026-03-22 09:33:39 -07:00
status.py fix(gateway): detect stopped processes and release stale locks on --replace 2026-03-21 18:13:53 -07:00
sticker_cache.py fix(cli): respect HERMES_HOME in all remaining hardcoded ~/.hermes paths 2026-03-13 21:32:53 -07:00
stream_consumer.py fix: handle message length overflow in streaming mode (#1783) 2026-03-17 11:00:52 -07:00