feat: 增强插件管理和日志处理,兼容旧版参数,优化 UDS 路径处理

This commit is contained in:
DrSmoothl
2026-03-12 23:34:07 +08:00
parent d14eb48051
commit 6bac2b9331
6 changed files with 90 additions and 28 deletions

View File

@@ -155,12 +155,29 @@ class RunnerIPCLogHandler(logging.Handler):
if not entries:
return
# IPC 发送失败时静默忽略(进程退出、网络断开等场景)
with contextlib.suppress(Exception):
# IPC 连接断开时回退到 stderr避免日志静默丢失
if not self._rpc_client.is_connected:
import sys
for entry in entries:
print(
f"[LOG-FALLBACK] [{entry.logger_name}] {entry.message}",
file=sys.stderr,
)
return
# IPC 发送失败时回退到 stderr
try:
await self._rpc_client.send_event(
"runner.log_batch",
payload=LogBatchPayload(entries=entries).model_dump(),
)
except Exception:
import sys
for entry in entries:
print(
f"[LOG-FALLBACK] [{entry.logger_name}] {entry.message}",
file=sys.stderr,
)
async def _flush_remaining(self) -> None:
"""将缓冲中剩余的所有条目分批全部发送。"""