dsh-account-balance
开发工具 活跃维护

dsh-account-balance

lovstudio/dsh-account-balance

固定在网页右下角的余额状态卡片,可持久化挂载至根shell.overlay层,不随页面跳转或操作消失,实时同步账户余额,方便开发者随时查看。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
85 KB
仓库大小
3 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:lovstudio/dsh-account-balance
git clone https://github.com/lovstudio/dsh-account-balance.git
git clone git@github.com:lovstudio/dsh-account-balance.git
README.md main

@lovstudio/dsh-account-balance

English | 中文

A persistent bottom-right status card for the DeepSeek Harness web surface. It
pins into the root shell.overlay seat and shows, across the whole process:

  • a status dot plus 「空闲 / N 会话 · M 任务」 (idle, or live session and running
    background-job counts), polled every 3 seconds;
  • GLM / KIMI rows with two 5px quota bars — the 5-hour window and the weekly
    allowance — colored green (<50%), orange (≥50%) or red (≥80%) with a hover
    tooltip showing usage, remaining, and the reset countdown;
  • OpenRouter (US$) and DeepSeek (¥) remaining balances, polled every 60
    seconds through a 55-second Host cache.

The Host half exposes two Typert Remote faces — accountBalance.status and
accountBalance.quotas. status is a pure in-memory snapshot over
ctx.agents.list() and ctx.jobs.list(); it never scans session logs, so the
3-second browser poll stays sub-millisecond and cannot stall a user message.
quotas fans the four provider requests out in parallel and caches the result
for 55 seconds; every external number is normalized at the wire boundary and
rows are shaped strictly by mode, so the Remote JSON never carries an
undefined field. Provider credentials resolve per operation through
ctx.credentials (ZAI_CODING_CN_API_KEY, KIMI_CODING_API_KEY,
OPENROUTER_API_KEY, DEEPSEEK_API_KEY) and never leave the Host.

Service API

accountBalance.status(): Promise<RemoteResult<AccountBalanceStatusSnapshot>>

Live process status: { sessions, tasks } — distinct live session ids and
background jobs currently in the running state.

accountBalance.quotas(): Promise<RemoteResult<AccountBalanceQuotaSnapshot>>

Four-provider snapshot: { at, rows: { glm, kimi, or, ds } }. Window rows
(glm, kimi) carry mode: 'windows' with windows.w5 and windows.week;
balance rows (or, ds) carry mode: 'balance' with balance and detail.
Every row carries a status of ok | no-key | no-data | error.

Config

No configuration. The four provider credentials are read from the credential
service by reference; a missing key renders the row as 「—」 with a tooltip
reason.

Extension points

None — the card is a leaf surface. Consumers may read the same two Remote
faces for their own status/quota displays.

Model Experience

What the model sees

Nothing. The card is browser-only UI; both Remote calls run outside model
turns and their results never enter a prompt.

Token effect

Zero — the plugin performs no model calls.

KV Cache effect

None — no prompt prefix is contributed.

Known Limitations and Deferred Work

  • jobs.list() visibility — the Host status handler lists jobs without a
    caller, so jobs owned by another session may not be counted as tasks;
    unowned and visible jobs are counted.
  • Quota shape drift — GLM and KIMI wire formats are extracted
    defensively; an API shape change surfaces as no-data rows rather than a
    crash.
  • Page reload / restart — the plugin is a composition row, so it survives
    both once installed; before install it behaves like any other plugin package
    in this workspace.