Preface¶
The write path of DeepSeek Harness (DSH) is relatively permissive, but the read path is strict: once a tool output or session event fails to conform to the kernel contract, the failure often falls upon the entire session—history loading errors and unexplainable logs, rather than just “this one record is broken.” The community already has pre-release audits for plugin repositories (e.g., omdsh-dev/dsh-plugin-check, covering 33 items including manifests, patches, and packaging). However, after plugins are installed into a profile, output.render() in the registry and session event types written at runtime may still quietly harbor risks.
Below is an introduction to the plugin dsh-contract-check under the workflow classification by maintainer imtokenxinluo: it does not check for malware or intercept execution; it specifically answers “do the currently installed plugins violate DSH kernel contracts?”. Externally, it only issues log warns and optionally displays a zero-token “health check” status at the session header.
What is this¶
dsh-contract-check is a contract compliance check plugin for DSH (GitHub: imtokenxinluo/dsh-contract-check). Its positioning can be summarized as:
- Scan Target: The running tool registry (after installation), rather than just scanning the source tree.
- Check Scope: Two hard contracts—
output.render()should returnContentBlock[](not strings, etc.); and session event types must fall within the kernel’sKNOWN_SESSION_EVENT_TYPESvocabulary. - Behavior: Warns only, does not block any operations; does not register model tools, consuming zero tokens per conversation turn.
It complements dsh-plugin-check: the latter is more suitable for checking packaging and ecosystem compliance before release; this tool focuses on the period after installation, monitoring those two types of issues that “can cause the session to fail to open,” and can still read registry definitions for minified or source-less plugins.
Core Features¶
1. render Contract¶
The kernel requires output.render() to return ContentBlock[]. If it returns a raw string, etc., the loader may throw a SessionPersistenceCorruptionError, causing the entire session history to fail to load (README cites incidents related to dsh-ssh-ops around September 2026 as an example).
Check methods include:
| Method | Approach | Limitation |
|---|---|---|
| Static | Read render source code to see if return is an array |
Often cannot see through shell functions wrapped by defineTool |
| Probe (Enabled by default) | Create legal fake data based on output.schema and actually call render once |
Throws exception if fake data doesn’t match shape → classified as unknown, does not false-report as violation |
Static analysis can only report unknown for most serious plugins; the README emphasizes that probing is essential, but it can be turned off via configuration (probeRender: false).
2. Session Event Type Vocabulary¶
The loader refuses to interpret the entire log for unknown event types that are not marked as ignorable. README explanation: plugins cannot set ignorable via Session.append; if custom types are not registered in the host-side KNOWN_SESSION_EVENT_TYPES, the user’s session may fail to open. The plugin subscribes to session/event during runtime and warns immediately upon finding types outside the table; the wording is “appears to be outside the vocabulary, please confirm if registered,” because it is impossible to see at runtime whether the author has registered it via modifying the Set or other means.
3. Tri-state Judgment and GUI¶
| Judgment | Meaning |
|---|---|
ok |
Return value form is correct |
violation |
Confirmed return of string / non-array / undefined, etc. |
unknown |
Inconclusive—prefer unknown over violation |
After installation into the profile and restart, a “Health Check” button (colored dot + text) appears at the session header. Green: verified with 0 violations; Yellow: has violations; Gray: not yet checked, cannot enumerate, or all are inconclusive. Status is provided via same-origin HTTP GET /contract-check/status and POST /contract-check/audit; the client artifact requires a local npm run build to generate lib/client.js, otherwise DSH may report client bundles not found.
4. Offline CLI (No need to run DSH)¶
dsh-contract-check scan <file_or_directory>
dsh-contract-check package <package_directory>
dsh-contract-check vocab
scan: Recursively scan source code for render definitions.package: Lightweight check to see if npm packaging missed files required bypackage.jsondeclarations (for the full 33 items, usedsh-plugin-check).vocab: Print the embedded vocabulary version and entry count.
When a violation is found, the CLI exit code is 1, facilitating CI.
What it explicitly does NOT do¶
- Does not detect intentional poisoning, theft, or backdoors; the in-process inspector has the same permissions as a malicious plugin.
- Does not register model tools or inject prompts; the only common external output is
ctx.logger.warn(...).
Installation and Activation¶
The method provided in the official README is to write into the profile’s package.json dependencies and bundle list (not commands like dsh plugin add):
// profiles/<profile>/package.json
{
"dependencies": { "dsh-contract-check": "^0.1.0" },
"dsh": { "profile": { "bundles": ["...", "dsh-contract-check"] } }
}
For local development, the dependency can be written as link: pointing to the repository path; after modifying client source code, you need to re-run npm run build before restarting DSH. Package metadata requires Node >= 22.
Once enabled, the plugin will: enumerate ctx.tools.view() for checks upon loading; listen for tools/change and session/event; register web status routes for the header button. Service dependencies are lazily injected via ctx.inject to avoid silent failures when tools / webServer are not ready.
Typical Usage¶
In-process Health Check: Add to the profile as per the previous section, restart DSH, and observe the “Health Check” status at the session header; click the button when an immediate re-check is needed (duplicate requests while running will return 409 to avoid stacking scans).
Offline scan render before releasing or modifying plugins:
dsh-contract-check scan ./src
Check if your own npm package will miss patch / exports targets:
dsh-contract-check package .
Verify the embedded event vocabulary:
dsh-contract-check vocab
Use Cases and Notes¶
Who is it for
- Users who have installed multiple DSH plugins in their profile and want to confirm with low cost if there are contract risks that “break session history.”
- Scenarios requiring a zero-token badge but do not want to register model tools like
plugin_checkfor the inspector itself. - Maintainers of plugin repositories using CLI for static render scanning or lightweight package checks (deep release audits should still use
dsh-plugin-check).
Must Know
- The plugin runs with the current DSH process permissions; read the source code and the MIT license (see repository
package.json) yourself before installation. - A warning does not equal malice; no warning does not equal a passing security audit. The same organization’s README also mentions tools with different divisions of labor such as
dsh-session-healthanddsh-security-audit. - The community plugin directory is an independent site SkillHub Entry, with no official affiliation with DeepSeek / High-Flyer.
Conclusion¶
dsh-contract-check turns the two kernel contracts of “post-installation”—render return form and session event vocabulary—into a zero-token, warning-only health check: it monitors the registry and real-time events in-process, and the CLI can scan source code and packaging omissions offline. For full ecosystem checks before release, continue to use mature tools; to prevent “the entire session failing to open” after installing plugins, you can use this for daily supplementary coverage.
- Directory Page: https://www.skillhub.cn/plugins/imtokenxinluo/dsh-contract-check
- Source Code & Docs: https://github.com/imtokenxinluo/dsh-contract-check