feat(wire): provide token usage and message id in StatusUpdate message#490
Merged
feat(wire): provide token usage and message id in StatusUpdate message#490
Conversation
Signed-off-by: Richard Chien <stdrc@outlook.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the StatusUpdate wire message by adding two new fields: token_usage and message_id. This allows the wire protocol to communicate token usage statistics and message identifiers from the LLM step results to downstream consumers.
Key Changes:
- Added
token_usageandmessage_idfields to theStatusUpdatemessage class - Made
context_usagefield have an explicit default value ofNonefor consistency - Updated the main usage site in
kimisoul.pyto populate these new fields from step results - Simplified StatusUpdate instantiation in
replay.pyby using the default constructor
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/kimi_cli/wire/message.py |
Added token_usage and message_id fields to StatusUpdate class with None defaults; added import for TokenUsage type |
src/kimi_cli/soul/kimisoul.py |
Modified to create StatusUpdate with token usage and message ID from step results, then conditionally add context usage |
tests/test_wire_message.py |
Updated test snapshot to include the new fields in serialized output |
src/kimi_cli/ui/shell/replay.py |
Simplified StatusUpdate() instantiation using default constructor instead of explicit context_usage=None |
CHANGELOG.md |
Added entry documenting the new fields in the Unreleased section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Resolve #(issue_number)
Description