Foreword¶
In DSH development and operations scenarios, interactions with Hermes often involve asynchronous task dispatch. If invoked directly, issues such as delayed state synchronization or concurrency conflicts may easily occur. dsh-task-queue provides a queue hub that uses file-based state management (queue.json) to coordinate task dispatch, execution, and feedback between DSH and Hermes.
What It Is¶
This is a cached tiered task queue for DSH↔Hermes collaboration, maintained by nicecx. It treats queue.json as the single source of truth, uses a lease/claim model to manage the task lifecycle, and provides anti-starvation mechanisms and mutex locks to ensure orderly task scheduling.
Core Capabilities¶
- Single Source of Truth:
queue.jsonis the only trusted source of task state; all operations are based on this file. - Three-Level Priority Queue: Tasks are divided into three tiers:
reset(restart),approve(approval), andreview(review); the priority order is reset > approve > review. - Lease/Claim Model: The consumer side (Hermes side) executes tasks by claiming them, avoiding duplicate processing.
- Anti-Starvation and Atomic Locks: Supports priority aging algorithms to prevent low-priority tasks from being blocked; combined with an atomic busy-mutex to ensure safety under high concurrency.
- Consumer Side: The Hermes-side cron scheduled tasks (monitoring gatekeeping) are responsible for dequeueing and execution.
Typical Usage¶
This plugin works with application-layer plugin protocols; the typical flow is as follows:
dsh-auto-approver(审批)──┐
dsh-design-review(评审)──┼──入队──▶ dsh-task-queue ──▶ 消费端 ──▶ Hermes
dsh-reset-handoff(重启)──┘
- Approval Flow:
dsh-auto-approverputs requests into theapprovetier. The approval channel uses a fast-lane synchronous direct call and shares the busy lock. - Review Flow:
dsh-design-reviewputs requests into thereviewtier. After the consumer dequeues a task, it writes to the single-slotrequest.json; after review by Hermes, routing is performed bysessionId. - Restart Flow:
dsh-reset-handoffputs requests into theresettier (highest priority). After passing the gate, the task invokesreset_agent.py.
Shared Mechanisms¶
The plugin provides a set of shared mechanisms to ensure environment consistency:
* Mutex Lock: Shares the .hermes-busy file to serialize Hermes invocations and prevent concurrent conflicts.
* Single Numbering Source: Serves as the single numbering source for requestId, ensuring unique numbering in scenarios such as docs/ scanning.
Installation and Enablement¶
The plugin is released under the MIT license. Since no specific installation commands are provided, refer to the source repository for integration.
Notes¶
- Runtime Permissions: The plugin runs with the permissions of the current DSH process. Before deployment, review the source code logic and license.
- Fault-Tolerance Strategy: The plugin follows a fail-closed strategy; in exceptional cases, it prevents tasks from continuing to flow.
- Documentation Reference: For detailed collaboration contracts, refer to “2.5 Architecture Overview” (
~/.dsh/DSH-HERMES-CONTRACT.md).