편집자 노트

配额面板

Provider quota / balance status widget for the dsh web surface (DeepSeek Harness).

이것은 DeepSeek Harness(DSH) 플러그인입니다. 이 사이트는 GitHub README, 설치 정보, 유지보수 상태, 공개 보안 시그널을 모아 보여줍니다.

dsh-quota-panel

English | 中文

Provider quota / balance status widget for the dsh web surface (DeepSeek Harness).

A zero-dependency host plugin: for every configured provider it registers one server-side proxy route /api/quota/<id> — the API key is resolved through the credentials seam and never reaches the browser — then injects a small Harness-native status widget (bottom-right) with two sizes:

  • Collapsed (default) — a minimal glanceable capsule: one independent "status dot + value" pair per account (e.g. ● ¥58.36 · ● 45%), no text labels — only the affected account's dot changes color. Click to expand.
  • Expanded — the full card: "模型额度" header with refresh/collapse buttons, then one structured row per provider (status dot, name, primary value, secondary line, progress bar for usage-style providers). The collapse button shrinks it back.

Both sizes auto-refresh (paused while the page is hidden; the refresh button spins while a manual refresh runs and re-entrant clicks are ignored).

In the capsule, usage percentages are battery-colored (green when healthy, amber when tight, red when critical), matching their independent dot; balance values are tinted only when their own state warns or errors.

The widget is styled with the Harness design tokens (--dsw-alias-*, --dsw-static-*, --dsw-shadow-*, --dsw-font-*) and falls back to sensible values when tokens are absent, so it follows the product theme (light/dark) instead of carrying its own palette.

Screenshots

Collapsed capsule (light / dark):

Capsule (light) Capsule (dark)

Expanded card (light / dark):

Panel (light) Panel (dark)

Full page, collapsed capsule (light / dark):

Full page, capsule (light) Full page, capsule (dark)

Install

dsh plugin --profile web add "github:brittanistrehlowll-oss/dsh-quota-panel"
# restart `dsh web` (bundle layers apply at boot)

The package declares dsh.bundle.patch, so dsh plugin add activates it as a profile layer automatically.

Configuration

Each provider is one entry under providers. Two renderers ship:

formatendpoint shaperow
deepseek-balance{ "balance_infos": [{ "currency", "total_balance", "granted_balance", "topped_up_balance" }] }¥58.36 + 余额充足/正常/紧张/建议充值
opencode-usage{ "usage": { "rolling"|"weekly"|"monthly": { "percent", "resetsAt" } } }五 10% · 周 45% · 月 22% + progress bar + 当前最高占用

Override the shipped defaults in your profile's cordis.patch.yml:

- id: quota-panel
  config:
    refreshMs: 30000
    providers:
      - id: deepseek
        label: DeepSeek
        credential: DEEPSEEK_API_KEY
        endpoint: https://api.deepseek.com/user/balance
        format: deepseek-balance
        balanceTiers: { critical: 10, warn: 20, healthy: 50 }
      - id: opencode-go
        label: OpenCode Go
        credential: OPENCODE_GO_API_KEY
        endpoint: https://opencode.ai/zen/go/v1/usage
        format: opencode-usage
        windowLabels: { rolling: , weekly: , monthly:  }
        warnPercent: 70
        errorPercent: 90

Fields:

fieldmeaningdefault
idroute id (/api/quota/<id>), ^[a-z0-9-]+$required
labelprovider name on the cardrequired
credentialcredential reference ($DSH_HOME/.credentials.yaml or env)required
endpointquota JSON endpoint, GET with Authorization: Bearer <key>required
formatrow rendererdeepseek-balance
balanceTiers(deepseek-balance) {critical, warn, healthy} levels{10, 20, 50}
lowBalancelegacy alias for balanceTiers.warn
windowLabels(opencode-usage) {rolling, weekly, monthly}{滚, 周, 月}
warnPercent / errorPercent(opencode-usage) thresholds70 / 90
refreshMsauto-refresh interval60000

DeepSeek balance levels

With the default balanceTiers {critical: 10, warn: 20, healthy: 50}:

balancestatesecondary line
<= 10error (red dot + value)建议充值
10 < x <= 20warn (amber)余额紧张
20 < x <= 50ok余额正常
> 50ok余额充足

OpenCode usage states

high = max(rolling, weekly, monthly):

usagestate
< warnPercentok (green dot, DeepSeek-blue progress)
>= warnPercentwarn (amber dot + progress)
>= errorPercenterror (red dot + progress)

Changelog

  • v0.3.0 — Two sizes: collapsed capsule (independent per-account dot + battery-colored value) expands into the full card.
  • v0.2.0 — Harness-native card: design tokens, balance tiers, progress bar.
  • v0.1.0 — Initial floating panel: server-side quota proxies + page badge.

Security

  • API keys are resolved server-side via ctx.credentials and only used in the server-to-provider request; the browser only talks to /api/quota/<id>.
  • The injected card builds DOM with createElement/textContent only; API response values never pass through innerHTML. Technical errors (401, timeout, credential missing) go into title hover text, not the card body.

Local development

# Regenerate demo pages docs/demo.html + docs/demo-dark.html
node scripts/gen-demo.mjs
# Headless screenshots via Chrome DevTools Protocol
node scripts/shoot.mjs both
# Verify the rendered DOM of a demo page
node scripts/verify.mjs [dark]
# Syntax + content checks for the injected page script
node scripts/test-page-script.mjs

License

MIT

REPOSITORY SIGNALS

보안 및 설치 증거

이 점수는 공개 저장소 메타데이터와 이 사이트에 등록된 설치 증거에만 기반하며, 코드 보안 감사와 다릅니다.

출처 추적 가능

공개 플러그인 카탈로그에서 왔으며, 공개 GitHub 저장소로 연결됩니다.

라이선스

저장소가 MIT 라이선스를 선언했습니다.

유지보수 활동

최근 180일 내 코드 업데이트가 있습니다.

설치 증거

재현 가능한 정확한 설치 메타데이터가 아직 등록되지 않았습니다. 저장소 설명에 따라 직접 확인하세요.

설치 라이프사이클 스크립트

검사한 패키지 메타데이터에 설치 라이프사이클 스크립트가 선언되지 않았습니다.