dsh-session-insight: DeepSeek Harness Session Health Insights

Introduction

One of the core capabilities of DeepSeek Harness (DSH) is projection, which is used to observe session state. The existing sessionStats provides basic counts, but it is difficult to directly answer the question, “Is the current session healthy?” The dsh-session-insight plugin supplements key metrics such as steps, tool calls, failure count, repeat count, and failure rate via a read-only session health status bar. It exists as a sessionInsight projection unit and is displayed as a card above the input box.

Core Features

This plugin focuses on real-time health monitoring of the session and possesses the following capabilities:

  1. Health Status Bar
    Displays a set of read-only data above the input box: steps, tool calls, failures, repeat calls, and failure rate.

  2. Projection Unit Implementation
    Implements the sessionInsight projection unit, passing calculation results to the client via wire.view.

  3. Event Collapsing
    Collapsing the following events internally to avoid sending unnecessary changes to the client:

    • assistant/message: Extracts tool call information.
    • tool/call: Records dispatched calls.
    • tool/result: Records results and error status.
    • step/end and turn/end: Session cycle termination events.
  4. Failure Rate Calculation

    • Formula: Failure Rate = Number of failed tool/result events ÷ Number of dispatched tool/call events.
    • Boundary: Calls intercepted by ctx.tools.guard() are not counted in the denominator or the numerator, reflecting the health status of “dispatched calls.”
  5. Display Precision Strategy
    Dynamically adjusts the display format based on the sample size to avoid over-interpretation of small samples:

    • Sample Size < 10: Displays raw scores (e.g., 1/3, 0/5), preserving precision and sample size information.
    • Sample Size ≥ 10: Displays percentages (e.g., 8.6%), reducing digits for readability.
    • Sample Size = 0: Displays a dash (—).

Installation and Activation

The plugin is released via GitHub repository and does not support the npm channel.

Web Profile

The Web Profile supports the standard CLI installation method:

& $dsh plugin --profile web add github:Elari39/dsh-session-insight

After installation, you need to add "dsh-session-insight" to the dsh.profile.bundles array in ~/.dsh/profiles/web/package.json and then restart DSH.

Desktop Profile

The Desktop Profile is exclusive to Electron and cannot use the dsh plugin command. You need to run the installation script provided with the plugin:

pwsh -File .\install.ps1

Verifying Loading

After restarting the application, the health status bar should appear above the input box. You can also request the load directly via the browser to test:

/plugins/??dsh-session-insight/client.js&rev=<rev>

If it returns 200, the browser-side loading was successful; a 404 usually implies the Host-side was not mounted correctly.

Notes

  1. Desktop Profile Limitation: The Desktop Profile must be installed via install.ps1 and cannot use the dsh plugin command.
  2. Process Exit: You must completely exit the Electron application before any plugin installation or configuration modification operations.
  3. Production Environment: It is recommended to pin to a fixed version (using a tarball URL) to avoid incompatibilities caused by subsequent updates.
  4. Dependency Limitation: The client component only allows require('react') and cannot import other first-party UI libraries, otherwise it may cause Slot crashes. The plugin returns null when useProjection is unavailable, ensuring safe degradation.
  5. Release Status: Currently, this plugin is only released on GitHub; the npm channel has not been released yet.

Summary

dsh-session-insight provides a lightweight session health monitoring layer, separating calculation logic from the view via the projection mechanism, and optimizes display strategies for small sample scenarios. This is a practical auxiliary tool for developers who need to deeply analyze agent operation status.

Plugin Directory
GitHub Repository

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

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

Xiaoye