DeepSeek Harness Plugin Hub

发布与管理完整 Harness Profiles,发现适合你的插件。

探索

插件目录环境预设文档中心动态

社区

发布插件联系我们报告问题

相关链接

Plugin Hub GitHubDeepSeek Harness 官方项目系统状态隐私说明
© 2026 DeepSeek Harness Plugin HubPowered byPaxTech

独立、非官方社区项目,与 DeepSeek 官方无隶属、授权或背书关系。

Tool Repair — DeepSeek Harness 插件(DSH Plugin)
← Plugins
T

dsh-tool-repair

Tool Repair

面向 DeepSeek Harness 的模式引导工具调用修复

插件会安装到这里;不确定时保持 web。

npx -y @deepseek-ai/dsh plugin --profile web add github:monotykamary/dsh-tool-repair#bbfdff52ece52729214390623a057ebae9682624
README兼容性版本

兼容性与来源证明

Tool Repair 以 dsh-tool-repair 发布,当前版本为 0.1.1。Plugin Hub 会校验它的 manifest,并保存精确安装来源,便于复现安装结果。

DSH 兼容范围
*
运行环境
any
发布来源
github
Registry 更新时间
2026/9/20

版本

0.1.1stable
2026/8/24
0.1.0stable
2026/8/24

相关插件

正在加载相关插件…

最新版
0.1.1
DSH
*
HMR
重启进程
Tree shaking
未声明可安全裁剪
解包体积
未提供
文件数
未提供
Surface
any
许可证
MIT
发布源
github
GitHub
★ 0
周下载
59
最近提交
2026/8/27
查看源码 ↗
README Badge

点击下方 Badge 复制 Markdown,粘贴到 README 即可。

这是你的 Plugin?认领权益 · 优先安全扫描

验证 package.json 声明的 GitHub 仓库,即可管理这个公开页面。认领后,Hub 会优先安排当前版本的安全扫描,并在通过后公开展示结果。

认领这个 Plugin →
报告问题
DeepSeek Harness Plugin Hub
ProfilesPlugins分类动态文档登录管理 Profiles
ProfilesPlugins分类动态文档登录

相关插件

继续浏览 developer-tools 分类下经过校验的插件。

Web App@deepseek-ai/dsh-web-appdsh 浏览器界面捆绑包:位于 dsh-base 之上的 Web 补丁层,加上运行时粘合插件(提供前端 dist、Web 界面提示符、bash 运行时变量和 URL 行)Sdk Minimal@deepseek-ai/dsh-sdk-minimal独立的最小 SDK 配置包:JSON-RPC、一个 DeepSeek 适配器、持久化 Shell 和 JSONL 会话Sdk App@deepseek-ai/dsh-sdk-appdsh SDK 配置包:基于 dsh-base 提供 stdio JSON-RPC 服务和进程生命周期管理Subagent Codex@deepseek-ai/dsh-subagent-codex基于官方 app-server 协议的一次性 Codex 子代理提供程序

README

🩹 dsh-tool-repair

Schema-guided tool-call repair for DeepSeek Harness

Validate first. Repair only what is unambiguous. Validate again before anything executes.

A malformed tool call passing through schema-guided repair into a validated DeepSeek Harness call


dsh-tool-repair is a native Cordis plugin and DSH bundle for provider outputs that almost form a valid tool call. It wraps the provider-neutral llm/stream waterfall, inspects finalized tool-call blocks against the exact schemas sent in that request, and commits a repair only when DSH's authoritative JSON Schema validator accepts the result.

The plugin is an external companion rather than one of the Harness monorepo's packages. The official DSH application pins the version it tests and layers the bundle into its shipped Web and Headless profiles, while this repository keeps its own release and maintenance cycle.

Why repair at this point?

flowchart LR
  Model[Model / gateway] --> Stream[DSH llm/stream]
  Stream --> Check{Exact request schema}
  Check -->|valid| Same[Byte-for-byte passthrough]
  Check -->|recoverable| Repair[Deterministic repair]
  Repair --> Recheck{Revalidate}
  Recheck -->|valid| Log[assistant/message + tool/call]
  Recheck -->|invalid| Reject[Fail closed]
  Log --> Runtime[DSH ToolRuntime]
  Runtime --> Policy[Policy + tool body]

Repairing after ToolRuntime starts would let the durable assistant message disagree with what executed. Repairing before the provider finishes would guess from partial JSON. The finalized block-end is the first point that has the complete call, the request's schema snapshot, and time to replace provider replay metadata before the agent loop logs the message.

What it repairs

Input problemBehavior
Valid argumentsReturned byte-for-byte unchanged.
Balanced malformed JSONRepaired through jsonrepair, then schema-validated.
GLM <arg_key> / <arg_value> wrappers at key or value boundariesStripped only for configured provider/model routes and only when the result validates.
Complete GLM key/value argument pairsDecoded when every key/value tag is complete and the remaining envelope names the same tool.
Optional property sent as nullRemoved when the property is not required and its schema rejects null.
Array/object sent as a JSON stringParsed when the property schema accepts the parsed collection.
Known alternate field nameRenamed only through an explicit per-tool alias map and only to a property in the live schema.

What it refuses to guess

  • Missing required operational values are never invented.
  • Unknown fields are never dropped to force validation.
  • Field names are never fuzzy-matched.
  • Truncated strings, objects, arrays, programs, commands, and file contents are never auto-closed.
  • A grammar marker in the middle of a value is not cut out. For a configured route, a residual marker is handed to a monotonic ToolRuntime guard and denied before the tool body.
  • Key collisions reject the candidate rather than choosing a winner.
  • Complete tool grammars leaked as ordinary assistant prose are not converted into tool calls. This package repairs finalized tool-call arguments, not free text.

These rules matter most for mutating tools: schema validity cannot prove that an auto-completed file body or command contains the model's full intent.

Install

Requirements: Node.js ^22.19.0 || >=24, pnpm 11 for this checkout, DeepSeek Harness ^0.1.0-rc.7, and Cordis ^4.0.1.

The package is included in the tested DSH distribution. For another profile or checkout:

# Registry install into one profile
pnpm dlx @monotykamary/dsh@0.1.0 plugin --profile web add dsh-tool-repair

# Local development checkout
pnpm install
pnpm run install:local

The local installer builds the package, records any dependency it replaces, links this checkout through the DSH plugin command, and verifies one active dsh-tool-repair row. It never starts or restarts DSH. Reload the selected profile after installation.

Other profiles, homes, and uninstall
pnpm run install:local -- --profile headless
DSH_HOME=/path/to/home pnpm run install:local -- --profile web
pnpm run install:local -- --skip-build
pnpm run uninstall:local -- --profile web

The uninstaller removes only a local link proven to belong to this checkout and restores the exact previous dependency specification.

Configuration

The bundle inserts one row with id dsh-tool-repair. A later profile patch can replace its config:

- id: dsh-tool-repair
  config:
    grammarLeakModels:
      - glm
    repairJsonSyntax: true
    dropOptionalNulls: true
    parseStringifiedCollections: true
    aliases:
      read:
        path: [file_path, filePath]
    debug: false
KeyBundle valueMeaning
grammarLeakModels[glm]Case-insensitive substrings matched against provider/model; only matching routes receive grammar-token handling.
repairJsonSyntaxtruePermit jsonrepair only after the input passes the balanced-container check.
dropOptionalNullstrueTreat schema-invalid null optional properties as omitted.
parseStringifiedCollectionstrueParse embedded JSON only where the property requires an array or object.
aliases{}Explicit tool → canonical field → aliases[] map. No aliases are implicit.
debugfalseLog tool identity, status, rule names, and bounded diagnostics; arguments are never logged.

An empty grammarLeakModels list disables marker-specific mutation while leaving schema-guided JSON and collection repairs active. Unknown config keys fail plugin loading.

Repair lifecycle

  1. Snapshot tool schemas from the immutable GenerateOptions request.
  2. Let the configured adapter produce its stream by calling next().
  3. Strictly parse each finalized tool call. An invalid input may use complete GLM-pair decoding or balanced JSON syntax repair.
  4. For configured grammar-leaking routes, normalize exact key/value boundary wrappers and reject residual markers or collisions.
  5. Apply explicit aliases and schema-directed optional-null or collection normalization.
  6. Revalidate against the request schema. A changed call is emitted only after validation succeeds.
  7. Drop the response replay envelope after any call changes because provider-private metadata describes the original content.
  8. ToolRuntime validates the repaired arguments again against the live definition and retains all normal policy, approval, timeout, sandbox, logging, and result behavior.

A tool definition can change while a response streams. Validation against the request snapshot establishes what the model was asked to produce; ToolRuntime's later validation against the current definition remains authoritative for execution.

Model Experience

Model-visible behavior

The plugin adds no prompt section and changes no tool schema. Valid calls and ordinary assistant text are unchanged. A recovered call proceeds as if the provider had emitted the canonical JSON. An ambiguous configured grammar leak returns a normal denied tool result explaining that the complete call must be regenerated.

Token effect

There is no steady-state prompt cost. A successful repair can avoid a full error-and-retry model round trip; an unrepairable call adds only the ordinary bounded tool error already returned by DSH.

KV Cache effect

None. The request prefix, tool schemas, and system prompt are untouched. Repairs affect only the newly generated assistant suffix.

Programmatic API

import { repairToolCall } from 'dsh-tool-repair'

const outcome = repairToolCall({
  name: 'read',
  arguments: '{"<arg_key>path":"README.md"}',
  schema: request.tools?.find(tool => tool.name === 'read'),
  grammarLeak: true,
  config,
})

if (outcome.status === 'repaired') {
  console.log(outcome.arguments)
}

The package also exports repairToolCallStream and BlockedCallStore for tested embedding. These APIs accept DSH's public message, schema, and stream types; they do not construct another registry or execution pipeline.

Development and release

pnpm install --frozen-lockfile
pnpm run check

# Inspect the exact npm payload; prepack runs the complete check again
pnpm pack --dry-run

# Release after the repository and npm metadata are ready
pnpm publish --access public

pnpm run check type-checks source, emits declarations and the ESM runtime bundle, runs the complete tests, and verifies built exports, bundle metadata, required files, and absence of Pi host dependencies or source-checkout paths.

Known limitations and deferred work

  • The plugin can only repair data exposed by a DSH adapter. An upstream library that throws before emitting a finalized block must be fixed in that adapter or provider parser.
  • Text-to-tool grammar recovery is deliberately absent; adding it requires preserving block order, call ids, finish reasons, and replay semantics across mixed prose and tool envelopes.
  • Route matching uses explicit case-insensitive substrings rather than regexes so invalid patterns cannot break plugin load or turn a broad expression into accidental mutation.
  • Schema-valid strings containing literal grammar tokens are indistinguishable from provider leakage without route knowledge. Configure grammarLeakModels narrowly, especially when an agent edits documentation about those tokens.

Relationship to the other projects

  • pi-tool-repair established the validate-then-repair strategy for Pi and supplies the provider-corruption corpus adapted here.
  • dsh-fabric owns Fabric's optional inferred run_code labels. Cosmetic label omission is resolved there; this package handles provider serialization corruption without fabricating missing work inputs.
  • dsh-fovea established the single-package external DSH bundle, package verifier, and ownership-safe local installer conventions.
  • DeepSeek Harness owns request schemas, session logging, ToolRuntime validation, policy, and execution.

License and acknowledgments

MIT © Tom Nguyen. See LICENSE and THIRD_PARTY_NOTICES.md.