ForcePilot/backend/package/yuxi/channel/extensions/slack/constants.py

95 lines
2.2 KiB
Python
Raw Normal View History

SLACK_TEXT_LIMIT = 40000
SLACK_MEDIA_MAX_MB = 50
SLACK_STREAM_BUFFER_CHARS = 256
SLACK_PREVIEW_THROTTLE_MS = 1000
SLACK_PREVIEW_MAX_CHARS = 40000
SLACK_API_BASE = "https://slack.com/api"
SLACK_DEDUPE_TTL_SECONDS = 60
SLACK_DEDUPE_MAX_SIZE = 10000
SLACK_BOT_TOKEN_PREFIX = "xoxb-"
SLACK_APP_TOKEN_PREFIX = "xapp-"
SLACK_USER_TOKEN_PREFIX = "xoxp-"
SLACK_APP_TOKEN_PATTERN = r"^xapp-\d-[a-z0-9]+-"
SLACK_USER_ID_PATTERN = r"^U[A-Z0-9]{7,12}$"
SLACK_BOT_ID_PATTERN = r"^B[A-Z0-9]{7,12}$"
SLACK_CHANNEL_ID_PATTERN = r"^C[A-Z0-9]{7,12}$"
SLACK_PRIVATE_CHANNEL_ID_PATTERN = r"^G[A-Z0-9]{7,12}$"
SLACK_DM_ID_PATTERN = r"^D[A-Z0-9]{7,12}$"
SLACK_WORKSPACE_ID_PATTERN = r"^T[A-Z0-9]{7,12}$"
SLACK_MENTION_PATTERN = r"<@([A-Z0-9]+)>"
SLACK_REQUIRED_BOT_SCOPES = [
"chat:write",
"channels:history",
"groups:history",
"im:history",
"mpim:history",
"app_mentions:read",
"files:write",
"files:read",
"users:read",
]
SLACK_RECOMMENDED_BOT_SCOPES = [
"chat:write.customize",
"reactions:write",
"reactions:read",
"channels:read",
"groups:read",
"team:read",
]
SLACK_APP_TOKEN_SCOPE = "connections:write"
SLACK_BENIGN_FINALIZE_CODES = frozenset(
[
"user_not_found",
"team_not_found",
"missing_recipient_user_id",
]
)
SLACK_MESSAGE_SUBTYPES_SYSTEM = frozenset(
[
"channel_join",
"channel_leave",
"channel_topic",
"channel_purpose",
"channel_name",
"channel_archive",
"channel_unarchive",
"group_join",
"group_leave",
"group_topic",
"group_purpose",
"group_name",
"group_archive",
"group_unarchive",
]
)
SLACK_MAX_BUTTONS = 5
SLACK_MAX_SELECT_OPTIONS = 100
SLACK_RETRY_MAX_ATTEMPTS = 3
SLACK_RETRY_BASE_DELAY = 1.0
SLACK_RETRY_MAX_DELAY = 30.0
SLACK_NATIVE_COMMAND_HELP = "help"
SLACK_NATIVE_COMMAND_RESET = "reset"
SLACK_AGENT_PROMPT_RULES = [
"Use Slack mrkdwn, not standard Markdown.",
"Bold uses *single asterisks*.",
"Italic uses _underscores_.",
"Links use <url|label> format.",
"Code blocks use triple backticks without a language identifier.",
"Do not use markdown headings or pipe tables.",
]