Skip to main content

render_opencode_config

Function render_opencode_config 

Source
pub fn render_opencode_config(
    compose: &Compose,
    h: AgentHandle<'_>,
    team_mcp_bin: &str,
) -> Option<String>
Expand description

Per-agent OpenCode opencode.json for runtime: opencode agents. Returns None for every other runtime. OpenCode has no --mcp-config flag — servers are read from the mcp object of the config file OPENCODE_CONFIG points at — so this is the opencode-shaped mirror of [render_mcp]’s JSON: the unconditional team bus plus declared mcps: under the same supports_mcp gate (render_mcp already warns when the gate drops them, so this stays quiet). The file also carries:

  • instructions: the absolute role-prompt path (opencode has no system-prompt flag; absolute-path entries verified to load),
  • autoupdate: false: the TUI otherwise upgrades the shared binary in place mid-fleet (the wrapper also exports OPENCODE_DISABLE_AUTOUPDATE=1 — defense in depth, upstream has open bugs about this key being ignored on some paths),
  • share: "disabled": agents must never leak conversations to opencode’s public share links.

HAZARD (verified on 1.17.13): opencode drops schema violations SILENTLY — renaming command made the server vanish with no error — so the tests pin the exact type/command/environment/enabled key names.