dsh-workspace-auto-sort: Introducing Automatic Workspace Sorting for DSH

Preface

The native sorting mechanism of DeepSeek Harness (DSH) only applies to sessions within a workspace group. The order of workspaces themselves relies on manual dragging, and the order resets after restart. dsh-workspace-auto-sort adds automatic workspace sorting to DSH Web / Desktop: it monitors session activity, automatically reorders sidebar workspaces based on user message timestamps, and persists the order to disk so it is retained after restart.

Core Capabilities

The plugin runs in the host process, does not rely on browser-side injection, and reorders workspaces through the official workspaceRegistry.insertBefore API.

  1. Activity monitoring and filtering: Monitors host session/event and refreshes a session’s last activity time according to the activity rule (default 'prompt', only user messages count); automatically excludes hidden subagent sessions where origin === 'subagent'.
  2. Debouncing and reordering: Activity events are merged within a debounce window (default 750ms) before triggering a reorder calculation.
  3. Persistent sorting: Applies reordering through workspaceRegistry.insertBefore(id, beforeId), using the same persistence channel as manual dragging.
  4. Flexible configuration: Supports configuring the activity rule (prompt/any) and sorting scope (all/outermost).

Installation and Enabling

dsh web (CLI profile)

# 克隆仓库
git clone https://github.com/huimingli666/dsh-workspace-auto-sort.git
cd dsh-workspace-auto-sort

# 安装插件
dsh plugin --profile web add link:"$PWD"

# 重启 dsh web 生效

DSH Desktop (desktop client)

The dsh plugin command cannot directly manage the desktop profile. Manually perform the following steps:

  1. Create a symbolic link under the desktop profile’s node_modules pointing to the cloned directory:
    mkdir -p ~/.dsh/profiles/desktop/node_modules/@dsh-plugins
    ln -s <克隆目录>/dsh-workspace-auto-sort \
          ~/.dsh/profiles/desktop/node_modules/@dsh-plugins/dsh-workspace-auto-sort
  1. Edit ~/.dsh/profiles/desktop/package.json and add the following entry to dependencies:
    "@dsh-plugins/dsh-workspace-auto-sort": "link:<克隆目录>/dsh-workspace-auto-sort"
  1. Append the following entry to the end of the dsh.profile.bundles array in the same file:
    "@dsh-plugins/dsh-workspace-auto-sort"
  1. Restart the desktop app to take effect.

After enabling, running a session in any workspace will automatically move that workspace to the top. Disabling the plugin (enabled: false) restores pure manual mode.

Configuration Options

The plugin overrides default values through a configuration file:

Key Default Description
enabled true Master switch; when disabled, no listeners are attached and no reordering occurs
debounceMs 750 Merge window for activity events (non-negative integer)
activity 'prompt' Recency rule: 'prompt' counts only user messages; 'any' counts all submission events
scope 'all' Sorting scope: 'all' all workspaces; 'outermost' only top-level workspaces
logFile '' Log path; empty string uses the default ~/.dsh/logs/...; 'off' disables logging
announceToAgent false Whether to announce this plugin to the model

Diagnostics and Manual Trigger

The plugin provides local APIs for viewing status and manually triggering a reorder (requires local loopback access):

# 查看状态(监听计数、rank、最近一轮计划)
curl http://127.0.0.1:<端口>/api/dsh-workspace-auto-sort/status

# 强制执行一轮重排(不等会话活动)
curl -X POST http://127.0.0.1:<端口>/api/dsh-workspace-auto-sort/reorder

Cautions

  • Manual dragging is overridden: When triggered by activity, the result of manual dragging will be overwritten by reordering.
  • Cold session accuracy: For sessions that have never been run in the host process (cold sessions), sorting accuracy depends on the createdAt field in the session header on disk.
  • Rule differences: The plugin uses “last run time” (including all submission events), which is broader than the GUI’s “last updated” rule.
  • Runtime requirements: Node runtime must satisfy ^22.0.0 || >=24.0.0.
  • Host dependencies: Depends on the host providing features such as workspaceRegistry.insertBefore and sessionPersistence.list().
  • Configuration validation: Invalid configuration (for example, a negative debounceMs) will throw an error immediately during loading.

End

This plugin fills a gap in DSH workspace management through official APIs. It is suitable for users who frequently switch workspaces and want to keep the order tidy. For more details, see SkillHub Directory or GitHub Repository.

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

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

Xiaoye