opencode-visual-cache 1.1.2 → 1.1.6

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 CHANGED
@@ -18,13 +18,16 @@
18
18
 
19
19
  <div align="center">
20
20
  <strong>支持折叠,节省侧边栏占用👇</strong> <br>
21
- <img src="https://raw.githubusercontent.com/Hotakus/opencode-visual-cache/master/assets/example2.png"></img>
21
+ <img src="https://raw.githubusercontent.com/Hotakus/opencode-visual-cache/master/assets/collapse.png"></img>
22
+ <img src="https://raw.githubusercontent.com/Hotakus/opencode-visual-cache/master/assets/collapse_en.png"></img>
22
23
  </div>
23
24
  <div align="center">
24
25
  <strong>展开👇</strong> <br>
25
- <img src="https://raw.githubusercontent.com/Hotakus/opencode-visual-cache/master/assets/example1.png"></img>
26
+ <img src="https://raw.githubusercontent.com/Hotakus/opencode-visual-cache/master/assets/expand.png"></img>
27
+ <img src="https://raw.githubusercontent.com/Hotakus/opencode-visual-cache/master/assets/expand_en.png"></img>
26
28
  </div>
27
29
 
30
+
28
31
  ---
29
32
  ## 功能
30
33
 
@@ -45,7 +48,7 @@
45
48
  在 OpenCode 中按 **`Ctrl + P`** 打开命令面板,搜索 **`install plugin`**,输入:
46
49
 
47
50
  ```
48
- opencode-visual-cache
51
+ opencode-visual-cache@latest
49
52
  ```
50
53
 
51
54
  回车即可完成安装与配置。
@@ -55,7 +58,7 @@ opencode-visual-cache
55
58
  **1. 安装插件**
56
59
 
57
60
  ```bash
58
- npm install -g opencode-visual-cache
61
+ npm install -g opencode-visual-cache@latest
59
62
  ```
60
63
 
61
64
  **2. 配置 TUI 插件**
@@ -65,7 +68,7 @@ npm install -g opencode-visual-cache
65
68
  ```jsonc
66
69
  {
67
70
  "$schema": "https://opencode.ai/tui.json",
68
- "plugin": ["opencode-visual-cache"]
71
+ "plugin": ["opencode-visual-cache@latest"]
69
72
  }
70
73
  ```
71
74
 
@@ -75,6 +78,32 @@ npm install -g opencode-visual-cache
75
78
 
76
79
  ---
77
80
 
81
+ ## 更新
82
+
83
+ 由于 [OpenCode 已知问题 #6774](https://github.com/anomalyco/opencode/issues/6774),插件缓存会锁死在首次安装时的版本,不会自动检测 npm 上的新版本。
84
+
85
+ 更新步骤:
86
+
87
+ **1. 清除 OpenCode 插件缓存**
88
+
89
+ ```powershell
90
+ # Windows
91
+ Remove-Item -Recurse -Force "$env:USERPROFILE\.cache\opencode\packages\opencode-visual-cache@latest"
92
+ ```
93
+
94
+ ```bash
95
+ # macOS / Linux
96
+ rm -rf ~/.cache/opencode/packages/opencode-visual-cache@latest
97
+ ```
98
+
99
+ **2. 重新安装插件**
100
+
101
+ 在 OpenCode 中按 **`Ctrl + P`** → `install plugin` → `opencode-visual-cache@latest` → 回车
102
+
103
+ **3. 重启 OpenCode**
104
+
105
+ ---
106
+
78
107
  ## 调试
79
108
 
80
109
  强制英文(Windows PowerShell):
package/README_EN.md CHANGED
@@ -18,11 +18,13 @@
18
18
 
19
19
  <div align="center">
20
20
  <strong>Collapsed 👇</strong> <br>
21
- <img src="https://raw.githubusercontent.com/Hotakus/opencode-visual-cache/master/assets/example2.png"></img>
21
+ <img src="https://raw.githubusercontent.com/Hotakus/opencode-visual-cache/master/assets/collapse.png"></img>
22
+ <img src="https://raw.githubusercontent.com/Hotakus/opencode-visual-cache/master/assets/collapse_en.png"></img>
22
23
  </div>
23
24
  <div align="center">
24
25
  <strong>Expanded 👇</strong> <br>
25
- <img src="https://raw.githubusercontent.com/Hotakus/opencode-visual-cache/master/assets/example1.png"></img>
26
+ <img src="https://raw.githubusercontent.com/Hotakus/opencode-visual-cache/master/assets/expand.png"></img>
27
+ <img src="https://raw.githubusercontent.com/Hotakus/opencode-visual-cache/master/assets/expand_en.png"></img>
26
28
  </div>
27
29
 
28
30
  ---
@@ -46,7 +48,7 @@
46
48
  Press **`Ctrl + P`** in OpenCode to open the command palette, search **`install plugin`**, then type:
47
49
 
48
50
  ```
49
- opencode-visual-cache
51
+ opencode-visual-cache@latest
50
52
  ```
51
53
 
52
54
  Press Enter to install and configure automatically.
@@ -56,7 +58,7 @@ Press Enter to install and configure automatically.
56
58
  **1. Install the plugin**
57
59
 
58
60
  ```bash
59
- npm install -g opencode-visual-cache
61
+ npm install -g opencode-visual-cache@latest
60
62
  ```
61
63
 
62
64
  **2. Configure TUI plugin**
@@ -66,7 +68,7 @@ Create or edit `~/.config/opencode/tui.jsonc`:
66
68
  ```jsonc
67
69
  {
68
70
  "$schema": "https://opencode.ai/tui.json",
69
- "plugin": ["opencode-visual-cache"]
71
+ "plugin": ["opencode-visual-cache@latest"]
70
72
  }
71
73
  ```
72
74
 
@@ -76,6 +78,32 @@ Open any session — the cache stats panel appears in the sidebar.
76
78
 
77
79
  ---
78
80
 
81
+ ## Update
82
+
83
+ Due to a [known OpenCode issue #6774](https://github.com/anomalyco/opencode/issues/6774), the plugin cache locks to the version installed at first setup and does **not** auto-detect newer releases on npm.
84
+
85
+ To update:
86
+
87
+ **1. Clear the OpenCode plugin cache**
88
+
89
+ ```powershell
90
+ # Windows
91
+ Remove-Item -Recurse -Force "$env:USERPROFILE\.cache\opencode\packages\opencode-visual-cache@latest"
92
+ ```
93
+
94
+ ```bash
95
+ # macOS / Linux
96
+ rm -rf ~/.cache/opencode/packages/opencode-visual-cache@latest
97
+ ```
98
+
99
+ **2. Re-install the plugin**
100
+
101
+ Press **`Ctrl + P`** in OpenCode → `install plugin` → `opencode-visual-cache@latest` → Enter
102
+
103
+ **3. Restart OpenCode**
104
+
105
+ ---
106
+
79
107
  ## Debug
80
108
 
81
109
  Force English:
@@ -0,0 +1 @@
1
+ export declare const PLUGIN_VERSION = "1.1.6";
@@ -0,0 +1,2 @@
1
+ // auto-generated
2
+ export const PLUGIN_VERSION = "1.1.6";
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@opentui/solid/jsx-runtime";
2
2
  import { createMemo, createSignal, Show } from "solid-js";
3
+ import { PLUGIN_VERSION } from "./_version";
3
4
  // ── terminal-width helpers ────────────────────────────────────────
4
5
  // CJK characters occupy 2 terminal columns; padEnd/padStart count
5
6
  // string length (=1 per char), which breaks alignment with mixed text.
@@ -201,8 +202,6 @@ const BAR_GAP = 1; // "]" 后面的空格
201
202
  const PCT_FIXED_WIDTH = 5; // "XX.X%" 固定 5 字符宽度
202
203
  const HEADER_PREFIX = 2; // 折叠态标题行:▶/▼ 图标 + 后面的空格
203
204
  const UNIT_GAP = 1; // 计量单位前的空格(如 "tok")
204
- /** Current plugin version — bump alongside npm version. */
205
- const PLUGIN_VERSION = '1.1.1';
206
205
  function TokenCachePanel(props) {
207
206
  const [panelWidth, setPanelWidth] = createSignal(DEFAULT_PANEL_WIDTH);
208
207
  const [open, setOpen] = createSignal(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-visual-cache",
3
- "version": "1.1.2",
3
+ "version": "1.1.6",
4
4
  "description": "OpenCode TUI plugin displaying real-time token cache hit rate in the sidebar",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,6 +30,7 @@
30
30
  "scripts": {
31
31
  "build": "tsc",
32
32
  "typecheck": "tsc --noEmit",
33
+ "version": "node -e \"require('fs').writeFileSync('src/_version.ts','// auto-generated\\nexport const PLUGIN_VERSION='+JSON.stringify(require('./package.json').version)+';\\n')\"",
33
34
  "prepublishOnly": "tsc"
34
35
  },
35
36
  "keywords": [
@@ -0,0 +1,2 @@
1
+ // auto-generated
2
+ export const PLUGIN_VERSION="1.1.6";
package/src/index.tsx CHANGED
@@ -11,6 +11,7 @@ import type {
11
11
  } from "@opencode-ai/plugin/tui"
12
12
  import type { AssistantMessage, Message } from "@opencode-ai/sdk"
13
13
  import { createMemo, createSignal, Show } from "solid-js"
14
+ import { PLUGIN_VERSION } from "./_version"
14
15
 
15
16
  // ---------------------------------------------------------------------------
16
17
  // Helpers
@@ -223,8 +224,6 @@ const PCT_FIXED_WIDTH = 5 // "XX.X%" 固定 5 字符宽度
223
224
  const HEADER_PREFIX = 2 // 折叠态标题行:▶/▼ 图标 + 后面的空格
224
225
  const UNIT_GAP = 1 // 计量单位前的空格(如 "tok")
225
226
 
226
- /** Current plugin version — bump alongside npm version. */
227
- const PLUGIN_VERSION = '1.1.1'
228
227
 
229
228
  function TokenCachePanel(props: {
230
229
  theme: TuiThemeCurrent