dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
OpenCode Zen/Go quota usage (5h rolling, weekly, monthly) as a settings page in DeepSeek Harness
在 DeepSeek Harness 的「設定」對話框裡看 opencode.ai 的套餐額度。
把你想貼的那張用量卡(5 小時滾動 / 每週 / 每月、剩餘百分比與重置倒數)搬進 DSH:
Host 半每 30 秒輪詢 opencode 官方額度介面,瀏覽器半用官方的
settings.section 插槽渲染成一個設定頁。API key 只在 Host 行程內使用,
不會經過任何 RPC。
| 能力 | 說明 |
|---|---|
| 三檔額度 | rolling(5 小時)、weekly、monthly,顯示剩餘百分比、重置倒數與進度條 |
| 套餐模型數 | 同時讀 GET <base>/v1/models,顯示方案可用模型數量 |
| 自動更新 | 每 30 秒輪詢一次;倒數計時另外每 30 秒自行刷新 |
| 手動刷新 | 卡片右上角「刷新」,會先叫 Host 立即重讀再取快照 |
| 主題相容 | 全部用行內樣式與 rgba(128,128,128,…) 中性色,深/淺色主題皆可讀 |
| 憑證安全 | key 由 ctx.credentials 在 Host 端解析,僅百分比 / 重置時間 / 模型 id 過 Remote |
llm-pi-ai.providers 有一個 opencode 系 provider(id 為 opencode / opencode-go,
或 apiKeyEnv 以 OPENCODE 開頭,或 baseURL 含 opencode.ai);或OPENCODE_GO_API_KEY(或 OPENCODE_API_KEY)。https://opencode.ai。用法示例(放在 profile 的 cordis.patch.yml):
- id: llm-pi-ai
name: "@deepseek-ai/dsh-llm-pi-ai"
config:
providers:
opencode-go:
apiKeyEnv: OPENCODE_GO_API_KEY
models:
- id: deepseek-v4-flash-vision-exp
name: DeepSeek V4 Flash Vision Exp
從 GitHub 直接安裝(最省事,日後 dsh plugin update 也能跟著更新):
dsh plugin --profile <profile> add github:yal3ay/opencode-usage-dsh
也可以裝本地目錄或打包好的 tgz:
dsh plugin --profile desktop add /絕對路徑/opencode-usage-dsh-1.0.0.tgz
這一步會把套件裝進該 profile 的 node_modules,並自動把 opencode-usage-dsh
加到 dsh.profile.bundles;套件內附的 cordis.patch.yml 接著插入宿主插件行
(已實測 dsh --profile <name> --dump-config 會出現 id: opencode-usage-dsh)。
重啟該 profile(沒有開 HMR 時),重新載入頁面,打開 設定 → OpenCode 用量。
若不想改 bundle 清單,也可以只把下面兩行加進
~/.dsh/profiles/desktop/cordis.patch.yml:
- insert:
- id: opencode-usage-dsh
name: 'opencode-usage-dsh'
用 GUI 的「外掛」頁安裝也可以:它會同步處理依賴與 bundle 清單。
node test/smoke.mjs
$DSH_HOME/.credentials.yaml 有 OPENCODE_GO_API_KEY,
會直接打真實的 https://opencode.ai/zen/go/v1/usage 並檢查三檔額度與重置時間;
沒有憑證時改用樁資料,因此可離線執行。window.__ModuleLoader__ 裡載入 lib/client.js,驗證
settings.section 註冊、Remote 讀取、渲染文字與刷新流程。在一個獨立的 DSH_HOME(同樣從 web 模板建立)裡實測:
dsh plugin --profile <name> add <tgz> → 依賴安裝成功,且自動把
opencode-usage-dsh 寫進 dsh.profile.bundles。dsh --profile <name> --dump-config → 組裝結果出現 id: opencode-usage-dsh。opencode-go / key 已解析 / 36 個套餐模型 / rolling 92% 剩餘、weekly 97%、monthly 99%。opencode-usage-dsh/client.js。設定頁 (browser) Host 行程
│ │
├─ ctx.remote.$mount(descriptors) ───────┤ Typert Remote namespace `opencodeUsage`
├─ namespace.snapshot() ───────────────▶├─ 30s 輪詢
├─ namespace.refresh() ───────────────▶│ GET https://opencode.ai/zen/go/v1/usage
│ │ GET https://opencode.ai/zen/go/v1/models
◀── { accounts:[{ usage:{rolling,weekly,monthly}, modelCount, … }] }
{ usage: { rolling, weekly, monthly: { status, percent, resetsAt } } },
其中 percent 是已使用百分比,UI 顯示 100 - percent。dsh plugin --profile desktop remove opencode-usage-dsh
再從 profile 的 dsh.profile.bundles 或 cordis.patch.yml 移除對應條目(用 GUI
外掛頁安裝的,在那裡停用/移除即可)。
/v1/usage 會顯示錯誤。MIT