"""Build the exact fixed-policy call record from explicit tool metadata. 根据明确工具元数据构建准确固定策略调用记录。 """ import json import shared_prompt_v1 def make_record(tool_name: str, arguments: dict, project_root: str, settings: dict) -> dict: """Return one complete call record; accept a tool name, full arguments, project root and fixed choices. 返回一条完整调用;参数为工具名、全部参数、项目目录及固定选项。 This function reads no files and infers no user intent or last-turn context. 本函数不读文件,不推断用户意图或上轮上下文。 """ if not isinstance(tool_name,str) or not tool_name or not isinstance(project_root,str) or not project_root: raise ValueError('Tool name and provided project root must be nonempty strings') if not isinstance(arguments,dict) or not isinstance(settings,dict): raise TypeError('Arguments and fixed settings must be JSON objects') if set(settings)!=set(shared_prompt_v1.POLICY['options']): raise ValueError('Missing or unknown fixed setting') for name,option in shared_prompt_v1.POLICY['options'].items(): if settings[name] not in option['modes']: raise ValueError('Unknown fixed choice for '+name) rendered='Project: '+project_root+'\nTool: '+tool_name+'\nArguments: '+json.dumps(arguments,ensure_ascii=False,separators=(',',':'),allow_nan=False) return dict(settings=dict(settings),rendered=rendered)