llm: switch Skald to agent-loop Model clients; drop llm-client (phase 1, D13)

The LLM call path now runs on the agent-loop crate's clients and trait:

- core-api: BuiltLlmClient.client is Arc<dyn agent_loop::model::Model>;
  chatbot.rs (ChatbotClient + wire types) deleted; APP_NAME re-exported
  from agent-loop
- providers (openai/anthropic/ollama/openrouter/requesty/declared) build
  OpenAiModel/AnthropicModel/OllamaModel with the model's wire id
- LoggingModel decorator (llm/logging.rs) replaces LoggingChatbotClient;
  per-request correlation (session/stack/user) travels in the new
  ModelRequest.log field, never sent to providers
- llm_call/llm_loop/compactor speak Model::complete + ModelResponse;
  retriability via Model::is_retriable (structured status, B6 rule now
  the crate's default); payload persistence reads RawMeta off
  ModelResponse/ModelError
- crates/llm-client and skald-core/src/chatbot deleted

Full workspace test suite green (incl. 162 skald-core + 32 agent-loop).
This commit is contained in:
2026-07-25 23:55:17 +01:00
parent b8cc6d263b
commit 882a8c9cb9
29 changed files with 251 additions and 2128 deletions
+3 -3
View File
@@ -15,7 +15,7 @@ use anyhow::{anyhow, Context, Result};
use core_api::provider::{ApiProvider, BuiltLlmClient, LlmModelRecord, LlmProviderRecord};
use crate::chatbot::openai::OpenAiClient;
use agent_loop::models::OpenAiModel;
/// Computes the `extra_params` an OpenAI-compatible client should be built with,
/// given a model's stored `extra_params` and its selected reasoning value. The
@@ -75,7 +75,7 @@ pub(crate) async fn fetch_openai_models(
.ok_or_else(|| anyhow!("unexpected {who} response shape"))
}
/// Builds an `OpenAiClient` for an OpenAI-compatible provider: requires the
/// Builds an `OpenAiModel` for an OpenAI-compatible provider: requires the
/// provider record's `api_key` and merges the model's stored `extra_params`
/// with the provider-translated reasoning fragment (see `extra_with_reasoning`).
pub(crate) fn build_openai_llm(
@@ -89,7 +89,7 @@ pub(crate) fn build_openai_llm(
.with_context(|| format!("provider '{}': api_key required for {}", record.name, provider.type_id()))?;
let extra = extra_with_reasoning(provider, model);
Ok(BuiltLlmClient {
client: Arc::new(OpenAiClient::new(base_url, key, extra, prompt_cache)),
client: Arc::new(OpenAiModel::with_options(base_url, key, model.model_id.clone(), extra, prompt_cache)),
prompt_cache,
})
}