Files
hapi/cli/src/agy
Junmo KimandGitHub ac82d2d8d6 feat: show generation rate (tok/s) for Claude rounds (#2367)
* refactor(agent): extract agy's generation-time clock into a shared helper

agy computes generation time as the round minus tool-run and user-wait
windows. Move the window math and the event-fed bookkeeping into
cli/src/agent/generationClock.ts (GenerationClock + generationTimeMs) so
other ACP launchers can time their rounds the same way, and feed agy's
clock the same session updates and permission waits it always did.
Numbers are identical: the moved pure function is agyGenerationMs
verbatim and the agy tok/s integration tests pass unchanged.

* feat(claude): fill the round footer tok/s from the SDK result

Claude Code reports duration_api_ms on every result: the API-active time
of the round, with tool execution and permission waits already outside
it. Pair it with the round's usage.output_tokens and send both in the
existing turn_duration resultSummary, so the web's generic round-summary
normalizer picks them up and the footer renders tok/s — no new wire
types, and the renderer already knew how to format the pair.

Errored rounds and the manual /compact turn carry no meaningful
generation rate, so they emit nothing: claudeRemote marks the compact
turn result in-process (hapi_compact_turn) before it reaches the log
converter. Values that cannot produce a rate (zero, negative, fractional,
missing) are omitted rather than guessed.
2026-11-11 08:57:45 +08:00
..