(tool_name: str, args: dict)
| 166 | ] |
| 167 | |
| 168 | def check_rules(tool_name: str, args: dict) -> str | None: |
| 169 | for rule in PERMISSION_RULES: |
| 170 | if tool_name in rule["tools"] and rule["check"](args): |
| 171 | return rule["message"] |
| 172 | return None |
| 173 | |
| 174 | |
| 175 | # Gate 3: User approval — wait for confirmation after rule match |