Files
hermes-agent/tools/path_security.py
alt-glitch 2e248ea10d refactor(utils): ANSI stripping and path checks move from tools/ to utils/
tools/ansi_strip.py becomes utils/text.py and tools/path_security.py becomes
utils/path_safety.py, each file whole with no line changed. Seven packages strip
ANSI escapes and three check paths, and neither file knows anything about tools, so
utils/ is their owner. Importers use the new names.

Old names stay importable: tools.ansi_strip and tools.path_security get a MOVES key,
a REQUIRED_NAMES row and a generated file at the old path. Releases v0.21.6 to v0.23.5
import both inside functions on the terminal, skill_view and V4A patch paths, and pinned
catalog plugins import both (custom-dangerous-patterns, ttsbuddy). The plugin guide and
utils/AGENTS.md gain a row for each.
2026-12-01 22:45:51 +05:30

35 lines
1.6 KiB
Python
Generated

try: # Generated by scripts/move/generate_shims.py; do not edit.
"""``tools.path_security`` moved to ``utils.path_safety``."""
import importlib
import importlib.util
import runpy
import sys
from pathlib import Path
def _forward():
if __name__ == "__main__" or sys.argv[:1] == ["-m"] or importlib.util.find_spec("hermes_agent") is None:
if __name__ == "__main__" and Path(sys.path[0]).resolve() == Path(__file__).resolve().parent:
del sys.path[0] # run as a path: a folder here named like an installed package would be imported in its place
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from hermes_agent.compat import install
install()
return None if __name__ == "__main__" else importlib.import_module("utils.path_safety")
try:
_module = _forward()
except Exception:
if sys.argv[:1] != ["-m"] and __name__ != "__main__": # an entry launch; a plain import stays light
raise
import hermes_bootstrap # repairs a killed update and relaunches when it restored something
_module = _forward()
if __name__ == "__main__":
runpy.run_module("utils.path_safety", run_name="__main__", alter_sys=True)
else:
if getattr(sys.modules.get(__name__), "__dict__", None) is globals():
sys.modules[__name__] = _module
_identity = ('__name__', '__file__', '__spec__', '__loader__', '__package__', '__path__', '__cached__', '__builtins__')
globals().update({k: v for k, v in vars(_module).items() if k not in _identity})
finally:
pass