dsh-session-metrics

DSH PLUGIN通知与集成

仓库 mrdhira/dsh-session-metrics

通知与集成 L4 · 沙盒安装通过 安全审查:低风险 可信度:银 可安装插件
安装这个插件

dsh-session-metrics 是 mrdhira 维护的 通知与集成 类 DSH 可安装插件, 仓库为 mrdhira/dsh-session-metrics,许可证 MIT。 下面按「装什么、怎么装、验没验过、跑起来要注意什么」逐项列出。

一句话选型结论

按资料字段整理

dsh-session-metrics 是通知与集成类的 DSH 可安装插件,验证等级 L4 · 沙盒安装通过,安全审查为低风险,有可直接复制的安装命令。验证通过不等于安全:插件会读写文件、执行命令或联网,装前先到仓库确认它做了什么;涉及密钥或系统权限的,建议先在隔离环境试装。

分类通知与集成 收录类型可安装插件 验证等级L4 · 沙盒安装通过 安全审查低风险
验证等级 L4 L4 · 沙盒安装通过
GitHub 星标 0 复刻 0 · 未关闭 issue 0
最近更新 2026-10-17 创建于 2026-10-16
README 12.4 KB 正文体量,越大说明说明书写得越细

安装

可安装插件
在 DSH 里执行,装完用 dsh plugin list 确认已挂上;标了 L4 / L5 的命令已在沙盒里真实跑通
dsh plugin --profile web add github:mrdhira/dsh-session-metrics
  1. 1
    确认版本与运行环境

    仓库没有标注兼容版本与 Node.js 要求,先确认你的 DSH 版本能装,再继续。

  2. 2
    执行安装命令

    在 DSH 里执行上面的命令;多包仓库要注意区分具体子包名,别装错包。

  3. 3
    确认已挂载

    用 dsh plugin list 查看列表里是否出现这个插件,出现即挂载成功。

  4. 4
    试跑并检查权限

    加载后跑一个最小用例,确认它能正常工作;同时看它申请了哪些文件、命令或网络权限。

兼容 DSH 版本未标注版本不匹配时安装会报错
Node.js 要求未标注来自仓库 package.json 的 engines 字段
前置依赖无需要同时安装的同级依赖
npm 包名未发布到 npm可用 npm view 查看包信息

能做什么

通知与集成
字段来自项目仓库与公开索引,中文说明由本站标注

适用场景

通知联网搜索

上游标签

billingcache-efficiencycost-trackingdshdsh-pluginelectronllmmetricsobservabilitytypescript

验证等级与安全审查

L4 · 沙盒安装通过
自动化流程结论,不是人工审核
验证等级L4 · 沙盒安装通过安装命令在隔离沙盒内真实执行成功,无依赖错误
安全审查低风险静态分析结论,未标注不代表已通过审查
仓库健康度活跃按仓库活跃度与最近更新时间给出
可信度银综合仓库活跃度与验证结果

选择建议

装之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 验证等级 L4:在沙盒里真实装过,依赖能装上,不是纸面声明。
  • 静态安全审查为低风险,没有发现明显可疑行为。
  • 有可直接复制的安装命令,不用自己翻文档找入口。

先想清楚的地方

  • 没有声明 Node.js 版本要求,版本不匹配可能装不上。
  • 验证通过不等于安全:插件会读写文件、执行命令或联网,装前先到仓库确认它做了什么。

更适合

  • 需要在通知与集成场景里给 DSH 补能力的人。
  • 想装完就能用、不想自己排依赖的人。
  • 能接受在本地装依赖、愿意自己确认权限的人。

不太适合

  • 只使用 DSH 官方内置能力、不接受第三方插件的人。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
插件验证等级安全审查星标兼容版本安装命令
dsh-session-metrics当前 L4 · 沙盒安装通过 低风险 0 未标注 有
treg L3 · 安装规范通过 低风险 4,976 未标注 无
dsh-purge 未做沙盒验证 未标注 3,412 未标注 有
dsh-im L5 · 运行验证通过 低风险 1,837 0.1.7-rc.2 等 10 个 有
dsh-dafeiyu L5 · 运行验证通过 低风险 425 0.1.7-rc.2 等 10 个 有
dsh-trading L3 · 安装规范通过 低风险 235 未标注 无

仓库档案

通知与集成
字段来自项目仓库与公开索引,中文说明由本站标注
作者 / 维护方mrdhira仓库 dsh-session-metrics · 默认分支 main
分类通知与集成notify
收录类型可安装插件声明了 dsh.bundle、可用 dsh plugin add 安装的条目
开发语言未标注仓库主语言
许可证MIT商用或二次分发前请确认条款原文
星标 / 复刻 / issue0 / 0 / 0收录时的数值,非实时
创建 / 更新2026-10-16 · 2026-10-17最后推送 2026-10-17
本站收录2026-10-30首次进入本站目录的时间

README 全文

12.4 KB
作者原文,中文版优先;只做安全转义,不改内容

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 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//.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.

Setting Default What it does
display.currency USD USD or CNY
display.primaryProvider — hides the provider chip when the session uses this provider
display.chips all which chips to show, and in what order: peak, time, cost, saved, provider, budget
budget.sessionUsd off per-session ceiling; omit to disable
budget.warnAt 0.75 fraction 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//).
  • 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=.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.

light dark

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

light dark

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

常见问题

6 问
答案由本站依据条目字段整理,不引用上游原文
dsh-session-metrics 怎么安装?

在 DSH 里执行 `dsh plugin --profile web add github:mrdhira/dsh-session-metrics` 即可。

dsh-session-metrics 的验证等级是什么意思?

L4 · 沙盒安装通过。安装命令在隔离沙盒内真实执行成功,无依赖错误

dsh-session-metrics 安全吗?

低风险。

dsh-session-metrics 装之前要先确认什么?

先看它会读写哪些文件、执行哪些命令、连接哪些网络地址;验证等级只说明装得上、跑得起来,不等于安全。涉及密钥或系统权限的,建议先在隔离环境试装。

dsh-session-metrics 用的是什么许可证?

上游标注为 MIT。商用或二次分发前请到仓库确认许可证原文。

这条记录的数据可靠吗?

本站按仓库名去重后合并整理,字段以作者仓库与 npm 元数据为准;安装命令、仓库地址与 README 保持原文,带 L4 / L5 标记的安装命令已在隔离沙盒里真实跑通。

同名或近似条目

1 条
不同作者的仓库分开列,请确认你要装的是哪一个
通知与集成
按星标排序,可作替代方案

treg

treg

Treg 是面向 Agent 工具的 OpenRouter,聚合 60 个提供商的 2896 个端点,按调用计费,统一令牌访问,无需注册各供

L3 · 安装规范通过 4,976 星

dsh-purge

dsh-purge

dsh-purge Community · DeepSeek Harness 社区维护版:宿主兼容、状态诊断、提示词管理、更新与本机备份回滚

未标注验证等级 3,412 星

dsh-im

dsh-im

将IM机器人接入DeepSeek Harness,支持飞书、微信、钉钉等九种渠道,通过扫码或凭据配置,统一管理多机器人连接。

L5 · 运行验证通过 1,837 星

dsh-dafeiyu

dsh-dafeiyu

DSH 大肥鱼是一款由 DeepSeek Harness 真实工作状态驱动的桌面伴侣插件,以始终置顶的透明窗口实时展示 Agent 的思考、

L5 · 运行验证通过 425 星

dsh-trading

dsh-trading

L3 · 安装规范通过 235 星

mrdhira 的其它插件

2 个

插件的元信息来自作者仓库;分类、验证等级与安全结论的中文说明为中文整理,最近核验 —。