""" LLM mode 空壳注册表:按 mode 名取 invoke_shell。 本文件只做分发到各 mode_* 模块;ordered_actions 走 routing/DeepSeekA。 """ from __future__ import annotations from typing import Any, Callable from agent.llm import mode_attachment_text, mode_extract_fields, mode_group_quote, mode_sheet_map, mode_vision from agent.llm.modes import LlmMode _SHELLS: dict[str, Callable[..., dict[str, Any]]] = { LlmMode.EXTRACT_FIELDS.value: mode_extract_fields.invoke_shell, LlmMode.ATTACHMENT_TEXT.value: mode_attachment_text.invoke_shell, LlmMode.VISION.value: mode_vision.invoke_shell, LlmMode.GROUP_QUOTE.value: mode_group_quote.invoke_shell, LlmMode.SHEET_MAP.value: mode_sheet_map.invoke_shell, } def invoke_mode_shell(mode: str | LlmMode, *, payload: dict[str, Any]) -> dict[str, Any]: """调用对应 mode 空壳;未知 mode 返回错误结构。""" key = mode.value if isinstance(mode, LlmMode) else str(mode) fn = _SHELLS.get(key) if fn is None: return {"ok": False, "stub": True, "mode": key, "error": "unknown_or_unregistered_mode"} return fn(payload=payload) def list_mode_shells() -> list[str]: """已注册空壳 mode 名。""" return sorted(_SHELLS.keys())