dsh-token-receipt 1.0.0 → 1.1.1

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/CHANGELOG.md CHANGED
@@ -1,24 +1,31 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to this project are documented here.
4
-
5
- ## Unreleased
6
-
7
- - Add Japanese plugin metadata, sidebar and receipt translations, date formatting, and Japanese font fallbacks.
8
- - Estimate model costs from the public models.dev catalogue, with a one-hour cache.
9
- - Preserve provider/model identity and price input, cache reads, cache writes, and output separately.
10
- - Use the DeepSeek Flash official reference rate and peak policy for WorkBuddy's deepseek-v4.1-flash route.
11
- - Add model line amounts, cost breakdown, estimated total, and USD/CNY/JPY selection to the receipt.
12
- - Default currency follows the interface language, with an explicit automatic mode and manual overrides.
13
- - Convert JPY using a dated reference rate (2026-11-13: 1 USD = 160 JPY); preserve fractional-yen precision for small estimates.
14
- - Mark missing prices, partial subtotals, stale prices, and the WorkBuddy reference-rate override.
15
- - Keep the DSH whale logo and include monetary amounts and pricing notes in PNG/print output.
16
-
17
- ## 1.0.0 — 2026-11-14
18
-
19
- - Initial release.
20
- - Daily, weekly, and monthly token usage bills.
21
- - Receipt-printer animation with stepped paper feed, torn edge, and barcode.
22
- - Save the receipt as a 3× PNG.
23
- - Print / PDF action with a print-only stylesheet.
24
- - Light/dark themes, Chinese/English UI, and reduced-motion support.
3
+ All notable changes to this project are documented in this file.
4
+
5
+ ## 1.1.1
6
+
7
+ Released on 2026-11-17.
8
+
9
+ - Add a client/server version guard. The running panel now probes `/api/token-receipt?version=1` on startup, on window focus, and every 30 seconds; when the installed plugin is newer than the loaded browser bundle it shows a localized banner with a one-click **Reload UI** action instead of silently keeping old code.
10
+ - Document the DSH Desktop update behavior: after updating a plugin's browser bundle, fully quit and reopen DeepSeek Harness; closing the plugin panel or toggling the plugin does not reload `client.js`.
11
+ - Add a regression test that keeps the embedded client version in sync with `package.json`.
12
+
13
+ ## 1.1.0
14
+
15
+ Released on 2026-11-17.
16
+
17
+ - Replace the `Print / PDF` action with `Copy image` to copy a 3x PNG receipt directly to the clipboard for instant pasting and sharing alongside `Save PNG`.
18
+ - Add `30 days`, `90 days`, and `All` (`days30`, `days90`, `all`) receipt periods with `TR-30D-`, `TR-90D-`, and `TR-ALL-` bill numbers and real matched-session date spans.
19
+ - Replay the stepped receipt-printer paper-feed animation automatically whenever switching periods or navigating dates.
20
+ - Harden pricing catalog refresh cancellation/timeouts, session LRU caching, and Node 22/24 test runner compatibility.
21
+
22
+ ## 1.0.0
23
+
24
+ Released on 2026-11-14.
25
+
26
+ - Print daily, weekly, and monthly token usage receipts with quick date navigation.
27
+ - Render a stepped receipt-printer feed animation with a torn paper edge, barcode, and `prefers-reduced-motion` support.
28
+ - Estimate model and token-category costs from the public [models.dev](https://models.dev) catalog across input, output, cache read, and cache write tokens, including built-in gateway route mappings and peak-hour adjustments.
29
+ - Match the default currency to the interface language, with manual switching between `USD`, `CNY`, and `JPY` and status notes for unpriced, partial, or cached rates.
30
+ - Export receipts as 3x high-resolution PNG images or print and save to PDF through the system print dialog.
31
+ - Support English, Simplified Chinese, and Japanese interfaces across light and dark themes.
package/README.ja.md ADDED
@@ -0,0 +1,96 @@
1
+ <div align="center">
2
+ <img src="icon.svg" width="64" height="64" alt="トークン明細" />
3
+ <h1>トークン明細</h1>
4
+ <p>DeepSeek Harness の日・週・月・直近30日・直近90日・全期間のトークン使用量と推定モデル料金を、手触りのあるレシートとして印刷し、画像のコピーや PNG 保存ができます。</p>
5
+ <p>
6
+ <a href="https://www.npmjs.com/package/dsh-token-receipt"><img src="https://img.shields.io/npm/v/dsh-token-receipt.svg" alt="npm version" /></a>
7
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license" /></a>
8
+ <a href="https://github.com/maxlee/dsh-token-receipt/actions/workflows/ci.yml"><img src="https://github.com/maxlee/dsh-token-receipt/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
9
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.3-4c8bf5.svg" alt="DSH >=0.2.2-rc.3" />
10
+ </p>
11
+ <p>
12
+ <a href="README.md">English</a> · <a href="README.zh.md">简体中文</a> · <strong>日本語</strong>
13
+ </p>
14
+ </div>
15
+
16
+ | ダーク · 日次明細 | ライト · 月次明細 |
17
+ | :---: | :---: |
18
+ | ![ダークテーマの日次明細プレビュー](assets/screenshots/dark.png) | ![ライトテーマの月次明細プレビュー](assets/screenshots/light.png) |
19
+
20
+ ## 主な機能
21
+
22
+ トークン明細は、DeepSeek Harness のローカル使用記録をレシート形式で集計・出力するプラグインです。
23
+
24
+ - **期間の切り替え。** **日**・**週**・**月**・**直近30日**・**直近90日**・**全期間** の明細を切り替えられ、日・週・月ではパネル内で過去の日付や今日へ移動できます。期間を切り替えるたびに紙送りアニメーションが再生されます。
25
+ - **モデル別の推定料金。** [models.dev](https://models.dev) の公開レートに基づき、入力・出力・キャッシュ読込・キャッシュ書込ごとの内訳を表示します。
26
+ - **複数通貨への対応。** 表示言語に応じた自動選択のほか、`USD`・`CNY`・`JPY` を手動で切り替えられます。
27
+ - **レシートプリンター演出。** 期間の切り替えに合わせてステップ紙送り、切り口、バーコードを再生し、OS の視差効果を減らす設定にも自動で追従します。
28
+ - **高解像度エクスポートと共有。** **画像をコピー** で 3 倍解像度の PNG をクリップボードへ直接コピーしてすぐ貼り付け・共有できるほか、**PNG を保存** で画像ファイルとしてダウンロードできます。
29
+ - **多言語とテーマ対応。** 日本語・English・简体中文のインターフェースと、ライト・ダーク両テーマに対応しています。
30
+
31
+ > [!NOTE]
32
+ > 表示される金額は [models.dev](https://models.dev) の公開カタログレートから算出した参考推定値であり、プロバイダーからの実際の請求額ではありません。セッションとトークン使用量のデータはすべて端末内に保持され、オンライン通信は公開料金レートの取得にのみ使用されます。
33
+
34
+ ## インストール
35
+
36
+ ### npm からインストール
37
+
38
+ DeepSeek Harness で **Plugins** を開き、**Add plugin** をクリックして以下を入力します。
39
+
40
+ ```text
41
+ dsh-token-receipt
42
+ ```
43
+
44
+ または `plugin_manager` ツールでインストールします。
45
+
46
+ ```json
47
+ {
48
+ "action": "install_bundle",
49
+ "target": "dsh-token-receipt"
50
+ }
51
+ ```
52
+
53
+ ### ローカルリポジトリからインストール
54
+
55
+ ローカルのチェックアウト先の絶対パスを `plugin_manager` に指定します。
56
+
57
+ ```json
58
+ {
59
+ "action": "install_bundle",
60
+ "target": "/absolute/path/to/dsh-token-receipt"
61
+ }
62
+ ```
63
+
64
+ DeepSeek Harness に `restart-required` と表示された場合は、アプリを一度再起動してください。
65
+
66
+ ### DSH Desktop での更新
67
+
68
+ ブラウザ側の UI(`client.js`)を含む更新の後は、DeepSeek Harness を完全に終了してから再度開いてください。プラグインページを閉じる、プラグインを無効/有効にする、ウィンドウを閉じるだけでは不十分です。DSH Desktop はアプリウィンドウの起動時にのみブラウザ側のプラグインバンドルを読み込みます。アンインストールと再インストールは不要です。1.1.1 以降は、インストール済みバージョンが現在のページより新しいことを検出すると、**画面を更新** ボタン付きの通知を表示します。
69
+
70
+ ## 使い方
71
+
72
+ DeepSeek Harness の言語設定で **日本語** を選択すると、日本語インターフェースに切り替わります。
73
+
74
+ 1. 左サイドバーから **トークン明細** を開きます。
75
+ 2. **日**・**週**・**月**・**直近30日**・**直近90日**・**全期間** から期間を選びます(日・週・月では日付コントロールで過去の日付や今日へ移動できます)。期間を切り替えると紙送りアニメーションが再生されます。
76
+ 3. **通貨** メニューから `USD`・`CNY`・`JPY` または **言語に合わせる** を選びます。
77
+ 4. **画像をコピー** で 3 倍解像度の PNG をクリップボードに直接コピーしてそのまま貼り付け・共有でき、**PNG を保存** で画像をダウンロードできます。**印刷を再生** をクリックすると紙送りアニメーションをもう一度再生できます。
78
+
79
+ ## 動作環境と開発
80
+
81
+ 必要な実行環境は以下の通りです。
82
+
83
+ - DeepSeek Harness `>=0.2.2-rc.3 <0.3.0`
84
+ - Node.js `^22.19.0 || >=24.0.0`
85
+
86
+ ローカル環境で構文チェックとテストを実行するには、以下のコマンドを使用します。
87
+
88
+ ```bash
89
+ npm run check && npm test
90
+ ```
91
+
92
+ ## ライセンス
93
+
94
+ [MIT License](LICENSE) のもとで公開されています。
95
+
96
+ レシートプリンターのインタラクションは [dqnamo の Receipt Printer](https://www.dqnamo.com/experiments/receipt-printer) に着想を得ており、料金解決ロジックの一部は [dsh-context](https://github.com/bowenliang123/dsh-context) をもとに改変しています。Apache-2.0 および SIL Open Font License 1.1 のライセンス表記については [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) を参照してください。
package/README.md CHANGED
@@ -1,108 +1,94 @@
1
- # Token Receipt for DeepSeek Harness
2
-
3
- [![npm version](https://img.shields.io/npm/v/dsh-token-receipt.svg)](https://www.npmjs.com/package/dsh-token-receipt)
4
- [![license](https://img.shields.io/npm/l/dsh-token-receipt.svg)](LICENSE)
5
-
6
- A DeepSeek Harness plugin that prints your daily, weekly, or monthly token
7
- usage as a tactile receipt — complete with a stepped paper feed, a torn edge,
8
- and a barcode. Save the finished receipt as a PNG or send it through the
9
- system print dialog. The receipt includes model costs and an estimated total.
10
-
11
- [中文说明](README.zh.md)
12
-
13
- ![Token Receipt in dark mode](docs/screenshots/dark.png)
1
+ <div align="center">
2
+ <img src="icon.svg" width="64" height="64" alt="Token Receipt" />
3
+ <h1>Token Receipt</h1>
4
+ <p>Print daily, weekly, monthly, 30-day, 90-day, and all-time DeepSeek Harness token usage and estimated model costs as a tactile receipt, then copy the image or save a PNG.</p>
5
+ <p>
6
+ <a href="https://www.npmjs.com/package/dsh-token-receipt"><img src="https://img.shields.io/npm/v/dsh-token-receipt.svg" alt="npm version" /></a>
7
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license" /></a>
8
+ <a href="https://github.com/maxlee/dsh-token-receipt/actions/workflows/ci.yml"><img src="https://github.com/maxlee/dsh-token-receipt/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
9
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.3-4c8bf5.svg" alt="DSH >=0.2.2-rc.3" />
10
+ </p>
11
+ <p>
12
+ <strong>English</strong> · <a href="README.zh.md">简体中文</a> · <a href="README.ja.md">日本語</a>
13
+ </p>
14
+ </div>
15
+
16
+ | Dark · Daily | Light · Monthly |
17
+ | :---: | :---: |
18
+ | ![Token Receipt dark theme daily view](assets/screenshots/dark.png) | ![Token Receipt light theme monthly view](assets/screenshots/light.png) |
14
19
 
15
20
  ## Features
16
21
 
17
- - **Daily / weekly / monthly bills** — switch periods and move backwards or
18
- forwards without leaving the page.
19
- - **Tactile receipt printer animation** — processing, stepped paper feed, and
20
- a completion state, adapted from the dqnamo Receipt Printer study.
21
- - **Estimated costs** — model line prices, four token cost categories, and a prominent total, using the public models.dev catalogue. The default currency follows the interface language (Chinese → CNY, English → USD, Japanese → JPY); choose USD, CNY or JPY manually at any time, or return to Follow language.
22
- - **Save as PNG** — exports the actual receipt card at 3× resolution.
23
- - **Print / PDF** — uses the browser's system print dialog with a print-only
24
- stylesheet, so only the receipt is printed.
25
- - **Local usage** — session data stays on your machine. Only the public price catalogue is fetched online; no usage or session text is uploaded.
26
- - **Light and dark themes**, Chinese, English and Japanese, and reduced-motion support. Select **日本語** in DSH's language settings to use the Japanese interface.
22
+ Token Receipt turns local DeepSeek Harness usage records into a printable receipt:
27
23
 
28
- ![Token Receipt in light mode](docs/screenshots/light.png)
24
+ - **Period navigation.** Switch between **Day**, **Week**, **Month**, **30 days**, **90 days**, and **All** views, step across dates for Day, Week, and Month without leaving the panel, and replay the paper-feed print animation automatically on every period change.
25
+ - **Estimated model costs.** Break down spending per model across input, output, cache read, and cache write tokens using public [models.dev](https://models.dev) rates.
26
+ - **Multi-currency display.** Match the default currency to your interface language, or switch manually between `USD`, `CNY`, and `JPY`.
27
+ - **Tactile receipt feed.** Watch a stepped paper-feed animation with a torn paper edge and a barcode whenever you print or switch periods, with automatic `prefers-reduced-motion` support.
28
+ - **High-DPI export and sharing.** Click **Copy image** to copy a 3x PNG directly to your clipboard for instant pasting and sharing, or **Save PNG** to download a local image.
29
+ - **Multilingual themes.** Use the interface in English, Simplified Chinese, or Japanese across light and dark themes.
29
30
 
30
- ## Install
31
+ > [!NOTE]
32
+ > Displayed costs are reference estimates calculated from public [models.dev](https://models.dev) catalog rates, not provider invoices. All session and token usage data stays local on your device, and only public price rates are fetched online.
31
33
 
32
- ### From npm (recommended)
34
+ ## Installation
33
35
 
34
- Open **Plugins → Add plugin** in DeepSeek Harness and enter:
36
+ ### Install from npm
37
+
38
+ Open **Plugins** in DeepSeek Harness, click **Add plugin**, and enter:
35
39
 
36
40
  ```text
37
41
  dsh-token-receipt
38
42
  ```
39
43
 
40
- Or use the DSH `plugin_manager` tool with an installation spec:
44
+ Or install with the `plugin_manager` tool:
41
45
 
42
46
  ```json
43
47
  {
44
- "action": "install_bundle",
45
- "target": "dsh-token-receipt@1.0.0"
48
+ "action": "install_bundle",
49
+ "target": "dsh-token-receipt"
46
50
  }
47
51
  ```
48
52
 
49
- After installation, open **Token 账单 / Token receipt** from the left sidebar.
50
- If DSH reports `restart-required`, restart the app once.
53
+ ### Install from a local checkout
51
54
 
52
- ### From a local checkout
55
+ Pass the local repository path to `plugin_manager`:
53
56
 
54
- ```text
55
- plugin_manager install_bundle
56
- target: /absolute/path/to/dsh-token-receipt
57
+ ```json
58
+ {
59
+ "action": "install_bundle",
60
+ "target": "/absolute/path/to/dsh-token-receipt"
61
+ }
57
62
  ```
58
63
 
59
- ## Usage
64
+ If DeepSeek Harness reports `restart-required`, restart the app once to activate the plugin.
60
65
 
61
- 1. Open **Token 账单 / Token receipt** in the left sidebar.
62
- 2. Pick **日 / 周 / 月** (day / week / month), or use the date picker.
63
- 3. The first visit plays the printer animation; use **重播打印 / Replay print**
64
- to replay it.
65
- 4. Use **保存 PNG / Save PNG** to download a high-resolution receipt image.
66
- 5. Use **打印 / PDF / Print / PDF** for the system print dialog.
66
+ ### Updating on DSH Desktop
67
67
 
68
- ![Monthly bill](docs/screenshots/light.png)
68
+ After an update that changes the plugin's browser UI (`client.js`), fully quit DeepSeek Harness and reopen it. Closing the plugin panel, toggling the plugin, or closing the window is not enough: DSH Desktop loads browser plugin bundles only when the app window starts. Uninstalling and reinstalling is not required. Version 1.1.1 and later show a **Reload UI** banner when they detect that the installed version is newer than the loaded page.
69
69
 
70
- ## Data and privacy
70
+ ## Usage
71
71
 
72
- The plugin reads token usage from local DSH session records through the DSH
73
- host APIs. It does not send session data anywhere. Only messages with a
74
- recorded `usage` value are included; old messages without usage metadata are
75
- not estimated. Prices are fetched from https://models.dev/api.json and cached for one hour. Costs are reference estimates, not provider invoices; unavailable model prices are marked instead of treated as free.
72
+ 1. Open **Token receipt** from the left sidebar.
73
+ 2. Select **Day**, **Week**, **Month**, **30 days**, **90 days**, or **All** (use the date controls on Day, Week, and Month to step across dates or return to today). Switching periods plays the paper-feed print animation automatically.
74
+ 3. Choose `USD`, `CNY`, `JPY`, or **Follow language** in the **Currency** menu.
75
+ 4. Click **Copy image** to copy a 3x PNG directly to your clipboard for instant pasting and sharing, **Save PNG** to download the receipt image, or **Replay print** to run the paper-feed animation again.
76
76
 
77
- See [Pricing](docs/PRICING.md) for the formula, provider matching, the WorkBuddy override, currency conversion, and pricing limits.
77
+ ## Compatibility and development
78
78
 
79
- ## Compatibility
79
+ Token Receipt requires the following runtime versions:
80
80
 
81
81
  - DeepSeek Harness `>=0.2.2-rc.3 <0.3.0`
82
82
  - Node.js `^22.19.0 || >=24.0.0`
83
83
 
84
- The bundle contains both a Host half (`index.js`) and a Client half
85
- (`client.js`), plus locale resources, a detail illustration, and an icon.
86
-
87
- ## Development
84
+ Run syntax checks and the test suite from a local checkout:
88
85
 
89
86
  ```bash
90
- npm run check
91
- npm test
92
- npm pack --dry-run
87
+ npm run check && npm test
93
88
  ```
94
89
 
95
- The plugin has no runtime npm dependencies. Fonts are embedded in the client
96
- bundle: Inter and JetBrains Mono, both under the SIL Open Font License 1.1.
97
- See [docs/FONTS.md](docs/FONTS.md).
98
-
99
- ## Credits
100
-
101
- The receipt-printer interaction is inspired by
102
- [dqnamo's Receipt Printer experiment](https://www.dqnamo.com/experiments/receipt-printer).
103
- This repository is an independent implementation; the bundled textures are
104
- original procedural SVGs. Pricing resolution is adapted from [dsh-context](https://github.com/bowenliang123/dsh-context) under Apache-2.0; see [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
105
-
106
90
  ## License
107
91
 
108
- MIT for original code — see [LICENSE](LICENSE). Adapted pricing code retains its Apache-2.0 notices; bundled fonts retain their OFL licenses.
92
+ Licensed under the [MIT License](LICENSE).
93
+
94
+ Receipt printer interaction inspired by [dqnamo's Receipt Printer](https://www.dqnamo.com/experiments/receipt-printer), with pricing resolution adapted from [dsh-context](https://github.com/bowenliang123/dsh-context). See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) for Apache-2.0 and SIL Open Font License 1.1 notices.
package/README.zh.md CHANGED
@@ -1,101 +1,94 @@
1
- # Token 账单 · DeepSeek Harness 插件
2
-
3
- [![npm 版本](https://img.shields.io/npm/v/dsh-token-receipt.svg)](https://www.npmjs.com/package/dsh-token-receipt)
4
- [![许可证](https://img.shields.io/npm/l/dsh-token-receipt.svg)](LICENSE)
5
-
6
- 把日、周、月的 token 用量打印成一张有手感的小票:阶梯送纸、撕边、条形码,
7
- 小票展示模型费用与预估总计,打印完成后可保存为 PNG,也可以走系统打印 / PDF。
8
-
9
- [English](README.md)
10
-
11
- ![深色主题下的 Token 账单](docs/screenshots/dark.png)
12
-
13
- ## 功能
14
-
15
- - **日 / 周 / 月账单**:同一个页面切换周期,向前或向后翻查。
16
- - **小票打印机动画**:整理用量 → 阶梯送纸 → 打印完成,参考 dqnamo 的
17
- Receipt Printer 实验。
18
- - **预估费用**:按模型及输入、输出、缓存读写分别计费,突出显示总价。默认币种跟随语言(中文 CNY、英文 USD、日文 JPY),也可手动切换 USD/CNY/JPY,或恢复「跟随语言」。
19
- - **保存 PNG**:按 3 倍分辨率导出当前小票图片。
20
- - **打印 / PDF**:调用系统打印对话框,打印样式只输出小票。
21
- - **只读本地数据**:从本机 DSH 会话记录读取 token 用量,不会发送到任何地方。
22
- - 支持浅色 / 深色主题、中/英/日文界面和 reduced-motion;在 DSH 语言设置中选择「日本語」即可使用日文。
23
-
24
- ![浅色主题下的 Token 账单](docs/screenshots/light.png)
1
+ <div align="center">
2
+ <img src="icon.svg" width="64" height="64" alt="Token 账单" />
3
+ <h1>Token 账单</h1>
4
+ <p>将 DeepSeek Harness 日、周、月、近 30 天、近 90 天与全部周期的 Token 用量及预估模型费用打印成一张有质感的小票,支持复制图片与保存 PNG。</p>
5
+ <p>
6
+ <a href="https://www.npmjs.com/package/dsh-token-receipt"><img src="https://img.shields.io/npm/v/dsh-token-receipt.svg" alt="npm version" /></a>
7
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license" /></a>
8
+ <a href="https://github.com/maxlee/dsh-token-receipt/actions/workflows/ci.yml"><img src="https://github.com/maxlee/dsh-token-receipt/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
9
+ <img src="https://img.shields.io/badge/DSH-%3E%3D0.2.2--rc.3-4c8bf5.svg" alt="DSH >=0.2.2-rc.3" />
10
+ </p>
11
+ <p>
12
+ <a href="README.md">English</a> · <strong>简体中文</strong> · <a href="README.ja.md">日本語</a>
13
+ </p>
14
+ </div>
15
+
16
+ | 深色 · 每日账单 | 浅色 · 每月账单 |
17
+ | :---: | :---: |
18
+ | ![深色主题每日账单预览](assets/screenshots/dark.png) | ![浅色主题每月账单预览](assets/screenshots/light.png) |
19
+
20
+ ## 功能特性
21
+
22
+ Token 账单将本地 DeepSeek Harness 用量记录整理为可打印的小票:
23
+
24
+ - **周期切换。** 查看 **日**、**周**、**月**、**近 30 天**、**近 90 天** 与 **全部** 账单;在日、周、月视图下可在同一面板内翻阅历史日期或回到今天,切换周期时自动播放送纸打印动画。
25
+ - **预估模型费用。** 基于 [models.dev](https://models.dev) 公开价格,按模型及输入、输出、缓存读取、缓存写入分别展示费用明细。
26
+ - **多币种显示。** 默认币种自动跟随界面语言,也可随时手动切换 `USD`、`CNY` 与 `JPY`。
27
+ - **小票打印动效。** 呈现阶梯送纸、纸张撕边与条形码细节,每次切换周期都会自动播放,并自动适配系统的减弱动态效果设置。
28
+ - **高清导出与分享。** 点击 **复制图片** 可将 3 倍分辨率 PNG 直接复制到剪贴板以便即刻粘贴分享,也可点击 **保存 PNG** 下载本地图片。
29
+ - **多语言与明暗主题。** 支持简体中文、English、日本語界面,适配浅色与深色主题。
30
+
31
+ > [!NOTE]
32
+ > 小票金额基于 [models.dev](https://models.dev) 公开目录价格计算,仅作参考估算,不等同于供应商实付账单。所有会话与 Token 用量数据均保留在本地设备,联网仅用于读取公开价格目录。
25
33
 
26
34
  ## 安装
27
35
 
28
- ### 从 npm 安装(推荐)
36
+ ### 从 npm 安装
29
37
 
30
- 在 DeepSeek Harness 中打开 **Plugins → Add plugin**,输入:
38
+ 在 DeepSeek Harness 中打开 **Plugins**,点击 **Add plugin**,输入:
31
39
 
32
40
  ```text
33
41
  dsh-token-receipt
34
42
  ```
35
43
 
36
- 也可以使用 DSH 的 `plugin_manager` 工具:
44
+ 也可以使用 `plugin_manager` 工具安装:
37
45
 
38
46
  ```json
39
47
  {
40
- "action": "install_bundle",
41
- "target": "dsh-token-receipt@1.0.0"
48
+ "action": "install_bundle",
49
+ "target": "dsh-token-receipt"
42
50
  }
43
51
  ```
44
52
 
45
- 安装后,在左侧栏打开「Token 账单」。如果 DSH 提示 `restart-required`,
46
- 重启一次应用即可。
53
+ ### 从本地仓库安装
47
54
 
48
- ### 从本地目录安装
55
+ 将本地仓库绝对路径传入 `plugin_manager`:
49
56
 
50
- ```text
51
- plugin_manager install_bundle
52
- target: /absolute/path/to/dsh-token-receipt
57
+ ```json
58
+ {
59
+ "action": "install_bundle",
60
+ "target": "/absolute/path/to/dsh-token-receipt"
61
+ }
53
62
  ```
54
63
 
55
- ## 使用
64
+ 如果 DeepSeek Harness 提示 `restart-required`,重启一次应用即可启用插件。
56
65
 
57
- 1. 左侧栏打开「Token 账单」。
58
- 2. 选择 **日 / 周 / 月**,或点日期选择器跳到某一天。
59
- 3. 第一次打开会自动播放一次打印动画;点「重播打印」可再次播放。
60
- 4. 「保存 PNG」会把高分辨率小票下载到本地。
61
- 5. 「打印 / PDF」会打开系统打印对话框。
66
+ ### 在 DSH Desktop 上更新
62
67
 
63
- ![月账单](docs/screenshots/light.png)
68
+ 如果更新包含浏览器端界面(`client.js`),请完全退出 DeepSeek Harness 后重新打开。仅关闭插件页面、禁用/启用插件或关闭窗口都不够:DSH Desktop 只会在应用窗口启动时加载浏览器端的插件 bundle。不需要卸载重装。1.1.1 及以后版本检测到「已安装版本比当前页面新」时,会显示带 **刷新界面** 按钮的提示。
64
69
 
65
- ## 数据与隐私
70
+ ## 使用
66
71
 
67
- 插件通过 DSH 的本地会话记录读取 token 用量,不发送任何会话数据;只统计
68
- 记录了 `usage` 的消息,不会估算没有 usage 元数据的旧消息。联网仅获取
69
- https://models.dev/api.json 的公开价格,缓存一小时,不上传会话或用量数据。
70
- 金额为参考估算,不等同于供应商实付账单;缺价模型会明确标记。
72
+ 1. 在左侧边栏打开 **Token 账单**。
73
+ 2. 选择 **日**、**周**、**月**、**近 30 天**、**近 90 天** 或 **全部**(在日、周、月视图下可通过日期控件翻阅历史日期或回到今天);切换周期时会自动播放送纸打印动画。
74
+ 3. 在 **币种** 菜单中选择 `USD`、`CNY`、`JPY` 或 **跟随语言**。
75
+ 4. 点击 **复制图片** 将 3 倍分辨率 PNG 小票直接复制到剪贴板以便粘贴分享,点击 **保存 PNG** 下载本地图片,或点击 **重播打印** 再次播放送纸动画。
71
76
 
72
- 计费公式、模型匹配、WorkBuddy 官方参考价回退和币种规则见 [计价说明](docs/PRICING.md)。
77
+ ## 兼容性与开发
73
78
 
74
- ## 兼容性
79
+ 运行环境要求:
75
80
 
76
81
  - DeepSeek Harness `>=0.2.2-rc.3 <0.3.0`
77
82
  - Node.js `^22.19.0 || >=24.0.0`
78
83
 
79
- ## 开发
84
+ 在本地仓库中运行语法检查与单元测试:
80
85
 
81
86
  ```bash
82
- npm run check
83
- npm test
84
- npm pack --dry-run
87
+ npm run check && npm test
85
88
  ```
86
89
 
87
- 插件没有运行时 npm 依赖。字体以 base64 内嵌在客户端 bundle 中:
88
- Inter 与 JetBrains Mono,均为 SIL Open Font License 1.1,详见
89
- [docs/FONTS.md](docs/FONTS.md)。
90
-
91
- ## 致谢
92
-
93
- 小票打印机的交互参考了
94
- [dqnamo Receipt Printer](https://www.dqnamo.com/experiments/receipt-printer);
95
- 内置纹理由程序化 SVG 生成。价格匹配参考
96
- [dsh-context](https://github.com/bowenliang123/dsh-context),保留 Apache-2.0 授权,
97
- 详见 [第三方说明](THIRD_PARTY_NOTICES.md)。
98
-
99
90
  ## 许可证
100
91
 
101
- 原创代码采用 MIT,详见 [LICENSE](LICENSE)。适配的价格匹配代码保留 Apache-2.0 说明;内嵌字体保留 OFL 授权。
92
+ 基于 [MIT License](LICENSE) 开源。
93
+
94
+ 小票打印机交互灵感来自 [dqnamo 的 Receipt Printer](https://www.dqnamo.com/experiments/receipt-printer),价格解析部分改编自 [dsh-context](https://github.com/bowenliang123/dsh-context)。Apache-2.0 与 SIL Open Font License 1.1 相关声明见 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。
@@ -2,9 +2,7 @@
2
2
 
3
3
  ## dsh-context
4
4
 
5
- Parts of `pricing.js` are adapted from the following files in
6
- [dsh-context](https://github.com/bowenliang123/dsh-context), commit
7
- `d81325ec6bab9dae9bf83e7a866ac74119504e18`:
5
+ Parts of `pricing.js` are adapted from [dsh-context](https://github.com/bowenliang123/dsh-context) at commit `d81325ec6bab9dae9bf83e7a866ac74119504e18`:
8
6
 
9
7
  - `src/shared/pricing.ts`
10
8
  - `src/shared/priceIdentity.ts`
@@ -12,25 +10,19 @@ Parts of `pricing.js` are adapted from the following files in
12
10
 
13
11
  Copyright 2025 bowenliang123.
14
12
 
15
- These portions are licensed under the Apache License, Version 2.0. A complete
16
- copy of the upstream license, including its copyright notice, is provided in
17
- [`licenses/dsh-context-LICENSE.txt`](licenses/dsh-context-LICENSE.txt).
18
- The upstream repository did not contain a separate NOTICE file at that commit.
13
+ These portions are licensed under the Apache License, Version 2.0. See [`licenses/dsh-context-LICENSE.txt`](licenses/dsh-context-LICENSE.txt) for the full upstream license text and copyright notice. The upstream repository did not include a separate `NOTICE` file at that commit.
19
14
 
20
- The adapted file prominently records its modifications: the TypeScript
21
- resolver was converted to a self-contained JavaScript module; Token Receipt
22
- adds an activation-scoped price catalog, an explicit user-requested WorkBuddy
23
- Flash reference-price override, per-message peak/off-peak pricing, and USD
24
- amount breakdowns. The override is marked `user-override` in API responses.
15
+ `pricing.js` converts the TypeScript resolver into a standalone JavaScript module and adds an activation-scoped price catalog, built-in route mappings for compatible gateways, time-of-day peak and off-peak pricing, and USD cost breakdowns.
25
16
 
26
- The rest of Token Receipt remains under the repository's MIT license. These
27
- notices do not change the license of the upstream portions.
17
+ The rest of Token Receipt remains under the MIT License in [`LICENSE`](LICENSE). These notices do not alter the license of the upstream portions.
18
+
19
+ ## Embedded fonts
20
+
21
+ `client.js` embeds two open-source typefaces under the SIL Open Font License, Version 1.1:
22
+
23
+ - **[Inter](https://github.com/rsms/inter).** Copyright 2016 The Inter Project Authors. Licensed under the SIL Open Font License 1.1. Full license text in [`licenses/Inter-OFL.txt`](licenses/Inter-OFL.txt).
24
+ - **[JetBrains Mono](https://github.com/JetBrains/JetBrainsMono).** Copyright 2020 The JetBrains Mono Project Authors. Licensed under the SIL Open Font License 1.1. Full license text in [`licenses/JetBrainsMono-OFL.txt`](licenses/JetBrainsMono-OFL.txt).
28
25
 
29
26
  ## Model price data
30
27
 
31
- Reference model rates are fetched at runtime from
32
- [models.dev](https://models.dev/api.json). The model directory and its data
33
- sources are maintained by [models.dev](https://github.com/anomalyco/models.dev).
34
- The plugin does not bundle a copied model catalogue. Rates are reference
35
- estimates and may differ from invoices, subscription entitlements, and
36
- provider-specific pricing conditions.
28
+ Token Receipt fetches reference model rates at runtime from [models.dev](https://models.dev/api.json), maintained at [`anomalyco/models.dev`](https://github.com/anomalyco/models.dev). This package does not bundle a copied model catalog. Displayed amounts are reference estimates and may differ from provider invoices, subscription plans, or custom pricing terms.