参数: active_mode: 当前的权限模式 可以是 PermissionMode 枚举值 或 "prompt"(每次询问) / "allow"(全部允许)
(self, active_mode: PermissionMode | str)
| 145 | """ |
| 146 | |
| 147 | def __init__(self, active_mode: PermissionMode | str): |
| 148 | """ |
| 149 | 参数: |
| 150 | active_mode: 当前的权限模式 |
| 151 | 可以是 PermissionMode 枚举值 |
| 152 | 或 "prompt"(每次询问) / "allow"(全部允许) |
| 153 | """ |
| 154 | self.active_mode = active_mode |
| 155 | # 每个工具需要的权限等级 |
| 156 | # 默认所有工具都需要最高权限,然后逐个设置 |
| 157 | self._tool_requirements: dict[str, PermissionMode] = {} |
| 158 | |
| 159 | def with_tool_requirement(self, tool_name: str, required_mode: PermissionMode) -> "PermissionPolicy": |
| 160 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected