新增了完整的Signal渠道适配器实现,包含RPC客户端、守护进程管理、安全策略、消息处理、安装配置工具等全套功能,支持通过signal-cli与Signal网络进行通信,包含账户管理、消息收发、反应处理、媒体分析、健康检查等能力。
280 lines
8.1 KiB
Python
280 lines
8.1 KiB
Python
from __future__ import annotations
|
|
|
|
SIGNAL_CONFIG_SCHEMA = {
|
|
"enabled": {
|
|
"type": "bool",
|
|
"default": True,
|
|
"description": "Whether the Signal channel is enabled",
|
|
},
|
|
"signal_number": {
|
|
"type": "str",
|
|
"default": "",
|
|
"description": "Signal E.164 phone number (legacy single-account config)",
|
|
},
|
|
"account_uuid": {
|
|
"type": "str",
|
|
"default": None,
|
|
"description": "Signal account UUID for self-loop detection",
|
|
},
|
|
"accounts": {
|
|
"type": "dict",
|
|
"default": {},
|
|
"description": "Multi-account configuration map (account_id -> config)",
|
|
},
|
|
"cli_path": {
|
|
"type": "str",
|
|
"default": "signal-cli",
|
|
"description": "Path to signal-cli binary",
|
|
},
|
|
"http_host": {
|
|
"type": "str",
|
|
"default": "127.0.0.1",
|
|
"description": "HTTP daemon listen host",
|
|
},
|
|
"http_port": {
|
|
"type": "int",
|
|
"default": 8080,
|
|
"description": "HTTP daemon listen port",
|
|
},
|
|
"http_listen": {
|
|
"type": "str",
|
|
"default": "127.0.0.1:8080",
|
|
"description": "HTTP daemon listen address (host:port, overrides http_host/http_port)",
|
|
},
|
|
"http_url": {
|
|
"type": "str",
|
|
"default": None,
|
|
"description": "Custom HTTP URL (overrides host/port)",
|
|
},
|
|
"home_dir": {
|
|
"type": "str",
|
|
"default": None,
|
|
"description": "signal-cli data directory",
|
|
},
|
|
"java_opts": {
|
|
"type": "str",
|
|
"default": "-Xmx256m",
|
|
"description": "Java runtime options",
|
|
},
|
|
"receive_mode": {
|
|
"type": "str",
|
|
"default": None,
|
|
"description": "Daemon receive mode: 'on-start' or 'manual'",
|
|
},
|
|
"send_read_receipts": {
|
|
"type": "bool",
|
|
"default": None,
|
|
"description": "Whether daemon should send read receipts",
|
|
},
|
|
"auto_start": {
|
|
"type": "bool",
|
|
"default": True,
|
|
"description": "Whether to auto-start the daemon",
|
|
},
|
|
"startup_timeout_ms": {
|
|
"type": "int",
|
|
"default": 30000,
|
|
"description": "Daemon startup timeout in milliseconds",
|
|
},
|
|
"rpc_timeout_ms": {
|
|
"type": "int",
|
|
"default": 30000,
|
|
"description": "RPC call timeout in milliseconds",
|
|
},
|
|
"media_max_mb": {
|
|
"type": "int",
|
|
"default": 8,
|
|
"description": "Maximum media file size in MB",
|
|
},
|
|
"text_chunk_limit": {
|
|
"type": "int",
|
|
"default": 4000,
|
|
"description": "Maximum text chunk length",
|
|
},
|
|
"chunk_mode": {
|
|
"type": "str",
|
|
"default": "newline",
|
|
"description": "Text chunking mode: 'length' or 'newline'",
|
|
},
|
|
"markdown_enabled": {
|
|
"type": "bool",
|
|
"default": True,
|
|
"description": "Whether to convert Markdown to Signal rich text",
|
|
},
|
|
"markdown_table_mode": {
|
|
"type": "str",
|
|
"default": "bullets",
|
|
"description": "Markdown table conversion mode",
|
|
},
|
|
"heading_style": {
|
|
"type": "str",
|
|
"default": "bold",
|
|
"description": "Heading conversion style",
|
|
},
|
|
"blockquote_prefix": {
|
|
"type": "str",
|
|
"default": "> ",
|
|
"description": "Blockquote prefix",
|
|
},
|
|
"reaction_level": {
|
|
"type": "str",
|
|
"default": "minimal",
|
|
"description": "Reaction level: 'off', 'ack', 'minimal', or 'extensive'",
|
|
},
|
|
"reaction_notifications": {
|
|
"type": "str",
|
|
"default": "all",
|
|
"description": "Reaction notification policy: 'off', 'own', 'allowlist', or 'all'",
|
|
},
|
|
"reaction_allowlist": {
|
|
"type": "list",
|
|
"default": [],
|
|
"description": "Reaction notification allowlist",
|
|
},
|
|
"history_limit": {
|
|
"type": "int",
|
|
"default": 50,
|
|
"description": "Group chat history context limit",
|
|
},
|
|
"block_streaming": {
|
|
"type": "bool",
|
|
"default": False,
|
|
"description": "Whether to disable block streaming mode",
|
|
},
|
|
"block_streaming_coalesce": {
|
|
"type": "dict",
|
|
"default": {"min_chars": 1500, "idle_ms": 1000},
|
|
"description": "Streaming coalesce parameters",
|
|
},
|
|
"ignore_attachments": {
|
|
"type": "bool",
|
|
"default": False,
|
|
"description": "Whether to ignore incoming attachments",
|
|
},
|
|
"ignore_stories": {
|
|
"type": "bool",
|
|
"default": False,
|
|
"description": "Whether to ignore stories",
|
|
},
|
|
"config_writes": {
|
|
"type": "bool",
|
|
"default": False,
|
|
"description": "Whether to allow config writes via Signal messages",
|
|
},
|
|
"name": {
|
|
"type": "str",
|
|
"default": "",
|
|
"description": "Account display name",
|
|
},
|
|
"default_to": {
|
|
"type": "str",
|
|
"default": None,
|
|
"description": "Default send target",
|
|
},
|
|
"context_visibility_mode": {
|
|
"type": "str",
|
|
"default": "all",
|
|
"description": "Context visibility: 'all', 'same-group', 'trusted', or 'none'",
|
|
},
|
|
"security": {
|
|
"type": "dict",
|
|
"default": {
|
|
"dm_policy": "pairing",
|
|
"group_policy": "allowlist",
|
|
"allow_from": [],
|
|
"group_allow_from": [],
|
|
"require_mention": False,
|
|
},
|
|
"description": "Security policy config",
|
|
},
|
|
"streaming": {
|
|
"type": "dict",
|
|
"default": {"edit_support": "auto"},
|
|
"description": "Streaming config",
|
|
},
|
|
"allow_remote_daemon": {
|
|
"type": "bool",
|
|
"default": False,
|
|
"description": "Allow non-loopback daemon URL (disable SSRF guard)",
|
|
},
|
|
"download_max_mb": {
|
|
"type": "int",
|
|
"default": 256,
|
|
"description": "Maximum signal-cli download size in MB",
|
|
},
|
|
"entity_cache_ttl": {
|
|
"type": "int",
|
|
"default": 600,
|
|
"description": "Entity cache TTL in seconds",
|
|
},
|
|
"event_queue_max_size": {
|
|
"type": "int",
|
|
"default": 1000,
|
|
"description": "Maximum event queue size",
|
|
},
|
|
"prefer_native_binary": {
|
|
"type": "bool",
|
|
"default": True,
|
|
"description": "Prefer GraalVM native binary over universal tar.gz",
|
|
},
|
|
"receive_mode_daemon_level": {
|
|
"type": "str",
|
|
"default": "auto",
|
|
"description": "Daemon-level receipt mode: 'auto', 'on-start', or 'manual'",
|
|
},
|
|
"human_delay": {
|
|
"type": "dict",
|
|
"default": {"enabled": False, "min_ms": 300, "max_ms": 1500},
|
|
"description": "Human typing delay simulation config",
|
|
},
|
|
"ingest": {
|
|
"type": "dict",
|
|
"default": {"enabled": False},
|
|
"description": "Group silent ingest config (fire-and-forget hook for skipped messages)",
|
|
},
|
|
"main_dm_owner_pin": {
|
|
"type": "str",
|
|
"default": None,
|
|
"description": "Pin DM routing to a specific allowlisted sender (E.164/UUID)",
|
|
},
|
|
"daemon_ready": {
|
|
"type": "dict",
|
|
"default": {
|
|
"poll_interval_ms": 150,
|
|
"log_after_ms": 10000,
|
|
"log_interval_ms": 10000,
|
|
},
|
|
"description": "Daemon readiness check timing parameters",
|
|
},
|
|
"duplicate_reaction_check": {
|
|
"type": "bool",
|
|
"default": True,
|
|
"description": "Enable composite-key reaction deduplication",
|
|
},
|
|
"command_double_auth": {
|
|
"type": "bool",
|
|
"default": True,
|
|
"description": "Enable dual-verifier (DM allowFrom + group allowFrom) for commands",
|
|
},
|
|
"pairing_store_persist": {
|
|
"type": "bool",
|
|
"default": True,
|
|
"description": "Persist pairing approvals to Store for cross-restart survival",
|
|
},
|
|
"audit": {
|
|
"type": "dict",
|
|
"default": {"enabled": False},
|
|
"description": "Structured security audit logging config",
|
|
},
|
|
"ai_vision": {
|
|
"type": "dict",
|
|
"default": {"enabled": False},
|
|
"description": "AI-powered media vision analysis config",
|
|
},
|
|
"lane_separator": {
|
|
"type": "str",
|
|
"default": "---",
|
|
"description": "Reasoning lane separator for streaming output",
|
|
},
|
|
}
|