Skip to main content

dsh-damage-pulse

73Stars2Forks0Issues0Watchers

Monitor token usage and cost for each DSH model call, display each deduction as a health-deduction animation on the balance floating card, and automatically calibrate the real-time balance of the DeepSeek account.

Evidence5/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
TypeScript
License
MIT
Branch
master
balance-monitordamage-animationdeepseekdeepseek-harnessdshdsh-plugintoken-monitortoken-usage

Install

cmdweb profile
$ dsh plugin --profile web add dsh-damage-pulse

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin wssfk12138/dsh-damage-pulse for me: review the repository at https://github.com/wssfk12138/dsh-damage-pulse first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Line Description

A balance monitoring plugin that presents the Token usage and cost of each DeepSeek Harness (DSH) model call with a game-style "damage pulse" animation; also real-time pulls the DeepSeek official account balance and auto-calibrates, letting users intuitively feel each deduction during chat.

Core Features

  • After each model call ends, insert a line into the conversation flow showing single-call usage details (input / cache hit / output / reasoning) and the precise amount
  • Continuously display the cumulative Token count and cumulative amount for the current session above the input box
  • The balance floating card precisely deducts each expense locally, with red deduction numbers floating up from the balance and accompanied by hit rebound animations
  • When cache misses occur or cache is written, trigger a stronger red "miss" animation with a brief horizontal shake; pure cache hits follow the normal hit animation
  • Pull the DeepSeek official account balance every 60 seconds for calibration; when a balance increase is detected, float a green "recharge" number
  • The balance card displays a "Peak / Valley" indicator in the bottom right corner, combined with Beijing time peak/valley periods with red/green glow effects
  • Append each single-call usage detail as JSONL to local storage for historical query and session-based filtering

Technical Implementation

  • Language: TypeScript + React 18
  • Key Dependencies: @deepseek-ai/cordis, @deepseek-ai/schemastery, zod, react
  • Architecture Pattern: Standard DSH Host + Client combined package; Host injects dsh-damage-pulse plugin via cordis.patch.yml, Client declares injection via package.json's dsh.client.inject to inject into dsh-client-runtime / dsh-client-ui-conversation / dsh-client-ui-layout. Host listens to session/event to collect each call → registers tokenCost session projection → registers three HTTP endpoints for balance / usage / deduction events; Client occupies conversation.chat.node, conversation.composer.dock, shell.overlay three slots to render UI.
  • Entry Files: lib/index.js (Host bundle, corresponding to source plugins/dsh-token-monitor/src/index.ts); lib/client.js (Client bundle, corresponding to source packages/client/ui-token-monitor/src/client/index.ts)

Use Cases

Heavy users of DeepSeek models (especially those with context caching enabled) who want to see the exact amount and damage feedback immediately with each deduction, avoiding discovering accumulated spending exceeds budget at the end of the day. Regular users can also use it to intuitively feel "how much this answer cost", the money-saving effect from cache hit rates, and peak/valley period price differences.

Prerequisites and Compatibility

DependencyMinimum VersionDescription
DSH^0.1.0-rc.5Host side requires cordis, session-projection, session-projection-cache, session-persistence, host-webserver, credentials, session, llm, settings and other services
Node.js^22.19.0 or >=24.0.0Declared in repository engines field
PlatformCross-platformUses browser Web profile, no native binary dependencies
Native ModulesNoneDoes not depend on node-pty, sqlite, better-sqlite3, etc.

Note: This plugin only works in DSH's Web profile (--profile web), because the Client bundle is a browser-side React package.

Installation

dsh plugin --profile web add github:wssfk12138/dsh-damage-pulse

After installation, restart the Web profile with dsh --profile web. The balance card, single-call usage row, session accumulation in input area, and damage pulse animation will take effect.

Configuration

ConfigTypeDescriptionDefault
DEEPSEEK_API_KEY (credential)StringConfigured via DSH credential system (~/.dsh/.credentials.yaml); when not configured, balance card shows "unconfigured" state, but Token metering and damage pulse animation still work normallyNot configured
settings namespace dsh-token-monitor → priceTableObjectCustom price table, overriding built-in 2026-08-17 peak/valley pricing; historical costs before 2026-08-17 are not affectedBuilt-in PRICE_TABLE
Peak Hours (built-in only)Time period arrayBeijing time 9:00-12:00, 14:00-18:00; peak/valley shown with red/green glow indicatorsNot configurable

Note: This plugin has no runtime toggle; it enables upon installation, and the Host automatically registers three HTTP endpoints for balance / usage / deduction events.

FAQ

Q: The balance card shows "API Key Not Configured" - what should I do?

A: You need to configure DEEPSEEK_API_KEY in the DSH credential system (write to ~/.dsh/.credentials.yaml). Not configuring will only cause the balance card to show the unconfigured state; it does not affect Token metering or damage pulse animation.

Q: Does each deduction immediately deduct from the balance?

A: The balance is precisely deducted locally: after each model call ends, the exact amount is immediately subtracted and the damage pulse animation is triggered; at the same time, the DeepSeek official balance is pulled every 60 seconds for calibration. If the official balance is higher than what the local display shows, a green "recharge" animation automatically appears.

Q: What's the difference between cache hit and cache miss?

A: Pure cache hits only show normal red deduction numbers; as long as there is cache miss input or cache write in a single call, it triggers a stronger red "miss -x.xx¥" animation, accompanied by a brief horizontal shake and larger balance rebound. Multiple deductions merged within the same second, if any one belongs to a miss, the entire group plays as miss.

Q: What should I do if I don't see any animation after installation?

A: Confirm that you have restarted the target profile with dsh --profile web. If you previously used the source integration version, please first remove manual patches and duplicate mounts to avoid loading the same plugin twice.

Q: Why don't old sessions show amounts at first?

A: When the plugin starts, it automatically triggers a cold read fold for historical sessions missing Token amount projections. After a few seconds, the page will display the amounts. Once projections are written to checkpoint, no re-filling is needed on next startup.

Q: Why doesn't the left session list show cumulative amounts?

A: DSH currently does not expose a third-party slot for "left session row trailing information", so the standard package does not modify the host DOM. If using full DSH source code and this function is truly needed, you can run the sidebar integration script in the repository to modify the source code, but this is not a capability of the standard package.

Q: Can I override the price table?

A: Yes. Enter custom pricing in the settings namespace "dsh-token-monitor"'s priceTable field to override the built-in table; old prices (before the 2026-08-17 price increase) will automatically use old prices based on their timestamp, without recalculation.

Getting Started Difficulty

Beginner — Install with a single command to use; all features are enabled by default; further setup is only needed when wanting to override the price table or adjust peak/valley periods.

Known Issues and Limitations

  • Although the public brand has been renamed to dsh-damage-pulse, the plugin runtime identifier / settings namespace / localStorage keys / data directory / API paths still use the old name dsh-token-monitor to ensure compatibility for already-installed users; a full rename has not been done yet
  • Cache damage pulse animation merges multiple deductions within the same second into a single floating text; consecutive deductions keep at most three groups of floating text at the same time, excess ones get overwritten
  • The standard package does not modify the host DOM; DSH's left session list does not show cumulative amounts; this feature is only available for full Harness source code and requires running a separate sidebar integration script
  • The built-in price table version is 2026-08-17 peak/valley pricing (peak: Beijing time 9:00-12:00, 14:00-18:00); model names are matched by prefix (e.g., deepseek-v4-pro matches deepseek-v4-pro-xxx), unmatched models fall back to flash peak pricing
  • Deduction details are appended as JSONL to local ~/.dsh/data/dsh-token-monitor/usage.jsonl, with cold boot automatic recall; corrupted lines are silently skipped

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/wssfk12138/dsh-damage-pulse)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory