DeepSeek Harness Multi-Account Plugin: dsh-account-switch

Introduction

DeepSeek Harness (DSH) is a workflow platform designed for building agents. In the official UI, only one account can remain logged in at a time. Switching accounts typically requires logging out of the current account and logging in again, resulting in the invalidation of the token. The dsh-account-switch plugin addresses this friction: it stores tokens for multiple accounts in a credential store, supports hot-swapping accounts without restarting the Harness, and automatically switches when quota is exhausted.

Core Features

The plugin provides multi-account management capabilities via CLI and the plugin API. Its primary features include:

  • Multi-Account Coexistence: Tokens for an arbitrary number of accounts exist simultaneously in the credential store without overwriting each other or kicking each other offline.
  • Hot Switching: Running the dsh-account use <account> command takes effect immediately, requiring no Harness restart or re-login.
  • Automatic Quota Rotation: When the current account’s quota is exhausted, the plugin automatically switches to the next available account and re-runs the failed step in-place within the current session.
  • Account Cooldown: Accounts recently flagged for insufficient quota enter a cooldown period (default: 5 minutes). During cooldown, they are not selected, preventing repeated switching before quota recovers.
  • Switch Audit Trail: Every automatic switch logs a single line of JSON, containing the target account, error reason, and session step.
  • Fingerprinted Archiving: Account IDs are derived from the sha256(token) prefix. The same Grant always maps to the same slot, making archiving naturally idempotent.
  • Nickname Management: Supports assigning Chinese names to accounts, making commands like use MainAccount more intuitive than use acct-af3bded5.
  • CLI + Plugin API: Provides the dsh-account command-line tool and exposes the ctx.accountSwitch interface for other plugins to call.
  • Zero Kernel Modification: Utilizes only public seams without modifying the official package kernel, ensuring no conflicts during Harness upgrades.
  • No Extra Secret Storage: registry.json stores only fingerprints; the list --json command does not output plaintext tokens.

Installation and Activation

During installation, the script copies plugin files as a real directory rather than a directory junction to ensure the Harness loads them correctly. Please use the following command:

powershell -NoProfile -File scripts/sync-install.ps1

After installation, you must enable the plugin in the profile’s patch file. Edit $DSH_HOME/profiles/desktop/cordis.patch.yml and append the following configuration:

- insert:
    - id: dsh-account-switch
      name: dsh-account-switch
      config:
        enabled: true
        autoArchiveOnStart: true
        autoCaptureOnSignIn: true
        verbose: false

You must restart the Harness for the plugin to take effect after modification.

Usage

Viewing and Managing Accounts

First, view the list of currently archived accounts:

dsh-account list

If the official UI is currently logged in, you can use the park command to vacate the current account (this does not invalidate the token, it merely frees up the UI slot):

dsh-account park --label MainAccount

At this point, log in with a new account in the official UI, and the plugin will automatically archive it.

Switching Accounts

Once archiving is complete, you can switch the active account using either the nickname or the ID:

dsh-account use MainAccount
dsh-account use acct-af3bded5

The switch is global; the next model request will immediately use the new account’s token.

Automatic Rotation and Logging

The plugin monitors model request errors. Upon encountering ACCOUNT_QUOTA or QUOTA errors, it automatically switches to the next available account and retries the current step. All switching activities are recorded in $DSH_HOME/accounts/quota-switch.log.

Notes

  • Switching is Global: ctx.deepseekAccount is a process-level singleton. Switching accounts affects all sessions under the current Harness instance; you cannot run Session A with Account 1 and Session B with Account 2 simultaneously.
  • Directory Structure Requirements: node_modules must be a real directory, not a directory junction, otherwise the plugin cannot load.
  • Logout Behavior: Clicking “Logout” in the official UI invalidates the token with the platform.

Summary

dsh-account-switch solves the single-account limitation of the DeepSeek Harness official UI by managing multiple Grant slots within the credential store. It provides hot switching, automatic quota rotation, and audit trails, making it suitable for long-running agent workflows with limited quota.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye