Skip to content

The agent that grows with you

refactor(termhub): derive ensure_hub_dirs seeds from state-file EMPTY shapes; module docstrings name the split companions

Tekniuma8f3dc4946f3
diff --git a/tools/skills_hub.py b/tools/skills_hub.py
index 9a6d07806e7..e3cce82aeeb 100644
--- a/tools/skills_hub.py
+++ b/tools/skills_hub.py
@@ -2,10 +2,12 @@
"""
Skills Hub — hub state management and the public facade for the source adapters.
-Library module (not an agent tool). Owns the hub paths, index cache, lock file,
-taps, audit log, quarantine/install/uninstall, update checks, and the source
-router; the adapters live in the ``tools.skills_hub_*`` siblings and are
-re-exported here so ``from tools.skills_hub import X`` keeps working.
+Library module (not an agent tool). Owns the hub paths, guarded HTTP, index
+cache, lock file, taps and audit log. Install/uninstall/update live in
+``skills_hub_install``, the index fetch/source router/search in
+``skills_hub_search``, and the adapters in the other ``tools.skills_hub_*``
+siblings; all are re-exported here so ``from tools.skills_hub import X`` keeps
+working (and stays the test patch target).
Used by hermes_cli/skills_hub.py for CLI commands and the /skills slash command.
"""
@@ -368,9 +370,9 @@ def ensure_hub_dirs() -> None:
_quarantine_dir().mkdir(exist_ok=True)
_index_cache_dir().mkdir(exist_ok=True)
for path, initial in (
- (_lock_file(), '{"version": 1, "installed": {}}\n'),
+ (_lock_file(), json.dumps(HubLockFile.EMPTY) + "\n"),
(_audit_log(), ""),
- (_taps_file(), '{"taps": []}\n'),
+ (_taps_file(), json.dumps(TapsManager.EMPTY) + "\n"),
):
if not path.exists():
path.write_text(initial, encoding="utf-8")
diff --git a/tools/terminal_tool.py b/tools/terminal_tool.py
index b12d0bf8d44..f23e54150f5 100644
--- a/tools/terminal_tool.py
+++ b/tools/terminal_tool.py
@@ -9,9 +9,13 @@ Cloud-sandbox persistent filesystems preserve working state across sandbox
recreation but do NOT guarantee the same live sandbox or long-running
processes survive cleanup, idle reaping, or Hermes exit.
-Companion modules: ``terminal_tool_guards`` (pre-exec blocks),
-``terminal_tool_background`` (background spawn), ``terminal_tool_result``
-(foreground result post-processing).
+Companion modules (all re-exported here, so ``tools.terminal_tool.<name>``
+stays the import/patch target): ``terminal_tool_config`` (TERMINAL_* reads),
+``terminal_tool_backends`` (env builders + requirement checkers),
+``terminal_tool_lifecycle`` (reaper/teardown/ensure_task_env),
+``terminal_tool_sudo`` (sudo password + shell rewrites), ``terminal_tool_guards``
+(pre-exec blocks), ``terminal_tool_background`` (background spawn),
+``terminal_tool_result`` (foreground result post-processing).
"""
import json