omdsh-dev/dsh-tool-schema

DSH JSON Schema validation tool plugin: validate/paths/explain/normalize, zero network, zero dynamic execution.

Project Overview项目介绍

This is a DSH-native plugin that adds JSON Schema validation functionality to DeepSeek Harness. It can be installed via the official DSH plugin command: run dsh plugin --profile <web or headless> add github:omdsh-dev/dsh-tool-schema to add it to your DSH profile. It is compatible with DSH version 0.1.5-rc.1 and newer, and has passed full end-to-end validation on isolated local DSH instances. It provides four core actions for different use cases: validate, paths, explain, and normalize, each returning structured output matching RFC 6901 standards for error paths. It runs entirely offline with no dynamic code execution, making it secure for local use.

This tool is designed for both DSH plugin developers and regular end users. Developers can use it to validate plugin manifests, configuration files, and API response structures, while end users can leverage it to verify any JSON data exchanged during DSH agent sessions. To run a quick validation after installation, you can execute dsh run "Use the schema tool to validate {name: 'x', age: 3} against the given JSON Schema" to confirm it works correctly. All errors are sorted stably by instance path, schema path, and keyword to ensure consistent output across multiple runs. It cuts down on manual validation errors that often happen with complex nested schemas, letting agents rely on consistent structural checks.

This plugin is released under the open source MIT license, with no associated costs for commercial or non-commercial use. It has several built-in safety limits to prevent resource abuse: data and schema are capped at 256 KiB each, maximum nesting depth is 64 levels, and all pattern checks have a 1000ms hard timeout. Users are warned not to pass sensitive data to the tool, as all tool parameters are logged in the DSH session log. It requires no extra external dependencies beyond the base DSH installation, as missing peer dependencies are handled automatically by DSH. To build locally you need TypeScript and Vitest for testing, with 125 test cases covering all core functionality.

这是一个原生 DSH 插件,为 DSH 提供纯函数式的 JSON Schema 验证能力,支持验证数据、列出校验失败路径、解释 schema 约束、安全应用默认值。它全程不联网、不执行动态代码,内置多层安全防护,包括原型污染防护、正则执行超时限制、本地引用循环检测和大小深度预算控制,满足 DSH Agent 对 JSON 数据结构校验的需求。

插件面向 DSH 插件开发者和普通用户,可用于校验 API 响应、插件 manifest、配置文件、会话事件等任意 JSON 数据。使用时可选择对应操作:validate 输出完整验证结果,paths 仅返回失败路径,explain 静态解释 schema 约束,normalize 应用默认值后再验证,能根据不同使用场景灵活选择操作类型。

本插件遵循 MIT 许可证,已兼容 DSH 0.1.5-rc.1 版本,可通过 DSH 内置的插件命令从 GitHub 仓库一键安装,也可本地构建后通过 tarball 安装。它对输入数据有大小深度限制:数据和 schema 各不超过 256 KiB,嵌套深度不超过 64 层,使用时不要传入敏感数据。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 3 stars - very few users, little community feedback星标只有 3,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:omdsh-dev/dsh-tool-schema

把 omdsh-dev/dsh-tool-schema 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-tool-schema

English

DSH JSON Schema 验证工具插件 —— 验证数据、列出失败路径、解释 schema 约束、安全应用 default。零网络、零动态代码执行。

License

动机

Agent 需要验证任意 JSON 数据是否符合 schema(API 响应结构、插件 manifest、配置文件、会话事件),并定位失败路径。现有路径没有这个能力:

  1. defineTool 参数 DSL 是作者 DSL——面向插件作者声明工具参数,不是面向任意用户 schema 的通用验证服务
  2. dsh-tool-json 只提供查询——能取路径、能筛选,但不验证结构、不给 RFC 6901 失败定位
  3. 模型"目测"验证不可靠——复杂嵌套 schema(allOf/oneOf/$ref/pattern)组合下,手算通过/失败极易出错,且无法展示可验证的过程

本插件提供独立的纯函数 JSON Schema 验证内核:一次函数调用返回 verdict、路径化错误与 schema 问题。不执行任何代码、不访问网络,绝不静默忽略不支持的 schema 关键字。

安全模型

  • 零动态执行:验证内核是纯数据遍历,不构造 RegExp(pattern 在独立 worker 内执行)、不 eval、不访问网络、不读文件
  • 不支持关键字绝不静默忽略:报告 unsupported-keyword schema issue;strictSchema=true(默认)直接失败(valid:false / complete:false),strictSchema=false 验证已支持子集(valid:null / complete:false / supportedSubsetValid)
  • ReDoS 防线:所有 pattern 校验在可终止的 worker 线程内共享 1,000ms 硬预算,超时 terminate() 并报错——灾难性回溯不能阻塞宿主进程;pattern ≤ 16 KiB、每 schema ≤ 100 个
  • 原型污染防护:所有对象访问用 Object.hasOwn,__proto__ / constructor / prototype 只作为普通 JSON 键处理
  • $ref 安全性:仅支持本地引用(# 与 #/$defs/<token>,RFC 6901 转义);目标必须存在;环检测(schema-check 静态报告 ref-cycle + 验证期 (schemaNode, instance) 栈动态兜底)
  • 预算:
    • data / schema 各 ≤ 256 KiB(超限直接报错)
    • 嵌套深度 ≤ 64、schema 节点 ≤ 10,000、遍历节点 ≤ 100,000
    • 错误 100(默认)/ 1,000(上限);$ref 链 ≤ 64
    • canonical 输出 ≤ 1 MiB(超限截断 errors/schemaIssues 等并置 truncated)
  • 工具参数会记入会话日志,不要传入敏感数据

工具声明

注册 schema 工具(@deepseek-ai/dsh-tool-schema,row id tool-schema),统一输出 JSON 文本字符串。

action 作用 输出
validate 验证 instance 是否符合 schema verdict + RFC 6901 instancePath/schemaPath 错误(稳定排序)+ schemaIssues + checkedNodes + truncated
paths 只返回失败路径 paths(path + 关键字摘要)+ errorCount + truncated
explain 静态解释 schema 约束 约束树节点序列(nodes,有限列表非自然语言长文)+ schemaIssues + truncated
normalize 深拷贝 + 应用显式 default 后验证 appliedDefaults(path + value)+ warnings(default-invalid / normalize-skip-branch)+ 完整 validate 结果
参数 类型 必填 说明
action string ✅ validate / paths / explain / normalize
data json 待验证实例(validate/paths/normalize 必需;null 是合法数据)
schema json ✅ JSON Schema(boolean 或 object;draft 2020-12 子集)
strictSchema boolean 不支持关键字时失败。默认 true
maxErrors integer 最大错误报告数。默认 100,范围 1..1,000

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-tool-regex 下一个 Next dock-editor →