Preface¶
When running agents in DeepSeek Harness (DSH), a common requirement is to “wait for logs to finish writing, wait for the build to complete, or wait for a message pushed from a remote source” before allowing the model to proceed to the next step. Relying solely on the model to repeatedly poll files or command outputs wastes turns, interrupts its train of thought, and makes it difficult to visualize “what is currently listening” at a glance in the Web interface.
Below is an introduction to the community plugin dsh-tool-monitor (npm package name @caizhiyuan/dsh-tool-monitor, repository substitute525/dsh-tool-monitor). It listens to files, command output, or WebSockets in the background on the host side. When new output is detected, it wakes up the owning session according to rules and provides a listener list and output viewer panel in the Web session header. It is maintained by substitute525, categorized under workflows, and licensed under MIT.
What is this¶
dsh-tool-monitor is a dsh-plugin bundle that declares dsh.bundle.patch: once installed into a profile, it automatically inserts a profile layer without the need for manual modification of the profile’s cordis.patch.yml. The host module handles listening and waking; the Web client half registers a “N listeners” widget in the session header.
Listener state is stored in a plugin-owned Map (IDs are formatted as monitor-N) and is not written to the framework’s ctx.jobs. Therefore, it does not appear in DSH’s built-in “Background Tasks” list—this is an intentional design choice to separate it from the framework’s task list.
Core Features¶
Three Listening Sources¶
Monitoring is initiated in the background via the monitor_start tool, which immediately returns a monitor_id, allowing the main flow to continue execution:
| source | Meaning |
|---|---|
file |
Polls for file changes |
command |
Listens to command stdout/stderr (kills the background process upon stopping) |
ws |
Outbound WebSocket client, event-driven (does not rely on interval_ms) |
By default, it triggers a wake-up when any new output is detected; pattern (JavaScript regex) can be used to restrict triggering to only matching output.
WebSocket (ws) mode key points (from README):
- text frame → one event; multi-line frames are kept as a whole and not split.
- binary frame → reports only
[binary frame, N bytes]; content is not passed through. - socket close → ends monitoring and displays close code (
1000/1001recorded ascompleted;1006/1011recorded asfailed). - Errors/exceptions surface before closing and are not subject to
patternfiltering. - Optional
protocolsarray for negotiating sub-protocols per RFC 6455.
Four Model-Visible Tools¶
Registered at the host layer, available to all sessions in all presets:
monitor_start— Starts listening. Key parameters:source(file|command|ws),path/command/url,protocols(optional for ws),duration_seconds(0 means continues until session or plugin stops),interval_ms(default 3000, ignored for ws),pattern,initial_snapshot(uses existing file content as the first batch),one_shot(auto-stops after first trigger),max_chars(tail-retained buffer size, default 4000).monitor_read(id)— Incremental read (consumes cursor, semantics same asjob_output).monitor_stop(id)— Stops monitoring.monitor_list()— Lists listeners visible to this session.
Web Session Header¶
Provides a “N listeners” widget: clicking it reveals the status dot, duration, details, and stop button for each listener; clicking a row displays retained output on demand. The client polls the host /tool-monitor/list approximately every 2s (preferring connection.rpc, otherwise same-origin fetch); when the listener list changes, the host also pushes { type:'snapshot', monitors:[...] } via a dedicated WebSocket endpoint /tool-monitor/ws. Output is not downloaded via push—viewing inline output on the Web side goes through the read method of the /tool-monitor RPC (retained window, non-consuming); the model side uses monitor_read.
Wake-up Mechanism¶
Constructs a UserMessage (a notice with source plugin:tool-monitor). If the owning agent is idle, it is immediately woken via followup; if busy, the notification enters a plugin-owned queue. Once that owner becomes idle, notifications are grouped by monitor and merged into a single followup to be sent. This avoids being interrupted repeatedly while busy, and there is no upper limit on wake-up count. agent/disposed or plugin unloading will stop all its listeners.
Installation and Activation¶
This package is a complete bundle; installation commands follow the README:
# Install from npm
dsh plugin --profile web add @caizhiyuan/dsh-tool-monitor
For development, you can link from source (example path follows README; restart dsh after modifying the host):
dsh plugin --profile web add link:W:/图南/dsh-tool-monitor
Restart dsh after installation (for host modules and new client bundle to take effect; for the client part, a page refresh is sufficient). dsh plugin add writes the package name into dsh.profile.bundles in profiles\web\package.json and validates that the patch pointed to by dsh.bundle.patch is resolvable.
Prerequisite: The profile needs to have composed webServer (default for the Web version). In headless environments without webServer, the four tools on the model side are still available, but there are no Web header widgets or WS pushes.
The version in current materials is 0.5.1 (see repository package.json).
Typical Usage (Workflow)¶
The README does not provide complete conversation examples, but the tool parameters are sufficient to reproduce common flows:
- The model calls
monitor_start, e.g., monitoring a build log file with apatternmatchingBUILD SUCCESS, or running a long command withsource: 'command', or connecting to a local/intranet WS service withsource: 'ws'. - The session receives a notice-type followup when idle or transitioning from busy to idle, summarizing which monitor has new output.
- The model uses
monitor_read(monitor_id)to pull incremental content for continued reasoning; callsmonitor_stop(monitor_id)when finished. - The human opens the listener list in the Web header, clicks a row to view retained output or manually stops it.
If initial_snapshot: true is set for a file source, the existing file content is used as the first batch of events, suitable for scenarios where you “start listening first, then tail increments”. one_shot: true is suitable for one-time waits where you “stop once the first match is found”.
Use Cases and Notes¶
Suitable for: Local/CI log tailing, long command stdout waiting, WebSocket push-driven automation steps, and workflows requiring side-by-side viewing of multiple listener statuses in the Web UI.
Notes:
- The plugin runs with the current dsh process privileges;
commandandfilepaths, as well aswsURLs, are subject to these privileges. Read the source code and MIT license before installation to ensure the monitoring targets are trusted. commandmonitoring terminates child processes onmonitor_stopor session cleanup to avoid orphan processes.- The dedicated WS endpoint performs loopback verification, rejecting non-local sources.
- The community directory SkillHub Plugin Page and GitHub repository are maintained by the community and have no official affiliation with DeepSeek / High-Flyer; the DSH ecosystem philosophy is “everything is a plugin”. The facts in this article are based on the repository README and
package.json.
Conclusion¶
dsh-tool-monitor separates “waiting for output” from polling turns: it listens to file / command / WebSocket in the background, wakes the session according to rules, and centrally displays listeners and on-demand output in the Web header. If you are working with build, log, or WS-driven workflows in a DSH Web profile, you can install @caizhiyuan/dsh-tool-monitor (0.5.1, MIT) using the command above. After restarting, combine it with the four monitor tools and the header panel for use.
- Directory Page: https://www.skillhub.cn/plugins/substitute525/dsh-tool-monitor
- GitHub: https://github.com/substitute525/dsh-tool-monitor