Community plugin

Chsw-CC / dsh-lazy-tools

按需加载工具:核心工具保持原生可见,长尾工具收进一个 toolbox 入口,显著降低每次请求的上下文与 token 占用。

  • JavaScript
  • MIT
  • 1 stars
  • Nov 18, 2026

About this plugin

Written by the registry from verified metadata, not from the README.

dsh-lazy-tools is a DSH plugin published from the Chsw-CC/dsh-lazy-tools repository.

  • Listing statusManifest verified
  • Manifest checkedNov 19, 2026
  • Packagedsh-lazy-tools
  • Package version0.4.2
  • Source commit9c2eb7a
  • Repository createdNov 17, 2026

Capabilities and topics

dsh-plugindeepseek-harnesscontexttokens
From the repository README

README

Everything below this line is the repository's own document, cached here. This site did not write or review it.

Cached versionView on GitHub

dsh-lazy-tools

按需加载工具与技能的 DSH 插件:把「每个工具一份 JSON schema 常驻系统提示」换成一个 toolbox 入口。

它解决什么

DSH 会把每个可见工具的 schema 注入每次请求。工具越多,提示越长——即使这一轮只用得上其中一两个。 这个插件让模型先看到一份紧凑目录,按需取 schema、按需调用:

before:  read(1200 tok) + write(900) + bash(1500) + edit(1100) + web(800) + …  ≈ 每条请求都付
after:   toolbox(约 400 tok) + 目录(按需) + 实际用到的 schema(按需)

工作机制

  1. 窄化视图:插件为每个 agent 调用 ctx.tools.restrict({ allow: ['toolbox', ...keep] }), 这是注册表自带的按 agent 收窄接口,因此提示装配、会话回放与 UI 呈现都保持一致。
  2. 按需读取:{action:"list"} 给出工具与技能的名称加一行摘要; {action:"schema"} 只取真正要用的那几个 schema;{action:"skill"} 读取技能正文。
  3. 不绕过策略:{action:"call"} 通过插件自己的 ToolExecutionPipeline 重放调用, 审批、guard、超时、post-execute 策略与结果渲染全部照常生效。

安装

cd <profile>        # 例如 ~/.dsh/profiles/default
pnpm add link:<本目录绝对路径>

或在「插件」页用 plugin_manager 的 install_bundle,spec 用 link:<本目录绝对路径>。 本包含 cordis.patch.yml,安装后条目自动注册;改配置后重启(或 HMR)生效。

配置

- id: dsh-lazy-tools
  config:
    toolName: toolbox            # 模型看到的工具名
    keep: []                     # 始终可见、不进工具箱的工具名
    catalogDescriptionChars: 96  # 目录每行摘要长度
    catalogTokenBudget: 1200     # 一次 list 的 token 预算;超了自动降级(摘要 → 纯名称 → 前缀计数)
    # keep 支持通配符:['read_*', 'todo_*'] 表示这一族核心工具始终 eager
    hideOthers: true             # false = 只加工具箱、不收窄视图
    skills: true                 # 目录里是否包含技能,并开放 {action:"skill"}

动作一览

action参数结果
listquery?已加载工具与技能的名称 + 一行摘要
schematools: string[]这些工具的完整 JSON 参数 schema
calltool, arguments走完整策略管线执行该工具
skillskill该技能的完整说明正文
plugins—已安装插件清单(名称 + 启用状态)
usetools: string[]把这些工具提升为本会话常驻可见
releasetools?: string[]撤销提升(省略则全部撤销)

会话级提升

use / release 直接替换该 agent 的 restrict() 结果(返回的 disposer 立即释放), 所以可见集合永远是「工具箱 + 本会话点名要的工具」,不会层层堆叠。 适合工具密集型任务:把 read、bash 这类真正反复用的提到常驻,其余继续按需。

插件清单的来源

plugins 依次尝试 ctx.get('pluginInventory' | 'inventory' | 'pluginManager') 上的 listBundles / list / bundles / entries,把返回结构归一成「名称 + 启用状态」; 若当前组合没有这些服务,则退回工具注册表并如实说明——不会伪造清单。

行为边界

  • 失败开放:若工具箱自身未注册成功,插件不会收窄视图(否则 agent 会失去全部能力),并在下一步重试。
  • 仅模型可见面:收窄作用于模型可见的工具集;工具本身仍注册在组合里,插件互不干扰。
  • 技能目录:系统提示中的 <available_skills> 仍由 @deepseek-ai/dsh-tool-skill 注入; 若目录本身偏大,可调它的 catalogDescriptionMaxLength。本插件负责把技能正文改为按需加载。
  • PTC 模式:在 PTC(run_code)组合下同样生效——SDK 只列工具箱,其余工具经工具箱调用。
  • approval:call 会触发与该工具直调完全相同的审批流程,不会被静默绕过。
  • 不裁剪真实结果:call 与 skill 返回原文;只有 list/schema/plugins 有字符预算。
  • 原子替换:新限制先装、旧限制后释放,替换失败时旧限制原样保留,不会出现「裸奔」窗口。
  • 递归护栏:工具箱嵌套调用最多 6 层。

开发

bun test tests/      # 24 个用例:目录格式化 + 装配/收窄/分发/提升 + 四条不变量

lib/catalog.js 是零依赖的纯函数,lib/index.js 只负责服务接线。

同类插件

同赛道里做得更早、也更完整的几个:

本插件的差异:不做语义检索,也不替换执行器。可见面只留一个工具箱,其余靠注册表的 restrict() 收窄;call 走自己的 ToolExecutionPipeline,因此审批与 guard 与直调一致。 代价是每次 use 都会改可见列表——上面 dsh-progressive-tools 的论点直接命中这一点, 所以结果里会明确写出缓存前缀失效。

Badge

Listed here? Link back with this badge — paste the snippet into your repository README.

Listed on DSH Plugin badge
[![Listed on DSH Plugin](https://dsh-plugin.com/badges/listed.svg)](https://dsh-plugin.com/plugins/Chsw-CC/dsh-lazy-tools)