Skip to main content

agentmux_srv_core/backend/providers/
opencode.rs

1// Copyright 2026, AgentMux Corp.
2// SPDX-License-Identifier: Apache-2.0
3
4use super::{Tier, ControllerType, ProviderConfig};
5
6// OpenCode (V1 line): `opencode acp` speaks ACP over stdio and runs signed out
7// on OpenCode Zen's free models. Checked against 1.19.0 on 2026-10-14
8// (SPEC_NINE_NEW_HARNESSES_2026_10_14.md ยง7.1).
9pub(super) static OPENCODE: ProviderConfig = ProviderConfig {
10    id: "opencode",
11    tier: Tier::Preview,
12    cli_command: "opencode",
13    controller_type: ControllerType::Acp,
14    app_server: None,
15    launch_args: &["acp"],
16    persistent_launch_args: None,
17    resume_flag: None,
18    session_id_field: "sessionId",
19    // ACP, read with the turn's token usage (the frontend's translator-factory.ts).
20    styled_output_format: "opencode-acp",
21    // OpenCode keeps auth.json and its session database under
22    // XDG_DATA_HOME/opencode; OPENCODE_CONFIG_DIR doesn't move them.
23    auth_config_dir_env_var: "XDG_DATA_HOME",
24    auth_dir_name: "opencode",
25    history_native_subdir: None,
26    // The pin holds (no self-update), and the user's own ~/.claude/CLAUDE.md
27    // stays out of an OpenCode agent.
28    auth_extra_env: &[("OPENCODE_DISABLE_AUTOUPDATE", "1"), ("OPENCODE_DISABLE_CLAUDE_CODE_PROMPT", "1")],
29    unset_env: &[],
30    npm_package: "opencode-ai",
31    pinned_version: "1.19.6",
32    base_url_env_var: None,
33    supported_vendors: &["opencode"],
34    startup_instructions_filename: Some("AGENTS.md"),
35    native_instruction_sources: &["AGENTS.md"],
36    native_instruction_dirs: &[],
37};