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

Class RuntimeConfig

mini_claude_code/config.py:162–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160# ============================================================
161
162class RuntimeConfig(BaseModel):
163 merged: dict = Field(default_factory=dict)
164 loaded_entries: list[ConfigEntry] = Field(default_factory=list)
165 feature_config: RuntimeFeatureConfig = Field(default_factory=RuntimeFeatureConfig)
166
167 model_config = {"arbitrary_types_allowed": True}
168
169 # --- 便捷访问方法 ---
170 # 源码: config.rs:260-312
171 # CC 为每个常用字段提供 getter,避免外部直接访问内部结构。
172 # 这叫 "封装" — 将来内部结构变了,外部代码不用改。
173
174 def get(self, key: str) -> Optional[Any]:
175 return self.merged.get(key)
176
177 def hooks_pre(self) -> list[str]:
178 return self.feature_config.hooks_pre_tool_use
179
180 def hooks_post(self) -> list[str]:
181 return self.feature_config.hooks_post_tool_use
182
183 def model(self) -> Optional[str]:
184 return self.feature_config.model
185
186 def permission_mode(self) -> Optional[str]:
187 return self.feature_config.permission_mode
188
189 def timeout(self) -> int:
190 return self.feature_config.timeout
191
192 def token_budget(self) -> int:
193 return self.feature_config.token_budget
194
195 @staticmethod
196 def empty() -> "RuntimeConfig":
197 """空配置 — 用于测试或默认场景。源码: config.rs:251-257"""
198 return RuntimeConfig()
199
200
201# ============================================================

Callers 2

emptyMethod · 0.70
loadMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected