dsh-desktop-statusbar 2.2.1 → 3.0.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.en.md +13 -1
- package/README.md +13 -1
- package/cordis.patch.yml +10 -1
- package/docs/pricing.en.png +0 -0
- package/docs/settings.en.png +0 -0
- package/docs/settings.png +0 -0
- package/docs/statusbar.en.png +0 -0
- package/docs/statusbar.png +0 -0
- package/lib/balance-api.js +68 -4
- package/lib/client.js +3013 -298
- package/lib/holiday.js +39 -6
- package/lib/index.js +5622 -4216
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +2 -2
- package/tools/shot.cjs +33 -11
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Desktop Status Bar",
|
|
4
|
-
"description": "Replaces the stats line under the DSH desktop conversation with a configurable status bar:
|
|
4
|
+
"description": "Replaces the stats line under the DSH desktop conversation with a configurable status bar: 9 optional reorderable fields plus the context ring at the head of the bar, official peak/off-peak cost estimates, custom model prices and account balance."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-desktop-statusbar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "把 DSH 桌面端对话区底部的统计行换成可配置状态栏:
|
|
5
|
+
"description": "把 DSH 桌面端对话区底部的统计行换成可配置状态栏:9 个可选字段可排序 + 栏首上下文圆环,按官方峰谷口径估算费用,支持自定义模型单价与账户余额。",
|
|
6
6
|
"icon": "icon.svg",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"engines": {
|
package/tools/shot.cjs
CHANGED
|
@@ -226,8 +226,11 @@ function settingsShot(locale) {
|
|
|
226
226
|
/** 只要价格区:前两块隐藏、展开第一张卡,并把币种下拉收起(展开会压住右边那列输入框) */
|
|
227
227
|
function pricingShot(locale) {
|
|
228
228
|
/* SettingsSection 里 useState 的顺序(组件加了 hook 就要回来重数一遍):
|
|
229
|
-
0
|
|
230
|
-
|
|
229
|
+
0 drag / 1 newModel / 2 hostModel / 3 editing / 4 draft /
|
|
230
|
+
5 holidayBusy / 6 holidayNote / 7 currencyOpen。
|
|
231
|
+
**2026-10-22 起前移了一位**:开发模式的状态改从模块级快照读(`useDevState` 的 const),
|
|
232
|
+
组件里不再有 `devOn` 那个 useState,于是它后面所有 hook 整体前移一位 ——
|
|
233
|
+
editing 4→3、draft 5→4、currencyOpen 8→7。不改的话第一张卡展不开(探针 dsb-edit-pop=0)。
|
|
231
234
|
2026-10-05 之前按下标写的是旧顺序(把 editing 当第 5 个、holidayNote 当第 6 个),
|
|
232
235
|
结果第一张卡展不开、还把草稿对象塞进了 holidayNote,卡片里冒出一句「抓取失败(undefined)」。
|
|
233
236
|
2026-10-13 又踩了一次同类的坑:新增 devOn(开发模式胶囊)插在最前面,
|
|
@@ -235,20 +238,24 @@ function pricingShot(locale) {
|
|
|
235
238
|
presets[4] 从 draft 变成 editing、presets[7] 从 currencyOpen 变成 holidayNote。
|
|
236
239
|
教训:**下标是脆的**,加 hook 必须回来重数,并用 `node tools/shot.cjs` 实际生成一次确认。 */
|
|
237
240
|
const presets = [];
|
|
238
|
-
presets[
|
|
239
|
-
/*
|
|
240
|
-
|
|
241
|
+
presets[3] = 'deepseek-flash';
|
|
242
|
+
/* 浮层里的数字也要跟着币种走:预设草稿按语言挑人民币或美元那套。
|
|
243
|
+
**`currency` 必须一起写**:下拉按钮显示的正是 `draft.currency`(不是 config.currency),
|
|
244
|
+
漏了它英文截图就会退回默认的 CNY —— 与整页英文界面自相矛盾(2026-10 实际踩过)。 */
|
|
245
|
+
presets[4] = locale === 'en'
|
|
241
246
|
? {
|
|
242
247
|
tiered: true,
|
|
248
|
+
currency: 'USD',
|
|
243
249
|
peak: { input: '0.3', cacheRead: '0.006', cacheWrite: '0', output: '1.2' },
|
|
244
250
|
offPeak: { input: '0.15', cacheRead: '0.003', cacheWrite: '0', output: '0.6' }
|
|
245
251
|
}
|
|
246
252
|
: {
|
|
247
253
|
tiered: true,
|
|
254
|
+
currency: 'CNY',
|
|
248
255
|
peak: { input: '2', cacheRead: '0.04', cacheWrite: '0', output: '8' },
|
|
249
256
|
offPeak: { input: '1', cacheRead: '0.02', cacheWrite: '0', output: '4' }
|
|
250
257
|
};
|
|
251
|
-
presets[
|
|
258
|
+
presets[7] = false; /* 币种下拉收起:展开会压住右边那列输入框 */
|
|
252
259
|
const loaded = loadPlugin(locale, locale === 'en' ? SETTINGS_USD : SETTINGS_CONFIG, presets);
|
|
253
260
|
const t = translator(loaded.shot, locale);
|
|
254
261
|
const tree = loaded.shot.SettingsSection({
|
|
@@ -266,7 +273,14 @@ function statusbarShot(locale) {
|
|
|
266
273
|
/* StatusBar 里 useState 的顺序:now → balance → tipId → tipPos → tipTick。
|
|
267
274
|
余额平时靠 effect 轮询拿,静态渲染要直接喂进去。 */
|
|
268
275
|
const presets = [];
|
|
269
|
-
|
|
276
|
+
/* 余额故意给**双币种**(3.0.0 起底栏支持 `¥13.14+$5.21` 这种并列显示):
|
|
277
|
+
README 的图要能体现这个能力,只给单币种会让"支持双币种"的说法与图对不上。
|
|
278
|
+
数值是用户挑的吉祥数(13.14 一生一世 / 5.21 我爱你),纯为截图好看。
|
|
279
|
+
`total` 保持两个币种之和(18.35),与 balances 自洽、不制造假数据。 */
|
|
280
|
+
presets[1] = {
|
|
281
|
+
ok: true, total: '18.35', toppedUp: '18.35', granted: '0.00', currency: 'CNY', at: Date.now(),
|
|
282
|
+
balances: [{ currency: 'CNY', total: '13.14' }, { currency: 'USD', total: '5.21' }]
|
|
283
|
+
};
|
|
270
284
|
const loaded = loadPlugin(locale, SETTINGS_CONFIG, presets);
|
|
271
285
|
const t = translator(loaded.shot, locale);
|
|
272
286
|
const calls = SAMPLE.calls;
|
|
@@ -283,7 +297,13 @@ function statusbarShot(locale) {
|
|
|
283
297
|
}
|
|
284
298
|
if (name === 'desktopStatusbarTiming') return SAMPLE.timing;
|
|
285
299
|
if (name === 'desktopStatusbarActiveTime') return { turns: 12, steps: 268, since: Date.now() - 3152000, stepSince: null };
|
|
286
|
-
if (name === 'desktopStatusbarBalance')
|
|
300
|
+
if (name === 'desktopStatusbarBalance') {
|
|
301
|
+
/* 与上面 presets[1] 必须是**同一份**双币种数据(两处都喂给底栏,不一致会截出前后矛盾的两版) */
|
|
302
|
+
return {
|
|
303
|
+
ok: true, total: '18.35', toppedUp: '18.35', granted: '0.00', currency: 'CNY', at: Date.now(),
|
|
304
|
+
balances: [{ currency: 'CNY', total: '13.14' }, { currency: 'USD', total: '5.21' }]
|
|
305
|
+
};
|
|
306
|
+
}
|
|
287
307
|
if (name === 'desktopStatusbarModel') return { provider: 'deepseek', model: 'deepseek-v4-pro', at: Date.now() };
|
|
288
308
|
return undefined;
|
|
289
309
|
},
|
|
@@ -304,9 +324,11 @@ function statusbarShot(locale) {
|
|
|
304
324
|
}
|
|
305
325
|
|
|
306
326
|
/* status 场景生成的底栏是**合成**的(自己摆的示例数据 + 假对话区背景)。
|
|
307
|
-
2026-10-05 起
|
|
308
|
-
|
|
309
|
-
|
|
327
|
+
**2026-10-29 更正**:这里原先写着"2026-10-05 起 docs/statusbar*.png 换成了真机截图,
|
|
328
|
+
跑全量会覆盖掉",但实际不是 —— 旧图尺寸 2360x460 正好等于 SIZES.status(1180,230)× 2 倍
|
|
329
|
+
缩放,一直是本工具生成的合成图。那条警告是错的,会让下一个人不敢重跑 status 场景。
|
|
330
|
+
现在三张场景图**全部**由本工具生成,`node tools/shot.cjs` 可以放心跑全量。
|
|
331
|
+
只想更新其中一张就单跑:node tools/shot.cjs zh settings(scene ∈ status/settings/pricing)。 */
|
|
310
332
|
const SCENES = { settings: settingsShot, pricing: pricingShot, status: statusbarShot };
|
|
311
333
|
/* 窗口高度按内容量出来的(上下留白对齐到页面自己的 30px 内边距):
|
|
312
334
|
settings 内容底 1050、pricing 内容底 315.5。改了场景内容要重量一遍再调这里。 */
|