from typing import Any from app.modules.feishu.constants import ( FeishuCommandName, FeishuCommandResultKey, FeishuReplyType, ) def command_result( command: FeishuCommandName, reply_type: FeishuReplyType, title: str, content: str, provider_response: dict[str, Any] | None = None, lines: list[str] | None = None, ) -> dict[str, Any]: """Build the stable command response contract.""" result: dict[str, Any] = { FeishuCommandResultKey.COMMAND: command, FeishuCommandResultKey.REPLY_TYPE: reply_type, FeishuCommandResultKey.TITLE: title, FeishuCommandResultKey.CONTENT: content, FeishuCommandResultKey.PROVIDER_RESPONSE: provider_response, } if lines is not None: result[FeishuCommandResultKey.LINES] = lines return result