deepseek-harness-wallet 0.1.2 → 0.1.4

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 ADDED
@@ -0,0 +1,54 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here.
4
+
5
+ ## 0.1.4 - 2026-08-17
6
+
7
+ - Reworked wallet placement around direct manipulation: the chip can stay in the composer, move freely, or snap to the composer bottom, viewport sides, and the main-content divider. Dragging now previews the destination and can cross from one region to another in a single gesture instead of being trapped by an intermediate snap.
8
+ - Added compact horizontal and vertical dock layouts, narrowed the side-dock frame without shrinking its text, and kept every vertical value directly below its label. When a narrow composer cannot fit the full home chip, it now preserves a clickable 44px balance/token value instead of overflowing under the model selector.
9
+ - Added a 75–125% live scale slider and independent official/third-party visibility controls, while preventing both data sources from being hidden at once.
10
+ - Made the details panel draggable with a remembered, viewport-clamped position. “Minimize” now goes directly to a freely movable circular wallet instead of creating a second floating state.
11
+ - Expanded conversation-completion reminders with persistent or timed dismissal, simultaneous-completion queueing, deduplication, cross-tab ownership, click-to-open behavior, and an in-page fallback when system notifications cannot be delivered.
12
+ - Added a single desktop-wrapper compatibility adapter for notifications, notification permission, local storage, external links, and optional host capabilities. Synchronous, fire-and-forget, Promise-based, and failure-fallback notification bridges are covered by regression tests.
13
+ - Added a host-gated permanent-deletion preference. The npm plugin exposes the preference only when the surrounding DSH host advertises a real deletion implementation; unsupported hosts show a disabled control. The separate “clear wallet data” action was renamed and documented to make clear that it removes only this conversation's wallet counters, not the conversation.
14
+ - Added a versioned Agent host-integration kit for permanent deletion: bilingual guides, a complete adaptation prompt, compatibility manifest, read-only preflight, upstream/license notice, and a reference patch pinned to DSH commit `47f943859bef60e4160492346772ded9b24f765a` (`0.1.0-rc.5`). The npm plugin still does not claim to be the deletion engine.
15
+ - Tightened the control-panel layout and labels without reducing the base font size, including clearer completion-reminder and permanent-deletion controls.
16
+ - Replaced screenshot-dependent README sections with detailed English and Chinese product introductions, package-safe language navigation, explicit compatibility evidence levels, and clearer trust and host-capability boundaries.
17
+ - Expanded the zero-dependency test suite with release metadata, documentation-resource, HTTP route-boundary, layout, reminder, desktop fallback, and capability-gating checks; added exact npm archive verification for the 0.1.4 release candidate.
18
+ - Expanded validation to Windows, Ubuntu, and macOS on Node 22.19 and 24, added cross-platform reference-patch checks and focused DSH deletion-chain tests, and added npm OIDC trusted publishing for formal GitHub Releases.
19
+
20
+ ## 0.1.3 - 2026-08-16
21
+
22
+ - Fixed the recharge shortcut so its first click reliably opens the anti-phishing confirmation, including when the detail panel is closed (contributed in PR #2 by QZYWQ).
23
+ - Fixed the detail panel opening below the viewport; it now uses viewport-aware fixed positioning and flips above the chip when needed.
24
+ - Session cost is now accumulated at the price active when each usage event arrives, so historical spend no longer changes at peak/off-peak or policy boundaries. Existing stores migrate once to schema v2 and keep the migrated estimate.
25
+ - Added currency-aware balance formatting and stopped applying the CNY low-balance threshold to non-CNY accounts.
26
+ - Reworked floating drag with pointer events for mouse and touch, fixed click-without-drag crashes, and clamp positions using the actual dot/window dimensions.
27
+ - Replaced nested clickable markup with native buttons, added dialog semantics, focus handling, Escape support, and keyboard focus styles.
28
+ - Moved the interactive chip to the Harness `conversation.input.left` slot, deduplicated concurrent balance refreshes, and flush pending persisted changes during plugin shutdown.
29
+ - Expanded regression coverage and CI to run tests and package verification on Linux and Windows with Node 22 and 24.
30
+ - Added capability-based browser/desktop adaptation: optional wrapper bridges for notifications, storage, and external links; in-page notification, cross-tab lease, and CSS-scale fallbacks; and host capability discovery that disables unsupported permanent-delete controls instead of exposing a dead switch.
31
+ - Fixed completion reminders for the currently selected conversation by detecting its running-to-idle transition; desktop notification bridges now also support fire-and-forget, Promise-based, and native callback APIs.
32
+
33
+ ## 0.1.2 - 2026-08-15
34
+
35
+ - Fixed the client bundle loader id to match the package name (`deepseek-harness-wallet`); 0.1.1 still registered the old `dsh-wallet` id, which aborted the whole plugin boot ("loaded without registering") after the rename. Regression test added.
36
+ - Implemented the 2026-08-17 peak/off-peak pricing for the v4 models (Beijing 09:00–12:00 / 14:00–18:00 peak; off-peak is half the peak rate).
37
+ - Fixed the v4 pricing effective date in the READMEs (2026-04-24, matching the V4 preview launch).
38
+ - Balance total now prefers the CNY record and never sums mixed currencies (fixes wrong totals and false low-balance alerts on international accounts).
39
+ - Hardened the persisted store: threshold values are coerced on load, saves are atomic (temp file + rename), and boot-retry timers are cleaned up on plugin stop.
40
+ - Floating window drag now clamps by the dragged element's real size, so the panel can no longer be pushed mostly off-screen.
41
+
42
+ ## 0.1.1 - 2026-08-14
43
+
44
+ - Added floating window mode: detach the wallet panel into a draggable floating window with a persistent position, or minimize it to a dot that turns red when the balance is below the threshold.
45
+ - Replaced the control-panel screenshot with floating-window screenshots in the READMEs.
46
+
47
+ ## 0.1.0 - 2026-08-14
48
+
49
+ - Initial public release.
50
+ - Added official DeepSeek balance monitoring and manual refresh.
51
+ - Added per-session DeepSeek cost estimation and provider-aware token counters.
52
+ - Added configurable low-balance alerts and desktop notifications.
53
+ - Added a guarded shortcut to the official DeepSeek recharge page.
54
+ - Added English and Simplified Chinese documentation.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 feibi-mochi
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 feibi-mochi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,50 +1,58 @@
1
- # deepseek-harness-wallet
1
+ # DeepSeek Harness Control Center
2
2
 
3
- ### DeepSeek Harness Balance Monitor & Recharge Plugin · 余额监控和充值插件
3
+ ### DeepSeek Harness monitoring, alerts, recharge, and session control center · DeepSeek Harness 监控、提醒、充值与会话控制中心
4
4
 
5
- <p align="center">
6
- <a href="./README.md">English</a> ·
7
- <a href="./docs/i18n/README.zh-CN.md">简体中文</a>
8
- </p>
5
+ [English](./README.md) · [简体中文](https://github.com/feibi-mochi/deepseek-harness-control-center/blob/main/docs/i18n/README.zh-CN.md)
9
6
 
10
- <p align="center">
11
- <img alt="Version 0.1.2" src="https://img.shields.io/badge/version-0.1.2-5965d8">
12
- <img alt="DeepSeek Harness rc.6" src="https://img.shields.io/badge/dsh-0.1.0--rc.6-4aa3ff">
13
- <img alt="MIT License" src="https://img.shields.io/badge/license-MIT-3b7a57">
14
- </p>
7
+ **Version:** 0.1.4 · **DeepSeek Harness:** 0.1.0-rc.6 · **License:** MIT
15
8
 
16
- **The multi-provider wallet chip for the DeepSeek Harness Web GUI.**
9
+ **A local-first monitoring and control companion for DeepSeek Harness Web.**
17
10
 
18
- A resident one-line chip beside the composer: official DeepSeek (balance, session cost, tokens, one-click recharge, low-balance alert) plus the third-party token total. Accounting is bucketed per provider — a GLM session never shows a DeepSeek balance, and DeepSeek costs are never computed from GLM tokens.
11
+ DeepSeek Harness can keep several conversations and model providers active at once, but the information needed to manage them is normally scattered: the official account balance is on one page, token usage is buried in stream events, a long-running conversation may finish in a background tab, and session cleanup is separate again. DeepSeek Harness Control Center brings those signals and controls into one small surface beside the composer while retaining `deepseek-harness-wallet` as its installation and compatibility identifier. It is designed to answer three everyday questions without interrupting the conversation: **How much official balance remains? What has this conversation used? Does anything need my attention?**
19
12
 
20
- <p align="center">
21
- If deepseek-harness-wallet helps you, please consider leaving a ⭐ Star. Thank you!
22
- </p>
13
+ The resident chip combines the live DeepSeek balance, the open conversation's estimated official spend, official token usage, third-party token totals, and the official recharge shortcut. Accounting is isolated twice—by conversation and by provider—so one conversation cannot borrow another conversation's counters, and third-party traffic cannot become DeepSeek spend. Official cost is accumulated when each usage event arrives using the price active at that moment; later peak/off-peak changes therefore do not rewrite historical estimates. The detail panel expands this summary into per-currency balance rows, token splits, session spend, refresh controls, and a configurable CNY low-balance threshold.
23
14
 
24
- ## What it shows
15
+ Monitoring is paired with deliberate actions. A low balance changes the wallet's visual state and emits one alert until the balance recovers. The recharge shortcut always targets DeepSeek's fixed official top-up URL, and the first use shows the destination before leaving Harness. Completion reminders cover a different kind of waiting: they can remain until manually dismissed or close after a selected delay, combine simultaneous completions into a queue, coordinate across tabs, and open the relevant conversation when clicked. If a system notification cannot be shown, the same event falls back to an in-page notice instead of disappearing silently.
16
+
17
+ The interface is meant to live with the user's workspace rather than occupy it. The chip may remain in the composer, move freely, preview and snap to supported page edges or regions, switch between compact horizontal and vertical arrangements, scale from the control panel, or minimize directly to a movable dot. If the composer becomes too narrow for the full home chip, it keeps a clickable balance/token value instead of overflowing underneath the model selector. Official and third-party data can be shown independently while preventing an empty all-hidden state. The details panel itself is draggable and remembers its last position, and saved positions are fitted back into the viewport when the window changes.
18
+
19
+ Session controls keep two very different operations separate. **Clear current-session wallet data** removes only this plugin's balance-derived spend and token counters for the open conversation; it does not delete the conversation. **Permanent session deletion** is an optional host integration, not a deletion engine supplied by this npm package. It appears only when the current DSH host advertises a real deletion path, remains opt-in, and still requires confirmation; unsupported hosts keep the setting disabled. This boundary prevents a decorative switch from promising an operation the surrounding application cannot perform.
20
+
21
+ The trust model is intentionally narrow. The plugin registers no model tools, injects no prompt text, and adds no model-token overhead. Its host-side accounting is kept in the local DSH storage, while layout and reminder preferences use browser-compatible local storage. The existing DSH credential is used only for the official balance request, and recharge navigation is fixed to the official DeepSeek domain. The plugin does not collect payment details, estimate third-party money values without a price source, or merge balances across currencies.
22
+
23
+ Compatibility is based on capabilities rather than operating-system names. A normal DSH Web environment uses standards-based browser behavior; restricted Electron, Tauri, or other desktop shells can provide a small adapter for notifications, storage, and external links without changing accounting or UI logic. Optional features degrade visibly when a capability is absent. This keeps the project useful as a broader Harness monitoring and session-control center while leaving room for future provider adapters, history views, and other management features without changing the established npm package identity.
24
+
25
+ > If DeepSeek Harness Control Center helps you, please consider leaving a ⭐ Star. Thank you!
26
+
27
+ ## What it does
25
28
 
26
29
  ```
27
- 余额 5.89 · 本场 0.72 · 官 18.8M | 三方 800K · ↗充
30
+ 余额 ¥5.89 · 本场 ¥0.72 · 官 18.8M | 三方 800K · ↗充
28
31
  ```
29
32
 
30
- - **Official DeepSeek** — live balance (60s global refresh with fast boot retries), current-session cost (official pricing timeline, including the 2026-08-17 peak/off-peak rollout), and token breakdown.
33
+ - **Official DeepSeek** — live balance (60s global refresh with fast boot retries), current-session cost locked to the price active for each usage event (including the 2026-08-17 peak/off-peak rollout), and token breakdown.
31
34
  - **Third-party total** — current-session tokens (input / cache read / output). No balance guessing, no cost math, zero configuration.
32
- - **Click the chip** to open the detail panel: per-currency balance breakdown, cost and token splits, a freely editable low-balance threshold in CNY (two decimals, persisted globally; the chip compares the CNY balance, never a mixed-currency sum), manual refresh, and a jump to the official recharge page (first click shows the domain for confirmation — anti-phishing).
33
- - **Floating window mode** — from the detail panel, detach the wallet into a floating window you can drag anywhere (position remembered across reloads), or minimize it to a small dot; the dot turns red below the threshold.
35
+ - **Click the chip** to open the detail panel: correctly formatted per-currency balances, cost and token splits, a freely editable low-balance threshold in CNY (two decimals, persisted globally; alerts only compare a CNY balance and never mix currencies), manual refresh, and a jump to the official recharge page (first click shows the domain for confirmation — anti-phishing).
36
+ - **Move, dock, and scale** — drag the chip freely, preview nearby snap targets, use compact horizontal or vertical layouts, adjust its scale from the control panel, and show official or third-party data independently. The choices are remembered locally.
37
+ - **Floating window mode** — detach the detail panel into a draggable window with a remembered position, or minimize it directly to a freely movable dot; the dot turns red below the threshold.
38
+ - **Completion reminders** — optionally notify when a conversation finishes, with persistent or timed modes, queueing and deduplication for simultaneous completions, cross-tab coordination, and an in-page fallback when system notifications are unavailable.
39
+ - **Optional permanent deletion** — when the DSH host advertises a real deletion capability, an opt-in setting enables a confirmed permanent-delete action in the session menu; unsupported hosts keep the control disabled.
34
40
  - **Low-balance alert** — below the threshold the chip turns red with a breathing animation and fires one desktop notification; it resets automatically once the balance recovers.
35
41
  - **Theme-native UI** — built entirely on `--dsw-alias-*` theme variables, so light and dark themes both render correctly; the panel closes when you click outside and flips open-direction near screen edges.
36
- - **Clear current session** — one button clears only the open conversation's token/cost records; every other conversation is untouched.
42
+ - **Clear current-session wallet data** — one button clears only the open conversation's token/cost records; it does not delete the conversation, and every other conversation is untouched.
37
43
 
38
- ### Screenshots
44
+ ## Install
39
45
 
40
- | Floating window (draggable) | Minimized dot | Below threshold (alert on) | Above threshold (normal) |
41
- | --- | --- | --- | --- |
42
- | <img alt="Floating wallet window" src="docs/assets/floating-window.png" width="340"> | <img alt="Minimized floating dot" src="docs/assets/floating-dot.png" width="340"> | <img alt="Below threshold" src="docs/assets/below-threshold.png" width="340"> | <img alt="Above threshold" src="docs/assets/above-threshold.png" width="340"> |
46
+ From npm:
43
47
 
44
- ## Install
48
+ ```sh
49
+ dsh plugin --profile web add deepseek-harness-wallet
50
+ ```
51
+
52
+ or from GitHub directly:
45
53
 
46
54
  ```sh
47
- dsh plugin --profile web add github:feibi-mochi/deepseek-harness-wallet
55
+ dsh plugin --profile web add github:feibi-mochi/deepseek-harness-control-center
48
56
  ```
49
57
 
50
58
  Restart `dsh web`, then hard-refresh the page.
@@ -63,13 +71,47 @@ dsh plugin --profile web remove deepseek-harness-wallet
63
71
 
64
72
  > The package was renamed from `dsh-wallet` to `deepseek-harness-wallet` in 0.1.1. If you installed the old name, remove it with `dsh plugin --profile web remove dsh-wallet` first.
65
73
 
74
+ ## Browser, desktop, and OS compatibility
75
+
76
+ The client contains no operating-system-specific feature branch; it checks the Web and host capabilities it needs. That makes the same code portable, but **portable code is not the same as real-device verification**:
77
+
78
+ | Verification level | Coverage |
79
+ | --- | --- |
80
+ | Real environment checked for this release | Windows + current Edge + DSH Web |
81
+ | Automated compatibility checks | Browser notification failure, in-page fallback, cross-tab fallback, storage fallback, CSS-scale fallback, and synchronous/asynchronous desktop adapters |
82
+ | Capability-compatible targets | Current Chrome, Edge, and Firefox on Windows/macOS/Linux; Safari on macOS; Electron/Tauri-style DSH wrappers that provide the requirements below |
83
+
84
+ The last row describes intended compatibility, not a claim that every browser/OS/wrapper combination was physically tested. If system notifications are unavailable or denied, reminders fall back to an in-page notice; if Web Locks are unavailable, a renewable local-storage lease coordinates reminder ownership across tabs. CSS `zoom` also has a transform fallback. Core wallet data, controls, dragging, docking, scaling, and visibility settings use these shared paths rather than an OS name check.
85
+
86
+ Electron, Tauri, and other DSH desktop wrappers can run the wallet when they expose the normal DSH Web plugin loader, slots, wallet HTTP endpoints, DOM, and `fetch`. A wrapper that restricts native notifications, persistent storage, or external links may define one optional adapter before the plugin bundle loads:
87
+
88
+ ```js
89
+ window.__DSH_WALLET_ADAPTER__ = {
90
+ // All fields are optional. Keep storage synchronous and localStorage-compatible.
91
+ storage: { getItem, setItem, removeItem },
92
+ notify({ title, body, tag, requireInteraction, onClick, onClose }) {
93
+ // May return a notification-like handle, Promise, or nothing.
94
+ // Call the supplied onClick/onClose callbacks for native events.
95
+ },
96
+ requestNotificationPermission() { return 'granted' },
97
+ openExternal(url) { return true },
98
+ capabilities: { permanentDelete: true },
99
+ }
100
+ ```
101
+
102
+ `notify()` may return a notification-like handle, a Promise for one, or nothing for fire-and-forget native APIs. The payload also includes `onClick` / `onClose` callbacks so Electron IPC, Tauri notification actions, and other desktop bridges can return events without copying wallet logic; returning `false` asks the wallet to use its browser fallback. `requestNotificationPermission()` is optional for hosts such as Tauri and macOS that require a native permission request. Returning `false` from `openExternal()` likewise asks the wallet to try the browser fallback. Declare `permanentDelete` only when the host actually implements the wallet preference and session-menu action; compatible hosts advertise it automatically, while unsupported hosts show a disabled control instead of a switch that has no effect. Platform adaptations are intentionally confined to `createCompatibilityAdapter()` in `lib/client.js`, so an Agent can add a new wrapper without editing wallet accounting or UI logic.
103
+
104
+ For buildable DSH hosts, the npm package and repository include a versioned [Agent-assisted permanent-delete integration kit](./integrations/dsh-session-delete/README.md) with a Chinese guide, complete Agent prompt, read-only preflight, compatibility manifest, upstream notice, and an exact-baseline reference patch. The patch is not a universal installer: a different DSH commit must be inspected and adapted by semantics, and closed or non-rebuildable desktop applications remain unsupported.
105
+
66
106
  ## Data & trust
67
107
 
68
108
  | Item | Behavior |
69
109
  | --- | --- |
70
- | Token accounting | Listens to the `llm/stream` event and buckets per provider (`deepseek-official` vs. everything else) and per session; multiple sessions never mix accounts. |
110
+ | Token accounting | Listens to the `llm/stream` event and buckets per provider (`deepseek-official` vs. everything else) and per session; each usage event also locks its contemporaneous official price, so multiple sessions and pricing windows never mix. |
71
111
  | Balance | The `DEEPSEEK_API_KEY` from the credentials seam never leaves this machine except as the `Authorization` header of the official `/user/balance` request. |
72
112
  | Session log | The plugin writes no events; its data lives in `$DSH_HOME/storages/wallet.json`. |
113
+ | Local settings | Layout, scale, visibility, reminder, and panel settings stay in browser-compatible local storage. |
114
+ | Permanent deletion | Opt-in and host-gated. The wallet never advertises the action unless the host implements the matching session deletion path. |
73
115
  | Model surface | No tools registered, no prompt injection, zero token cost. |
74
116
  | Recharge | The URL is hardcoded to the official `https://platform.deepseek.com/top_up` and is not user-configurable (anti-phishing). |
75
117
 
@@ -83,7 +125,7 @@ CNY per 1M tokens, curated from official announcements (cache writes are not bil
83
125
  - v4-flash (off-peak / peak): cache read 0.05 / 0.10, input 1.5 / 3, output 4.5 / 9
84
126
  - v4-pro (off-peak / peak): cache read 0.15 / 0.30, input 4.5 / 9, output 13.5 / 27
85
127
 
86
- deepseek-chat and deepseek-reasoner keep their flat rates. Costs are estimates; the API-returned balance is authoritative.
128
+ deepseek-chat and deepseek-reasoner keep their flat rates. Each usage event is priced when it arrives; upgrading from 0.1.2 migrates legacy counters once using the then-current rate. Costs are estimates; the API-returned balance is authoritative.
87
129
 
88
130
  ## Roadmap
89
131
 
package/cordis.patch.yml CHANGED
@@ -1,4 +1,4 @@
1
- # deepseek-harness-wallet bundle patch: mounts the wallet row (host + browser halves).
2
- - insert:
3
- - id: wallet
4
- name: deepseek-harness-wallet
1
+ # deepseek-harness-wallet bundle patch: mounts the wallet row (host + browser halves).
2
+ - insert:
3
+ - id: wallet
4
+ name: deepseek-harness-wallet