@liuch0812/info-sidebar
v0.2.0
Published
An opencode-style info sidebar for DeepSeek Harness (DSH): session/runtime status, token & cost, and live activity. Static DSH Cordis plugin — install with `dsh plugin --profile web add @liuch0812/info-sidebar`.
Maintainers
Readme
@liuch0812/info-sidebar
An opencode-style info sidebar for DeepSeek Harness
(DSH), packaged as a real static Cordis plugin — one command to install, no
dynamic cordis_define needed.
It adds a floating right-side panel that shows, in three sections, the kind of session/runtime information opencode surfaces:
- 会话与运行 — session title,
provider / model, agent preset, workspace path, and the current Git branch. - Token 与花费 — input / output / total tokens (from DSH's real
tokenMeter), plus an estimated cost. - 实时活动 — Agent status (running / idle), running background jobs, and live subagent count.
The panel opens automatically, is dismissible to a floating "ⓘ 信息" launcher, shifts the main content left while open (it does not cover the workspace), and refreshes every 3 seconds. Visuals follow DSH's own theme tokens, so it looks native and adapts to light/dark.
一键安装
方式一:官方 dsh plugin(推荐)
需要 pnpm(npm i -g pnpm):
dsh plugin --profile web add @liuch0812/info-sidebardsh plugin add 会把包装进 profile 并自动把包名加入
dsh.profile.bundles(本包声明了 dsh.bundle.patch,启动时自动把插件行
insert 进组合)。然后重启 dsh web:
dsh web方式二:install.sh(无需 pnpm)
仓库里的 install.sh 在机器没有 pnpm 时自动走等价 fallback
(npm pack + 解压进 profile node_modules + 手动 reconcile bundles 名单),
有 pnpm 时则直接走方式一:
# 从 npm 安装到 web profile
curl -fsSL https://raw.githubusercontent.com/liuchang0812/dsh-plugins-info-sidebar/main/install.sh | bash
# 或克隆仓库后本地执行
./install.sh # 等价 ./install.sh web
./install.sh web # 显式指定 profile
./install.sh web /path/to/checkout # 发布前从本地目录验证装完重启 dsh web。验证是否生效:
dsh --profile web --dump-config | grep -A2 info-sidebar
# 应看到:
# == @liuch0812/info-sidebar
# - id: info-sidebar
# name: '@liuch0812/info-sidebar'卸载
dsh plugin --profile web remove @liuch0812/info-sidebar(无 pnpm 时手动删掉 profile node_modules/@liuch0812/info-sidebar、以及
profile package.json 里 dependencies 与 dsh.profile.bundles 中的对应
条目。)之后重启 dsh web。
工作原理
一个包、一个组合行(cordis.patch.yml 里 insert 的 name: 行),两个半:
- Host 半(
lib/index.js):标准 Cordis 插件,inject: ['webServer'], 在webServer服务上注册 exact 路由/plugins/info-sidebar/snapshot, 每次请求现算快照 JSON(复用 DSH 的agents/sessions/sessionTitle/shell/tokenMeter/jobs/subagents服务)。client-modules 自己 就用同一个webServer服务提供/plugins/<id>/client.js,所以该服务在 web profile 里必然存在。 - Client 半(
lib/client.js):window.__ModuleLoader__.load格式的 预构建 bundle(DSH 模块加载器的私有格式,无需额外构建链),require('react'),每 3 秒fetch上述路由刷新,并通过slots服务注册 进shell.overlay槽(静态面板层)。
Host↔Client 通信没有用动态插件私有的 harness/host.call 桥(静态包里
不存在),而是普通的同源 HTTP——浏览器端无沙箱,fetch/setInterval
直接可用。
Notes & caveats
- Cost is an estimate. The built-in LLM service exposes no pricing, so the
panel uses a small hardcoded price table (
PRICESinlib/index.js) keyed by model id. Unknown models show—. Patch the table or wire in a real pricing source as needed. - Git branch is read once per workspace (
git rev-parse --abbrev-ref HEAD) and cached; non-git workspaces or sandbox-denied commands show—. - The panel reads live Host services and only renders data already available to the runtime; it never stores anything.
- 装完必须重启
dsh web(运行中的 dsh web 不会重读 profile)。
Development
npm run check # 语法检查 host/client 两个半
./install.sh web /path/to/this/checkout # 发布前本地全链路验证