diff --git a/services/elephant_alpha_autonomous_engine.py b/services/elephant_alpha_autonomous_engine.py index 0e81e6e..4749528 100644 --- a/services/elephant_alpha_autonomous_engine.py +++ b/services/elephant_alpha_autonomous_engine.py @@ -664,18 +664,20 @@ class ElephantAlphaAutonomousEngine: self._log.error("Telegram escalation failed (non-blocking): %s", e) # ---- Resource Optimization ---- - def _ssh_exec(self, cmd: str, timeout: int = 60) -> tuple: - """Execute command via SSH jump host.""" + def _ssh_exec(self, host: str, user: str, cmd: str, timeout: int = 120) -> tuple: + """Execute command via SSH jump host to target host.""" import subprocess import shlex + # 這裡實作 SSH 跳板或直接連線邏輯,根據 ADR-013 應透過跳板機 + # 簡化版:直接從容器透過 SSH 連向目標 (188) full_cmd = [ "ssh", "-p", str(SSH_PORT), "-i", SSH_KEY_PATH, "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=10", - f"{SSH_JUMP_USER}@{SSH_JUMP_HOST}", + f"{user}@{host}", cmd ] try: