DeepSeek Harness Plugin Hub

发布与管理完整 Harness Profiles,发现适合你的插件。

探索

插件目录环境预设文档中心动态

社区

发布插件联系我们报告问题

相关链接

Plugin Hub GitHubDeepSeek Harness 官方项目系统状态隐私说明
© 2026 DeepSeek Harness Plugin HubPowered byPaxTech

独立、非官方社区项目,与 DeepSeek 官方无隶属、授权或背书关系。

Session Metrics — DeepSeek Harness 插件(DSH Plugin)
DeepSeek Harness Plugin Hub
ProfilesPlugins分类动态文档登录管理 Profiles
ProfilesPlugins分类动态文档登录
← Plugins
S

dsh-session-metrics

Session Metrics

DSH Web GUI 的会话成本和计费指标:按提供商显示费率、成本、缓存节省额、峰值/非峰值时段、提供商和预算;用于补充随产品提供的统计信息标签,而不是重复显示。

插件会安装到这里;不确定时保持 web。

npx -y @deepseek-ai/dsh plugin --profile web add github:mrdhira/dsh-session-metrics#b313fbd9e9ed8d5e60ca48b7bf16b3c611254d1d
README兼容性版本
The strip in the light themeThe strip in the dark themeThe detail popover in the light themeThe detail popover in the dark theme

兼容性与来源证明

Session Metrics 以 dsh-session-metrics 发布,当前版本为 1.1.0。Plugin Hub 会校验它的 manifest,并保存精确安装来源,便于复现安装结果。

DSH 兼容范围
*
运行环境
web
发布来源
github
Registry 更新时间
2026/10/17

版本

1.1.0stable
2026/10/17

相关插件

正在加载相关插件…

最新版
1.1.0
DSH
*
HMR
重启进程
Tree shaking
未声明可安全裁剪
解包体积
未提供
文件数
未提供
Surface
web
许可证
MIT
发布源
github
GitHub
★ 0
周下载
0
最近提交
2026/10/17
查看源码 ↗
README Badge

点击下方 Badge 复制 Markdown,粘贴到 README 即可。

这是你的 Plugin?认领权益 · 优先安全扫描

验证 package.json 声明的 GitHub 仓库,即可管理这个公开页面。认领后,Hub 会优先安排当前版本的安全扫描,并在通过后公开展示结果。

认领这个 Plugin →
报告问题

相关插件

继续浏览 models-usage 分类下经过校验的插件。

Client Ui Model Capabilities@linxin666/dsh-client-ui-model-capabilities为自定义 pi-ai 提供商声明每个模型的能力(图像输入和推理力度),可直接在 Models 设置卡片中编辑;写入官方 llm-pi-ai 设置命名空间,不更改 DSH 源代码。Codex Subscriptiondsh-codex-subscription在 DeepSeek Harness 中通过 OAuth 使用 ChatGPT 和 Codex 订阅,支持配额、安全重置、网络搜索、图像和快速模式,并可通过 ChatGPT 移动应用(Beta)控制 DSHDeepseek Web Logindsh-deepseek-web-login非官方 DSH 插件:将 chat.deepseek.com 网页模型用作 DSH LLM 提供商(浏览器登录捕获 + PoW 求解 + SSE 流式传输 + 基于提示的工具调用),提供商路由为 deepseek-webConnect Traedsh-connect-trae把本机登录的 Trae 模型接入 DeepSeek Harness:国内版与国际版双供应商并行,提供用量/积分概览与每日签到领取。

README

dsh-session-metrics

Session cost and billing metrics for the DSH Web GUI — what this conversation cost, what the cache saved, and whether the current hour is peak or off-peak. Built as a companion to the shipped stats pills, never a duplicate of them.

Why

The shipped stats pills report tokens and context, and stop short of money. That leaves three questions unanswered, and the obvious answer to each is a lie:

A model with no rate card is not free. An unpriceable provider reads unpriced and shows its tokens; a genuinely free model ships a card of zeros and reads a real $0.00. The two must not render alike — unpriced means no card, and an unpriced pair is never rendered as a number.

A newly integrated provider arrives silently. DSH reports usage per provider and model; rates are configuration. Integrate a provider before its rates are entered — the case that happened with OpenRouter — and every figure for it is missing with nothing on the page saying why. The session detail names the pair it observed with no card, and the tokens it used.

Peak pricing is invisible until it is a surprise. DeepSeek bills peak and off-peak at different rates, in the provider's own timezone. Whether right now is peak is not something a user should have to derive.

Agent Skills

Installing the plugin registers the session-metrics skill, so an agent can explain the figures and reconfigure the rates without reading the source. Ask it what a session cost, whether a model is priced, or how to add a rate card for a provider it has seen.

Quick Start

The plugin installs into your DSH profile by link — it is not published to npm, so the clone is the source. Both routes end with a restart.

Option A — the script

git clone https://github.com/mrdhira/dsh-session-metrics.git ~/.dsh/plugins/dsh-session-metrics
cd ~/.dsh/plugins/dsh-session-metrics
./install.sh                 # builds, registers in your profile, runs pnpm install

It accepts --profile <dir> to target a profile other than ~/.dsh/profiles/desktop, --check to report what would change without writing anything, and --remove to unregister.

Option B — the manual steps

1. Clone it somewhere stable (this path becomes your install path):

git clone https://github.com/mrdhira/dsh-session-metrics.git ~/.dsh/plugins/dsh-session-metrics
cd ~/.dsh/plugins/dsh-session-metrics

2. Build it. pnpm install runs the prepare script, which builds lib/** — the part DSH actually loads. It is generated; never hand-edit it.

pnpm install

3. Register it with your profile — the dependency and the bundle name, with an absolute path:

{
  "dependencies": {
    "dsh-session-metrics": "link:/Users/<you>/.dsh/plugins/dsh-session-metrics"
  },
  "dsh": {
    "profile": {
      "bundles": [
        "dsh-session-metrics"
      ]
    }
  }
}

4. Install the link, then restart DSH:

cd ~/.dsh/profiles/desktop && pnpm install

Nothing needs adding to cordis.patch.yml: the bundle declares its own Loader row.

Restart, don't reload. The host half loads once per app process, so a host-side change needs a full quit and reopen (⌘Q, then reopen). A page reload does not pick it up. A client-side (UI) change needs the bundle toggled in the plugin manager.

Verify it is really working

A strip should appear below the composer with cost, saved and a peak indicator. If it does not:

  • lib/v1/index.js exists — if not, pnpm install did not finish building;
  • the profile's package.json names dsh-session-metrics in both dependencies and dsh.profile.bundles;
  • DSH was restarted after installing.

An unpriced chip means a working install with no matching rate card — not a failure. See Configure.

Configure

A fresh install needs no configuration. Rate cards ship for deepseek-account, deepseek-official, netra-runtime and openrouter, so the cost chip works immediately. OpenRouter ships only the models its own catalog marks free (the :free suffix and the free-models router) at zero rates; its paid models deliberately carry no card, because DSH reports no prices for them and a fabricated rate is worse than a named gap.

Rates are edited in the GUI: Plugins sidebar → dsh-session-metrics. The same table can be set in your profile's cordis.patch.yml:

- id: session-metrics
  name: dsh-session-metrics
  config:
    display: { currency: USD, primaryProvider: deepseek-account }
    budget: { sessionUsd: 5, warnAt: 0.75 }
    providers:
      - id: my-router
        models:
          - model: some/model
            rates: { flat: { cacheHit: 0.01, cacheMiss: 0.1, output: 0.25 } }
        billing: { windows: [] }      # no peak concept

Rates are USD per 1M tokens. A model takes either a flat row or a peak row with offPeak. A provider with no billing.windows is flat and shows no peak chip.

A providers: list in your patch replaces the shipped cards rather than adding to them. Pin your own providers and the OpenRouter free cards stop shipping with them — add a card for each pair you need, or let Seen, unpriced name the ones you missed.

SettingDefaultWhat it does
display.currencyUSDUSD or CNY
display.primaryProvider—hides the provider chip when the session uses this provider
display.chipsallwhich chips to show, and in what order: peak, time, cost, saved, provider, budget
budget.sessionUsdoffper-session ceiling; omit to disable
budget.warnAt0.75fraction of the budget at which the strip warns

The full rate-card format, the shipped cards and the reasoning behind them are in docs/pricing.md.

How it Works

Costs are derived from the Host's own tokenUsage projection — the same source the stats pills read — so this plugin adds interpretation, not a second ledger. Cache savings compare each cache-hit token against the rate that would have been paid on a miss, per the card in effect. Peak and off-peak windows resolve in the provider's own timezone, holidays included, and the countdown is computed once a minute while the detail view is open rather than on every render.

Two surfaces, one projection:

  • the strip, below the composer: cost, cache savings, the peak state with your local time, the provider when it is not your configured primary, and budget progress;
  • the detail, on click: the cost breakdown (cache-hit / miss / write / output), cache savings and blended rate, the rate window with a countdown, cost per step, cost per model when a session switched models, and the projections each figure came from.

The plugin deliberately does not render session token totals, cache-hit rate, context percentage, turns, steps or tok/s — the shipped pills own those. docs/data-sources.md records which projection feeds which figure, which is what keeps the two from drifting back into duplication.

Requirements

  • DSH with the Web GUI, and a profile you can edit (~/.dsh/profiles/<profile>/).
  • Node.js 22+ and pnpm to build from source. The built artifact needs nothing extra at runtime.

Development

pnpm install                  # deps + build (prepare)
pnpm run build                # rebuild lib/**
pnpm test                     # 111 tests: 105 pass, 6 skipped without a session log
pnpm run typecheck            # three projects: host, browser half, tests
pnpm run test:fast            # host logic only — the quick loop
pnpm run test:dom             # the UI half under jsdom
DSH_SESSION_LOG=<path>.jsonl.zstd pnpm run test:replay   # replays a real session
src/host/*.ts         host half: config schema, projection, ledger, pricing  -> lib/v1/index.js
src/client/index.cts  browser half: strip, detail panel, pricing page        -> lib/v1/client.js
types/dsh.d.ts        the DSH surfaces this plugin uses (the app ships no .d.ts)
build.mjs             esbuild: ESM host half, CJS browser half + loader handshake
docs/                 authoring, data-sources and pricing notes

The six skipped tests are the replay ones; they need DSH_SESSION_LOG pointing at a real recorded session. With one, the suite is 111/111.

lib/** is generated and never hand-edited. Build before you test: the tests import the built artifacts, so a run against a stale build is green and wrong — pnpm test builds via pretest.

Testing and Validations

111 tests across twelve files. The host half is covered table-driven — every case names the rule it pins, so a failure reads as a sentence — and the browser half mounts the real bundle under jsdom.

What the suite proves beyond "the code runs":

  • the freshness gate (build.test.ts): every source module has an artifact, no artifact predates its source, and the entrypoints main/exports name actually exist. This exists because five test files once validated stale pre-port lib/*.js that were no longer shipped — green, and wrong.
  • non-vacuity: a new test is proven by mutation probe, not by passing. Deleting the badge's subject gate fails 2/14; reverting the calendar default fails one named test.
  • memory discipline: two defects once drove a machine to ~170 GB RSS, so the suite runs through scripts/guard.mjs, which watches the whole process tree and kills it past the cap (exit 124 — bisect, never raise it). A failing assertion must never take a DOM node as its actual value: compare primitives (assert.ok(node === null)), because inspecting a React node walks its fiber tree and allocates without bound.

Measured on Node v24: host tests peak ~70 MB, the DOM file ~180 MB, and the full suite with a real-log replay 277 MB under a 1 GB limit.

Contributing

One author: Dhira Wigata. Every commit is authored and committed by him, and CI re-checks the whole history for a single identity and for machine-attribution trailers — so --no-verify locally does not get a commit past CI. Signed-off-by: is fine. See AGENTS.md for the gates a change must pass: build, typecheck across three projects, and the suite.

Issues and pull requests are welcome.

What it looks like

The strip as it docks under the composer, at the width the app actually gives it: DSH's own computeColumns() resolves a 1440×900 window to a 280px sidebar and a 1160px centre column, and that is the canvas below. Every colour is one of the app's theme tokens.

lightdark
The strip in the light themeThe strip in the dark theme

The detail popover behind the trigger — cost breakdown, saving breakdown, per-model rows, and the peak window with its countdown.

lightdark
The detail popover in the light themeThe detail popover in the dark theme

Both come from scripts/capture-panel.mts, which renders the real bundle through test/harness.ts — the same path the DOM tests take — injects the real stylesheet the bundle itself ships, and resolves the --dsw-* tokens out of the installed app.asar. Nothing is mocked and no colour is hand-picked. Run it with:

node ~/.dsh/scripts/guard/guard.mjs --limit-mb 2560 -- \
  node --max-old-space-size=384 scripts/capture-panel.mts

One honest gap: the popover is captured standalone, centred by a layout wrapper, rather than anchored under the strip. Its left/bottom come from a live getBoundingClientRect() of the docked trigger, and the headless renderer has no layout engine to produce one — so its content, width and styles are real, and only the frame around it is not.

There is no flow to draw

This is a metrics panel, not a pipeline: the strip and the popover are two projections of one already-complete figure. Costs are derived from the Host's own tokenUsage projection, savings compare each cache-hit token against the miss rate on the same card, and the peak state is a clock read against the provider's window — all computed in the browser half on render. No queue, no stages, no hand-off, and no ordering a diagram would add information to. A flow diagram here would be decoration, so there is none; the data path is the table in docs/data-sources.md instead.

LICENSE

MIT © Dhira Wigata