JingCha (dsh-jingcha): DSH Runtime Monitoring and Per-call Force Stop

Preface

When running agents in DSH, the interface often only displays “Running”, making it difficult to distinguish whether the task itself is slow, the process is hung, stuck in approval, or has entered an error storm. To stop a runaway tool call, you often can only stop the entire round, and other normally in-progress calls get terminated together. DeepSeek Harness adopts the “everything is a plugin” extension approach; the community directory SkillHub has no official affiliation with DeepSeek / 幻方. Below we introduce 鲸察 (dsh-jingcha) released by maintainer QTATQ233: it performs read-only observation of the tool pipeline at runtime, provides judgments and reasons, supports forced stop by callId, and provides a traffic light status widget in the bottom-right corner of the Web console. By default it does not register tools to the model, occupying 0 model token.

What Is This

鲸察 is a DSH plugin categorized as “workflow”, with repository address github.com/QTATQ233/dsh-jingcha. The current package version is 0.5.1, license MIT, runtime zero npm dependencies, requiring Node ≥ 18.

It solves three types of problems: a lack of actionable diagnosis when tool calls have no feedback for a long time; the need to precisely terminate a single call rather than the whole round; and a lack of structured context for post-mortem review. Monitoring data is written to the local directory (default %DSH_HOME%\data\dsh-jingcha), with no network access and no dynamic execution of third-party code.

Core Features

Monitoring and Judgment

The plugin performs read-only observation at three layers—tools/pre-execute, tools/execute, and tools/result—recording duration, result bytes, and error classification. Built-in judgments include: slow, hung, stuck, silent (an agent is running but produces no output), waiting for approval, error storm, memory leak warning, and plugin’s own errors. Since 0.5.0, judgment rules are orchestratable: the 8 built-in rules can be disabled by id via disabledRules, and third parties can register rules via monitor.registerRule({ id, evaluate }).

Default thresholds (modifiable in configuration) are as follows:

Judgment Default condition
Slow Single call exceeds 30s (slowCallMs)
Hung In-flight exceeds 2min (hangCallMs)
Stuck In-flight exceeds 5min (stuckCallMs) and no output during that period
No output An agent is running but no streaming frames / session events / tool results within 90s (silenceMs)
Waiting for approval pre-execute stuck in approval for more than 20s (approvalWarnMs)
Error storm 3 consecutive failures (errorStormCount)
Memory leak warning RSS increases for 5 consecutive heartbeats with an increase exceeding 10%

State priority is: stalled > erroring > degraded > busy / ok, avoiding minor alerts drowning out “stuck”-type issues.

Force Stop by Call

At the pre-execute stage, the plugin registers a 鲸察-owned AbortController for each call and replaces exec.signal, fused with the DSH upstream callerSignal; upstream cancellation semantics remain unchanged, and the plugin can also actively cut off. Nested sub-calls (parent id plus :ptc: sequence) can also be registered. Each in-flight call in the panel carries a force-stop button; it also supports “stop stuck ones” and “stop all rounds” (with secondary confirmation). A successful force stop writes a kill.forensics event for review in events.jsonl.

Widget and Local API

The Web side injects a draggable “capsule”: color-coded by call duration (green / yellow / red), with full text visible on hover, shortcut key Ctrl+Shift+J. The details panel contains collapsible sections for judgment, in-flight calls, recent alerts, settings, and timeline. Four HTTP endpoints (status / kill / stop / settings) listen only on loopback addresses, with a Host whitelist and rejection of cross-site origins; change-type requests only accept POST JSON. An optional apiToken requires the request header x-jingcha-token.

Persistence and Zero Token

  • status.json: atomically replaced snapshot.
  • events.jsonl: append-only event stream, auto-rotating when exceeding 8MB (about 16MB cap).
  • Default toolEnabled: false, so the model context cannot see the plugin tool; if enabled, the README explains about 176 tokens of tool description per request and about 0.5k tokens of report per query.

Installation and Activation

After installing via the official channel, restart dsh is required:

dsh plugin --profile web add github:QTATQ233/dsh-jingcha

The repository also provides tools/install.ps1 (junction + profile manifest modification, with automatic backup before changes and full rollback capability). Before installing, uninstalling, or sharing data, refer to the repository’s docs/SHARING.md.

You can also run a repository self-check without starting dsh:

node test/verify.mjs          # 179 items
node test/verify-client.mjs   # 111 items (widget, DOM stub)

Configuration Essentials

Configuration is concentrated in cordis.patch.yml (items have Chinese comments beside them). Common keys:

Key Default Description
dataDir %DSH_HOME%\data\dsh-jingcha Data directory
displayName 鲸察 Console prefix and report title
toolEnabled false Whether to register a query tool to the model
slowCallMs / hangCallMs / stuckCallMs 30s / 2min / 5min Slow / hung / stuck
autoKillAfterMs 0 (off) Auto force stop; also requires no output
previewArgs / redactPreviews true / true Argument summaries and sensitive fragment masking
apiToken empty Recommended for multi-user machines

Typical Usage

  1. After installing and restarting dsh, open the Web console; a status capsule should appear in the bottom-right corner. When there are in-flight tool calls, it will show a summary like “pwsh 1m33s”.
  2. If judged as “waiting for approval”, go to the interface to complete confirmation, avoiding misjudgment as frozen.
  3. If judged as “stuck” or a single call is abnormally long, open the panel to view the in-flight list, click force stop for the target callId, or batch “stop stuck ones”.
  4. When a review is needed, read events.jsonl under dataDir; before sharing, note that it may contain tool argument summaries (default truncated and masked—still recommended to manually review, or set previewArgs: false).

The widget supports ?session= session-dimension filtering; since 0.5.0, the panel contains a mini timeline of about 5 minutes.

Applicable Scenarios and Notes

Suitable for: Developers who run tool chains for long periods under a local or single-machine Web profile and need to visualize “slow / hung / stuck / no output / approval / error storm” and precisely stop losses.

Notes:

  • The plugin runs with the current dsh process’s permissions; before installation, review the source code and the MIT license yourself—do not trust third-party plugins without checking.
  • The loopback API may still be reachable by other processes/accounts on this machine; set apiToken on shared machines.
  • Same-process infinite loops that ignore exec.signal cannot be hard-killed by signals; in nested scenarios, if only the parent call is running, the plugin will refuse to mistakenly kill the parent call.
  • Monitoring paths are wrapped in safe(); plugin exceptions are only logged in pluginErrors and do not rewrite tool results.

Architecture, state machine, and interface Schema are documented in the repository’s docs/ARCHITECTURE.md and SECURITY.md.

Conclusion

鲸察 turns DSH runtime tool calls, the event loop, and error patterns into readable judgments and actionable force stops, with default 0-token observation, making it suitable as a “runtime health check” plugin on the workflow side. Directory page: skillhub.cn/plugins/QTATQ233/dsh-jingcha; source code and documentation: github.com/QTATQ233/dsh-jingcha.

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

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

Xiaoye