mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 16:11:36 +00:00
feat: surface cached token counts in /status output (openclaw#21248) thanks @vishaltandale00
Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: vishaltandale00 <9222298+vishaltandale00@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -269,6 +269,8 @@ export async function incrementCompactionCount(params: {
|
||||
// Clear input/output breakdown since we only have the total estimate after compaction
|
||||
updates.inputTokens = undefined;
|
||||
updates.outputTokens = undefined;
|
||||
updates.cacheRead = undefined;
|
||||
updates.cacheWrite = undefined;
|
||||
}
|
||||
sessionStore[sessionKey] = {
|
||||
...entry,
|
||||
|
||||
@@ -86,6 +86,8 @@ export async function persistSessionUsageUpdate(params: {
|
||||
const patch: Partial<SessionEntry> = {
|
||||
inputTokens: input,
|
||||
outputTokens: output,
|
||||
cacheRead: params.usage?.cacheRead ?? 0,
|
||||
cacheWrite: params.usage?.cacheWrite ?? 0,
|
||||
// Missing a last-call snapshot means context utilization is stale/unknown.
|
||||
totalTokens,
|
||||
totalTokensFresh: typeof totalTokens === "number",
|
||||
|
||||
Reference in New Issue
Block a user