@stonehao/dsh-account-pool
v0.1.0
Published
Account pool for dsh: round-robin routing on agent/request, 429/quota cooldown failover on agent/request-error, per-account usage ledger
Readme
@stonehao/dsh-account-pool
Provider pool plugin for DeepSeek Harness (dsh): the harness provider registry with 429/quota cooldown failover, a per-provider usage ledger, and live quota probes.
Model
The pool IS the dsh provider registry. Every route llm.listProviders()
reports is a member; the pool re-derives lazily (default every 30s, on
request and status hits), so provider changes in dsh land on the next turn.
There is no separate account layer — no tiers, no model overrides, no custom
routes: providers dsh does not configure are not the pool's business.
- Routing (
agent/request): a request naming a member provider passes through untouched (your session's model choice always wins). When that member is cooling, the request drifts to the next healthy member (round-robin over registry order, serving that member's first configured model). Requests for non-members are never rewritten. - Failover (
agent/request-error): 429/quota-class failures cool the serving member and answer{kind:'retry'}while another healthy member exists. - Ledger: per-provider requests/failures/tokens persisted under
dataDir. - Status route:
POST /api/account-pool/statusreturns{ok, value:{rev, generatedAt, accounts[]}}(or{ok, value:null}when the registry is empty) under the authenticated/apifence. - UI (browser half): a right-sidebar tab with member cards (live cooldown
countdowns, token usage, balance capsules), a main-panel dashboard
(
conversation.view), and a page in Settings → Built-in plugins.
Configuration
Schemastery Config (all fields have defaults):
| field | default | meaning |
|---|---|---|
| dataDir | ~/.dsh/account-pool | holds providers.json, ledger.json, cooldown.json |
| cooldownMs | 60000 | base 429/quota cooldown |
| honorRetryAfter | true | extend cooldown to provider Retry-After when larger |
| quotaPollMs | 300000 | quota probe interval; 0 disables the poller |
| discoverRefreshMs | 30000 | pool re-derivation age; request/status hits trigger it |
providers.json (metadata only)
Keyed by provider route; unknown fields and unknown providers are inert — this file cannot add, remove, or reroute members.
{
"zai-coding-cn": { "label": "主力度", "quotaProbe": "deepseek-balance" },
"another-route": { "quotaProbe": "deepseek-balance", "quotaBaseURL": "https://api.deepseek.com", "key": "sk-..." }
}label— display name override (defaults to the registry's provider name)quotaProbe/quotaBaseURL— balance probe selection and endpointkey— probe credential, synced into the harness credential store; the only place a key is ever written down
Install
Two channels; both mount the same cordis.patch.yml.
From npm:
dsh plugin --profile web add @stonehao/dsh-account-poolFrom this repository's source (no publish step; the version tracks the repo commit and is pinned in the profile lockfile):
dsh plugin --profile web add "git+https://gitee.com/haostone/dsh-plugins.git#path:packages/dsh-account-pool"The source channel builds lib/client.js through the package's prepare
script, and pnpm only runs a git package's build scripts when the profile
allowlists it — add this to $DSH_HOME/profiles/<name>/pnpm-workspace.yaml
first, or use npm run plugin install account-pool --profile web --apply
from the repository root, which handles it.
dsh plugin writes the package into the profile's dependencies and
dsh.profile.bundles, and mounts it through this package's
cordis.patch.yml — no hand-edited patch rows, no junction to maintain.
Restart the profile afterwards. See the repository AGENTS.md for the
link-vs-hardlink behaviour and for isolated-home testing.
