dsh-zai-usage
开发工具 活跃维护

dsh-zai-usage

bosenok/dsh-zai-usage

实时监控Z.AI编码计划配额,清晰展示已用与剩余额度,支持多维统计与阈值提醒,界面轻巧、刷新即时,助你随时掌握资源消耗

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

dsh-zai-usage

Z.AI coding-plan quota panel in the DSH sidebar.

A DeepSeek Harness plugin,
packaged as a DSH bundle: package.json declares dsh.bundle.patch, and
cordis.patch.yml inserts the zai-usage row into the active profile.
The client half is served from lib/client.js (dsh.client.platform: web).

Install

  • Desktop app: Plugins → install github:bosenok/dsh-zai-usage (private repository:
    give the machine git access), then enable the bundle.
  • CLI: dsh plugin --profile <profile> add github:bosenok/dsh-zai-usage.
  • Local checkout: dsh plugin --profile <profile> add file:/path/to/dsh-zai-usage.

Enabling the bundle mounts the plugin; HMR applies it to a running app, and a
restart makes sure the client half is rebuilt.

Note for the app-managed desktop profile: dsh plugin --profile desktop add
only installs the dependency and copies the package; unlike a regular profile
it does not enable the bundle. Enable it by adding the package name to
dsh.profile.bundles in ~/.dsh/profiles/desktop/package.json (or through the
Plugins page). Other profiles enable the installed bundle automatically.

Where the key comes from

The host half declares inject: ['credentials'] and resolves the key through the
harness credential service — the same canonical seam the Z.AI provider itself
uses:

const resolved = await ctx.credentials.resolve('ZAI_API_KEY')

So there is nothing plugin-specific to configure. The value is found in the
service's layers: the credential store written when the Z.AI provider is
configured (~/.dsh/.credentials.yaml → refs), or the environment layers
(~/.dsh/.env, inherited environment, the project's .env). The value never
reaches the browser: the client half renders the quota snapshot only.

Missing key: the panel shows ZAI_API_KEY is not set in the credential store, and
the snapshot ~/.dsh/usage/zai-usage.json carries debug with the resolution
state (credsService, resolve) — for instance
{"credsService":"ok","resolve":"value(49) source=file"}.

Development

lib/ is built and committed; the sources live in src/. Rebuild the client with
the repository's Vite config (npx vite build → dist/, then the wrapper in
build/wrapper.js produces lib/client.js).

License

MIT — see LICENSE. Third-party code bundled into lib/ and its
licenses are listed in THIRD_PARTY_NOTICES.md.