In the DeepSeek Harness (DSH) Web environment, checking the remaining quota for an OpenCode Go subscription usually requires manual inspection or navigating to settings. This plugin provides instant status visualization by displaying usage and countdowns directly in the sidebar and offering a query tool for Agents.
Core Features¶
The plugin includes the following features:
- Sidebar display: Automatically shows rolling (5-hour), weekly, and monthly usage percentages and countdowns in the sidebar.
- Central panel: Clicking an entry opens a central column panel to display status badges, reset time, detailed progress bars, and a per-second countdown.
- Agent tool: Provides the
opencode_go_balancetool so assistants can directly answer remaining subscription quota. - Data caching and protection: In-memory cache with 30s TTL; the API route includes loopback protection (local/same-origin only); the API key is used only for local requests; the response returns a masked
keyHint. - Auto refresh: Balance data refreshes automatically every 60 seconds.
Installation¶
Install the plugin with the following command:
dsh plugin --profile web add @dong-victor/dsh-opencodego-usage
After installation, restart dsh web for the new bundle layer to take effect.
Configuration¶
The plugin supports optional configuration items. Set them in the config field of cordis.patch.yml:
- insert:
- id: opencode-go
name: '@dong-victor/dsh-opencodego-usage'
config:
enabled: true
announceToAgent: true
# apiBaseUrl: 'https://opencode.ai'
# apiKeyEnv: 'OPENCODE_GO_API_KEY'
# cacheTtlMs: 30000
# timeoutMs: 15000
Prerequisites¶
- The plugin reuses DSH’s existing LLM integration and depends on the
opencode-goroute configuration inllm-pi-ai. - The API key is provided via the
OPENCODE_GO_API_KEYcredential reference (notDEEPSEEK_API_KEY). - The endpoint defaults to
https://opencode.ai.
Technical Architecture¶
- Host-side (
lib/index.js): Provides the loopback-protectedGET /api/dsh-opencode-go/balanceendpoint, parses the API key and endpoint, and registers Agent tools and prompts. - Browser-side (
lib/client.js): Pure JS with zero build dependencies, implements self-healing via MutationObserver, and supports React re-render adaptation.
Development and Testing¶
The plugin depends on @deepseek-ai/dsh-tools (peer dependency). Testing requires installing jsdom:
npm install
npm test
Usage Examples¶
- View balance: Open DSH Web; the “Go Balance” sidebar entry directly shows progress and countdown.
- Agent query: Ask in a conversation, “How much OpenCode Go subscription is left?”, and the Agent will call the tool and return the result.