Build non-interactive permissions for benchmark-safe OpenCode runs.
(
server_names: list[str],
*,
allow_bash: bool = False,
allow_edit: bool = False,
allow_web: bool = False,
allow_files: bool = False,
)
| 81 | |
| 82 | |
| 83 | def _build_permissions( |
| 84 | server_names: list[str], |
| 85 | *, |
| 86 | allow_bash: bool = False, |
| 87 | allow_edit: bool = False, |
| 88 | allow_web: bool = False, |
| 89 | allow_files: bool = False, |
| 90 | ) -> dict[str, Any]: |
| 91 | """Build non-interactive permissions for benchmark-safe OpenCode runs.""" |
| 92 | permission: dict[str, Any] = { |
| 93 | "read": "allow" if allow_files else "deny", |
| 94 | "glob": "allow" if allow_files else "deny", |
| 95 | "grep": "allow" if allow_files else "deny", |
| 96 | "lsp": "allow" if allow_files else "deny", |
| 97 | "edit": "allow" if allow_edit else "deny", |
| 98 | "bash": "allow" if allow_bash else "deny", |
| 99 | "task": "deny", |
| 100 | "skill": "deny", |
| 101 | "question": "deny", |
| 102 | "webfetch": "allow" if allow_web else "deny", |
| 103 | "websearch": "allow" if allow_web else "deny", |
| 104 | "external_directory": "deny", |
| 105 | "doom_loop": "deny", |
| 106 | } |
| 107 | for name in server_names: |
| 108 | permission[f"{name}_*"] = "allow" |
| 109 | return permission |
| 110 | |
| 111 | |
| 112 | def _resolve_opencode_model_and_provider( |
no outgoing calls