ForcePilot/backend/package/yuxi/channel/extensions/bluesky/config_schema.py
Kris bb85da1ca2 feat(bluesky): 新增Bluesky (AT Protocol) 频道插件
实现了完整的Bluesky频道功能,支持私信轮询、@提及通知、账号会话管理、重复消息过滤、配对授权机制以及完整的API调用能力,包含配置schema和插件元数据定义
2026-05-21 10:40:50 +08:00

64 lines
2.0 KiB
Python

from pydantic import BaseModel, Field
class BlueskyAccountConfig(BaseModel):
handle: str = ""
app_password: str = Field(default="", alias="appPassword")
session_string: str = Field(default="", alias="sessionString")
dm_policy: str = Field(default="pairing", alias="dmPolicy")
allow_from: list[str] = Field(default_factory=list, alias="allowFrom")
enable_notifications: bool = Field(default=False, alias="enableNotifications")
enable_firehose: bool = Field(default=False, alias="enableFirehose")
name: str = ""
model_config = {"populate_by_name": True}
class BlueskyConfig(BaseModel):
accounts: dict[str, BlueskyAccountConfig] = Field(default_factory=dict)
BLUESKY_CONFIG_SCHEMA = {
"type": "object",
"properties": {
"handle": {
"type": "string",
"description": "Bluesky handle (e.g. my-bot.bsky.social)",
},
"appPassword": {
"type": "string",
"description": "Bluesky App Password with DM permission",
"sensitive": True,
},
"sessionString": {
"type": "string",
"description": "Persisted session token (auto-managed)",
"sensitive": True,
},
"dmPolicy": {
"type": "string",
"enum": ["pairing", "allowlist", "open", "disabled"],
"default": "pairing",
},
"allowFrom": {
"type": "array",
"items": {"type": "string"},
"description": "Allowed DIDs (did:plc:xxx) for allowlist/pairing policies",
},
"enableNotifications": {
"type": "boolean",
"default": False,
"description": "Enable @mention notification polling",
},
"enableFirehose": {
"type": "boolean",
"default": False,
"description": "Enable Firehose WebSocket (P2 feature)",
},
"name": {
"type": "string",
"description": "Display name for this account",
},
},
}