新增了完整的Signal渠道适配器实现,包含RPC客户端、守护进程管理、安全策略、消息处理、安装配置工具等全套功能,支持通过signal-cli与Signal网络进行通信,包含账户管理、消息收发、反应处理、媒体分析、健康检查等能力。
18 lines
645 B
Python
18 lines
645 B
Python
from yuxi.channels.models import ChannelIdentity, ChannelType
|
|
from yuxi.channels.adapters.signal.normalize import normalize_e164
|
|
|
|
|
|
def resolve_thread(identity: ChannelIdentity, agent_id: str = "main") -> str:
|
|
chat_id = identity.channel_chat_id
|
|
channel_type = identity.channel_type
|
|
|
|
if channel_type != ChannelType.SIGNAL:
|
|
raise ValueError(f"Unexpected channel type: {channel_type}")
|
|
|
|
if chat_id.startswith("group:"):
|
|
group_id = chat_id.removeprefix("group:")
|
|
return f"agent:{agent_id}:signal:group:{group_id}"
|
|
|
|
normalized = normalize_e164(chat_id)
|
|
return f"agent:{agent_id}:signal:dm:{normalized}"
|