MCPcopy Create free account
hub / github.com/IBM/AssetOpsBench / _build_opencode_config

Function _build_opencode_config

src/agent/opencode_agent/runner.py:150–189  ·  view source on GitHub ↗

Return (OpenCode config, env overrides, resolved OpenCode model).

(
    *,
    model: str,
    agent_name: str,
    max_steps: int,
    server_paths: dict[str, Path | str],
    allow_bash: bool = False,
    allow_edit: bool = False,
    allow_web: bool = False,
    allow_files: bool = False,
)

Source from the content-addressed store, hash-verified

148
149
150def _build_opencode_config(
151 *,
152 model: str,
153 agent_name: str,
154 max_steps: int,
155 server_paths: dict[str, Path | str],
156 allow_bash: bool = False,
157 allow_edit: bool = False,
158 allow_web: bool = False,
159 allow_files: bool = False,
160) -> tuple[dict[str, Any], dict[str, str], str]:
161 """Return (OpenCode config, env overrides, resolved OpenCode model)."""
162 opencode_model, provider, env = _resolve_opencode_model_and_provider(model)
163 permission = _build_permissions(
164 list(server_paths),
165 allow_bash=allow_bash,
166 allow_edit=allow_edit,
167 allow_web=allow_web,
168 allow_files=allow_files,
169 )
170 config: dict[str, Any] = {
171 "$schema": "https://opencode.ai/config.json",
172 "model": opencode_model,
173 "autoupdate": False,
174 "mcp": _build_mcp_config(server_paths),
175 "agent": {
176 agent_name: {
177 "description": "AssetOpsBench MCP benchmark agent",
178 "mode": "primary",
179 "model": opencode_model,
180 "prompt": _OPENCODE_SYSTEM_PROMPT,
181 "permission": permission,
182 "steps": max_steps,
183 "temperature": 0.1,
184 }
185 },
186 }
187 if provider:
188 config["provider"] = provider
189 return config, env, opencode_model
190
191
192def _resolve_run_dir(

Callers 2

__init__Method · 0.85

Calls 3

_build_permissionsFunction · 0.85
_build_mcp_configFunction · 0.85