opencode-visual-cache 1.1.0 → 1.1.2
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/dist/index.js +3 -1
- package/package.json +1 -1
- package/src/index.tsx +9 -1
package/dist/index.js
CHANGED
|
@@ -201,6 +201,8 @@ const BAR_GAP = 1; // "]" 后面的空格
|
|
|
201
201
|
const PCT_FIXED_WIDTH = 5; // "XX.X%" 固定 5 字符宽度
|
|
202
202
|
const HEADER_PREFIX = 2; // 折叠态标题行:▶/▼ 图标 + 后面的空格
|
|
203
203
|
const UNIT_GAP = 1; // 计量单位前的空格(如 "tok")
|
|
204
|
+
/** Current plugin version — bump alongside npm version. */
|
|
205
|
+
const PLUGIN_VERSION = '1.1.1';
|
|
204
206
|
function TokenCachePanel(props) {
|
|
205
207
|
const [panelWidth, setPanelWidth] = createSignal(DEFAULT_PANEL_WIDTH);
|
|
206
208
|
const [open, setOpen] = createSignal(true);
|
|
@@ -331,7 +333,7 @@ function TokenCachePanel(props) {
|
|
|
331
333
|
// 通过 ref 获取 Renderable 实例宽度
|
|
332
334
|
const w = boxEl ? Math.max(MIN_PANEL_WIDTH, boxEl.width) : DEFAULT_PANEL_WIDTH;
|
|
333
335
|
setPanelWidth((prev) => (prev === w ? prev : w));
|
|
334
|
-
}, children: [_jsxs("text", { onMouseUp: () => setOpen((o) => !o), children: [_jsx("span", { style: { fg: pal().muted }, children: open() ? "\u25bc " : "\u25b6 " }),
|
|
336
|
+
}, children: [_jsxs("text", { onMouseUp: () => setOpen((o) => !o), children: [_jsx("span", { style: { fg: pal().muted }, children: open() ? "\u25bc " : "\u25b6 " }), _jsxs("span", { style: { fg: pal().primary }, children: [_jsx("b", { children: T.title }), _jsx(Show, { when: open(), children: _jsxs("span", { style: { fg: pal().muted }, children: [" (v", PLUGIN_VERSION, ")"] }) })] }), _jsxs(Show, { when: !open() && data().hasData, children: [_jsxs(Show, { when: data().hasTrendData, children: [_jsx("span", { children: " ".repeat(Math.max(1, panelWidth() - GUTTER - HEADER_PREFIX - visualWidth(T.title) - visualWidth(pct() + " " + T.hitFolded + " " + trendLabel(data().trend)))) }), _jsxs("span", { style: { fg: hitColor() }, children: [pct(), " ", T.hitFolded] }), _jsxs("span", { style: { fg: data().trend !== 0 ? (data().trend > 0 ? pal().success : pal().error) : pal().text }, children: [" ", trendLabel(data().trend)] })] }), _jsxs(Show, { when: !data().hasTrendData, children: [_jsx("span", { children: " ".repeat(Math.max(1, panelWidth() - GUTTER - HEADER_PREFIX - visualWidth(T.title) - visualWidth(pct() + " " + T.hitFolded))) }), _jsxs("span", { style: { fg: hitColor() }, children: [pct(), " ", T.hitFolded] })] })] })] }), _jsx(Show, { when: open(), children: _jsxs(Show, { when: data().hasData, fallback: _jsxs(_Fragment, { children: [_jsx("text", { fg: pal().muted, children: sep() }), _jsxs("text", { children: [_jsx("span", { style: { fg: pal().muted }, children: "> " }), _jsx("span", { style: { fg: pal().muted }, children: T.noData })] })] }), children: [_jsx("text", { fg: pal().muted, children: sep() }), _jsxs("text", { children: [_jsxs("span", { style: { fg: pal().text }, children: [T.hit, " "] }), _jsxs("span", { style: { fg: hitColor() }, children: ["[", bar(), "] "] }), _jsx("span", { style: { fg: pal().text }, children: pct() }), _jsx(Show, { when: data().hasTrendData, children: _jsxs("span", { style: { fg: data().trend !== 0 ? (data().trend > 0 ? pal().success : pal().error) : pal().text }, children: [" ", trendLabel(data().trend)] }) })] }), _jsx("text", { fg: pal().muted, children: justify(T.totalHit, data().sessionHitRate.toFixed(1) + "%") }), _jsx(Show, { when: data().read > 0, children: _jsx("text", { fg: pal().muted, children: justify(T.read, fmt(data().read), T.tok) }) }), _jsx(Show, { when: data().write > 0, children: _jsx("text", { fg: pal().muted, children: justify(T.write, fmt(data().write), T.tok) }) }), _jsx("text", { fg: pal().muted, children: justify(T.miss, fmt(data().freshInput), T.tok) }), _jsx("text", { fg: pal().muted, children: justify(T.out, fmt(data().output), T.tok) }), _jsx("text", { fg: pal().muted, children: sep() }), _jsx("text", { fg: pal().text, children: justify(T.cost, fmtCost(data().cost)) }), _jsx(Show, { when: data().saved > 0, children: _jsxs("text", { children: [_jsx("span", { style: { fg: pal().muted }, children: T.saved }), _jsx("span", { children: " ".repeat(Math.max(1, panelWidth() - GUTTER - visualWidth(T.saved) - visualWidth("~" + fmtCost(data().saved)))) }), _jsxs("span", { style: { fg: pal().success }, children: ["~", fmtCost(data().saved)] })] }) }), _jsx(Show, { when: data().providerName, children: _jsx("text", { fg: pal().muted, children: justify(T.provider, data().providerName) }) }), _jsx("text", { fg: pal().muted, children: justify(T.model, data().model) }), _jsxs(Show, { when: data().hasPricing, children: [_jsx("text", { fg: pal().muted, children: justify(T.rate, "$" + data().inputRate.toFixed(2) + "/M " + T.inputRate) }), _jsx(Show, { when: data().cacheReadRate > 0, children: _jsx("text", { fg: pal().muted, children: justify("", "$" + data().cacheReadRate.toFixed(2) + "/M " + T.cacheRate) }) }), _jsx(Show, { when: data().cacheWriteRate > 0, children: _jsx("text", { fg: pal().muted, children: justify("", "$" + data().cacheWriteRate.toFixed(2) + "/M " + T.writeRate) }) })] })] }) })] }));
|
|
335
337
|
}
|
|
336
338
|
// ---------------------------------------------------------------------------
|
|
337
339
|
// Plugin entry
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -223,6 +223,9 @@ const PCT_FIXED_WIDTH = 5 // "XX.X%" 固定 5 字符宽度
|
|
|
223
223
|
const HEADER_PREFIX = 2 // 折叠态标题行:▶/▼ 图标 + 后面的空格
|
|
224
224
|
const UNIT_GAP = 1 // 计量单位前的空格(如 "tok")
|
|
225
225
|
|
|
226
|
+
/** Current plugin version — bump alongside npm version. */
|
|
227
|
+
const PLUGIN_VERSION = '1.1.1'
|
|
228
|
+
|
|
226
229
|
function TokenCachePanel(props: {
|
|
227
230
|
theme: TuiThemeCurrent
|
|
228
231
|
api: TuiPluginApi
|
|
@@ -381,7 +384,12 @@ function TokenCachePanel(props: {
|
|
|
381
384
|
{/* collapsible header */}
|
|
382
385
|
<text onMouseUp={() => setOpen((o) => !o)}>
|
|
383
386
|
<span style={{ fg: pal().muted }}>{open() ? "\u25bc " : "\u25b6 "}</span>
|
|
384
|
-
<span style={{ fg: pal().primary }}
|
|
387
|
+
<span style={{ fg: pal().primary }}>
|
|
388
|
+
<b>{T.title}</b>
|
|
389
|
+
<Show when={open()}>
|
|
390
|
+
<span style={{ fg: pal().muted }}> (v{PLUGIN_VERSION})</span>
|
|
391
|
+
</Show>
|
|
392
|
+
</span>
|
|
385
393
|
<Show when={!open() && data().hasData}>
|
|
386
394
|
<Show when={data().hasTrendData}>
|
|
387
395
|
<span>
|