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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user