dsh-token-dash 1.3.0 → 2.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 CHANGED
@@ -23,14 +23,12 @@
23
23
  <p align="center">
24
24
  <img src="https://img.shields.io/github/v/tag/spartawhy117/dsh-token-dash?label=version&sort=semver" alt="version" />
25
25
  <img src="https://img.shields.io/npm/dt/dsh-token-dash?logo=npm&label=npm%20downloads" alt="npm downloads" />
26
- <img src="https://img.shields.io/github/downloads/spartawhy117/dsh-token-dash/total?label=downloads" alt="downloads" />
27
- <img src="https://img.shields.io/github/license/spartawhy117/dsh-token-dash" alt="license" />
28
- <img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen" alt="node" />
29
26
  <img src="https://img.shields.io/badge/DSH-0.2.2--rc.1_tested-4c8bf5" alt="DSH tested" />
27
+ <img src="https://img.shields.io/github/license/spartawhy117/dsh-token-dash" alt="license" />
30
28
  <a href="https://awesome-dsh-plugin.com/p/spartawhy117/dsh-token-dash"><img src="https://img.shields.io/badge/awesome--dsh--plugin-listed-6ea8ff" alt="awesome-dsh-plugin" /></a>
31
29
  </p>
32
30
 
33
- **Three entry points, one local ledger**: the Pill shows the current model; the floating panel shows budget, balance and the usage table; the full dashboard shows every provider card and model breakdown. No duplicated accounting between pages.
31
+ **Three entry points, one local ledger**: the composer-footer-right Pill shows the current model; the floating panel shows budget, balance and the usage table; the full dashboard shows every provider card and model breakdown. No duplicated accounting between pages.
34
32
 
35
33
  ## Provider matrix
36
34
 
@@ -53,7 +51,7 @@
53
51
 
54
52
  Screenshots use mock data so the full layout is visible at once.
55
53
 
56
- **P1 · Bottom bar Pill**: pay-as-you-go / subscription variants; click to open, click outside, `×` or `Esc` to close.
54
+ **P1 · Composer footer-right Pill**: pay-as-you-go / subscription variants; click to open, click outside, `×` or `Esc` to close.
57
55
 
58
56
  <p align="center">
59
57
  <img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/pill-api.png" alt="Pay-as-you-go pill" />
@@ -63,7 +61,7 @@ Screenshots use mock data so the full layout is visible at once.
63
61
  <img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/pill-sub.png" alt="Subscription pill" />
64
62
  </p>
65
63
 
66
- **P2 · Floating panel (current model)**: fixed 380, one row with four groups — used ring / used-budget / real balance / month-to-date spend — a full-width range control and the usage table.
64
+ **P2 · Floating panel (current model)**: fixed 380, one row with three groups — used ring / used-budget / real balance — with the balance right-aligned to the panel edge, a full-width range control and the usage table.
67
65
 
68
66
  <p align="center">
69
67
  <img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/panel-api.png" alt="Floating panel - pay-as-you-go" />
@@ -89,6 +87,7 @@ Screenshots use mock data so the full layout is visible at once.
89
87
  - Pay-as-you-go card: budget input, planned balance, real balance, month-to-date spend; subscription card: one ring per window with remaining percentage and countdown.
90
88
  - Breakdown: model / Tokens / input / cache / output / requests / hit rate / cost; everything except the model column is right-aligned.
91
89
  - Settings capsule: refresh interval + account-balance toggle; logs, export/import, price table and version below.
90
+ - The settings section has an external "Settings and data" title above the capsule; the capsule itself keeps the refresh interval, logs/data controls and version row.
92
91
  - Spacing uses only 4 / 8 / 12 / 16 / 24 / 32; P2 and P3 share the same tokens.
93
92
 
94
93
  ## Install
@@ -144,7 +143,7 @@ Common events:
144
143
  ## Development
145
144
 
146
145
  ```bash
147
- npm test # unit tests (79 passing)
146
+ npm test # unit tests (80 passing)
148
147
  npm run e2e # end-to-end (temp DSH_HOME + web profile + Playwright)
149
148
  npm run shots # regenerate the P1/P2/P3 screenshots in docs/pic from mock data
150
149
  npm run pack # build the release tarball into build/
package/README.md CHANGED
@@ -23,14 +23,12 @@
23
23
  <p align="center">
24
24
  <img src="https://img.shields.io/github/v/tag/spartawhy117/dsh-token-dash?label=version&sort=semver" alt="version" />
25
25
  <img src="https://img.shields.io/npm/dt/dsh-token-dash?logo=npm&label=npm%20downloads" alt="npm downloads" />
26
- <img src="https://img.shields.io/github/downloads/spartawhy117/dsh-token-dash/total?label=downloads" alt="downloads" />
27
- <img src="https://img.shields.io/github/license/spartawhy117/dsh-token-dash" alt="license" />
28
- <img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen" alt="node" />
29
26
  <img src="https://img.shields.io/badge/DSH-0.2.2--rc.1_tested-4c8bf5" alt="DSH tested" />
27
+ <img src="https://img.shields.io/github/license/spartawhy117/dsh-token-dash" alt="license" />
30
28
  <a href="https://awesome-dsh-plugin.com/zh/p/spartawhy117/dsh-token-dash"><img src="https://img.shields.io/badge/awesome--dsh--plugin-listed-6ea8ff" alt="awesome-dsh-plugin" /></a>
31
29
  </p>
32
30
 
33
- **三个入口,一份数据**:底栏 Pill 看当前模型;浮层看预算、余额与用量表;整页看 7 家供应商的全量卡片与模型明细。所有页面共用同一份本地账本,不重复计算。
31
+ **三个入口,一份数据**:输入框底栏右侧 Pill 看当前模型;浮层看预算、余额与用量表;整页看 7 家供应商的全量卡片与模型明细。所有页面共用同一份本地账本,不重复计算。
34
32
 
35
33
  ## 支持矩阵
36
34
 
@@ -53,7 +51,7 @@
53
51
 
54
52
  以下截图使用假数据演示,便于一次看到完整效果。
55
53
 
56
- **P1 · 底栏 Pill**:按量 / 订阅两种形态,点击展开浮层,点击外部、`×` 或 `Esc` 收起。
54
+ **P1 · 输入框底栏右侧 Pill**:按量 / 订阅两种形态,点击展开浮层,点击外部、`×` 或 `Esc` 收起。
57
55
 
58
56
  <p align="center">
59
57
  <img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/pill-api.png" alt="按量 Pill" />
@@ -63,7 +61,7 @@
63
61
  <img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/pill-sub.png" alt="订阅 Pill" />
64
62
  </p>
65
63
 
66
- **P2 · 浮层(当前模型)**:固定 380,单行四组「已用环 / 已用·预算 / 真实余额 / 本月已花」;时间范围撑满,下面是用量表。
64
+ **P2 · 浮层(当前模型)**:固定 380,单行三组「已用环 / 已用·预算 / 真实余额」,真实余额右对齐到面板右缘;时间范围撑满,下面是用量表。
67
65
 
68
66
  <p align="center">
69
67
  <img src="https://raw.githubusercontent.com/spartawhy117/dsh-token-dash/main/docs/pic/panel-api.png" alt="浮层 · 按量形态" />
@@ -88,7 +86,7 @@
88
86
 
89
87
  - 按量卡:预算输入、计划余额、真实余额、本月已花;订阅卡:每个窗口一个环 + 剩余百分比 + 倒计时。
90
88
  - 明细表:模型 / Tokens / 输入 / 缓存 / 输出 / 请求 / 命中 / 费用;除模型列外全部右对齐。
91
- - 设置胶囊:第一行刷新间隔 + 账户余额开关;下面是日志、导出导入、价格表与版本。
89
+ - 设置区:胶囊外是「设置与数据管理」区块标题;胶囊内第一行刷新间隔 + 账户余额开关,下面是日志、导出导入、价格表与版本。
92
90
  - 间距只使用 4 / 8 / 12 / 16 / 24 / 32 六档,P2 / P3 同一套 token。
93
91
 
94
92
  ## 安装
@@ -144,7 +142,7 @@ npm run logs -- --module provider,route # 缓存 / 路由异常
144
142
  ## 开发
145
143
 
146
144
  ```bash
147
- npm test # 单元测试(79 通过)
145
+ npm test # 单元测试(80 通过)
148
146
  npm run e2e # 端到端(临时 DSH_HOME + web profile + Playwright)
149
147
  npm run shots # 用假数据重新生成 docs/pic 的 P1/P2/P3 截图
150
148
  npm run pack # 发布 tarball 生成到 build/
package/client.js CHANGED
@@ -320,7 +320,7 @@ window.__ModuleLoader__.load({
320
320
  borderRadius: 999, cursor: 'pointer', maxWidth: '100%', fontVariantNumeric: 'tabular-nums',
321
321
  border: `1px solid ${T.border}`, color: T.text,
322
322
  },
323
- pillWrap: { position: 'relative', display: 'inline-flex', alignItems: 'center', marginLeft: 8 },
323
+ pillWrap: { position: 'relative', display: 'inline-flex', alignItems: 'center', order: 10, marginLeft: 8 },
324
324
  pillHover: { background: 'color-mix(in srgb, currentColor 8%, transparent)' },
325
325
  hint: {
326
326
  position: 'absolute', right: 12, bottom: 30, padding: '5px 8px', borderRadius: 6,
@@ -393,7 +393,7 @@ window.__ModuleLoader__.load({
393
393
  card: { background: T.section, borderRadius: 10, padding: 10, marginTop: 10, display: 'grid', gap: 8 },
394
394
  link: { color: T.text, textDecoration: 'underline', cursor: 'pointer' },
395
395
  status: { minHeight: 15, fontSize: 10.5, color: T.muted, textAlign: 'right' },
396
- summaryRow: { display: 'flex', flexWrap: 'nowrap', alignItems: 'center', justifyContent: 'space-between', gap: 12, minHeight: 24, fontSize: 12 },
396
+ summaryRow: { display: 'grid', gridTemplateColumns: 'auto minmax(120px,1.2fr) minmax(80px,1fr) minmax(0,1fr)', alignItems: 'center', columnGap: 12, minHeight: 24, fontSize: 12 },
397
397
  summaryCell: { display: 'flex', flexDirection: 'column', gap: 4, minWidth: 0, whiteSpace: 'nowrap' },
398
398
  summaryLabel: { color: T.muted, fontSize: 11 },
399
399
  summaryValue: { fontSize: 12, fontWeight: 600, fontVariantNumeric: 'tabular-nums' },
@@ -1215,7 +1215,7 @@ window.__ModuleLoader__.load({
1215
1215
  }, suffix === '' ? text : `${text} ${suffix}`)
1216
1216
  }
1217
1217
 
1218
- /** P2 API 主区:环+% / 已用·预算 / 真实余额 / 本月已花。 */
1218
+ /** P2 API 主区:环+% / 已用·预算 / 真实余额;第四格留空。 */
1219
1219
  function P2Summary({ provider, summary }) {
1220
1220
  const budget = provider.budget
1221
1221
  const hasBudget = budget !== undefined && budget.state !== 'unset' && budget.amount > 0
@@ -1238,18 +1238,18 @@ window.__ModuleLoader__.load({
1238
1238
  h('span', { style: styles.summaryValue },
1239
1239
  hasBudget ? `${fmtMoney(budget.used, provider.currency)} / ${fmtMoney(budget.amount, provider.currency)}` : '—')),
1240
1240
  h('span', {
1241
- 'data-testid': 'token-dash-summary-balance', style: styles.summaryCell,
1241
+ 'data-testid': 'token-dash-summary-balance',
1242
+ style: {
1243
+ ...styles.summaryCell,
1244
+ gridColumn: '3 / 5',
1245
+ justifySelf: 'end',
1246
+ alignItems: 'flex-end',
1247
+ textAlign: 'right',
1248
+ },
1242
1249
  title: tr('账户真实余额,不受预算影响'),
1243
1250
  },
1244
1251
  h('span', { style: styles.summaryLabel }, tr('真实余额')),
1245
- h('span', { style: styles.summaryValue }, balance ?? '—')),
1246
- h('span', {
1247
- 'data-testid': 'token-dash-summary-month',
1248
- style: { ...styles.summaryCell, alignItems: 'flex-end', textAlign: 'right' },
1249
- title: tr('本月累计消耗,等于已用/预算 的分子'),
1250
- },
1251
- h('span', { style: styles.summaryLabel }, tr('本月已花')),
1252
- h('span', { style: styles.summaryValue }, fmtMoney(provider.usage?.monthCost, provider.currency)))))
1252
+ h('span', { style: styles.summaryValue }, balance ?? '—'))))
1253
1253
  }
1254
1254
 
1255
1255
  /** P2 订阅窗口行:两段数字 + 倒计时 + 绝对时间(无「重置」后缀)。 */
@@ -1809,8 +1809,14 @@ window.__ModuleLoader__.load({
1809
1809
  rows: models,
1810
1810
  providerNames: Object.fromEntries(providers.map((provider) => [provider.id, provider.name])),
1811
1811
  })))),
1812
- h('div', { 'data-testid': 'token-dash-settings-capsule', style: styles.capsule },
1813
- h(SettingsRows, { summary, prefs, onSave: savePrefs, onRefresh: refresh, onRefreshSubs: refreshSubs }))))
1812
+ h('section', { style: styles.boardSection },
1813
+ h('div', { style: styles.boardSectionHead },
1814
+ h('b', {
1815
+ 'data-testid': 'token-dash-settings-title',
1816
+ style: styles.sectionTitle,
1817
+ }, tr('设置与数据管理'))),
1818
+ h('div', { 'data-testid': 'token-dash-settings-capsule', style: styles.capsule },
1819
+ h(SettingsRows, { summary, prefs, onSave: savePrefs, onRefresh: refresh, onRefreshSubs: refreshSubs })))))
1814
1820
  }
1815
1821
 
1816
1822
  return {
@@ -1847,13 +1853,9 @@ window.__ModuleLoader__.load({
1847
1853
  }).catch(() => {})
1848
1854
  } catch { /* ignore */ }
1849
1855
  }
1850
- slots.inject('conversation.hero.agentPreset', () => {
1851
- reportMount('conversation.hero.agentPreset')
1852
- return slots.register({ name: 'conversation.hero.agentPreset', id: 'token-dash-home', order: 10 }, LocaleRoot)
1853
- })
1854
1856
  slots.inject('conversation.composer.dock', () => {
1855
1857
  reportMount('conversation.composer.dock')
1856
- return slots.register({ name: 'conversation.composer.dock', id: 'token-dash-input', order: -1 }, LocaleRoot)
1858
+ return slots.register({ name: 'conversation.composer.dock', id: 'token-dash-input', order: 10 }, LocaleRoot)
1857
1859
  })
1858
1860
  slots.inject('main', () => {
1859
1861
  reportMount('main')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-token-dash",
3
- "version": "1.3.0",
3
+ "version": "2.0.0",
4
4
  "description": "DeepSeek Harness Token 看板:月度预算与订阅配额、账户余额、时间范围费用与真实 Tokens 明细,支持本地 JSON 导出 / 导入备份。",
5
5
  "type": "module",
6
6
  "main": "./index.js",