dsh-commandcode-quota: View Command Code Quota in DSH Session Header

Introduction

When running Command Code in DSH, quota is spread across 5-hour windows, weekly windows, monthly windows, and billing-cycle usage; to confirm “how much is left, and when it resets,” you often have to leave the session to check the CLI or console. The DeepSeek Harness community plugin dsh-commandcode-quota (maintainer s11phere, category admin-security) brings this information into the session header: click an icon button to open a card and view it, and checking quota is a pure GET request that does not consume Command Code quota.

What Is This

dsh-commandcode-quota is a DSH plugin for the web profile (current package version 0.1.2, MIT). It injects a quota entry into the utilities row on the right side of the session header, displaying the progress of the Command Code plan across the 5-hour / weekly / monthly windows, reset countdowns, as well as token usage and plan status within the billing cycle. Credentials and API addresses do not need to be manually configured; they are automatically discovered in order via the DSH profile’s commandcode provider routing, ~/.dsh/.credentials.yaml, and environment variables.

Core Features

The following are the verified capabilities the plugin provides in the UI.

Quota Card

Clicking the icon button in the utilities row on the right side of the session header pops up a card; clicking the button again, clicking outside the card, or pressing Esc collapses it. The card contains:

  • Usage progress and reset countdowns for the three quota windows (5-hour, weekly, monthly);
  • Usage-related display within the billing cycle (consistent with the README and package description).

See the GitHub repository README for screenshots and descriptions.

Button Appearance Conditions

The button is placed at DSH’s native location: conversation.session.header.utilities, to the left of the right-panel toggle. It only appears after the conversation has started (at least one message has been sent); the utilities row is not rendered on empty conversations or welcome pages, so the button is not visible there.

Data Refresh and Degradation

  • Fetched once on page load, when the card is opened, and every 10 minutes;
  • When the tab returns to the foreground, if the cache has expired, one additional request is made.

The four data endpoints are independent of each other: a single failure only shows a notice at the bottom of the card, while the remaining data displays normally. The host-side default cache is 3 seconds (configurable via cacheMs).

Platform Support

Platform Status
Windows 10 / 11 (native dsh web) Tested
WSL2 / Linux Tested

Both environments share the same code; the maintainer verified it on DSH 0.1.7-rc.2 (the documentation is based on DSH 0.1.7). If on Windows you install via a local path and the source code and $DSH_HOME are on different drives, read the repository’s Windows notes.

Installation and Activation

First install, then restart the web process; the button only becomes effective afterward.

  1. Run the official install command on the target machine (web profile):
dsh plugin --profile web add github:s11phere/dsh-commandcode-quota
  1. After installation completes, restart dsh web. To uninstall, change add to remove; a restart is also required.

Note: Do not use scp-style addresses like git@github.com:...; pnpm may misparse them, causing the plugin not to take effect. On Windows, installing via GitHub works directly with the above command; for local-path installation, see the cross-drive note above.

The plugin runs with the current dsh process permissions. Before installing, it is recommended to review the GitHub source code and the MIT license to ensure it meets your security policy.

Optional Configuration

All options are optional. Override them in the profile’s cordis.patch.yml by plugin id:

- id: dsh-commandcode-quota
  config:
    timeoutMs: 15000   # Per-endpoint timeout
    cacheMs: 3000      # Host-side result cache
    debug: true        # Print credential source and registration result

timeoutMs controls the per-endpoint request timeout; cacheMs controls the host-side result cache duration; debug: true helps troubleshoot the credential source and registration result.

Typical Usage

After the installation and restart steps above:

  1. Start or refresh dsh web, and enter a Command Code session that already has messages;
  2. Find the quota icon in the utilities row on the right side of the session header (to the left of the right-panel toggle);
  3. Click to open the card to view the progress of each window, reset countdowns, and billing-cycle usage;
  4. For the latest data, click the card again, or wait for an automatic refresh (including every 10 minutes and the refetch when switching back to the foreground).

For more detailed API contracts, credential discovery order, and monthly limit calculations, see the repository’s docs/api.md.

Use Cases and Notes

Who it’s for: Developers or operations roles who use Command Code in DSH web long-term and need to check the 5-hour / weekly / monthly windows and billing-cycle usage at any time; the category falls under admin-security, focusing on usage visibility and in-session self-checks.

Known limitations (from the README):

  • The button only appears after the conversation has started;
  • Token in/out and request counts come in batches aggregated about every 2–3 minutes, which may lag slightly; quota windows and costs are real-time;
  • The account-level API does not provide cache hit / miss breakdowns, only the gross input token total;
  • The data comes from internal interfaces used by the official CLI itself (the path contains alpha), and field names are subject to change.

Summary

dsh-commandcode-quota brings Command Code plan quota into the DSH session header, reducing the number of times you need to leave the session to check quota; the install command and behavior are governed by the repository README.

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

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

Xiaoye