The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(cli): one helper prints a restore's kept and not-removed paths
unsupportedpastels0014e65b3cea
diff --git a/hermes_cli/cli_commands_mixin.py b/hermes_cli/cli_commands_mixin.pyindex 16b08fdaf2d..76edc0b67c2 100644--- a/hermes_cli/cli_commands_mixin.py+++ b/hermes_cli/cli_commands_mixin.py@@ -34,7 +34,7 @@ from agent.turn_context import extract_api_content_sidecarfrom hermes_cli.cli_agent_setup_mixin import _retire_agentfrom hermes_cli.cli_commands_session_tools import (CLICommandsSessionToolsMixin, _TTYBuf, _accent, _accent_line, _command_arg, _cp, _dim,- _dim_line, _gt, _lines, _pr, _probe, _save, _say_block, _shlex_args, _t, _tn)+ _dim_line, _gt, _lines, _pr, _probe, _rollback_kept, _save, _say_block, _shlex_args, _t, _tn)from hermes_cli.browser_connect import (DEFAULT_BROWSER_CDP_URL, discover_local_cdp_url, find_free_debug_port, is_browser_debug_ready,launch_chrome_debug, local_port_in_use, manual_chrome_debug_command)@@ -613,15 +613,7 @@ class CLICommandsMixin(CLICommandsSessionToolsMixin):restored = dict(hash=result["restored_to"], reason=result["reason"])print(f" {_t('rollback.restored_file', file=file_path, **restored)}" if file_pathelse f" {_t('rollback.restored_all', **restored)}")- skipped = result.get("skipped_user_edits") or []- if skipped:- _pr(*_lines(_gt("rollback.kept_user_edits", files=_summarize_paths(skipped))))- oversize = result.get("skipped_oversize") or []- if oversize:- print(f" {_gt('rollback.kept_oversize', files=_summarize_paths(oversize))}")- failed = result.get("failed_deletes") or []- if failed:- print(f" {_gt('rollback.failed_deletes', files=_summarize_paths(failed))}")+ _rollback_kept(result)print(f" {_t('rollback.snapshot_saved')}")# Also undo the last conversation turn so the agent's context matches the restored files.if self.conversation_history:diff --git a/hermes_cli/cli_commands_session_tools.py b/hermes_cli/cli_commands_session_tools.pyindex 669cb7acc9b..c8c58770705 100644--- a/hermes_cli/cli_commands_session_tools.py+++ b/hermes_cli/cli_commands_session_tools.py@@ -80,6 +80,17 @@ def _lines(text: str, pad: str = " ") -> list:return [f"{pad}{line}" if line else "" for line in text.splitlines()]+def _rollback_kept(result: dict) -> None:+ """The kept / not-removed path lines of a restore result (in-process CLI and gateway client alike)."""+ from hermes_cli.cli_commands_mixin import _summarize_paths+ if skipped := result.get("skipped_user_edits"):+ _pr(*_lines(_gt("rollback.kept_user_edits", files=_summarize_paths(skipped))))+ if oversize := result.get("skipped_oversize"):+ print(f" {_gt('rollback.kept_oversize', files=_summarize_paths(oversize))}")+ if failed := result.get("failed_deletes"):+ print(f" {_gt('rollback.failed_deletes', files=_summarize_paths(failed))}")++def _probe(module: str, name: str, default, *args):"""``<module>.<name>(*args)`` or ``default`` when the import or the call fails (optionalsubsystems: browser backends, async delegations, wake word, ...)."""diff --git a/hermes_cli/gateway_rollback.py b/hermes_cli/gateway_rollback.pyindex 5003b46eb7a..c66cbcfa930 100644--- a/hermes_cli/gateway_rollback.py+++ b/hermes_cli/gateway_rollback.py@@ -71,14 +71,8 @@ def _restored(cli, connection, result, file_path):restored = {"hash": result.get("restored_to", ""), "reason": result.get("reason", "")}print(f" {_t('rollback.restored_file', file=file_path, **restored)}" if file_pathelse f" {_t('rollback.restored_all', **restored)}")- from hermes_cli.cli_commands_mixin import _summarize_paths- from hermes_cli.cli_commands_session_tools import _gt, _lines, _pr- if skipped := result.get("skipped_user_edits"):- _pr(*_lines(_gt("rollback.kept_user_edits", files=_summarize_paths(skipped))))- if oversize := result.get("skipped_oversize"):- print(f" {_gt('rollback.kept_oversize', files=_summarize_paths(oversize))}")- if failed := result.get("failed_deletes"):- print(f" {_gt('rollback.failed_deletes', files=_summarize_paths(failed))}")+ from hermes_cli.cli_commands_session_tools import _rollback_kept+ _rollback_kept(result) # the in-process CLI's own linesprint(f" {_t('rollback.snapshot_saved')}")if result.get("history_removed"):snapshot = connection.call("session.resume", session_id=cli.session_id)