Problem
Several fields that the API supports and stores are never populated by the CLI:
| Field |
Current state |
Impact |
clientVersion |
Never sent, always null |
No way to know which CLI version generated an event — makes debugging and compatibility tracking impossible |
durationMs |
Hardcoded to 0 |
No tool execution timing. For PostToolUse events, the time between Pre and Post is knowable but not calculated |
bytesIn / bytesOut |
Never computed |
No payload size tracking despite having tool_input and tool_response data |
Fix
CLI version
- Add CLI version to
CreateSessionRequest.client_info map (e.g. {"name": "kontext-cli", "os": "darwin", "version": "0.1.0"})
- The version is already available via
ldflags (-X main.version=...) from goreleaser
Duration
- For PostToolUse events: compute elapsed time since the corresponding PreToolUse event (match by
tool_use_id)
- The sidecar can maintain a map of
tool_use_id → start_time from PreToolUse events
- Add
duration_ms to the proto or compute it server-side by correlating Pre/Post events
Byte counts
- Compute from
len(tool_input) and len(tool_response) before sending
- Add
bytes_in and bytes_out fields to the proto
Problem
Several fields that the API supports and stores are never populated by the CLI:
clientVersiondurationMs0bytesIn/bytesOuttool_inputandtool_responsedataFix
CLI version
CreateSessionRequest.client_infomap (e.g.{"name": "kontext-cli", "os": "darwin", "version": "0.1.0"})ldflags(-X main.version=...) from goreleaserDuration
tool_use_id)tool_use_id → start_timefrom PreToolUse eventsduration_msto the proto or compute it server-side by correlating Pre/Post eventsByte counts
len(tool_input)andlen(tool_response)before sendingbytes_inandbytes_outfields to the proto