Introduction

DeepSeek Harness (DSH), when handling model tool calls, sometimes encounters malformed parameters in the model output (such as nested {"arguments":{…}} wrappers). If these parameters are persisted as-is, the model may imitate the error during the next round of history replay, causing the call chain to become increasingly malformed. The dsh-tool-args-unwrap plugin intercepts and corrects these parameters at the llm/stream waterline, blocking the generation and propagation of bad examples at the source.

Overview

Plugin Name: dsh-tool-args-unwrap
Maintainer: shy19805
Core Value: Fixes malformed tool parameters produced by the model on DSH’s llm/stream pipeline, preventing bad examples from entering the history.

Core Features

  1. Fix malformed parameters: Handles nested arguments wrappers, key aliases (such as args, parameters), and parameter key aliases (such as skill_name, name).
  2. Full-chain repair: Intercepts before parameter persistence, resolving malformed parameter issues across the three stages of execution, persistence, and history replay.
  3. History session correction: Version v0.3.1 adds correction capability for the input side of legacy sessions. Before requests are sent to the model, it corrects existing malformed parameters in the history in place, preventing the model from continuing to imitate errors.
  4. Host validation: Relies on the host’s validateJsonSchemaValue validator, ensuring that corrected parameters meet schema requirements.
  5. Silent handling: For tools without required parameters, the plugin silently swallows extra wrapper layers, avoiding errors caused by wrappers.

Installation and Activation

Install by configuring dependencies and bundles in the profile’s package.json.

// <profile>/package.json
{
  "dependencies": { "@dsh-external/dsh-tool-args-unwrap": "link:/abs/path/to/dsh-tool-args-unwrap" },
  "dsh": { "profile": { "bundles": ["@dsh-external/dsh-tool-args-unwrap"] } }
}

Once configured, restart DSH for the changes to take effect.

Verification and Debugging

  1. Confirm it is in effect: Check the state.json file in the plugin directory and confirm listenerRegistered: true.
  2. Temporary disabling: Set enabled: false in the configuration to completely disable stream rewriting without uninstalling the plugin.

Notes and Limitations

  • Repair scope: The plugin only fixes parameter “shape malformations” (such as an extra wrapper layer), not semantic omissions (for example, the model actually failing to include a required field).
  • Cross provider: Real-world reproduction across providers has not been fully completed.
  • Fundamental fix: The plugin is a pluggable implementation reference. The fundamental fix should be on the host side (schema validation + normalization of tool-call parameters before persistence).

References