@mtayfur/opencode-cache-view 1.0.3 → 1.0.4
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.
- package/README.md +35 -55
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# OpenCode Cache View
|
|
2
2
|
|
|
3
|
-
`@mtayfur/opencode-cache-view` adds a compact sidebar to the OpenCode TUI for cache efficiency, estimated context
|
|
3
|
+
`@mtayfur/opencode-cache-view` adds a compact sidebar to the OpenCode TUI for cache efficiency, estimated context
|
|
4
|
+
usage, generation speed, and loaded skills. The latest cache-hit ratio and trend also remain visible in the prompt
|
|
5
|
+
status row.
|
|
4
6
|
|
|
5
7
|
```text
|
|
6
8
|
Cache View
|
|
@@ -26,73 +28,51 @@ customize-opencode 3.1K tok
|
|
|
26
28
|
|
|
27
29
|
## Metrics
|
|
28
30
|
|
|
29
|
-
- **Cache:** `Hit` is `cache.read / (input + cache.read + cache.write)` for the latest regular LLM step.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- **
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
- **Cache:** `Hit` is `cache.read / (input + cache.read + cache.write)` for the latest regular LLM step.
|
|
32
|
+
`Session Hit` is the aggregate OpenCode session ratio, including compaction calls. `Miss` combines uncached input and
|
|
33
|
+
cache writes.
|
|
34
|
+
- **Estimated Tokens:** Uses one character-based estimator for the visible system, user, tool, reasoning, and output
|
|
35
|
+
content from the latest completed compaction summary, its preserved tail, and subsequent messages loaded in the TUI.
|
|
36
|
+
Provider system prompts, tool schemas, and media tokens are not included.
|
|
37
|
+
- **Speed:** During streaming, `TPS` shows a `~`-prefixed estimate from visible text and reasoning deltas over the
|
|
38
|
+
latest five seconds. Hidden reasoning with no deltas uses the previous completed turn or remains `… tok/s` when none
|
|
39
|
+
exists.
|
|
40
|
+
Completed tool-call steps and tool execution time are excluded. The rate remains `~`-prefixed while the turn is
|
|
41
|
+
incomplete; the final non-tool-call assistant step replaces it with exact `(output + reasoning) / duration`
|
|
42
|
+
throughput. `TTFT` retains the estimated delay to the first visible reasoning or text block, and `Trend` shows the
|
|
43
|
+
latest eight completed-turn TPS values.
|
|
44
|
+
- **Loaded Skills:** Shows active, non-compacted skill outputs and their estimated token counts. When a skill is loaded
|
|
45
|
+
more than once, the latest load is shown.
|
|
46
|
+
|
|
47
|
+
Rows and the cache-hit bar adapt to the available sidebar width. The arrow next to the hit rate compares the latest two
|
|
48
|
+
LLM steps. Sections can be expanded or collapsed with the mouse.
|
|
49
|
+
|
|
50
|
+
The prompt status indicator uses the composable `session_prompt_right` slot, so it does not replace the prompt or
|
|
51
|
+
conflict with plugins that customize prompt behavior. It shows the same completed-step TPS as the sidebar, followed by
|
|
52
|
+
a single separator and the cache ratio; only the cache trend is color-coded.
|
|
37
53
|
|
|
38
54
|
## Requirements
|
|
39
55
|
|
|
40
56
|
- OpenCode `1.18.16` or a newer compatible 1.x release
|
|
41
|
-
- Bun `1.3.14` or newer for local development
|
|
42
57
|
|
|
43
58
|
## Installation
|
|
44
59
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
```json
|
|
48
|
-
{
|
|
49
|
-
"plugin": ["@mtayfur/opencode-cache-view"]
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
OpenCode installs package plugins automatically. Restart the TUI after changing the configuration.
|
|
54
|
-
|
|
55
|
-
### Local checkout
|
|
60
|
+
Install the plugin globally with OpenCode:
|
|
56
61
|
|
|
57
62
|
```sh
|
|
58
|
-
|
|
63
|
+
opencode plugin @mtayfur/opencode-cache-view --global
|
|
59
64
|
```
|
|
60
65
|
|
|
61
|
-
|
|
66
|
+
Restart OpenCode after installation.
|
|
62
67
|
|
|
63
|
-
|
|
64
|
-
bash ./install.sh --uninstall
|
|
65
|
-
```
|
|
68
|
+
### Manual configuration
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
Alternatively, add the package to `~/.config/opencode/tui.json`:
|
|
68
71
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
├── index.tsx Plugin entrypoint
|
|
74
|
-
├── cache-status.tsx Prompt status-row cache ratio
|
|
75
|
-
├── cache-view.tsx Solid/OpenTUI view and event subscriptions
|
|
76
|
-
├── format.ts Display formatting
|
|
77
|
-
├── token-estimator.ts Cached character-based token estimation
|
|
78
|
-
└── metrics/
|
|
79
|
-
├── cache.ts Cache usage and hit ratios
|
|
80
|
-
├── context.ts Active context, token, and skill calculations
|
|
81
|
-
├── helpers.ts Shared message and part helpers
|
|
82
|
-
├── read.ts Metric orchestration
|
|
83
|
-
├── speed.ts Completed-step generation speed
|
|
84
|
-
└── types.ts Metric data contracts
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"plugin": ["@mtayfur/opencode-cache-view"]
|
|
75
|
+
}
|
|
85
76
|
```
|
|
86
77
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
## Development
|
|
90
|
-
|
|
91
|
-
From the repository root:
|
|
92
|
-
|
|
93
|
-
```sh
|
|
94
|
-
bun install --frozen-lockfile
|
|
95
|
-
bun run --filter @mtayfur/opencode-cache-view typecheck
|
|
96
|
-
bun run --filter @mtayfur/opencode-cache-view build
|
|
97
|
-
npm pack ./packages/cache-view --dry-run
|
|
98
|
-
```
|
|
78
|
+
Restart OpenCode after changing the configuration.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@mtayfur/opencode-cache-view",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.4",
|
|
5
5
|
"description": "Minimal OpenCode TUI sidebar for cache hit, estimated tokens, and generation speed.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|