fix(cli): report cumulative total_tokens in stream-json/json output (#8910)

Signed-off-by: Trinity <trinity@multica.ai>
Signed-off-by: Bright Zheng <bzqzheng@gmail.com>
Signed-off-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
Bright Zheng
2026-05-13 14:35:39 -04:00
committed by GitHub
parent 09d7f98001
commit 9ca29a1047
2 changed files with 116 additions and 2 deletions
+1 -2
View File
@@ -1501,10 +1501,9 @@ impl CliSession {
.await
}
// Get the session's total token usage
pub async fn get_total_token_usage(&self) -> Result<Option<i32>> {
let metadata = self.get_session().await?;
Ok(metadata.total_tokens)
Ok(metadata.accumulated_total_tokens)
}
/// Display enhanced context usage with session totals