dsh-bottom-info-bar 1.27.2 → 1.28.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.
- package/README.md +20 -0
- package/README.zh-CN.md +20 -0
- package/lib/accounting.js +27 -1
- package/lib/client.js +155 -21
- package/lib/constants.js +26 -0
- package/lib/index.js +37 -4
- package/lib/locales.js +52 -0
- package/lib/native.js +13 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,26 @@ On **DSH 0.2.2 with the native activity/usage buttons**, the native line sits on
|
|
|
27
27
|
|
|
28
28
|
On **older hosts**, clicking the bar still switches between **Full** and **Compact**: Full keeps the legacy statistics row, Compact collapses it. Plugin fields remain identical in both modes. Compatibility is detected from the host's live extension entries, rather than a version string.
|
|
29
29
|
|
|
30
|
+
## DSH Go
|
|
31
|
+
|
|
32
|
+
Since v1.25.0, the bar and its settings page also adapt to **DSH Go**, the touch host for DeepSeek Harness — same package, no separate build, detected from the host's live layout signals rather than a version string. On the Go surface the account row becomes a card matched to the composer's material, the whole bar is a single touch target, and the details the desktop shows as hover tooltips open as an expandable details card instead, because touch has no hover. Wide Go windows gain two extra spend columns: today and the last 30 days.
|
|
33
|
+
|
|
34
|
+
The bar running under the composer in DSH Go:
|
|
35
|
+
|
|
36
|
+
<img src="assets/promo-dsh-go/dsh-go-info-bar-success.png" width="360" alt="Bottom Info Bar running under the composer in DSH Go">
|
|
37
|
+
|
|
38
|
+
Tapped open, the same card carries the full details:
|
|
39
|
+
|
|
40
|
+
<img src="assets/promo-dsh-go/dsh-go-info-bar-expanded.png" width="360" alt="Bottom Info Bar expanded into its details card in DSH Go">
|
|
41
|
+
|
|
42
|
+
The settings page adapts too, with a live preview of the bar and the same field switches:
|
|
43
|
+
|
|
44
|
+
<img src="assets/promo-dsh-go/dsh-go-plugin-settings-controls.png" width="360" alt="Bottom Info Bar settings with live preview in DSH Go">
|
|
45
|
+
|
|
46
|
+
And the plugin's own page in DSH Go carries the info bar card natively (v1.26.0):
|
|
47
|
+
|
|
48
|
+
<img src="assets/promo-dsh-go/dsh-go-plugin-settings-final.png" width="360" alt="Bottom Info Bar plugin page with the info bar card in DSH Go">
|
|
49
|
+
|
|
30
50
|
## Install
|
|
31
51
|
|
|
32
52
|
Recommended: open the DSH plugin page, choose **Add plugin**, and enter the npm package name — DSH fetches the published package from npm, with no commands and no build:
|
package/README.zh-CN.md
CHANGED
|
@@ -27,6 +27,26 @@ DeepSeek Harness 插件:把输入框下方那行统计栏换成一行信息栏
|
|
|
27
27
|
|
|
28
28
|
**旧宿主**仍保留点击信息栏切换**完整/简洁**:完整显示旧统计行,简洁收起它;插件字段在两种模式下一致。兼容方式通过实际扩展入口判断,不依赖版本号猜测。
|
|
29
29
|
|
|
30
|
+
## DSH Go
|
|
31
|
+
|
|
32
|
+
v1.25.0 起,信息栏与设置页同样适配 **DSH Go**(DeepSeek Harness 的触屏宿主)——还是同一个包,不用另装,靠宿主的实时布局信号识别,不看版本号。在 Go 里,账户信息行变成与输入框同材质的卡片,整条栏是一个触控目标;桌面端靠悬停提示展示的明细,在触屏上改为点开一张可展开的明细卡,因为触屏没有悬停。Go 宽屏窗口还会多出两列花费:今天与近 30 天。
|
|
33
|
+
|
|
34
|
+
信息栏在 DSH Go 输入框下方的运行画面:
|
|
35
|
+
|
|
36
|
+
<img src="assets/promo-dsh-go/dsh-go-info-bar-success.png" width="360" alt="信息栏在 DSH Go 输入框下方运行">
|
|
37
|
+
|
|
38
|
+
点开后,同一张卡承载完整明细:
|
|
39
|
+
|
|
40
|
+
<img src="assets/promo-dsh-go/dsh-go-info-bar-expanded.png" width="360" alt="信息栏在 DSH Go 里展开为明细卡">
|
|
41
|
+
|
|
42
|
+
设置页同样适配,带信息栏的实时预览与全部显示开关:
|
|
43
|
+
|
|
44
|
+
<img src="assets/promo-dsh-go/dsh-go-plugin-settings-controls.png" width="360" alt="DSH Go 里的信息栏设置页与实时预览">
|
|
45
|
+
|
|
46
|
+
DSH Go 里的插件页也原生带上信息栏卡片(v1.26.0):
|
|
47
|
+
|
|
48
|
+
<img src="assets/promo-dsh-go/dsh-go-plugin-settings-final.png" width="360" alt="DSH Go 里带信息栏卡片的插件页">
|
|
49
|
+
|
|
30
50
|
## 安装
|
|
31
51
|
|
|
32
52
|
最推荐:打开 DSH 的插件页 → **添加插件**,在「包名或地址」里填 npm 包名——DSH 会直接从 npm 下载已发布的版本,不用敲命令,也不用构建:
|
package/lib/accounting.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// 峰谷日历、币种与账户映射,否则两边算出的金额会漂移。这里保持纯函数 + 一张可增量更新的
|
|
6
6
|
// PRICING 表:host 用 createAccounting() 得到自己的实例,worker 也各建一份,远程价目由
|
|
7
7
|
// host 通过 setRemotePricingEntries 同步给 worker。
|
|
8
|
-
import { PROVIDER_DEFAULT_CURRENCY, PROVIDER_IDENTITY } from './constants.js'
|
|
8
|
+
import { PROVIDER_DEFAULT_CURRENCY, PROVIDER_IDENTITY, DISPLAY_CURRENCY_META, DISPLAY_CURRENCIES } from './constants.js'
|
|
9
9
|
|
|
10
10
|
const BEIJING_OFFSET_MS = 8 * 3600 * 1000
|
|
11
11
|
|
|
@@ -137,6 +137,30 @@ export const BUILTIN_PRICING = {
|
|
|
137
137
|
|
|
138
138
|
// 每个调用方各持一份可变的价目副本:host 主线程用一份算金额,worker 用另一份做迁移/回填;
|
|
139
139
|
// 远程目录合并后由 host 把增量同步给 worker(见 ledger-client.setPricing)。
|
|
140
|
+
// ---------- 显示货币换算(issue #317,纯函数,只供显示层调用) ----------
|
|
141
|
+
// 账本永远不调这里:换算只发生在金额落屏那一刻,换算值绝不写回账本与导出。
|
|
142
|
+
// 枢纽 USD:先把原生币种折成美元,再折成目标币种。target='auto' 或目标与原生
|
|
143
|
+
// 相同 → 不换算(converted=false)。未知币种 / 非有限数 → 原样返回、不换算。
|
|
144
|
+
// 顶层导出(native.js 直接 import);createAccounting 的返回值里同样挂一份。
|
|
145
|
+
export function convertMoney(value, fromCurrency, toCurrency) {
|
|
146
|
+
const n = Number(value)
|
|
147
|
+
if (!Number.isFinite(n)) return { value: value, currency: fromCurrency, converted: false }
|
|
148
|
+
const from = DISPLAY_CURRENCY_META[fromCurrency]
|
|
149
|
+
const to = DISPLAY_CURRENCY_META[toCurrency]
|
|
150
|
+
if (!from || !to || toCurrency === 'auto' || fromCurrency === toCurrency) {
|
|
151
|
+
return { value: n, currency: fromCurrency, converted: false }
|
|
152
|
+
}
|
|
153
|
+
const usd = fromCurrency === 'USD' ? n : n / from.perUsd
|
|
154
|
+
const out = toCurrency === 'USD' ? usd : usd * to.perUsd
|
|
155
|
+
return { value: Number.isFinite(out) ? out : n, currency: toCurrency, converted: Number.isFinite(out) }
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 显示货币归一(宽松版:客户端与 native 共用):合法值原样返回,其余一律回 'auto',
|
|
159
|
+
// 绝不抛错。host 的严格版(非法即拒收)在 host.js 里另写,与 quotaDisplayMode 同规。
|
|
160
|
+
export function normalizeDisplayCurrency(value) {
|
|
161
|
+
return DISPLAY_CURRENCIES.indexOf(value) !== -1 ? value : 'auto'
|
|
162
|
+
}
|
|
163
|
+
|
|
140
164
|
export function createAccounting() {
|
|
141
165
|
const PRICING = Object.assign(Object.create(null), BUILTIN_PRICING)
|
|
142
166
|
|
|
@@ -196,5 +220,7 @@ export function createAccounting() {
|
|
|
196
220
|
modelCurrency: modelCurrency,
|
|
197
221
|
costOf: costOf,
|
|
198
222
|
setRemotePricingEntries: setRemotePricingEntries,
|
|
223
|
+
convertMoney: convertMoney,
|
|
224
|
+
normalizeDisplayCurrency: normalizeDisplayCurrency,
|
|
199
225
|
};
|
|
200
226
|
}
|