feat(opencode): remplace le provider Ollama par llama.cpp

Le tool-calling local ne fonctionnait jamais via Ollama. Refonte du
support local d'OpenCode autour de llama.cpp: profil, catalogue,
matérialisation de la config OpenCode et surface first-run alignés sur
llama-server (backend + frontend).

QA vert (commandes réelles): domain 244, application 81+64, infra 263
(10 échecs = bind-port sandbox identiques sur develop, non-régression),
frontend 574, tsc propre. Réserve E2E live non bloquante faute de
llama-server joignable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-11 00:41:19 +02:00
parent eaba05d27d
commit 4e70631c40
12 changed files with 478 additions and 140 deletions

View File

@ -97,8 +97,8 @@ pub fn reference_profiles() -> Vec<AgentProfile> {
McpTransport::Stdio,
)),
AgentProfile::new(
reference_id("opencode-ollama"),
"OpenCode + Ollama",
reference_id("opencode-llamacpp"),
"OpenCode + llama.cpp",
"opencode",
Vec::new(),
ContextInjection::convention_file("AGENTS.md")
@ -110,8 +110,14 @@ pub fn reference_profiles() -> Vec<AgentProfile> {
.expect("OpenCode reference profile is valid")
.with_structured_adapter(StructuredAdapter::OpenCode)
.with_opencode(
OpenCodeConfig::new(Some("ollama/qwen3-coder:30b".to_owned()))
.expect("OpenCode config is valid"),
OpenCodeConfig::new(
"http://localhost:8080/v1",
Some("sk-no-key".to_owned()),
"qwen3-coder-30b",
None,
None,
)
.expect("OpenCode config is valid"),
)
.with_mcp(McpCapability::new(
McpConfigStrategy::open_code_config("opencode.json")
@ -225,8 +231,8 @@ mod mcp_tests {
}
#[test]
fn opencode_ollama_seed_replaces_http_ollama_profile() {
let profile = profile("opencode-ollama");
fn opencode_llamacpp_seed_replaces_http_ollama_profile() {
let profile = profile("opencode-llamacpp");
assert_eq!(
profile.structured_adapter,
Some(StructuredAdapter::OpenCode)
@ -237,8 +243,22 @@ mod mcp_tests {
profile
.opencode
.as_ref()
.and_then(|config| config.model.as_deref()),
Some("ollama/qwen3-coder:30b")
.map(|config| config.model.as_str()),
Some("qwen3-coder-30b")
);
assert_eq!(
profile
.opencode
.as_ref()
.map(|config| config.base_url.as_str()),
Some("http://localhost:8080/v1")
);
assert_eq!(
profile
.opencode
.as_ref()
.and_then(|config| config.api_key.as_deref()),
Some("sk-no-key")
);
assert!(profile.mcp.is_some());
assert!(profile.materializes_idea_bridge());