DeepSeek Harness Plugin Hub

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

探索

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

社区

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

相关链接

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

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

DeepSeek Harness Plugin Hub
ProfilesPlugins分类动态文档登录管理 Profiles
ProfilesPlugins分类动态文档登录
← Plugins

dsh-subagent-cost

Subagent Cost

DSH Web 插件:一个停靠栏胶囊和按轮次显示的面板,用于统计对话生成的子智能体会话数量及其人民币费用。

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

npx -y @deepseek-ai/dsh plugin --profile web add dsh-subagent-cost@0.1.4
README兼容性版本

兼容性与来源证明

Subagent Cost 以 dsh-subagent-cost 发布,当前版本为 0.1.4。Plugin Hub 会校验它的 manifest,并保存精确安装来源,便于复现安装结果。

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

版本

0.1.4stable
2026/10/24
0.1.1stable
2026/10/24

相关插件

正在加载相关插件…

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

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

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

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

认领这个 Plugin →
报告问题

相关插件

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

Experimental Cot Translation Bundle@deepseek-ai/dsh-experimental-cot-translation-bundle扩展推理的实验性机器翻译Whale Widgetdsh-whale-widgetDSH Web 界面右下角的 DeepSeek 余额小鲸鱼挂件:余额/今日已用/峰谷定价、自定义泡泡点击序列(文本/余额/今日/峰谷/图片/随机语句与并列加权选择)、逐行样式与字体、悬浮快捷编辑、音效与每轮消耗、自定义角色/动图/音效、吸附与翻转自定义Our Free Model@ebony-vinyl/dsh-our-free-modelOur Free Model — 在 dsh 里装上这个插件即可,无需登录、注册或填 API Key,就能使用包括 DeepSeek V4.1 Flash、Kimi K3 在内的前沿模型,桌面端另有 EAC 协付渠道;2.0 起接入 LobsterAI、Qoder、TRAE、Cline、Loomy、Raccoon、MiniMax、ZCode、Gemini 十个账号渠道(原有匿名免费通道保留)(登录、账号池、积分领取、本地 OpenAI 网关与局域网转发、数据看板与运行日志),六页毛玻璃界面统一呈现。Usage@linxin666/dsh-usage用于 dsh Web GUI 的使用统计插件:检测各提供商的余额和编程套餐配额,并实时记录令牌使用情况;侧边栏 Settings 行上方显示紧凑的价格概览卡片

README

dsh-subagent-cost

A DSH (DeepSeek Harness) Web plugin: counts the subagent sessions your conversation spawned, sums their tokens, prices them in CNY, and groups them by the parent conversation's turn.

一个 DSH(DeepSeek Harness)网页插件:统计本会话派出的子智能体会话,汇总它们的 token 与人民币花费,并按父会话的 turn 分组展示。

Screenshots / 截图

The dock pill, in the composer toolbar / 输入框工具条上的药丸:

Dock pill: 37 subagents · ¥1.30

The panel it opens, grouped by turn, with per-child tokens and cost / 点开后的面板,按 turn 分组、逐个列出 token 与花费:

Per-turn summary panel: 37 subagents, 514.4k tokens, ¥1.2981

● 3 subagents · ¥0.42

Click the pill and you get a panel / 点开药丸得到这样的面板:

Subagent usage                                  ¥0.4213
3 subagents · 546.0k tokens · 1 running            [refresh]
──────────────────────────────────────────────────────────
Turn 2 · 15:20 · 2 subagents      405.9k tokens · ¥0.9735
  [study-worker] Study bceacfbf · Part 1/9 · Rev…   63.3k  ¥0.2102
  [standard]     another child …                    27.9k  ¥0.0897
──────────────────────────────────────────────────────────
Estimated with DeepSeek V4.1 peak/off-peak pricing (CNY / 1M tokens)

The pill's dot: blue = some subagent still running, green = all finished, grey = this conversation has not spawned any, red = read failed.

药丸上的圆点:蓝=有子智能体在运行,绿=全部结束,灰=本会话没派发过,红=读取失败。

Install / 安装

From npm (recommended):

# cli / web profiles
dsh plugin --profile <profile> add dsh-subagent-cost

Straight from GitHub, if you want the tip of main:

dsh plugin --profile <profile> add github:Synapse-ACh/dsh-subagent-cost

From a DSH conversation both specs work through the plugin manager:

plugin_manager action:install_bundle target:dsh-subagent-cost
plugin_manager action:install_bundle target:github:Synapse-ACh/dsh-subagent-cost

The Desktop profile is managed by the Electron app, so the dsh plugin --profile … CLI refuses it — use the in-app plugin manager (paste dsh-subagent-cost into its install field) or the tool above.

Prefer a local checkout? git clone the repo and pass the absolute path of the directory instead of the spec.

Refresh the browser page once after installing: the host half restarts by itself, but the client half (the dock pill) is loaded by the Web UI and needs a reload.

推荐直接用 npm 安装(dsh plugin --profile <profile> add dsh-subagent-cost),想跟 main 最新代码就用 github:Synapse-ACh/dsh-subagent-cost;在对话里也可以让 plugin_manager 装这两个 spec 中的任意一个。Desktop profile 由 Electron 应用托管,dsh plugin --profile … 命令行会拒绝它——请用应用内的插件管理器,把 dsh-subagent-cost 粘进安装框,或者用上面的工具调用。想用本地仓库的话,git clone 之后把该目录的绝对路径当作 spec 传进去。装完刷新一次浏览器页面:宿主半会自己重启,但客户端半(药丸)是 Web UI 加载的,需要 reload。

How "one task" is decided / 「一次任务」怎么切

By turn of the parent conversation. The parent session log carries subagent/catalog events that name each childId, and turn/start events that carry turn; every catalog event is attributed to the most recent turn/start before it. So "you send one message → every subagent it dispatched" naturally forms one group, and multiple batches inside one conversation do not bleed into each other.

For older parent logs without catalog events the plugin falls back to ctx.subagents.listChildren(parentId); those children land under "unattributed turn".

按父会话的 turn 切。父会话日志里带 childId 的是 subagent/catalog 事件,带 turn 的是 turn/start 事件;每条 catalog 事件归到它之前最近的那个 turn/start——「你发一条消息 → 它派出的所有子智能体」自然成一组,同一会话里的多批派工不会互相串。更早的父会话日志没有 catalog 事件时,插件回落到 ctx.subagents.listChildren(parentId),这些子智能体落到「未归轮」分组下。

Metering and pricing / 计量与计价

  • A subagent is an independent session; its cost only counts the assistant/message.data.usage samples it produced itself.

  • Forked child sessions (isSeeded) replay the parent's events as a seed. Those tokens are on the parent's bill, so folding starts after inheritedEventCount.

  • The pricing module is vendored from @kidli1412/dsh-session-cost's lib/cost.js (MIT): each event is priced at the peak/off-peak window in force at that event's timestamp (Beijing time, weekdays 09:00–12:00 and 14:00–18:00 are peak), per provider/model.

  • Token buckets are disjoint: inputTokens is cache-miss input, cacheReadTokens is billed at the cache-hit rate (~1/50 of the miss rate), cacheWriteTokens at the write rate, outputTokens at the output rate.

  • The numbers are estimates: same billing rules as the official invoice, but not the invoice (retries and failed requests are not represented).

  • 子智能体是独立 session,只算它自己产生的 assistant/message.data.usage。

  • fork 出来的子会话(isSeeded)会把父会话事件当 seed 重放,这些 token 已经记在父会话账单上,所以折叠从 inheritedEventCount 之后才开始。

  • 计价模块 vendored 自 @kidli1412/dsh-session-cost 的 lib/cost.js(MIT):逐条事件按该事件发生时刻生效的峰谷时段计价(北京时间工作日 09:00–12:00、14:00–18:00 为高峰),按 provider/model 取价。

  • token 各桶互不重叠:inputTokens 是未命中缓存的输入,cacheReadTokens 按命中缓存价(约为未命中价的 1/50),cacheWriteTokens 按写入价,outputTokens 按输出价。

  • 数字是估算:与官方账单计价规则一致,但不等价于账单(重试和失败请求不在此列)。

Data sources and performance / 数据来源与性能

The host half registers exactly one read-only endpoint:

GET /api/subagent-cost/summary?session=<parent session id>

with a loopback check (peer socket must be 127.0.0.1/::1 and the Host header must be local) — anything else gets 403.

  • Parent session: ctx.sessionQuery.readSession(parentId) (live preferred, persisted fallback). Read once, for catalog events and turn boundaries.
  • Child sessions: read straight from disk, $DSH_HOME/sessions/<workspace>/<sessionId>/session.v4.jsonl.zstd, split on the zstd frame magic (28 B5 2F FD) and decompress frame by frame. This is the pitfall the plugin exists to dodge: Node's zstdDecompressSync / createZstdDecompress() stop after the first frame (a 53 KB log yields 279 bytes), so without frame-by-frame decoding every total comes out 0.
  • Falls back to sessionQuery.readSession in three cases: log file missing, undecodable, or a forked child (isSeeded, needs inheritedEventCount to skip the seed). Replay is persisted and serialized at ~130 ms per session — 38 children take ~5 s — hence fallback only.
  • Measured: for a parent with 38 subagents and 546k tokens, the disk path takes 0.19 s and sessionQuery takes 9.7 s; both paths agree to the last digit (545,792 tokens / ¥1.32122364).
  • Incremental: each child keeps a fold state (state.consumed) and only new events are processed; a child whose log ends with turn/end is frozen and revalidated every 5 minutes. A 30 s poll therefore never re-scans whole logs.

宿主半只注册一个只读端点 GET /api/subagent-cost/summary?session=<父会话 id>,带 loopback 校验(对端 socket 必须是 127.0.0.1/::1,且 Host 头是本机)——其余一律 403。

  • 父会话:ctx.sessionQuery.readSession(parentId)(活会话优先,否则读持久化),只读一次,用于取 catalog 事件和 turn 边界。
  • 子会话:直接读磁盘,$DSH_HOME/sessions/<workspace>/<sessionId>/session.v4.jsonl.zstd,按 zstd 帧魔数(28 B5 2F FD)切开逐帧解压。这正是本插件要绕开的坑:Node 自带的 zstdDecompressSync / createZstdDecompress() 只解第一帧(53 KB 的日志只出 279 字节),不逐帧解压统计会全是 0。
  • 三种情况回落到 sessionQuery.readSession:日志文件缺失、解不开、或 fork 出来的子会话(isSeeded,需要 inheritedEventCount 跳过 seed)。重放是持久化且串行的,约 130 ms/会话——38 个子会话约 5 s——所以只做兜底。
  • 实测:38 个子智能体、54.6 万 token 的父会话,走磁盘 0.19 s,走 sessionQuery 9.7 s,两边结果逐位一致(545,792 tokens / ¥1.32122364)。
  • 增量:每个子会话保留 fold 状态(state.consumed),只处理新事件;日志以 turn/end 结尾的子会话会被冻结,每 5 分钟才重新校验。所以 30 秒轮询不会反复重扫整份日志。

Layout / 目录结构

lib/index.js      host half: registers /api/subagent-cost/summary
lib/client.js     client half: a hand-written __ModuleLoader__ bundle (dock pill + panel)
lib/aggregate.js  pure functions: turn/catalog scan, child folding, summary
lib/cost.js       vendored pricing module (from @kidli1412/dsh-session-cost, MIT)
test/local-summary.mjs  offline check: aggregates $DSH_HOME/sessions directly
  • lib/index.js — 宿主半:注册 /api/subagent-cost/summary。
  • lib/client.js — 客户端半:手写的 __ModuleLoader__ bundle(药丸 + 面板)。
  • lib/aggregate.js — 纯函数:turn/catalog 扫描、子会话折叠、汇总。
  • lib/cost.js — vendored 计价模块(来自 @kidli1412/dsh-session-cost,MIT)。
  • test/local-summary.mjs — 离线校验:直接聚合 $DSH_HOME/sessions。

Offline check / 离线校验

No harness needed / 不需要启动 harness:

node test/local-summary.mjs                    # picks the parent with the most subagents / 选子智能体最多的父会话
node test/local-summary.mjs <parent-session-id>  # explicit parent / 指定父会话

Credits / 致谢

  • Pricing and usage-attribution semantics: @kidli1412/dsh-session-cost (MIT), itself mirroring the tokenUsage projection of dsh-token-meter, with a nod to dsh-usage-stats (MIT © Ychris12138).
  • Parent/child mapping leans on the harness's own subagent/catalog session events.

计价与用量归属口径来自 @kidli1412/dsh-session-cost(MIT),它本身对齐 dsh-token-meter 的 tokenUsage 投影,并参考了 dsh-usage-stats(MIT © Ychris12138);父子关系依赖 harness 自带的 subagent/catalog 会话事件。

License / 许可

MIT — see LICENSE / 见 LICENSE。