from yuxi.channel.extensions.bluebubbles.probe import ServerInfo, is_macos26_or_higher def build_action_gate( account_config: dict, server_info: ServerInfo, is_group: bool = False, ) -> set[str]: configured_actions = account_config.get("actions", {}) allowed = set(configured_actions.keys()) if configured_actions else None gate = {"send_text", "send_attachment", "send_multipart"} if not server_info.private_api_enabled: if allowed is not None: gate = gate & allowed return gate gate.add("react") gate.add("unsend") gate.add("reply") gate.add("send_with_effect") gate.add("force_notify") gate.add("schedule_message") gate.add("list_scheduled") gate.add("update_schedule") gate.add("delete_schedule") if not is_macos26_or_higher(server_info): gate.add("edit") if is_group: gate.add("rename_group") gate.add("set_group_icon") gate.add("remove_group_icon") gate.add("add_participant") gate.add("remove_participant") gate.add("leave_group") if allowed is not None: gate = gate & allowed return gate PRIVATE_API_ACTIONS = frozenset( { "react", "unsend", "reply", "send_with_effect", "edit", "rename_group", "set_group_icon", "remove_group_icon", "add_participant", "remove_participant", "leave_group", "force_notify", "schedule_message", "list_scheduled", "update_schedule", "delete_schedule", } )