ForcePilot/backend/package/yuxi/channels/adapters/irc/runtime.py
Kris 2dd1a075f2 feat(irc): 实现完整的IRC适配器基础功能模块
新增IRC协议相关的全套工具模块,包括:
- 核心协议解析与CTCP处理
- 消息发送缓存与文本 sanitize
- 账号配置管理与运行时状态
- 命令处理与权限控制
- 服务发现与诊断工具
- 多账号网关与配置加载
2026-05-12 00:45:10 +08:00

34 lines
789 B
Python

from __future__ import annotations
from typing import Any
_runtime_store: dict[str, Any] | None = None
def set_irc_runtime(store: dict[str, Any]) -> None:
global _runtime_store
_runtime_store = store
def get_irc_runtime() -> dict[str, Any] | None:
return _runtime_store
def clear_irc_runtime() -> None:
global _runtime_store
_runtime_store = None
def record_irc_outbound_activity(target: str, text: str, metadata: dict[str, Any] | None = None) -> None:
store = _runtime_store
if store is None:
return
entries: list[dict[str, Any]] = store.setdefault("outbound_activity", [])
entry: dict[str, Any] = {
"target": target,
"text": text,
}
if metadata:
entry["metadata"] = metadata
entries.append(entry)