dsh-web-search-ddg
aooyoo
Zero-token DuckDuckGo search provider for the DeepSeek Harness (DSH) web seam — local headless browser, no API key, no m…
PROJECT TOPICS
PROJECT README
Deployment-level 用量 / Usage plugin for DeepSeek Harness (DSH).
A real-time token & cost dashboard tab for the current session, placed next to Chat / Trajectory in the conversation view ring. It records input / output / cache-hit tokens and prices every model call with both the DeepSeek official peak/off-peak rate card and the OpenCode Go plan rate card, refreshes every second, shows animated gradient-blue status bars, supports a fully editable custom price table (persisted across restarts) and CSV/JSON export.
中文文档见 README.zh.md(Chinese documentation is in README.zh.md)。
order: 11), native DSH UI style (theme tokens, compact toolbar, card sections).llm/stream model call: a "generating" row appears the moment a call starts, output/reasoning tokens are estimated per chunk and updated every second, then replaced by the adapter's exact usage; the committed assistant/message finalizes the record (15s match window, no duplicates).<workspaceRoot>/.dsh-usage-prices.json, and historical costs are re-priced immediately after a change.⚠️ Important: register the plugin exactly once. Do not combine installation paths.
dsh plugin add(Method A / B) adds the plugin todsh.profile.bundles; the bundledcordis.patch.ymlis applied automatically as a bundle layer — do not also addui-usagemanually../install.shor manual patching (Method C / D) registers throughcordis.patch.yml— do not also usedsh plugin add.- If two
ui-usageentries exist, DSH fails withduplicate loader entry id: ui-usage. Fix: remove one../install.shautomatically removes the plugin fromdsh.profile.bundlesto prevent this.
web profile initialized at least once (dsh web), so ~/.dsh/profiles/web exists.dsh plugin --profile web add github:GHJIVHIDD/dsh-plugin-usage
Pin a commit for reproducibility:
dsh plugin --profile web add github:GHJIVHIDD/dsh-plugin-usage#<commit-sha>
pnpm ≥ 10 build authorization: if the first run fails because pnpm refuses to run the git dependency's
preparescript, add this to the profile'spnpm-workspace.yaml:
# File: ~/.dsh/profiles/web/pnpm-workspace.yaml
allowBuilds:
"@deepseek-ai/dsh-plugin-usage": true
Then re-run the install command.
The install package is published in GitHub Releases (not in the source tree):
curl -L -o dsh-plugin-usage-0.1.0.tgz \
https://github.com/GHJIVHIDD/dsh-plugin-usage/releases/download/v0.1.0/dsh-plugin-usage-0.1.0.tgz
dsh plugin --profile web add ./dsh-plugin-usage-0.1.0.tgz
Or download it from the Releases page:
https://github.com/GHJIVHIDD/dsh-plugin-usage/releases
You can also add a local source directory:
dsh plugin --profile web add /path/to/dsh-plugin-usage
git clone https://github.com/GHJIVHIDD/dsh-plugin-usage.git
cd dsh-plugin-usage
./install.sh
The script copies the plugin into ~/.dsh/profiles/web/node_modules/@deepseek-ai/dsh-plugin-usage, writes the ui-usage patch into cordis.patch.yml, and removes the plugin from dsh.profile.bundles (with a package.json.bak backup) if present. Customize the target:
DSH_HOME=/path/to/.dsh DSH_PROFILE=web ./install.sh
# 1. Copy the package into the profile's node_modules
mkdir -p ~/.dsh/profiles/web/node_modules/@deepseek-ai
cp -R dsh-plugin-usage ~/.dsh/profiles/web/node_modules/@deepseek-ai/
# 2. Make sure ~/.dsh/profiles/web/cordis.patch.yml contains:
# - insert:
# - id: ui-usage
# name: '@deepseek-ai/dsh-plugin-usage'
# The profile must compose without errors:
dsh --profile web --dump-config > /dev/null && echo OK
Then start (or refresh) your web profile and open the 用量 tab:
dsh web
If the tab is missing, check the browser console for usage-api fetch failures, and confirm the patch entry exists exactly once (grep -n ui-usage ~/.dsh/profiles/web/cordis.patch.yml ~/.dsh/profiles/web/package.json).
Edit any model, + Add model for new ones, Remove for custom entries.Export in the Call details header, then download CSV or JSON (links valid for 60 s; click again to regenerate).<workspaceRoot>/.dsh-usage-prices.json.Peak hours are Beijing time 09:00–12:00 and 14:00–18:00; official prices are 2× during peak. The toolbar badge shows the current period; per-call prices use the call's own timestamp, so history stays correct after the period changes.
dsh-plugin-usage/
├── package.json # npm package manifest with dsh.bundle.patch + dsh.client metadata
├── cordis.patch.yml # loader patch: inserts the ui-usage entry
├── install.sh # no-pnpm manual installer (Method C)
├── lib/
│ ├── index.js # host half (ESM): collection, pricing, /usage-api/* routes
│ ├── client.js # client half (web ModuleLoader bundle)
│ └── types/index.d.ts # TypeScript declarations
├── scripts/verify.mjs # structural + privacy verification (dev-time)
├── README.md # this file (English)
├── README.zh.md # Chinese documentation
└── LICENSE # MIT
| Route | Method | Purpose |
|---|---|---|
/usage-api/state?sessionId= |
GET | Aggregated session usage + per-call details (polled every second) |
/usage-api/mode |
POST | Switch pricing mode: { "mode": "auto" \| "official" \| "go" } |
/usage-api/prices |
GET | Merged price table (built-in + custom) |
/usage-api/setprice |
POST | Add/edit/remove custom prices (persisted) |
/usage-api/export?sessionId=&format=csv\|json\|both |
GET | Create one-shot download links |
/usage-export-<token> |
GET | Download the exported CSV/JSON (60 s TTL) |
conversation.view slot).dsh-plugin-canvas / dsh-plugin-vm-sandbox (dsh.bundle.patch + dsh.client metadata, ./client export, loader patch).webServer, timer, fs, sandboxPolicy, sessionQuery, llm/stream, session/event).Q: The tab shows "Failed to load usage data".
A: The host half is not serving /usage-api/*. Confirm the plugin is registered exactly once (see Install), then restart the profile. Check dsh --profile web --dump-config output for the ui-usage row.
Q: Why do numbers change after I edit a price? A: Costs are computed dynamically from the current price table on every read, so historical calls are re-priced immediately. This is by design.
Q: Is my conversation content stored? A: No. Only token counts, model names and timestamps are kept in memory; exports contain the same data. The custom price file contains prices only.
Q: Can I use it with the headless profile? A: The UI is web-only; the host half works in any profile, but the dashboard requires the web client.
MIT © 2026 GHJIVHIDD
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。