MCPcopy Create free account
hub / github.com/Louisym/MiniCC / RuntimeConfig

Class RuntimeConfig

tutorials/09_config_system.py:231–258  ·  view source on GitHub ↗

运行时配置 —— 合并后的最终配置。 对应源码: config.rs:31-36

Source from the content-addressed store, hash-verified

229
230@dataclass
231class RuntimeConfig:
232 """
233 运行时配置 —— 合并后的最终配置。
234
235 对应源码: config.rs:31-36
236 """
237 merged: dict[str, Any] # 合并后的完整字典
238 loaded_entries: list[ConfigEntry] # 实际加载了哪些文件
239 hooks: dict[str, list[str]] # 解析出的 hook 命令
240 model: Optional[str] = None # 使用的模型
241 permission_mode: Optional[str] = None # 权限模式
242
243 def get(self, key: str, default: Any = None) -> Any:
244 """获取配置值"""
245 return self.merged.get(key, default)
246
247 def summary(self) -> str:
248 """输出配置摘要"""
249 lines = [f"加载了 {len(self.loaded_entries)} 个配置文件:"]
250 for entry in self.loaded_entries:
251 lines.append(f" [{entry.source.value}] {entry.path}")
252 if self.model:
253 lines.append(f"模型: {self.model}")
254 if self.permission_mode:
255 lines.append(f"权限模式: {self.permission_mode}")
256 if self.hooks["pre_tool_use"] or self.hooks["post_tool_use"]:
257 lines.append(f"Hooks: pre={len(self.hooks['pre_tool_use'])}, post={len(self.hooks['post_tool_use'])}")
258 return "\n".join(lines)
259
260
261# ============================================================

Callers 1

loadMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected