thotam
f87cdaf616
feat(webhooks): split webhook usage tokens by cache vs non-cache ( #1345 )
...
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.
2026-07-04 23:26:49 +07:00
..
2026-05-22 20:59:47 +07:00
2026-05-22 20:59:47 +07:00
2026-03-27 10:19:16 +07:00
2026-03-27 10:19:16 +07:00
2026-04-09 21:15:19 +07:00
2026-04-24 00:16:14 +07:00
2026-04-09 21:15:19 +07:00
2026-05-31 12:44:29 +07:00
2026-05-17 15:51:56 +07:00
2026-03-29 18:01:08 +07:00
2026-04-09 21:15:19 +07:00
2026-06-12 10:40:59 +07:00
2026-06-12 10:40:59 +07:00
2026-05-17 15:51:56 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-04-10 19:35:02 +07:00
2026-04-10 19:35:02 +07:00
2026-04-09 21:15:19 +07:00
2026-03-14 18:13:52 +07:00
2026-07-03 08:25:05 +07:00
2026-07-03 08:25:05 +07:00
2026-04-17 19:02:53 +07:00
2026-03-29 18:01:08 +07:00
2026-07-03 08:25:05 +07:00
2026-05-22 20:59:47 +07:00
2026-04-12 10:24:07 +07:00
2026-03-23 08:08:23 +07:00
2026-04-12 10:24:07 +07:00
2026-05-20 22:17:13 +07:00
2026-03-23 08:08:23 +07:00
2026-04-11 21:22:23 +07:00
2026-06-26 22:55:17 +07:00
2026-06-26 22:55:17 +07:00
2026-04-13 21:01:21 +07:00
2026-04-13 21:01:21 +07:00
2026-05-24 11:27:02 +07:00
2026-05-24 11:27:02 +07:00
2026-05-24 11:27:02 +07:00
2026-04-11 23:22:17 +07:00
2026-05-21 16:44:43 +07:00
2026-05-21 16:44:43 +07:00
2026-07-03 08:25:05 +07:00
2026-05-31 13:50:31 +07:00
2026-05-31 13:50:31 +07:00
2026-05-31 13:50:31 +07:00
2026-05-31 13:50:31 +07:00
2026-05-22 20:59:47 +07:00
2026-06-03 11:01:14 +07:00
2026-05-31 14:01:29 +07:00
2026-04-09 21:15:19 +07:00
2026-04-24 00:16:14 +07:00
2026-04-24 00:16:14 +07:00
2026-03-29 23:51:53 +07:00
2026-03-27 09:28:42 +07:00
2026-04-09 21:15:19 +07:00
2026-04-10 10:13:58 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-03-28 13:33:25 +07:00
2026-05-17 15:33:55 +07:00
2026-06-05 00:48:38 +07:00
2026-06-05 00:48:38 +07:00
2026-05-22 21:53:10 +07:00
2026-05-22 21:53:10 +07:00
2026-05-24 11:13:03 +07:00
2026-05-24 11:13:03 +07:00
2026-05-22 20:59:47 +07:00
2026-03-29 18:01:08 +07:00
2026-03-14 18:13:52 +07:00
2026-04-16 17:19:50 +07:00
2026-07-03 08:25:05 +07:00
2026-06-21 22:27:44 +07:00
2026-03-14 18:13:52 +07:00
2026-06-21 22:27:44 +07:00
2026-06-21 22:27:44 +07:00
2026-06-21 22:27:44 +07:00
2026-06-21 22:27:44 +07:00
2026-06-21 22:27:44 +07:00
2026-06-21 22:27:44 +07:00
2026-03-29 12:54:12 +07:00
2026-03-23 22:57:26 +07:00
2026-05-20 22:17:13 +07:00
2026-05-20 22:17:13 +07:00
2026-03-27 09:35:57 +07:00
2026-03-27 10:19:16 +07:00
2026-06-05 00:48:38 +07:00
2026-04-09 21:15:19 +07:00
2026-07-03 20:23:47 +07:00
2026-03-23 22:57:26 +07:00
2026-04-09 21:15:19 +07:00
2026-04-23 19:16:12 +07:00
2026-04-16 15:09:48 +07:00
2026-05-11 14:58:19 +07:00
2026-05-11 15:41:27 +07:00
2026-05-11 15:41:27 +07:00
2026-05-11 14:58:19 +07:00
2026-05-24 11:13:03 +07:00
2026-03-30 21:36:09 +07:00
2026-03-30 21:36:09 +07:00
2026-06-21 16:39:14 +07:00
2026-06-15 10:16:47 +07:00
2026-07-03 20:23:47 +07:00
2026-07-03 20:23:47 +07:00
2026-03-25 14:50:43 +07:00
2026-05-24 11:13:03 +07:00
2026-04-24 00:16:14 +07:00
2026-04-24 00:16:14 +07:00
2026-04-03 15:44:39 +07:00
2026-05-21 16:37:19 +07:00
2026-06-21 16:39:14 +07:00
2026-06-05 00:48:38 +07:00
2026-07-03 20:23:47 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-04-13 21:01:21 +07:00
2026-06-24 14:03:00 +07:00
2026-05-31 22:05:59 +07:00
2026-06-12 10:40:59 +07:00
2026-05-24 15:14:43 +07:00
2026-05-31 11:05:47 +07:00
2026-05-31 11:05:47 +07:00
2026-05-31 22:05:59 +07:00
2026-05-31 19:42:05 +07:00
2026-05-31 19:42:05 +07:00
2026-05-31 16:49:23 +07:00
2026-05-22 20:59:47 +07:00
2026-05-22 20:59:47 +07:00
2026-06-12 10:38:53 +07:00
2026-06-12 10:38:53 +07:00
2026-04-11 23:22:17 +07:00
2026-06-12 15:38:23 +07:00
2026-06-12 15:38:23 +07:00
2026-05-31 12:44:29 +07:00
2026-05-31 12:44:29 +07:00
2026-06-12 10:38:53 +07:00
2026-04-16 17:07:56 +07:00
2026-06-12 10:38:53 +07:00
2026-06-12 10:38:53 +07:00
2026-06-12 10:38:53 +07:00
2026-05-21 16:37:50 +07:00
2026-05-24 15:57:21 +07:00
2026-06-26 05:59:35 +07:00
2026-06-29 20:54:30 +07:00
2026-05-31 12:24:22 +07:00
2026-05-21 16:37:50 +07:00
2026-05-24 15:57:21 +07:00
2026-06-12 15:38:23 +07:00
2026-03-29 22:33:17 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-05-24 11:13:03 +07:00
2026-03-23 10:17:47 +07:00
2026-03-27 09:35:57 +07:00
2026-05-24 11:13:03 +07:00
2026-04-13 19:19:51 +07:00
2026-03-23 22:57:26 +07:00
2026-03-23 22:57:26 +07:00
2026-03-29 22:33:17 +07:00
2026-03-29 22:33:17 +07:00
2026-04-12 10:24:07 +07:00
2026-04-16 15:49:50 +07:00
2026-04-16 15:49:50 +07:00
2026-04-13 21:01:21 +07:00
2026-04-09 21:15:19 +07:00
2026-04-16 15:49:50 +07:00
2026-05-11 14:58:19 +07:00
2026-04-09 21:15:19 +07:00
2026-04-09 21:15:19 +07:00
2026-06-12 00:14:40 +07:00
2026-06-12 00:14:40 +07:00
2026-04-20 00:05:19 +07:00
2026-04-20 00:05:19 +07:00
2026-04-20 00:05:19 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-04-20 00:05:19 +07:00
2026-04-23 08:31:53 +07:00
2026-04-23 08:31:53 +07:00
2026-04-23 08:31:53 +07:00
2026-04-23 19:16:12 +07:00
2026-04-23 08:31:53 +07:00
2026-05-23 09:34:29 +07:00
2026-05-23 00:16:03 +07:00
2026-05-24 11:13:03 +07:00
2026-07-03 06:24:21 +07:00
2026-07-03 06:24:21 +07:00
2026-07-03 06:24:21 +07:00
2026-07-03 06:24:21 +07:00
2026-07-03 06:24:21 +07:00
2026-04-17 19:07:01 +07:00
2026-04-09 21:15:19 +07:00
2026-04-11 21:22:23 +07:00
2026-03-30 14:12:18 +07:00
2026-06-21 22:27:44 +07:00
2026-04-13 10:59:27 +07:00
2026-05-28 20:55:23 +07:00
2026-05-28 20:55:23 +07:00
2026-06-09 23:04:59 +07:00
2026-06-09 23:04:59 +07:00
2026-04-23 18:56:57 +07:00
2026-04-12 13:25:15 +07:00
2026-04-11 21:22:23 +07:00
2026-04-12 14:31:36 +07:00
2026-04-13 21:42:17 +07:00
2026-04-20 00:05:19 +07:00
2026-04-20 00:05:19 +07:00
2026-04-09 21:15:19 +07:00
2026-06-24 16:10:38 +07:00
2026-06-24 10:39:24 +07:00
2026-06-24 10:39:24 +07:00
2026-06-24 16:10:38 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-05-20 16:33:49 +07:00
2026-07-04 23:26:49 +07:00
2026-07-04 23:26:49 +07:00
2026-05-11 13:29:24 +07:00
2026-06-24 16:10:38 +07:00
2026-06-21 18:46:37 +07:00
2026-05-11 13:29:24 +07:00
2026-05-11 13:29:24 +07:00
2026-05-11 13:29:24 +07:00
2026-03-25 22:17:33 +07:00
2026-05-11 14:58:19 +07:00