import json
import subprocess
from pathlib import Path
from tools import bot_mode_dm
import tools.terminal_tool as terminal_tool_module
class FakeDB:
db_path = "/home/hermes/.hermes/profiles/hermesvps/state.db"
def get_session_title(self, _sid):
return "Bot Chat"
class FakeAgent:
_session_db = FakeDB()
session_id = "aa053-message-agent-regression"
_session_title_hint = "Bot Chat"
_bot_mode_protocol = True
def synchronous_terminal(command, **kwargs):
try:
completed = subprocess.run(command, shell=True, capture_output=True, text=True, timeout=100)
return json.dumps({"session_id": "sync-regression", "output": completed.stdout, "stderr": completed.stderr, "returncode": completed.returncode})
except subprocess.TimeoutExpired as exc:
return json.dumps({"error": f"timeout: {exc}", "session_id": "sync-regression"})
terminal_tool_module.terminal_tool = synchronous_terminal
for target in ("argus", "reporter", "codex", "hermesvps"):
result = bot_mode_dm.message_agent_tool(
target=target,
message=f"AA-053 Zustelltest. Antworte exakt mit MESSAGE_AGENT_{target.upper()}_OK.",
agent=FakeAgent(),
)
print(target, result)