跳到正文

omdsh-dev/dsh-custom-tool

240最近提交 2026年8月13日

dsh-custom-tool DSH 插件

该插件允许用户在设置界面中直接创建、编辑和管理自定义 JavaScript 工具,使用内置 Monaco 编辑器和 TypeScript 智能提示。模型也可以通过 `custom_tool_create`、`custom_tools_list` 和 `custom_tool_remove` 自行创建、列出和删除工具。工具在受限的 worker 线程中执行,具有可配置的预算和安全作用域。

如何安装 dsh-custom-tool DSH 插件

dsh plugin --profile web add https://github.com/omdsh-dev/dsh-custom-tool/archive/refs/tags/v0.1.2.tar.gz

复制不会执行命令。安装 dsh-custom-tool DSH 插件前请核对仓库和版本。

dsh-custom-tool DSH 插件数据来源

dsh-custom-tool DSH 插件快照日期:2026年8月16日

discovered

dsh-custom-tool DSH 插件能做什么

  • 设置界面提供 Monaco 编辑器及 TypeScript 智能提示,用于编写工具代码
  • 实时注册:保存后工具立即可供模型调用
  • 模型自助服务:模型可通过专用函数创建、列出和删除自己的工具
  • 持久化存储:工具通过设置命名空间持久化,重启后恢复
  • 两种执行作用域:全局(无文件系统访问)和工作区(在会话工作区内有限的文件系统访问)
  • 可配置的执行预算:超时、内存、结果大小、代码大小和工具数量

dsh-custom-tool DSH 插件适合哪些场景

  • 为模型添加自定义数据获取能力,无需编写完整的 harness 插件
  • 让模型自动创建工作区内的文件处理工具,用于重复性任务
  • 在 UI 中快速原型和测试新函数,然后通过模型调用
  • 跨工作区共享全局工具,同时工作区专属工具保持隔离

dsh-custom-tool DSH 插件适合谁

  • 希望用自定义代码扩展模型能力的 DSH 用户
  • 需要低成本添加和管理工具,且不想修改 harness 的开发者

dsh-custom-tool DSH 插件的限制

  • 自定义工具名称不能与其它包中的工具重名,冲突会导致注册失败
  • 工作区限制是词法层面的,不防符号链接 – 工作区内的符号链接可能指向外部
  • UI 中暂无单个工具的测试运行按钮,需要通过模型调用或头运行来测试
  • 需要 harness 的 Web 配置命名空间白名单中包含 'custom-tools',否则 UI 无法保存设置

dsh-custom-tool DSH 插件的仓库 README 摘录

以下文字摘自 dsh-custom-tool DSH 插件的上游仓库 omdsh-dev/dsh-custom-tool 的 README,版权归原作者,仅作引用。

Custom tools for the DeepSeek Harness: users author their own JavaScript tools in the settings UI with a Monaco (VS Code) editor and TypeScript intellisense, and the model grows and prunes the same toolset itself through `custom_tool_create` / `custom_tool_remove` / `custom_tools_list`. Every tool is durable, hot-registered, and written into the model prompt on the next step. ![The Custom Tool settings page](assets/screenshots/settings-section.png) ![The tool editor](assets/screenshots/tool-editor.png) ## Problems it solves - **Users cannot extend their agent**: before this plugin, adding a capability meant shipping a harness package. Now a tool is a form in the settings UI — name, description, parameters, code — saved live and callable by the model immediately. - **The model cannot grow itself**: `custom_tool_create` lets the model persist tools mid-session (hot-registered, visible on its next step), with the same validation gate the UI uses — the model cannot persist anything the settings UI would refuse. - **User-authored code runs in a restricted worker**: every call executes in a fresh worker thread inside a `node:vm` realm with an explicit allowlist, Node Permission Model

阅读完整 README仓库许可: MIT

dsh-custom-tool DSH 插件常见问题

如何安装自定义工具插件?

运行 `dsh plugin --profile web add https://github.com/omdsh-dev/dsh-custom-tool/archive/refs/tags/v0.1.2.tar.gz`,然后重启服务器 `dsh web`。重启后插件即可使用。

模型可以自己创建工具吗?

可以。模型可以调用 `custom_tool_create` 创建新工具,`custom_tools_list` 列出工具,`custom_tool_remove` 删除工具。但创建全局位置的工具需要用户通过 GUI 确认。模型无法删除用户创建的工具。

自定义工具代码有哪些安全限制?

每个工具在独立的 worker 线程中运行,使用 `node:vm` 限制,有显式白名单、Node 权限模型和硬预算。全局作用域无文件系统访问,工作区作用域仅限会话工作区根目录的有限读写。网络访问由 `allowNetwork` 配置控制。

如何配置自定义工具的执行预算?

在 `cordis.yml` 配置文件中,`dsh-custom-tool` 条目下可以设置 `timeoutMs`、`memoryLimitMb`、`maxResultChars`、`maxCodeBytes`、`maxTools` 和 `allowNetwork`。每个字段都有默认值。

为什么 UI 中的工具保存不了?

请检查 harness 的 Web 配置命名空间白名单是否包含 `'custom-tools'`(在 `packages/host/apiproxy/src/api-proxy.ts` 中)。缺少该条目会导致 UI 渲染但保存被静默拒绝。