Keep provider models visible with Bedrock

This commit is contained in:
2026-08-12 12:39:59 -05:00
parent b806cd76f8
commit c79634e76f
5 changed files with 119 additions and 24 deletions
+4 -7
View File
@@ -158,9 +158,9 @@ impl AcpAgentPreset {
/// Resolves the best available executable for this preset.
///
/// OpenCode's native binary is preferred when installed. Codex runs its ACP
/// adapter through npx, while CODEX_PATH points at the user's installed
/// Codex CLI rather than downloading a second Codex installation.
/// NPM-backed presets run through npx when available. Codex still requires a
/// locally installed Codex CLI because the ACP adapter delegates to it via
/// CODEX_PATH rather than downloading a second Codex installation.
pub fn resolve_launch_config(self) -> Result<AcpLaunchConfig, String> {
self.resolve_launch_config_with(executable_on_path)
}
@@ -197,9 +197,6 @@ impl AcpAgentPreset {
.codex_path(codex))
}
Self::OpenCode => {
if let Some(command) = resolve("opencode") {
return Ok(AcpLaunchConfig::new(command).args(["acp"]));
}
if let Some(command) = resolve("npx") {
return Ok(AcpLaunchConfig::new(command).args([
"--yes".to_owned(),
@@ -208,7 +205,7 @@ impl AcpAgentPreset {
]));
}
Err(
"OpenCode ACP requires the opencode executable or npx; install OpenCode or Node.js/npm, or configure a custom ACP executable"
"OpenCode ACP requires npx because its ACP adapter is distributed as an NPM package; install Node.js/npm or configure a custom ACP executable"
.to_owned(),
)
}
+11 -4
View File
@@ -48,7 +48,7 @@ fn opencode_preset_is_version_pinned() {
}
#[test]
fn resolved_opencode_prefers_the_native_executable() {
fn resolved_opencode_uses_npx_for_the_npm_adapter() {
let launch = AcpAgentPreset::OpenCode
.resolve_launch_config_with(|command| match command {
"opencode" => Some(PathBuf::from("/opt/bin/opencode")),
@@ -57,8 +57,15 @@ fn resolved_opencode_prefers_the_native_executable() {
})
.unwrap();
assert_eq!(launch.command, PathBuf::from("/opt/bin/opencode"));
assert_eq!(launch.args, vec!["acp"]);
assert_eq!(launch.command, PathBuf::from("/opt/bin/npx"));
assert_eq!(
launch.args,
vec![
"--yes".to_owned(),
format!("opencode-ai@{OPENCODE_NPM_VERSION}"),
"acp".to_owned()
]
);
}
#[test]
@@ -129,7 +136,7 @@ fn resolved_presets_explain_missing_launchers() {
(command == "bunx").then(|| PathBuf::from("/opt/bin/bunx"))
})
.unwrap_err();
assert!(opencode_error.contains("requires the opencode executable or npx"));
assert!(opencode_error.contains("requires npx"));
let codex_adapter_error = AcpAgentPreset::Codex
.resolve_launch_config_with(|command| {