refactor(tui_gateway): projects mutator table, mcp_startup call helper, kwargs table in agent_callbacks

- methods_projects: update/add_folder/remove_folder/set_primary handlers registered from a
  _PROJECT_MUTATORS table (same @method names, same 5062/5063/5061 mapping); _pick() for
  params->kwargs; old-vs-new RPC golden (27 calls incl. error paths) identical.
- entry: _mcp_startup_call() replaces 5 lazy import+try/except ladders on hermes_cli.mcp_startup
  (tests monkeypatch mcp_startup module attrs — still resolved at call time).
- agent_callbacks: _background_agent_kwargs built from key tables; drop unused _registry.
- docstring compaction (module docstrings <= 8 lines, WHYs kept).
WIRE-PARITY-OK.
This commit is contained in:
Teknium
2026-09-02 23:44:18 -07:00
parent 79d0d3b600
commit aef127ad46
5 changed files with 106 additions and 171 deletions
+5 -8
View File
@@ -458,14 +458,11 @@ def build_tree(
exists: Optional[Exists] = None) -> dict:
"""Build the authoritative project tree -> ``{"projects", "scoped_session_ids"}``.
``projects`` are ``Project.to_dict()`` shapes; ``sessions`` projected row dicts;
``discovered_repos`` ``{"root", "label", "sessions", "last_active"}``. ``is_junk_root``
flags git roots that must never become an AUTO project (bare home, HERMES_HOME);
``is_junk_cwd`` is the narrower policy for non-git folders. User-created projects
are honored regardless. ``exists`` keeps a DELETED workspace from becoming a
phantom AUTO project; omit it (remote backends) to keep every candidate.
``hydrate`` False (overview) empties lane ``sessions`` but keeps counts and adds
up to ``preview_limit`` ``previewSessions``; True (drill-in) keeps full rows.
``is_junk_root`` flags git roots that must never become an AUTO project (bare home,
HERMES_HOME); ``is_junk_cwd`` is the narrower policy for non-git folders; explicit
projects are honored regardless. ``exists`` keeps a DELETED workspace from becoming
a phantom AUTO project (omit on remote backends). ``hydrate`` False (overview) empties
lane ``sessions`` but keeps counts + ``preview_limit`` ``previewSessions``.
"""
active_projects = [p for p in projects if not p.get("archived")]
_junk = is_junk_root or (lambda _root: False)