Skip to content

feat: send CLI version, duration, and byte counts with events #34

@tumberger

Description

@tumberger

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions