DeepSeek Harness Plugin Hub

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

探索

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

社区

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

相关链接

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

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

Tool Regex — DeepSeek Harness 插件(DSH Plugin)
DeepSeek Harness Plugin Hub
ProfilesPlugins分类动态文档登录管理 Profiles
ProfilesPlugins分类动态文档登录
← Plugins
T

@deepseek-ai/dsh-tool-regex

Tool Regex

DSH 正则表达式工具:在文本上进行测试、查找和替换,并提供静态模式解释;零依赖,带有 ReDoS 防护

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

npx -y @deepseek-ai/dsh plugin --profile web add github:omdsh-dev/dsh-tool-regex#928c6505416a6ce162612db0d2e5bd687f3823b6
README兼容性版本

兼容性与来源证明

Tool Regex 以 @deepseek-ai/dsh-tool-regex 发布,当前版本为 0.0.1。Plugin Hub 会校验它的 manifest,并保存精确安装来源,便于复现安装结果。

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

版本

0.0.1stable
2026/8/20

相关插件

正在加载相关插件…

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

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

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

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

认领这个 Plugin →
报告问题

相关插件

继续浏览 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-regex

English

DSH 正则工具插件 —— 测试匹配、提取捕获组、安全替换、静态解释正则含义(不执行任何代码)。零依赖、纯函数。

动机

模型经常需要验证用户给的 pattern、从日志/文本中提取字段、做文本替换。"心算"正则结果错误率极高,且无法给用户展示可验证的过程。现有替代是起 bash 进程跑 node -e 或 python——进程开销 + 模型现写脚本的正确性风险。内置 grep 只能做文件域搜索,无法对任意文本测试/提取/替换/解释。

本插件提供确定性正则工具,其中 explain 是差异化能力:静态解析 pattern 结构并给出人读解释,不执行匹配,天然免疫 ReDoS。

安全模型(ReDoS 多层防线)

JS 正则的灾难性回溯是真实威胁(如 (a+)+$ 配合超长输入)。防线:

  1. worker 硬超时:test/find/replace 在可终止的 worker 线程内同步执行,1,000ms 预算到期 worker.terminate() 并返回 regex: execution timed out——灾难性回溯不再能阻塞宿主进程(工具管道的 timeoutMs 对同步阻塞体是协作式,仅靠它不够;worker 内会再次执行全部上限校验)
  2. 输入长度上限:64,000 字节(UTF-8)——超限在入口直接拒绝,不进入回溯
  3. 资源上限:pattern ≤ 16KB、replacement ≤ 16KB、输出 ≤ 1MB、匹配数 ≤ 1,000(limit 钳制)
  4. explain 零执行:只做静态 tokenizer,不构造 RegExp 实例,任何 pattern 都即时返回

⚠️ 工具描述与 README 均明确警告模型:不要对不可信的大输入使用无锚点的嵌套量词 pattern(如 (a+)+、(.*)*)。

其余边界:无效 pattern 捕获 SyntaxError 报错(含位置信息);无效/重复 flag 逐字符校验;replace 使用 String.replace 字符串替换路径(JS 原生 $-语义,无 new Function、无 eval)。

工具声明

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

参数类型必填说明
actionstring✅test / find / replace / explain
patternstring✅正则(JavaScript 语法,不含外围 /);≤ 16KB
inputstring待匹配文本(test/find/replace 必需);≤ 64KB
flagsstring如 "gi";支持 g i m s u y d v,需唯一且合法
replacementstringreplace 的替换文本,支持 $1/$2/$<name>/$$;≤ 16KB
limitintegerfind 最大报告匹配数,默认 50,上限 1,000

Actions

action功能输出示例
test判断是否匹配(整串语义由模型自行用 ^...$ 表达){"matched":true}
find全部匹配:index / 完整匹配 / 编号捕获组 captures / 命名组 groups(无 g 自动补 g)[{"index":0,"match":"a@b","captures":["a","b"],"groups":{"name":"a"}}]
replace全局安全替换($1/$<name>/$$),返回结果与替换次数{"result":"world hello","replaced":1}
explain静态解析 pattern → 人读节点序列(不执行匹配;节点数 ≤ 4,096)[{"kind":"escape","text":"\\d","meaning":"A digit [0-9]"}]

示例

regex { action: "find", pattern: "(\\w+)@(\\w+)", input: "a@b x c@d" }
  → [{"index":0,"match":"a@b","captures":["a","b"],"groups":null},{"index":6,"match":"c@d","captures":["c","d"],"groups":null}]

regex { action: "replace", pattern: "(\\w+) (\\w+)", input: "hello world", replacement: "$2 $1" }
  → {"result":"world hello","replaced":1}

regex { action: "explain", pattern: "\\d{4}-\\d{2}" }
  → [{"kind":"escape","text":"\\d","meaning":"A digit [0-9]"},{"kind":"quantifier","text":"{4}",...},...]

边界行为

情况处理
无效 patternregex: invalid pattern: <SyntaxError 信息(含位置)>,不崩溃
无效 flag / 重复 flagregex: invalid flag "q" / regex: duplicate flag "g"
空 pattern合法(匹配空串);u/v 下空匹配按 code point 推进(surrogate pair 不会重复命中)
ReDoS(病理 pattern)worker 硬超时:regex: execution timed out (1000ms),宿主不阻塞
命名组 / 编号组find 输出 groups: {name: value} 与 captures: [...];replace 支持 $<name>/$n
零匹配find 返回 [];replace 返回原文本 + replaced: 0
输入超 64KB / pattern 超 16KB / replacement 超 16KB入口拒绝(不截断)
输出超 1MB(替换放大如 $`` / $'`)regex: result/output exceeds 1000000 bytes,拒绝而非截断
find limit默认 50,钳制到 1,000(防输出膨胀)
explain 节点超 4,096regex: explain: pattern too complex
$ 引用走 JS 原生字符串替换路径:$$→$、$n→组(未参与→空串)、$<name>→命名组、未知引用字面保留($0/$<foo> 与 V8 一致)

npm 0.1.0-rc.8 兼容(已验证)

本插件已迁移到 npm 0.1.0-rc.8 依赖线,并在 @deepseek-ai/dsh@0.1.0-rc.8(npm 私有包)的隔离 consumer 中完成全链路验证:

  • 类型/运行时:peer 为 @deepseek-ai/cordis: ^4.0.1 + @deepseek-ai/dsh-tools: >=0.0.1-rc.1 <0.2.0 + @deepseek-ai/dsh-invariants: >=0.0.1-rc.1 <0.2.0;不再依赖 unscoped cordis
  • 独立构建:npm install(devDependencies 自包含 typescript/vitest/@types/node)→ npm run typecheck → npm test → npm run build → npm pack
  • 消费验证:tarball 装入 DSH 0.1.0-rc.8(npm)consumer → dsh --profile compat --dump-config 出现本插件 row → 工具真实注册与执行通过
  • 启动方式:npx -p @deepseek-ai/dsh@0.1.0-rc.8 dsh web(lib 生产模式;勿 install -g 全局安装)

安装

Profile Bundle(推荐)

将本插件作为独立 bundle 安装到 profile(DSH 0.1.0-rc.8(npm))。本仓库位于 omdsh-dev 组织,公开可访问:

# 交互式(web)profile —— 从 GitHub 仓库安装
dsh plugin --profile web add github:omdsh-dev/dsh-tool-regex
# 一次性任务(headless)profile —— dsh run 默认使用 headless
dsh plugin --profile headless add github:omdsh-dev/dsh-tool-regex

或使用 npm pack 生成的 tarball 安装:

npm pack     # 生成 dsh-tool-regex-<version>.tgz
# 交互式(web)profile
dsh plugin --profile web add ./dsh-tool-regex-<version>.tgz
# 一次性任务(headless)profile
dsh plugin --profile headless add ./dsh-tool-regex-<version>.tgz

包内 dsh.bundle.patch 会在安装后自动把插件加入 profile 的 layer stack(row id:tool-regex)。插件缺失的 peer 依赖(@deepseek-ai/cordis、@deepseek-ai/dsh-tools)由 profile 的 healed profiles/node_modules 回退安装提供。

⚠️ web 与 headless 是不同 profile:web 安装不会自动覆盖 headless;dsh run 默认使用 headless profile。Windows 路径使用正斜杠(C:/...)。

验证安装

dsh --profile web --dump-config | grep tool-regex

运行验证

dsh run "使用 regex 工具测试 d+ 是否匹配 abc123"

手动安装与旧版本兼容(monorepo 旧场景)

monorepo 方式仅适用于旧场景:不支持 Profile Bundle 的旧快照或插件开发调试环境(本地 junction/symlink、手动编辑 profile 层)。

测试

node <monorepo>/node_modules/vitest/vitest.mjs run tests
  • engine.spec.ts:test/find/replace 全分支 + flags/pattern 错误 + 64KB 上限 + ReDoS worker 用例(病理 pattern 在 3s 预算内被取消,不挂死测试进程)
  • explain.spec.ts:字面量/字符类/分组/量词/转义/锚点/交替 + 未闭合报错
  • register.spec.ts:注册契约(AUDIT-CROSS-02 风格)

许可

MIT