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
+16 -2
View File
@@ -24,6 +24,13 @@ type wireRequest struct {
TopP *float64 `json:"top_p,omitempty"`
StopSequences []string `json:"stop_sequences,omitempty"`
OutputConfig *wireOutputConfig `json:"output_config,omitempty"`
// CacheControl is the top-level auto-placement form of prompt caching:
// the API puts the breakpoint on the last cacheable block.
CacheControl *wireCacheControl `json:"cache_control,omitempty"`
}
type wireCacheControl struct {
Type string `json:"type"`
}
type wireMessage struct {
@@ -109,8 +116,10 @@ type wireUsage struct {
// real total input is input + cache_creation + cache_read.
func (u wireUsage) toUsage() llm.Usage {
return llm.Usage{
InputTokens: u.InputTokens + u.CacheCreationInputTokens + u.CacheReadInputTokens,
OutputTokens: u.OutputTokens,
InputTokens: u.InputTokens + u.CacheCreationInputTokens + u.CacheReadInputTokens,
OutputTokens: u.OutputTokens,
CacheReadTokens: u.CacheReadInputTokens,
CacheWriteTokens: u.CacheCreationInputTokens,
}
}
@@ -157,6 +166,11 @@ func buildWireRequest(modelID string, req llm.Request, defaultMax int, stream bo
Schema: req.Schema,
}}
}
if req.PromptCache {
// Top-level auto-placement: the API puts the cache breakpoint on
// the last cacheable block.
wr.CacheControl = &wireCacheControl{Type: "ephemeral"}
}
return wr
}