mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-04 14:13:15 +00:00
Surface cache-read and cache-creation input tokens (plus the prompt_tokens_include_cached_segments flag) in webhook usage responses, so callers can distinguish cached from non-cached input tokens. The data already flowed end-to-end via providers.Usage and agent.RunResult.Usage; the two webhook envelope structs (webhookLLMUsage for the sync LLM webhook, callbackUsage for the async callback payload) copied only 3 of the fields, dropping the cache data. Add the 3 cache fields (mirroring providers.Usage JSON tags exactly, all omitempty) and populate them. The async callbackUsage mapping is extracted into a pure newCallbackUsage helper for unit testing. Additive and non-breaking: omitempty keeps responses without caching byte-identical. No schema change.