From 66e2a8890767ae813dad6c3620542b0dfa223b40 Mon Sep 17 00:00:00 2001 From: ArcticPole04 <98264904+ArcticPole04@users.noreply.github.com> Date: Tue, 17 Nov 2026 18:14:36 +0800 Subject: [PATCH] Add cmd-mod-toks to the registry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A tokens-per-second meter that reports the live generation rate beside the working spinner and the exact rate in the footer once a request finishes. The estimate is where most meters in this category go wrong: dividing a character count by 4 reads CJK about 4x too slow. This one samples the absolute count from `message_update` instead of deltas, so retries and stream fragmentation cannot skew it, and it counts tool-call arguments that never arrive as a text delta. Every request is reconciled against the provider's own outputTokens, handling both billing styles for reasoning tokens. kinds reflects what the mod registers: addCommand (/toks), addFlag (status, spinner, lang), and ui.override('spinner'). It registers no cmd.hooks, so "hook" is deliberately absent. cmd mods inspect reports reaches: none and imports: none — the mod reads host events and writes to cmd.state, with no network, filesystem, or process access. NOTICE.md credits the two MIT-licensed mods whose measurement constants informed this one and records what is original here. 90 tests pass on Node's built-in runner; typecheck is clean. Co-authored-by: CommandCodeBot --- mods/registry.json | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/mods/registry.json b/mods/registry.json index f953c13..2f3716c 100644 --- a/mods/registry.json +++ b/mods/registry.json @@ -673,6 +673,29 @@ "pane" ], "addedAt": "2026-11-10" + }, + { + "name": "cmd-mod-toks", + "source": "cmd-mod-toks", + "npm": "cmd-mod-toks", + "description": "Honest tokens-per-second meter: samples absolute message_update counts so retries and stream fragmentation cannot skew it, counts CJK as one token, and calibrates against the provider's own outputTokens.", + "author": { + "name": "ArcticPole04", + "github": "ArcticPole04" + }, + "repo": "https://github.com/ArcticPole04/cmd-mod-toks", + "kinds": [ + "command", + "flag", + "renderer" + ], + "tags": [ + "metrics", + "throughput", + "status-line", + "tokens" + ], + "addedAt": "2026-11-17" } ] }