dsh-workbuddy-credits: View WorkBuddy credits in the DSH web sidebar

Preface

When using WorkBuddy / CodeBuddy accounts in DeepSeek Harness (DSH), checking credit balances, plan expiration dates, and free model multipliers often requires separate checks on the desktop client or billing pages. DSH’s native credit display can be unstable, visually cramped, and lacks details on package expirations. More problematically, every credit query triggers a real call to the upstream billing interface (measured at approximately 200–500 ms). Frequent queries are slow and consume the very quota you intend to monitor; scheduled polling would continuously occupy the quota.

Below is an introduction to the community plugin dsh-workbuddy-credits (maintainer fancylear): it provides a persistent “WorkBuddy Credits” panel in the DSH Web sidebar. It utilizes host-side caching for reads and only hits the upstream when the “Refresh” button is manually clicked, making it ideal for daily monitoring of balances and expiration distributions.

What is this

dsh-workbuddy-credits is a client-side (Web sidebar) plugin for DSH, categorized under client tools. It displays the total balance, expiration summary within 7 days, number of free models, and plan count for WorkBuddy / CodeBuddy accounts. It also lists credit packages sorted by expiration time and model multipliers, supporting segmented switching between the Domestic version (workbuddy.cn) and the International version (WorkBuddy AI).

The plugin does not handle login or billing protocols itself: credits belong to the WorkBuddy desktop account. You must first install and log in with dsh-workbuddy-connect; this plugin reuses its login state and state routing. The current npm package version is 1.1.0, licensed under MIT.

Core Features

After installation and satisfying prerequisites, a “WorkBuddy Credits” entry appears in the sidebar. The top of the panel allows switching between the Domestic and International versions (the two sets of accounts and credits are mutually exclusive), and provides a “Refresh” button and the last update time.

The summary section displays: total balance, credits expiring within 7 days, number of free models, and number of plans. If there are credits about to expire, a warning line is shown (including the earliest expiration time). The table below lists the expiration time, remaining amount, total amount, remaining duration, and plan name for each package.

Host-Side Caching and Refresh Strategy

The design goal is to minimize calls to the upstream billing interface:

Measured
Cold Read (Real Upstream) ~210–370 ms
Hot Read (Cache) 2–3 ms
Auto Polling None

Opening the panel, switching sessions, or reopening the page only reads from the in-memory cache; a real query to the upstream is triggered only when “Refresh” is pressed or a request with refresh=1 is made. The cache uses stale-while-revalidate: when expired, it returns old data first, then refreshes in the background. Upon refresh failure, the last successful data is retained with the reason noted; “not logged in” or “token expired” are displayed as data states rather than clearing the panel. The not-logged-in state is not cached to avoid being blocked by old cache after login.

Multiple refresh requests at the same moment are coalesced into a single upstream call. The default cache duration is 60 seconds, adjustable in the configuration (see below); regardless of cache length, manual refresh bypasses the cache.

HTTP Status Interface

In addition to the GUI, the host side provides a read-only GET route for script queries (default listening port 19387, subject to your local DSH):

# Cache read
curl 'http://127.0.0.1:19387/plugins/dsh-workbuddy-credits/status'

# Force real upstream read
curl 'http://127.0.0.1:19387/plugins/dsh-workbuddy-credits/status?refresh=1'

# International version
curl 'http://127.0.0.1:19387/plugins/dsh-workbuddy-credits/status?provider=workbuddy-ai'

Common response fields include: state (ready / signed-out / unavailable), total, accounts[] (ascending by expiration), expiry.within{24h,3d,7d}, models[], freeModels[], as well as cached / stale / ageMs, refreshError, etc. The route only accepts GET and requires Host and Origin to be loopback addresses to prevent DNS rebinding; it writes no account state.

Installation and Activation

Prerequisites: dsh-workbuddy-connect is installed and logged in.

Official installation command:

dsh plugin add dsh-workbuddy-credits

After installation, the “WorkBuddy Credits” panel is ready in the sidebar. The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and MIT license on the GitHub repository before installation to ensure compliance with your environment policies.

Configuration

The cache duration can be adjusted in the profile’s cordis.patch.yml:

- id: workbuddy-credits
  name: dsh-workbuddy-credits
  config:
    cacheTtlMs: 60000   # Default 60s, max 3600000 (1 hour)

A larger value saves upstream queries but results in older data; a smaller value is more real-time. Manual refresh is not restricted by this TTL.

Typical Usage

  1. After completing dsh-workbuddy-connect login, install this plugin and open “WorkBuddy Credits” from the sidebar.
  2. If using both Domestic and International accounts, use the segmented button at the top of the panel to switch views.
  3. Click “Refresh” when the latest figures are needed; daily browsing can rely on the cache to avoid consuming billing queries every time the page is opened.
  4. For automated monitoring, point curl to /plugins/dsh-workbuddy-credits/status; use ?refresh=1 when strong consistency is required.

Data flow overview: Panel client.js → This plugin index.js (Caching & Projection) → dsh-workbuddy-connect /status → WorkBuddy Upstream Billing Interface.

Use Cases and Notes

Suitable for: WorkBuddy / CodeBuddy users who develop long-term within DSH, want to see credit balances and package expirations at a glance, and do not wish to frequently hit the upstream interface.

Limitations and Notes (from repository description):

  • Read-only: Does not support top-ups, deductions, or any account write operations.
  • Dependency: Relies on dsh-workbuddy-connect; if not installed or logged in, the panel will prompt “Not Logged In”.
  • Rates and Prices: The relationship between multipliers and prices is determined by the upstream; panel values are for reference only.
  • Enterprise Accounts: Use cyclical quota resets and do not have the expiration semantics of standard credit packages.
  • Cache: In-process only; the first time the panel is opened after restarting DSH will trigger a real upstream read.

The DSH ecosystem emphasizes “Everything is a Plugin”; the SkillHub Directory Page is a community collection and has no official affiliation with DeepSeek / High-Flyer.

Conclusion

dsh-workbuddy-credits solidifies WorkBuddy credit queries into the DSH Web sidebar: offering a summary, expiration details, and an overview of free models and multipliers. Combined with host-side caching and manual refresh, it makes a clear trade-off between readability and the number of upstream calls.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye