DeepSeek Harness 插件

dsh-ui-shadow-token

DSH web chat token badge: shadows the assistant-step renderer at slot priority -1 to show each message's input/output token usage(英文原文)

跳到安装方式

来源信息

GitHub 仓库
haoliangwu/dsh-ui-shadow-token
最近更新
2026年8月20日
分类
用量与账单
GitHub stars
0
载体类型
plugin
目录证据
上游声明已找到 dsh.bundle
证据路径
package.json#dsh.bundle
核对版本
0.1.0-rc.8
上游核对日期
2026-08-21

该证据由上游目录提供。本站没有安装、运行或安全审核这个插件。

安装

默认先复制一段 Prompt,让 Agent 读 GitHub 仓库和源码;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读 GitHub 仓库和源码。

请先不要安装或执行任何命令。阅读这个插件的 GitHub 仓库、README 和关键源码,然后用清楚、直接的方式回答以下问题,帮助我判断它是否适合我的需求:

1. 这个插件是什么,解决什么问题;
2. 适合哪些用户和典型使用场景;
3. 安装后如何使用,并给出一个最小使用示例;
4. 有哪些已知限制,以及隐私、安全、兼容性或维护风险;
5. 给出“推荐 / 有条件推荐 / 不推荐”的明确建议和理由。

请区分仓库明确说明、根据源码推断和未知信息。证据不足时请明确说明,不要猜测或照抄 README。

GitHub:https://github.com/haoliangwu/dsh-ui-shadow-token
插件名:dsh-ui-shadow-token
作者:haoliangwu

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器2 个文件
README.md来源说明 · 只读预览

<h1 align="center">dsh-ui-shadow-token</h1>

<p align="center">DSH web chat token badge — shows each assistant message's input/output token usage in a small pill at the message's top-right corner.</p>

<p align="center"><img src="docs/token-badge.png" alt="Token usage badge on assistant messages" width="640"></p>

A web client plugin for DeepSeek Harness. It shadows the keyed conversation.chat.node slot's assistant-step entry at slot priority -1, so every assistant message renders the stock content plus a ⚡ in {input} / out {output} badge in its top-right corner.

The badge reads the finalized message's usage payload (input/output/cache/reasoning tokens) with the same defensive narrowing the in-repo turn-metrics uses; while a message is still streaming and has no settled usage, the badge stays hidden. The stock assistant rendering — markdown, reasoning, tool rows, images — is untouched; only the pill is added.

Install

dsh plugin --profile web add github:haoliangwu/dsh-ui-shadow-token

Built lib/ is committed, so the git install is one line — no prepare script, no allowBuilds permission. Restart dsh --profile web after install (bundle layer stacks compose at boot).

Why slot priority -1

The conversation.chat.node slot is keyed by the node's kind: entryKey = routedNode.kind. The default assistant-step entry registers at priority 0. Keyed slot occupancy throws on same-key same-priority duplicates (fail loud), while a lower absolute priority shadows the default — the ledger sorts ascending and the lowest renders. Our entry registers the same key at priority: -1:

  • every assistant-step render resolves to this plugin's component;
  • the default renderer stays in the ledger as an inert fallback (upstream upgrades keep working; the default simply never renders);
  • any other kind (user, tool, turn-tail, …) is untouched — the default turn-tail footer (Ran for …, TTFT …, tok/s) still renders under the badge.

This is the client-slot alternative to disabled: true + re-registration: the slot declaration, seat dispatcher, and business-node state machines all stay in ui-conversation; the plugin only contributes one keyed renderer.

How it works

  • The badge is pure client rendering. The node half is an empty apply; all behavior lives in ./client, registered as a dsh.client web platform package. No host service, no RPC channel, no model-visible input, no session-log events.
  • Usage is read defensively from the node data. AssistantMessageNode.usage is typed unknown and carries a TokenUsage at runtime (inputTokens / outputTokens / cacheReadTokens / cacheWriteTokens / reasoningTokens). The component narrows it the same way the in-repo turn-metrics.ts does, so a future shape change degrades to a hidden badge, never a crash.
  • The badge text comes from a locale namespace. shadow-token (zh / en) interpolates {input} / {output} placeholders; the locale seat is provided automatically by the registration (PropsLocale mechanism).
  • The bundle id equals the row name. client-modules keys browser registration by the client row's name; the tsdown bundle id and cordis.patch.yml row name are both dsh-ui-shadow-token, or the browser shell throws "loaded without registering".

Build from source

pnpm install
pnpm build         # emits lib/index.js, lib/invariant.js, lib/client.js + sourcemaps
pnpm typecheck     # tsc --noEmit (types resolve via tsconfig paths to the local dsh profile)

lib/ is committed to the repo so git installs work without a build step. After changing source, run pnpm build and commit the updated lib/.

License

MIT