opencode-tokscope 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +61 -2
  3. package/dist/tui.js +2867 -0
  4. package/package.json +51 -4
  5. package/tui.js +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mihael Lenic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,62 @@
1
- # Temporary Holding Version
1
+ # opencode-tokscope
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm version](https://img.shields.io/npm/v/opencode-tokscope.svg)](https://www.npmjs.com/package/opencode-tokscope)
4
+ [![license](https://img.shields.io/npm/l/opencode-tokscope.svg)](https://github.com/mihaellenic/opencode-tokscope/blob/main/LICENSE)
5
+ [![made for OpenCode](https://img.shields.io/badge/made%20for-OpenCode%20V2-1024D3)](https://opencode.ai/docs/plugins/)
6
+
7
+ **Which models and providers are fastest in your actual OpenCode usage? And are they getting faster or slower?**
8
+
9
+ Tokscope is an OpenCode V2 terminal UI plugin with:
10
+
11
+ - A full-screen `/tokscope` page comparing median tokens per second for each model/provider pair.
12
+ - A daily median trend for the selected pair, with project, time-range, and reasoning-setting filters.
13
+ - A clickable sidebar summary of the fastest pairs over the last 24 hours.
14
+
15
+ ![Real OpenCode session with the Tokscope widget in the sidebar: fastest model/provider pairs over the last 24 hours](https://raw.githubusercontent.com/mihaellenic/opencode-tokscope/main/docs/images/tokscope-sidebar.png)
16
+
17
+ ![Model/provider comparison and daily trend — synthetic mockup](https://raw.githubusercontent.com/mihaellenic/opencode-tokscope/main/docs/images/tokscope-overview.png)
18
+
19
+ ## Install
20
+
21
+ Requires **OpenCode V2 TUI**.
22
+
23
+ ```sh
24
+ opencode plugin add opencode-tokscope
25
+ ```
26
+
27
+ ## Use
28
+
29
+ Run `/tokscope`, or press `Ctrl+P` and select **Tokscope**.
30
+
31
+ The page opens with **all projects · last 30 days · all reasoning settings**. Active filters and measured/unavailable coverage remain visible.
32
+
33
+ | Key | Action |
34
+ | --- | --- |
35
+ | `↑` / `↓` or `k` / `j` | Select a model/provider pair |
36
+ | `←` / `→` | Select a day in its trend |
37
+ | `s` | Choose current project or all projects |
38
+ | `t` | Choose last 7 / 30 / 90 days or all history |
39
+ | `r` | Choose all / a recorded reasoning setting / unknown |
40
+ | `Esc` | Return to the previous screen |
41
+ | `Enter` | Retry after a read error |
42
+
43
+ **Sidebar:** shows up to three fastest pairs across **all projects on the connected instance**, each requiring at least **three measured calls in the rolling 24-hour window**. Click anywhere in the widget to open the page. It refreshes after a model step completes and once a minute while visible. Read failures retain the last successful rows marked `(stale)`; no qualifying pairs shows `No models with 3+ calls in 24h.`
44
+
45
+ ## What tok/s means
46
+
47
+ One sample is one completed model request (assistant step), including main-agent, subagent, and background activity:
48
+
49
+ ```text
50
+ tok/s = (tokens.output + tokens.reasoning) / ((time.streamed - time.created) / 1000)
51
+ ```
52
+
53
+ - Comparisons use the **median of individual request rates**, not an average or total tokens divided by total duration.
54
+ - The interval ends when the provider response body ends, excluding tool settlement time. Input and cache tokens do not count.
55
+ - Measurements require completion without error, a recorded stream end, positive duration, and positive generated tokens. Failed, cancelled, and in-progress requests are excluded.
56
+ - Completed requests without usable data count as **unavailable**, never zero throughput. Pairs with only unavailable data appear after measured rows with `0` measured calls.
57
+ - Existing history is read through the connected OpenCode server, including requests made before installation when the recorded data supports measurement. Daily trends use the local calendar day of completion; missing days are gaps, not zeros.
58
+
59
+ ## Project links
60
+
61
+ - [Contributing and local development](https://github.com/mihaellenic/opencode-tokscope/blob/main/CONTRIBUTING.md)
62
+ - [MIT license](https://github.com/mihaellenic/opencode-tokscope/blob/main/LICENSE)