Fix headless mode: use sleep loop instead of CLI mode (prevent EOF exit)

- Headless now keeps server alive with asyncio.sleep(1) loop
- CLI mode only for non-headless fallback
- Enables running SenSu as daemon/service
This commit is contained in:
qinglong
2026-06-11 13:02:56 +08:00
parent 885929f3ff
commit 6918ee6514
3 changed files with 8 additions and 4 deletions
+5 -1
View File
@@ -333,7 +333,11 @@ class SenSuFramework:
# 特殊终端,添加命令行输入处理
tui = self.service_manager.get_service("tui")
if self.headless or not hasattr(tui, 'tui_app'):
if self.headless:
while self.is_running:
try: await asyncio.sleep(1)
except asyncio.CancelledError: break
elif not hasattr(tui, 'tui_app'):
await self._run_cli_mode()
else:
# 原有的TUI模式