"""审查运行的共享上下文。""" from dataclasses import dataclass from . import config from .cad_tools import CadTools from .checklist import load_checklist from .llm_client import LlmClient from .mcp_client import McpClient @dataclass class ReviewContext: client: McpClient tools: CadTools llm: LlmClient checklist: dict max_frames: int = 0 frame_limit: int = 200 max_iters: int = 4 annotate: bool = False dry_run: bool = False @classmethod def create(cls, *, need_llm=True, **overrides): client = McpClient() tools = CadTools(client) llm = LlmClient() if need_llm else None checklist = load_checklist() params = dict( client=client, tools=tools, llm=llm, checklist=checklist, max_frames=config.MAX_FRAMES, frame_limit=config.FRAME_ENTITY_LIMIT, max_iters=config.REVIEW_MAX_ITERS, ) params.update(overrides) return cls(**params)