Introduction¶
In DeepSeek Harness (DSH), regular user messages and slash commands travel through two different channels: the former enter the inbox queue while the agent is busy and are consumed after the turn ends; the latter invoke handlers directly via ctx.commands.execute(), with no queueing semantics while the agent is busy. A typical example is /compact: its handler calls compactNow() → agent.runMaintenance(), which synchronously throws ManualCompactionError('busy') when the agent is not idle. You simply see “Compaction is unavailable because this process has an active compaction, or the agent is not idle.” immediately — neither queued nor retried. The DSH side has explicitly ruled out the approach of “queuing the command itself,” and there is no official switch for it.
Below we introduce the community plugin dsh-command-queue (maintained by kuyueliuhun-ctrl): it wraps ctx.commands.execute() on the host side so that whitelisted slash commands (only /compact by default) enter a command queue while the agent is busy and execute once the state returns to idle; it also renders this queue in the browser in a style close to the native message queue. The plugin is categorized under Workflow, does not modify DSH source code, and uninstalling it restores the original execute behavior.
What This Is¶
dsh-command-queue is a dual host + client plugin for DSH: the host handles queueing and delayed execution, and the client (platform: "web") renders a “Command Queue” panel above the composer, directly below the native message queue. The interception point is ctx.commands.execute(); commands are still resolved by the original registry, and CommandRuntime still writes the command/run and command/done lifecycle events — only the execution timing is deferred to an idle window.
Native agent inbox queue entries can only be UserMessages and are picked up at the next step boundary — by then the agent is usually still running, and compactNow would still be busy. Therefore this plugin builds its own queue, replicating only the style and mount position (slot conversation.input.dock, id:"command-queue" / order:30), sitting side by side with the native id:"queue".
Core Features¶
Queue While Busy, Execute When Idle¶
Sending a command from the default whitelist (default: /compact) while the agent is running a turn:
- The command enters the queue; the input box does not freeze, and you can keep typing and queueing regular messages;
- A command queue UI appears above the composer: a single entry shows the command on one line; multiple entries collapse into an expandable “Queued commands · N”, each row with a remove button;
- Once the turn ends and the agent becomes idle, the command actually executes, a normal command card appears in the transcript (“Running…” → “Done · Compacted N history items”, etc.), and the corresponding row disappears from the queue.
When the queue is empty, the client panel does not render (returns null) and occupies no visual space.
Whitelist and Zero Regression¶
The queueing rule is a whitelist: only commands whose names are listed in deferCommands may be queued; by default only compact. In any of the following cases the command executes immediately and does not enter the queue:
- It is not valid command syntax (e.g., does not start with
/, contains uppercase letters, or is just/); - The command name is not in
deferCommands(i.e., by default, the vast majority of commands); - It is in the force-immediate list (built-in
stop/cancel/abort/interrupt/halt, unioned with the user-configuredimmediateCommands/alwaysImmediateCommands); - It cannot be resolved in the registry (
ctx.commands.findreturnsundefined); - The agent is already idle.
If the queueing logic itself throws, it falls back to the original behavior and does not swallow the command. On uninstall, waiters are woken so queued commands complete as soon as possible.
Browser Panel and /cmdqueue¶
The panel polls the host snapshot roughly every 1.5s; the button on the right side of a row removes a queued command that hasn’t executed yet (a removed command will not execute). Panel data goes through an authenticated route under /api (Host/Origin fencing + signed cookie), not a bare webServer route.
If you don’t want to enable the panel, you can use the read-only slash command to view the same queue:
/cmdqueue
→ 1 command(s) queued for this agent, waiting for it to become idle: /compact
→ No queued commands for this agent.
Per-Agent Isolation¶
Queues are isolated per agent, strictly FIFO and serial; one agent becoming idle does not let another agent’s queued commands through.
Installation and Enablement¶
This package is hand-written ESM / browser bundle with no build step; lib/index.js and lib/client.js are the source. The client plugin is assembled at page load — after installation or injection you need to refresh the page for the panel to appear.
Node engine requirement: >=22.19.0 (see package.json). Peer dependency @deepseek-ai/cordis (>=4.0.0-rc <5).
Method A: Assemble from GitHub into a profile (recommended, persists after restart)¶
Enter the profile directory in use (web profile in the example):
cd "$DSH_HOME/profiles/<profile>" # e.g. ~/.dsh/profiles/web
npm install github:kuyueliuhun-ctrl/dsh-command-queue
Add the package name to the dsh.profile.bundles array in that profile’s package.json:
{ "dsh": { "profile": { "bundles": ["dsh-command-queue"] } } }
The package ships with cordis.patch.yml; the bundle layer will insert command-queue into the loader, so no manual patch entry is needed.
Method B: Local directory (development)¶
npm install "file:/path/to/dsh-command-queue"
If using dsh-super-injector:
dev_install_package { "dir": "/path/to/dsh-command-queue", "profile": "web" }
Method C: Runtime injection (no restart, temporary verification)¶
dev_inject_plugin { "dir": "/path/to/dsh-command-queue" }
dev_plugin_status {}
Uninstall¶
dev_uninject_plugin { "match": "dsh-command-queue" }
In non-injector environments: remove the package name from dsh.profile.bundles, then delete the corresponding package from node_modules.
Configuration¶
There is no independent schema; it is parsed fault-tolerantly and everything is optional. Write it under config in the command-queue entry of the profile’s cordis.patch.yml:
- id: command-queue
name: 'dsh-command-queue'
config:
deferCommands: # main switch: only commands listed here are queued (default ['compact'])
- compact # leading / is optional
verbose: true # enable queueing/execution logs (default false)
pollIntervalMs: 250 # host-side idle-polling fallback interval, 50–5000 (default 250)
exposeState: true # authenticated route registered for the browser panel (default true; false = host only)
immediateCommands: # force immediate: unioned with the built-in list (since v0.2.2 no longer replaces it wholesale)
- export
alwaysImmediateCommands: # semantically equivalent to immediateCommands, also unioned
- my-control-command
deferCommands: []means no command is queued, equivalent to turning off queueing.- If a command appears in both
deferCommandsand a force-immediate list, force-immediate wins. - Why only
/compactis queued by default:/permission,/plan,/goal, etc. modify session state, and deferring them until the turn ends may render them completely ineffective; earlier versions that “queued everything except the immediate whitelist” caused this kind of regression, and the current default policy has been narrowed.
Typical Usage and Troubleshooting¶
Typical flow: type /compact while the agent is still busy → confirm it is queued in the command queue panel or via /cmdqueue → wait for the current turn to end → check the compact result in the transcript; the queue row disappears.
| Symptom | Key handling points |
|---|---|
| Panel still not visible after refresh | Use dev_plugin_status to confirm client ✓; if client ✗, it may be a negative cache of pkgMeta, restart the host |
| No hint in the transcript while queueing | By design: command/run is only written before the handler is invoked; the hint lives in the queue panel |
| Command never executes | It’s waiting for idle; if the inbox keeps receiving messages, idle windows get consumed — confirm via /cmdqueue or the panel |
/permission etc. don’t take effect while busy |
If still on an older rule version, upgrade to a version that only queues compact by default; check that state-changing commands were not mistakenly added to deferCommands |
On the development side you can run:
npm test # node --test tests/*.test.mjs
npm run check # node --check lib/index.js && node --check lib/client.js
npm run build # syntax check + full test suite
Use Cases and Caveats¶
Suitable for: users who frequently need /compact while a long agent turn is in progress but don’t want to repeatedly hit busy errors; teams that want to see in the UI “which commands are still waiting for idle.”
Notes:
- The plugin runs with the permissions of the current DSH host process. Before installing, please read the source and LICENSE (MIT) and evaluate the trust boundary yourself.
- The community catalog SkillHub plugin page and GitHub repository are published by the maintainer and have no official affiliation with DeepSeek / High-Flyer; the DSH ecosystem emphasizes “everything is a plugin,” and the facts in this article are based on the repository README and package.json (current package version 0.2.2).
Conclusion¶
dsh-command-queue fills the gap in DSH’s slash command channel where no queueing semantics exist while busy: by default it only defers /compact, and all other commands keep executing immediately; uninstalling restores the original behavior. For more implementation details see the repository’s docs/INTERNALS.md.
- Catalog page: https://www.skillhub.cn/plugins/kuyueliuhun-ctrl/dsh-command-queue
- GitHub: https://github.com/kuyueliuhun-ctrl/dsh-command-queue