dsh-cost-meter 1.5.20 → 1.5.21
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.en.md +5 -5
- package/README.md +5 -5
- package/lib/client.js +21 -9
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Per-conversation cost · daily totals · OpenCode Go subscription quota display · budget with usage percentage · official account balance · custom provider balance · balance progress bar · history · peak/off-peak pricing hours display (peak hours UTC 01:00–04:00, 06:00–10:00) · pre-switch popup & system-notification alerts for peak/off-peak changes (position / lead time / alert type configurable) · one-click price sync from the official docs · Codex-style token usage heat grid · multi-vendor model pricing (built-in 90+ model price catalog with auto-matching) · mainstream Coding Plan quota queries & display (Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow / SCNet)
|
|
8
8
|
|
|
9
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
10
10
|
[](https://www.npmjs.com/package/dsh-cost-meter)
|
|
11
11
|
[](LICENSE)
|
|
12
12
|
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
@@ -193,22 +193,22 @@ Real captures from an actual DSH sidebar of the period strip and collapsed verti
|
|
|
193
193
|
dsh plugin --profile web add dsh-cost-meter
|
|
194
194
|
```
|
|
195
195
|
|
|
196
|
-
**PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.5.
|
|
196
|
+
**PowerShell one-click script** (copy the whole line, paste, press Enter; pnpm is provisioned automatically, git is auto-detected — no clone needed; the install chain is **pinned to the release tag `v1.5.21`** — review the script before running):
|
|
197
197
|
|
|
198
198
|
```powershell
|
|
199
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.5.
|
|
199
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.5.21/install.ps1 | iex
|
|
200
200
|
```
|
|
201
201
|
|
|
202
202
|
**Or a plain command line** (the machine must already have pnpm and git; also pinned to the tag):
|
|
203
203
|
|
|
204
204
|
```sh
|
|
205
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.5.
|
|
205
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.5.21
|
|
206
206
|
```
|
|
207
207
|
|
|
208
208
|
Without git, use the GitHub tag archive:
|
|
209
209
|
|
|
210
210
|
```sh
|
|
211
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.5.
|
|
211
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.5.21.tar.gz
|
|
212
212
|
```
|
|
213
213
|
|
|
214
214
|
After installing, **restart** `dsh web` (plugin rows, the Typert manifest and the client bundle are all scanned at startup):
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
本会话费用 · 当日费用 · OpenCode Go 订阅额度显示 · 预算与已用百分比 · 官方账户余额 · 自定义 Provider 余额查询(可配任意 HTTP 端点) · 余额三段进度条 · 历史记录 · 峰谷计价时段显示(UTC 01:00–04:00、06:00–10:00 为峰时段) · 峰/谷切换前弹窗与系统通知提醒(位置/提前量/提醒类型可配) · 官方价格一键同步 · 类 Codex Token 用量热图 · 多厂商多模型价格计费(内置 90+ 模型价格目录与自动匹配) · 主流 Coding Plan 额度查询与显示(Anthropic / Z.ai / MiniMax / Kimi / OpenRouter / SiliconFlow / SCNet 七家)
|
|
8
8
|
|
|
9
|
-
[](https://github.com/Han-1413141/dsh-cost-meter)
|
|
10
10
|
[](https://www.npmjs.com/package/dsh-cost-meter)
|
|
11
11
|
[](LICENSE)
|
|
12
12
|
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
@@ -195,22 +195,22 @@
|
|
|
195
195
|
dsh plugin --profile web add dsh-cost-meter
|
|
196
196
|
```
|
|
197
197
|
|
|
198
|
-
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.5.
|
|
198
|
+
**PowerShell 一键脚本**(复制整行粘贴回车;自动补齐 pnpm、自动探测 git,无需克隆仓库;安装链**固定到发布 tag `v1.5.21`**,建议先下载审阅再运行):
|
|
199
199
|
|
|
200
200
|
```powershell
|
|
201
|
-
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.5.
|
|
201
|
+
irm https://raw.githubusercontent.com/Han-1413141/dsh-cost-meter/v1.5.21/install.ps1 | iex
|
|
202
202
|
```
|
|
203
203
|
|
|
204
204
|
**或直接命令行**(机器上需已有 pnpm 与 git;同样固定到 tag):
|
|
205
205
|
|
|
206
206
|
```sh
|
|
207
|
-
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.5.
|
|
207
|
+
dsh plugin --profile web add github:Han-1413141/dsh-cost-meter#v1.5.21
|
|
208
208
|
```
|
|
209
209
|
|
|
210
210
|
没有 git 时可用 GitHub tag 打包直链:
|
|
211
211
|
|
|
212
212
|
```sh
|
|
213
|
-
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.5.
|
|
213
|
+
dsh plugin --profile web add https://github.com/Han-1413141/dsh-cost-meter/archive/refs/tags/v1.5.21.tar.gz
|
|
214
214
|
```
|
|
215
215
|
|
|
216
216
|
安装后**重启** `dsh web`(插件行、Typert 清单与客户端 bundle 均在启动时扫描):
|
package/lib/client.js
CHANGED
|
@@ -2042,7 +2042,8 @@ window.__ModuleLoader__.load({
|
|
|
2042
2042
|
const timer = window.setInterval(() => setNow(Date.now()), 10000)
|
|
2043
2043
|
return () => window.clearInterval(timer)
|
|
2044
2044
|
}, [])
|
|
2045
|
-
//
|
|
2045
|
+
// 预览通道:监听自定义事件(事件由 activate 顶层的 window.cmPeakAlertPreview 派发),
|
|
2046
|
+
// 组件挂载期间置在线标志,供 API 判断弹窗宿主是否可用。
|
|
2046
2047
|
useEffect(() => {
|
|
2047
2048
|
const onPreview = event => {
|
|
2048
2049
|
const kind = event.detail?.kind === 'offpeak' ? 'offpeak' : 'peak'
|
|
@@ -2058,12 +2059,10 @@ window.__ModuleLoader__.load({
|
|
|
2058
2059
|
}
|
|
2059
2060
|
}
|
|
2060
2061
|
window.addEventListener(PEAK_ALERT_PREVIEW_EVENT, onPreview)
|
|
2061
|
-
window.
|
|
2062
|
-
window.dispatchEvent(new CustomEvent(PEAK_ALERT_PREVIEW_EVENT, { detail: { kind: kind === 'offpeak' ? 'offpeak' : 'peak' } }))
|
|
2063
|
-
}
|
|
2062
|
+
window.__cmPeakAlertLive = true
|
|
2064
2063
|
return () => {
|
|
2065
2064
|
window.removeEventListener(PEAK_ALERT_PREVIEW_EVENT, onPreview)
|
|
2066
|
-
|
|
2065
|
+
window.__cmPeakAlertLive = false
|
|
2067
2066
|
}
|
|
2068
2067
|
}, []) // eslint-disable-line react-hooks/exhaustive-deps
|
|
2069
2068
|
useEffect(() => {
|
|
@@ -4639,17 +4638,19 @@ window.__ModuleLoader__.load({
|
|
|
4639
4638
|
})
|
|
4640
4639
|
}
|
|
4641
4640
|
|
|
4642
|
-
// 峰/谷切换前弹窗提醒:全局 fixed
|
|
4643
|
-
//
|
|
4641
|
+
// 峰/谷切换前弹窗提醒:全局 fixed 浮层(fixed 定位与宿主位置无关),挂在常驻的
|
|
4642
|
+
// sidebar.footer.action 插槽——conversation.composer.dock 仅在有活跃会话的页面渲染,
|
|
4643
|
+
// 挂那里会导致 hero/设置页不弹提醒、预览按钮失效(issue:预览点了没反应)。
|
|
4644
|
+
// 组件内部再按配置门控(peakAlertEnabled + peakEnabled);开关变化时重挂/卸载。
|
|
4644
4645
|
const peakAlertActive = { gen: 0, dispose: null }
|
|
4645
4646
|
const registerPeakAlert = enabled => {
|
|
4646
4647
|
if (peakAlertActive.dispose !== null) { peakAlertActive.dispose(); peakAlertActive.dispose = null }
|
|
4647
4648
|
peakAlertActive.gen += 1
|
|
4648
4649
|
const gen = peakAlertActive.gen
|
|
4649
4650
|
if (!enabled) return
|
|
4650
|
-
slots.inject('
|
|
4651
|
+
slots.inject('sidebar.footer.action', () => {
|
|
4651
4652
|
if (peakAlertActive.gen !== gen) return
|
|
4652
|
-
const dispose = slots.register({ name: '
|
|
4653
|
+
const dispose = slots.register({ name: 'sidebar.footer.action', id: 'cost-meter-peak-alert', order: 0, inject: injected }, PeakAlert)
|
|
4653
4654
|
if (peakAlertActive.gen !== gen) { dispose(); return }
|
|
4654
4655
|
peakAlertActive.dispose = dispose
|
|
4655
4656
|
return () => {
|
|
@@ -4659,6 +4660,17 @@ window.__ModuleLoader__.load({
|
|
|
4659
4660
|
})
|
|
4660
4661
|
}
|
|
4661
4662
|
|
|
4663
|
+
// 预览 API 在 activate 顶层注册(不依赖任何插槽挂载):设置页按钮与控制台均经
|
|
4664
|
+
// 此入口派发事件;弹窗宿主组件挂载时置 __cmPeakAlertLive,未挂载时给出可诊断提示。
|
|
4665
|
+
window.cmPeakAlertPreview = kind => {
|
|
4666
|
+
if (window.__cmPeakAlertLive !== true) {
|
|
4667
|
+
// eslint-disable-next-line no-console
|
|
4668
|
+
console.warn('[dsh-cost-meter] 弹窗组件未挂载:需启用峰谷计价并重启 dsh web 后再预览。')
|
|
4669
|
+
return
|
|
4670
|
+
}
|
|
4671
|
+
window.dispatchEvent(new CustomEvent(PEAK_ALERT_PREVIEW_EVENT, { detail: { kind: kind === 'offpeak' ? 'offpeak' : 'peak' } }))
|
|
4672
|
+
}
|
|
4673
|
+
|
|
4662
4674
|
// 设置页「费用/Cost」分节:语言变化时撤销旧注册并重建,让侧边栏标签同步。
|
|
4663
4675
|
const sectionActive = { gen: 0, dispose: null }
|
|
4664
4676
|
const registerSection = locale => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cost-meter",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.21",
|
|
4
4
|
"description": "DeepSeek Harness 会话费用统计插件:本会话成本、当日费用、历史记录与官方价格同步,支持多厂商多模型价格计费(内置 90+ 模型价格目录与自动匹配)、主流 Coding Plan 订阅额度查询与显示(7 家,含 SCNet Token Plan 本地 Credits 计量)、自定义 Provider 余额查询(可配任意 HTTP 端点)与余额进度条、峰谷计价时段显示与切换前弹窗/系统通知提醒(位置/提前量/类型可配),界面中英双语。Session cost tracking plugin for DeepSeek Harness: per-conversation cost, daily totals, history and official price sync, with multi-vendor model pricing (built-in 90+ model catalog with auto-matching), Coding Plan quota queries & display for 7 vendors (incl. local credits metering for the SCNet Token Plan), custom provider balance lookup (configurable HTTP endpoint) and balance progress bar, plus peak/off-peak pricing display with pre-switch popup & system-notification alerts (position / lead time / type configurable), in a bilingual (Chinese/English) UI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|