dsh-jev-loop: Integrate Jev judgment at the DSH agent loop gate

Preface

In DeepSeek Harness (DSH), agents repeatedly call tools and advance multi-turn conversations. Common problems include: when the request itself isn’t clear enough, the model still guesses first and corrects later; dangerous or out-of-bounds tool calls lack unified interception before actual execution; tools return successfully but the task quietly doesn’t get completed; a conversation round ends prematurely, making the user think delivery has been completed. The community also has various guardrail or manual approval solutions, but they are either tied to specific UIs or only cover single scenarios.

Below we introduce dsh-jev-loop: it mounts Jev (TypeSafe System One) judgments on four standard events of the DSH agent-loop, not depending on any UI, and can be mounted into any Harness composition (headless or with UI). Maintainer is JWE24-code; the npm package name and plugin name are both dsh-jev-loop, current version 0.1.4, MIT license. The repository carries the dsh-plugin topic, indexed by market mechanisms such as dshfind, and has no official affiliation with DeepSeek / High-Flyer (幻方); the community directory is at the SkillHub plugin page.

What is this

In one sentence: dsh-jev-loop at four gates — agent/pre-step, tools/pre-execute, tools/post-execute, agent/turn-stopping — sends conversation snippets to the TypeSafe API for probabilistic judgment, and according to thresholds decides to inject prompts, log, ask, deny, block, or continue. The optional control panel moqi-jev-loop is published separately and only depends on the jevLoop service provided by this package; the core package itself has no UI dependency.

What the four gates do

Gate Event Jev Judgment Local Decision
Pre-step agent/pre-step whether the request is too vague inject “ask before guessing” type instructions
Pre-execute tools/pre-execute destructive, exfiltration, task deviation log / ask / deny
Post-execute tools/post-execute whether successful calls are silently omitted log / block with feedback
Turn-stopping agent/turn-stopping whether the request is truly completed nudge to continue or allow

The four gates automatically participate in the loop by default. Jev returns calibrated probabilities, and this package handles thresholds and actions; in cases of no API key, timeout, 429, malformed JSON, etc., it always fails open, so the judgment service being unavailable won’t block the agent loop.

Data flow and privacy

After enabling any gate, part of the conversation content will leave the local machine: sent to the third-party TypeSafe API (default https://api.typesafe.ai/v1/systemone, can be modified via baseUrl). Specifically: the name and parameters of each intercepted tool call (pre-execution), the output of each successful tool call (post-execution, along with the latest prompt), and the recent transcript used by pre-step and turn-stopping (prompts, model replies, tool results), with a per-request upper limit of maxStateChars. Files read by tools, command outputs, and sensitive information appearing in them will also be sent. To keep things local, set the corresponding *Enabled to false, or list tool names to skip in preExecuteSkip.

Compatible Harness versions

The README states support for 0.1.5-rc.x and 0.2.0 / 0.2.1; CI performs type checking against @deepseek-ai/dsh@0.1.5-rc.3, 0.2.0-rc.2, 0.2.1-rc.2. The peerDependencies range is consistent with this; newer Harness lines are considered untested until included in CI.

Installation and API Key

First install, then configure the key.

dsh plugin --profile <profile> add dsh-jev-loop

The key can be provided via environment variable TYPESAFE_API_KEY or TYPESAFE_APIKEY, or written to the TYPESAFE_API_KEY in the Harness credential store. In the configuration, apiKeyEnv (default TYPESAFE_API_KEY) can point to an environment variable, avoiding writing plaintext apiKey in the patch file.

Configuration entry point

Modify the dsh-jev-loop line in the profile’s cordis.patch.yml, or override it in the profile’s own patch layer. The cordis.patch.yml in the repository can be used as a reference. The default values of each *Enabled can also be overridden at runtime by moqi’s /JevLoop panel, and persisted to $DSH_HOME/jev-loop.json.

Summary of common fields (see README for the full table):

Field Default Meaning
preStepEnabled false whether to judge whether the request is underspecified before the first step
preExecuteEnabled true whether to judge risk before dispatching tools
preExecuteMode log log for observation only, ask for approval, deny for rejection
postExecuteEnabled true whether to check for omissions in successful results
turnStoppingEnabled true whether to check “is it really done” before the turn ends
maxStateChars 24000 hard upper limit of state sent to Jev
timeoutMs 3000 per-request timeout
auditPath $DSH_HOME/jev-loop.jsonl judgment audit JSONL

Cost and audit

Each judgment corresponds to one POST /v1/systemone; pre-execute asks about three types of risk in a single call. Transcript-type gates only send the most recent turnStoppingMaxMessages (default 14) messages. When the request body SHA-256 is the same, it uses an in-memory cache (default 500 entries), and repeated judgments are not billed repeatedly. Each judgment is written to auditPath, including probability, cache hit, latency, and tokens; when it exceeds auditMaxBytes (default 5 MiB), it rotates to jev-loop.jsonl.1, keeping the audit size roughly within twice the limit.

Typical usage

Mounting only the core bundle in an existing profile

To enable only this plugin and the base package in your own profile, you can write in the bundle list:

bundles: ['@deepseek-ai/dsh-base', 'dsh-jev-loop']

Self-testing with the throwaway profile provided by the repository

The maintainer provides the local build and temporary profile workflow in the README (you need to prepare TYPESAFE_APIKEY yourself):

npm install
npm run link-harness
npm run build
npm test
npm run install-profile -- jev-core
TYPESAFE_APIKEY=… dsh --profile jev-core

After running, you can view each judgment record in ~/.dsh/jev-loop.jsonl.

Suitable scenarios and notes

Suitable for teams that want to uniformly perform four types of judgment — “request clarification, tool risk, result completeness, whether the turn should stop” — in their DSH workflow, and accept calling the TypeSafe cloud API. Pre-execute can start with log observation, then switch to ask or deny; read-only or trusted tools can be listed in preExecuteSkip.

The plugin runs with the same permissions as the current dsh process, and judgment requests carry the actual content from tool parameters and outputs. Before installing, you should read the GitHub source code and MIT license to confirm that the scope of data leaving the local environment is consistent with your organization’s policy. For no-UI scenarios, you can use just this package directly; when you need graphical toggles, consider the separate moqi-jev-loop.

Conclusion

dsh-jev-loop connects Jev judgment to the standard gates of the DSH agent loop, with configuration centralized in the Cordis patch and optional $DSH_HOME/jev-loop.json, and fails open to avoid dragging down the main loop. Directory and documentation: SkillHub, GitHub, npm.

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

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

Xiaoye