4 Commits

Author SHA1 Message Date
kshitijk4poor
b8c5abc775 fix(api): serve only Bot Mode's ui_meta block from /api/profiles
The cherry-picked commit (#154536) fixed secondary-connection Bot Mode
sections by adding profile.yaml ui_meta to GET /api/profiles verbatim.
Verbatim also shipped every other plugin's ui_meta: hermes-bots-groups
holds group-chat room logs and room images, which the Desktop roster now
pulled every 5s per secondary connection (2.7 KB -> 36.7 KB per response
on a real install) and which a profile-scoped native grant could read for
every profile. A YAML .nan anywhere in ui_meta also made the whole list
500, and the nested dict was shared with the profile.yaml cache, so a
caller mutating it changed the next reader's result.

- read_profile_meta keeps only ui_meta['hermes-bots'] (sections, groups,
  title), serialized as strict JSON in the cache (YAML dates -> ISO via the
  gateway's existing yaml_scalar_to_json, now owned by profiles_cache) and
  parsed per caller; a block that is not JSON-representable becomes {}.
  Group chats keep reading hermes-bots-groups through profiles.list.
- The list fallback rows (list_profiles raised) carry ui_meta too.
- The contributor's tests move into tests/hermes_cli/test_profile_display_name.py
  (tests mirror source), through list_profiles and the fallback path.
2026-11-13 14:30:56 +05:30
kshitijk4poor
e39618f448 refactor(config): one public version helper pair in config_backend
Review of the rebased stack found the same "version, or None when the
config is absent" shape written out at three call sites
(`config_version(p) if config_exists(p) else None`), a private
try/except copy of it in profiles_cache, and the gateway importing the
TUI's private `_version_token` from tui_gateway.methods_config.

- config_backend gains `config_version_or_none()` (one backend call, no
  exists-then-stat race) and `version_token()`, moved from
  tui_gateway/methods_config.py unchanged.
- tui_gateway (methods_config, server), the classic CLI config watcher,
  gateway/session_config and the profile roster cache use them;
  profiles_cache drops its private copy.

No behaviour change: same version tuples, same numeric token.
2026-10-25 18:54:09 -07:00
kshitijk4poor
adebe1f8be fix(config): gate the readers main added since the rebase; adopt main's lint rules
Rebasing onto current main brought in direct config.yaml readers that the
seam's reader gate (scripts/check_config_yaml_readers.py) now rejects:

- gateway/session_config.py: the session `config.get mtime` getter uses
  config_exists/config_version + the TUI's _version_token, like
  tui_gateway/methods_config.py already does.
- hermes_cli/profiles.py: _strip_multiplex_flag checks config_exists.
- hermes_cli/config_backups.py: the byte comparison sits inside the
  supports_file_tooling()-gated block; marked like its siblings there.
- hermes_cli/update_receipt.py: _bare_collection_enabled runs in the bare
  bootstrap interpreter with no config stack; presence stat marked.

Main also turned on UP006/RUF100/B009 since the branch base: builtin
generics in the seam's new modules, stale noqa comments dropped, and the
newly unused typing imports removed.
2026-10-25 18:54:09 -07:00
kshitijk4poor
bf90544702 fix(config): address review on the config backend seam
- get_config_backend(): a shell HERMES_CONFIG_BACKEND that the launch home's .env (or managed
  .env) overrides no longer refuses at import time. hermes_cli.config reads config before
  load_hermes_dotenv() runs, so the selector applies those layers in the same order before refusing.
- _route() returns (ConfigBackend, home) for every path: explicit non-home files are served by
  _ExplicitFile, a FileBackend bound to that path, so the helpers call one interface instead of
  branching on an is_layer flag.
- config.get mtime: derived from the backend's opaque version (file backend unchanged: seconds
  from st_mtime_ns; other versions: a stable non-zero crc32).
- The profile roster's config-model cache keys on config_version(), not a local stat; the
  cache moves to hermes_cli/profiles_cache.py (keeps profiles.py under its cap).
- check_config_yaml_readers: catches io.open / builtins.open / os.open and path keywords
  (open(file=p)); scripts/check runs it locally as config-readers.
2026-10-25 18:54:09 -07:00