feat: conversion-driven extensions — resolvers, DefineTool, hooks, ops controls
CI / Tidy (push) Successful in 9m31s
CI / Build & Test (push) Successful in 10m13s

Phase 9a (ADR-0014): Registry.RegisterResolver for dynamic tiers;
DefineTool[Args] typed tools; Usage cache/reasoning detail fields wired
through anthropic/openai/google; WithPromptCaching (Anthropic
cache_control); agent supervision hooks (WithMaxStepsFunc, WithSteer,
WithCompactor, WithToolErrorLimits + ErrToolLoop); health
Bench/Unbench/Snapshot; ChainConfig.Observer failover events.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 13:30:06 +02:00
parent 04b21fdad2
commit 0147a79d18
21 changed files with 767 additions and 29 deletions
+26 -3
View File
@@ -125,9 +125,32 @@ type wireRespMessage struct {
}
type wireUsage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
PromptTokensDetails *wirePromptDetail `json:"prompt_tokens_details"`
CompletionTokensDetails *wireOutputDetail `json:"completion_tokens_details"`
}
type wirePromptDetail struct {
CachedTokens int `json:"cached_tokens"`
}
type wireOutputDetail struct {
ReasoningTokens int `json:"reasoning_tokens"`
}
// toUsage maps wire usage (with optional detail objects — absent on many
// compat servers) onto the canonical Usage.
func (u *wireUsage) toUsage() llm.Usage {
out := llm.Usage{InputTokens: u.PromptTokens, OutputTokens: u.CompletionTokens}
if u.PromptTokensDetails != nil {
out.CacheReadTokens = u.PromptTokensDetails.CachedTokens
}
if u.CompletionTokensDetails != nil {
out.ReasoningTokens = u.CompletionTokensDetails.ReasoningTokens
}
return out
}
type errorEnvelope struct {