M1: Anthropic codec and provider

Adds the Anthropic SSE codec (codec/anthropic.rs) translating Anthropic's event stream into LlmEvents, the AnthropicProvider, and registry wiring so the engine loop can run against the real API instead of just MockProvider.
This commit is contained in:
2026-07-10 16:19:38 +02:00
parent 4118279da1
commit 9ed278bcb5
9 changed files with 1761 additions and 27 deletions
+12 -12
View File
@@ -574,18 +574,18 @@ pub async fn process_step(
let mut result = StepResult::Stop;
loop {
let cancelled = ctx.cancel.is_cancelled();
if cancelled {
run.mark_errored(&ProviderError::Cancelled).await;
return Ok(StepOutcome {
result: StepResult::Stop,
message_id: run.assistant.as_ref().map(|m| m.id.clone()),
usage,
aborted: true,
});
}
let item = stream.next().await;
let item = tokio::select! {
item = stream.next() => item,
_ = ctx.cancel.cancelled() => {
run.mark_errored(&ProviderError::Cancelled).await;
return Ok(StepOutcome {
result: StepResult::Stop,
message_id: run.assistant.as_ref().map(|m| m.id.clone()),
usage,
aborted: true,
});
}
};
let Some(item) = item else { break };
let event = match item {