dsh-tool-drawer 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README-zh.md +65 -0
- package/README.md +64 -2
- package/cordis.patch.yml +11 -0
- package/lib/client.js +419 -0
- package/lib/drawer.js +197 -0
- package/lib/gate.js +76 -0
- package/lib/index.js +342 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +92 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zyd232
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README-zh.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# dsh-tool-drawer
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
**把工具当成一张桌子和一个抽屉。**
|
|
6
|
+
|
|
7
|
+
DeepSeek Harness 每一步都会把每个工具的完整说明塞进模型上下文。多装几个插件和 MCP 之后,这笔开销会一直压在那里。这个插件负责把桌面收小。
|
|
8
|
+
|
|
9
|
+
## 思路
|
|
10
|
+
|
|
11
|
+
- **桌面** —— 伸手就能拿到的工具。它们的说明永远在上下文里。
|
|
12
|
+
- **抽屉** —— 其他所有工具。不用的时候不花一分钱:模型点名要,插件拉开抽屉取出来、跑完再放回去。
|
|
13
|
+
|
|
14
|
+
## 两种模式
|
|
15
|
+
|
|
16
|
+
| | 抽屉模式(默认) | 桌面模式 |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| 上下文里的工具 | 只有桌面工具,列表永不变化 | 桌面 + 本次会话碰过的工具 |
|
|
19
|
+
| 上下文占用 | 最小,且稳定 | 随使用增长 |
|
|
20
|
+
| 用抽屉里的工具 | 查找 → 执行(多一跳) | 一样,但用过后会留在桌面上 |
|
|
21
|
+
| 前缀缓存 | 永不失效 | 列表一变就失效一次 |
|
|
22
|
+
| 适合 | 本地模型、长对话、工具很多 | 工具少、参数复杂 |
|
|
23
|
+
|
|
24
|
+
两种模式下桌面都是固定的,模型不必为常用工具再翻抽屉。
|
|
25
|
+
|
|
26
|
+
## 工作方式
|
|
27
|
+
|
|
28
|
+
每一步,DSH 用 `tools.resolve()` 决定模型能看见哪些工具,提示词提供者据此生成工具表。插件只包住这一个调用:
|
|
29
|
+
|
|
30
|
+
- **抽屉模式**:只放行桌面工具 + 三个桥接工具 `find_tool` / `describe_tool` / `use_tool`;
|
|
31
|
+
- **桌面模式**:再放行这个 agent 已经查找过或调用过的工具(超过桌面容量就把最旧的收回抽屉);
|
|
32
|
+
- 被收起的工具名单以一段**工具抽屉**说明注入系统提示,模型因此知道自己还有什么可用;
|
|
33
|
+
- `use_tool` 走 DSH 正常的工具管线执行,审批、超时、结果渲染(含图片)都与直接调用一致。
|
|
34
|
+
|
|
35
|
+
插件不落盘、不改任何工具注册、不碰 preset。卸载后 DSH 立刻回到原生工具表。
|
|
36
|
+
|
|
37
|
+
## 安装
|
|
38
|
+
|
|
39
|
+
```powershell
|
|
40
|
+
dsh plugin --profile <profile> add link:/path/to/dsh-tool-drawer
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
然后在 profile 的 `package.json` 里把 `dsh-tool-drawer` 加进 `dsh.profile.bundles`,重启 DSH。包发布到 npm 之后也可以直接按名字安装:`dsh plugin --profile <profile> add dsh-tool-drawer`。
|
|
44
|
+
|
|
45
|
+
## 设置
|
|
46
|
+
|
|
47
|
+
**设置 → 工具抽屉**:总开关、模式、常驻工具、桌面容量、搜索结果数。
|
|
48
|
+
|
|
49
|
+
界面跟随 DSH 的语言:默认英文;DSH 用中文时显示简体中文(浏览器标签如 `zh-TW` 也会落到同一个中文语言)。
|
|
50
|
+
|
|
51
|
+
## 兼容性
|
|
52
|
+
|
|
53
|
+
| DSH | 验证日期 |
|
|
54
|
+
|---|---|
|
|
55
|
+
| 0.2.2-rc.3 | 2026-11-16 |
|
|
56
|
+
|
|
57
|
+
## 注意
|
|
58
|
+
|
|
59
|
+
- 模型若直接调用抽屉里的工具而没先查找,会拿到 `UNKNOWN_TOOL`;抽屉说明里写清了取用步骤。
|
|
60
|
+
- 抽屉模式用「隐蔽工具调用多一跳」换「上下文小很多」。
|
|
61
|
+
- 桌面模式会改变工具表,llama.cpp 的前缀缓存因此失效一次——每次变化会慢一步。
|
|
62
|
+
|
|
63
|
+
## 许可
|
|
64
|
+
|
|
65
|
+
MIT
|
package/README.md
CHANGED
|
@@ -1,3 +1,65 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-tool-drawer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
English | [中文](README-zh.md)
|
|
4
|
+
|
|
5
|
+
**Your tools, as a desk and a drawer.**
|
|
6
|
+
|
|
7
|
+
DeepSeek Harness hands the model every tool's full schema on every single step. A few plugins and MCP servers later that is a large standing cost. This plugin keeps the desk small.
|
|
8
|
+
|
|
9
|
+
## The idea
|
|
10
|
+
|
|
11
|
+
- **Desk** — the tools that are always within reach. Their schemas are always in the prompt.
|
|
12
|
+
- **Drawer** — everything else. It costs nothing until it is needed: the model looks a tool up, the plugin fetches it and runs it.
|
|
13
|
+
|
|
14
|
+
## Two modes
|
|
15
|
+
|
|
16
|
+
| | Drawer (default) | Desk |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| Tools in the prompt | The desk only; the list never changes | Desk plus everything touched this session |
|
|
19
|
+
| Context | Smallest, and stable | Grows with use |
|
|
20
|
+
| Using a drawer tool | Look up → run (one extra hop) | Same, and it moves onto the desk afterwards |
|
|
21
|
+
| Prefix cache | Never invalidated | Invalidated whenever the list changes |
|
|
22
|
+
| Best for | Local models, long sessions, many tools | Few tools, complex arguments |
|
|
23
|
+
|
|
24
|
+
Both modes keep the desk fixed, so the model never has to hunt for the basics.
|
|
25
|
+
|
|
26
|
+
## How it works
|
|
27
|
+
|
|
28
|
+
Each step DSH resolves the model-visible tools with `tools.resolve()`, and the prompt provider renders that list. The plugin wraps that one call:
|
|
29
|
+
|
|
30
|
+
- **Drawer mode** admits only the desk set plus three bridge tools — `find_tool`, `describe_tool`, `use_tool`;
|
|
31
|
+
- **Desk mode** also admits whatever this agent already looked up or called (the oldest goes back into the drawer past the desk size);
|
|
32
|
+
- the hidden names are listed in a compact **tool drawer** note in the system prompt, so the model always knows what exists;
|
|
33
|
+
- `use_tool` dispatches through the normal tool pipeline, so approvals, timeouts and result rendering — images included — behave exactly like a direct call.
|
|
34
|
+
|
|
35
|
+
Nothing is persisted, no tool registration is changed, and no preset is touched. Unload the plugin and DSH is back to its stock tool list.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```powershell
|
|
40
|
+
dsh plugin --profile <profile> add link:/path/to/dsh-tool-drawer
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then add `dsh-tool-drawer` to `dsh.profile.bundles` in the profile's `package.json` and restart DSH. Once the package is published you can install it by name: `dsh plugin --profile <profile> add dsh-tool-drawer`.
|
|
44
|
+
|
|
45
|
+
## Settings
|
|
46
|
+
|
|
47
|
+
**Settings → Tool drawer**: enable switch, mode, desk tools, desk size, search results.
|
|
48
|
+
|
|
49
|
+
The panel follows DSH's language: English by default; DSH's Chinese locale (including browser tags such as `zh-TW`) shows Simplified Chinese.
|
|
50
|
+
|
|
51
|
+
## Compatibility
|
|
52
|
+
|
|
53
|
+
| DSH | Verified |
|
|
54
|
+
|---|---|
|
|
55
|
+
| 0.2.2-rc.3 | 2026-11-16 |
|
|
56
|
+
|
|
57
|
+
## Notes
|
|
58
|
+
|
|
59
|
+
- If the model calls a drawer tool without looking it up first, it gets `UNKNOWN_TOOL`; the drawer note spells out the lookup steps.
|
|
60
|
+
- Drawer mode trades one extra round trip per hidden-tool call for a much smaller prompt.
|
|
61
|
+
- Desk mode changes the tool list, which invalidates llama.cpp's prompt prefix cache — expect one slower step per change.
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# dsh-tool-drawer bundle layer.
|
|
2
|
+
#
|
|
3
|
+
# Mounted automatically when the profile lists this package in
|
|
4
|
+
# `dsh.profile.bundles` (`dsh plugin --profile <name> add <this package>`); the
|
|
5
|
+
# loader resolves `name` through the installed package's main entry.
|
|
6
|
+
#
|
|
7
|
+
# The row id doubles as the settings namespace, so the browser half can join its
|
|
8
|
+
# section to this entry (`configForms.get('tool-drawer')`).
|
|
9
|
+
- insert:
|
|
10
|
+
- id: tool-drawer
|
|
11
|
+
name: dsh-tool-drawer
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-tool-drawer — browser half.
|
|
3
|
+
*
|
|
4
|
+
* Hand-written client bundle in the loader's lazy-CJS factory format
|
|
5
|
+
* (`window.__ModuleLoader__.load({ id: <package name>, factory })`), which is
|
|
6
|
+
* what the client module system serves for a package declaring `dsh.client` and
|
|
7
|
+
* exporting `./client`. No build step: the artifact IS this file.
|
|
8
|
+
*
|
|
9
|
+
* It contributes one Settings left-sidebar section (`settings.section`) so the
|
|
10
|
+
* two modes are explained in plain language instead of as a raw config value.
|
|
11
|
+
*/
|
|
12
|
+
window.__ModuleLoader__.load({
|
|
13
|
+
id: 'dsh-tool-drawer',
|
|
14
|
+
factory: (require) => {
|
|
15
|
+
var module = { exports: {} }
|
|
16
|
+
var exports = module.exports
|
|
17
|
+
|
|
18
|
+
var React = require('react')
|
|
19
|
+
|
|
20
|
+
/** Must equal the bundle row id and the host settings namespace. */
|
|
21
|
+
var NS = 'tool-drawer'
|
|
22
|
+
var inject = ['slots', 'configForms', 'locale']
|
|
23
|
+
|
|
24
|
+
var MESSAGES = {
|
|
25
|
+
en: {
|
|
26
|
+
sectionLabel: 'Tool drawer',
|
|
27
|
+
intro:
|
|
28
|
+
'Keeps the tool list small: only the tools on your desk stay in front of the model, the rest sit in a drawer and are fetched when needed. Turn it off to get the stock list back.',
|
|
29
|
+
enableLabel: 'Enable',
|
|
30
|
+
enableDesc: 'Off = every tool is listed directly, exactly like DSH does without this plugin.',
|
|
31
|
+
enableOn: 'On',
|
|
32
|
+
enableOff: 'Off',
|
|
33
|
+
modeLabel: 'Mode',
|
|
34
|
+
modeProxyTitle: 'Drawer (recommended)',
|
|
35
|
+
modeProxyDesc: 'Tools stay in the drawer until they are needed. Smallest context; changing tools never stalls the model.',
|
|
36
|
+
modeExpandTitle: 'Desk',
|
|
37
|
+
modeExpandDesc: 'Tools you touch stay on the desk. More accurate calls, but takes more room and can stall when the list changes.',
|
|
38
|
+
coreLabel: 'Always on the desk',
|
|
39
|
+
coreDesc: 'Comma separated. These tools are always directly callable, with no search step.',
|
|
40
|
+
maxActiveLabel: 'Desk size',
|
|
41
|
+
maxActiveDesc: 'Desk mode only: how many fetched tools may stay on the desk before the oldest is put back.',
|
|
42
|
+
searchLimitLabel: 'Search results',
|
|
43
|
+
searchLimitDesc: 'How many tools one search returns.',
|
|
44
|
+
reset: 'Default',
|
|
45
|
+
resetTitle: 'Clear your override and fall back to the shipped default',
|
|
46
|
+
loading: 'Reading settings…',
|
|
47
|
+
noService: 'The settings service is unavailable (the tool-drawer namespace is not mounted).',
|
|
48
|
+
unavailable: 'The host does not expose the tool-drawer namespace, so there is nothing to edit.',
|
|
49
|
+
readOnly: 'This connection is read-only; changes are not written to the host.',
|
|
50
|
+
},
|
|
51
|
+
zh: {
|
|
52
|
+
sectionLabel: '工具抽屉',
|
|
53
|
+
intro:
|
|
54
|
+
'把工具表换小:常用的留在桌面上,其余收进抽屉,需要时再取。关掉就恢复 DSH 原样。',
|
|
55
|
+
enableLabel: '启用',
|
|
56
|
+
enableDesc: '关闭 = 所有工具直接列出来,和没装插件时一样。',
|
|
57
|
+
enableOn: '已启用',
|
|
58
|
+
enableOff: '已关闭',
|
|
59
|
+
modeLabel: '模式',
|
|
60
|
+
modeProxyTitle: '抽屉模式(推荐)',
|
|
61
|
+
modeProxyDesc: '工具放在抽屉里,用到才取。上下文最省,换工具不会卡。',
|
|
62
|
+
modeExpandTitle: '桌面模式',
|
|
63
|
+
modeExpandDesc: '摸过的工具就留在桌面上。调用更准,但占地方,切换时可能卡一下。',
|
|
64
|
+
coreLabel: '常驻工具',
|
|
65
|
+
coreDesc: '逗号分隔。这些工具一直直接可用,不用搜索。',
|
|
66
|
+
maxActiveLabel: '桌面容量',
|
|
67
|
+
maxActiveDesc: '仅桌面模式:最多留几个工具在桌面上,超出就把最旧的收回抽屉。',
|
|
68
|
+
searchLimitLabel: '搜索结果数',
|
|
69
|
+
searchLimitDesc: '每次搜索返回几个工具。',
|
|
70
|
+
reset: '默认',
|
|
71
|
+
resetTitle: '清除你的覆盖值,回到出厂默认',
|
|
72
|
+
loading: '正在读取设置…',
|
|
73
|
+
noService: '设置服务不可用(tool-drawer 命名空间未挂载)。',
|
|
74
|
+
unavailable: '宿主没有提供 tool-drawer 命名空间,这里没有可编辑的内容。',
|
|
75
|
+
readOnly: '当前连接只读,改动不会写入宿主。',
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var h = React.createElement
|
|
80
|
+
var rowStyle = { display: 'flex', flexDirection: 'column', gap: '4px', padding: '10px 0' }
|
|
81
|
+
var labelStyle = { fontSize: '13px', fontWeight: 600 }
|
|
82
|
+
var hintStyle = { fontSize: '12px', opacity: 0.7, lineHeight: 1.5 }
|
|
83
|
+
var inputStyle = {
|
|
84
|
+
width: '100%',
|
|
85
|
+
boxSizing: 'border-box',
|
|
86
|
+
padding: '6px 8px',
|
|
87
|
+
fontSize: '13px',
|
|
88
|
+
borderRadius: '6px',
|
|
89
|
+
border: '1px solid rgba(128,128,128,0.35)',
|
|
90
|
+
background: 'transparent',
|
|
91
|
+
color: 'inherit',
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function Hint(text) {
|
|
95
|
+
return h('div', { style: hintStyle }, text)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function Field(props) {
|
|
99
|
+
var draft = React.useState(String(props.value ?? ''))
|
|
100
|
+
var text = draft[0]
|
|
101
|
+
var setText = draft[1]
|
|
102
|
+
React.useEffect(
|
|
103
|
+
function () {
|
|
104
|
+
setText(String(props.value ?? ''))
|
|
105
|
+
},
|
|
106
|
+
[props.value],
|
|
107
|
+
)
|
|
108
|
+
var control
|
|
109
|
+
if (props.type === 'switch') {
|
|
110
|
+
control = h(
|
|
111
|
+
'button',
|
|
112
|
+
{
|
|
113
|
+
type: 'button',
|
|
114
|
+
role: 'switch',
|
|
115
|
+
'aria-checked': props.value === true,
|
|
116
|
+
'aria-label': props.label,
|
|
117
|
+
disabled: props.disabled === true,
|
|
118
|
+
onClick: function () {
|
|
119
|
+
props.onCommit(props.value !== true)
|
|
120
|
+
},
|
|
121
|
+
style: Object.assign({}, inputStyle, { width: 'auto', minWidth: '72px', cursor: 'pointer', fontWeight: 600 }),
|
|
122
|
+
},
|
|
123
|
+
props.value === true ? props.onLabel : props.offLabel,
|
|
124
|
+
)
|
|
125
|
+
} else if (props.type === 'textarea') {
|
|
126
|
+
control = h('textarea', {
|
|
127
|
+
rows: 3,
|
|
128
|
+
value: text,
|
|
129
|
+
disabled: props.disabled,
|
|
130
|
+
'aria-label': props.label,
|
|
131
|
+
style: Object.assign({}, inputStyle, { resize: 'vertical', fontFamily: 'inherit' }),
|
|
132
|
+
onChange: function (event) {
|
|
133
|
+
setText(event.currentTarget.value)
|
|
134
|
+
},
|
|
135
|
+
onBlur: function () {
|
|
136
|
+
props.onCommit(text)
|
|
137
|
+
},
|
|
138
|
+
})
|
|
139
|
+
} else {
|
|
140
|
+
control = h('input', {
|
|
141
|
+
type: props.type === 'number' ? 'number' : 'text',
|
|
142
|
+
value: text,
|
|
143
|
+
step: props.type === 'number' ? 1 : undefined,
|
|
144
|
+
disabled: props.disabled,
|
|
145
|
+
'aria-label': props.label,
|
|
146
|
+
style: inputStyle,
|
|
147
|
+
onChange: function (event) {
|
|
148
|
+
setText(event.currentTarget.value)
|
|
149
|
+
},
|
|
150
|
+
onBlur: function () {
|
|
151
|
+
if (props.type === 'number') {
|
|
152
|
+
var parsed = Number(text)
|
|
153
|
+
if (!Number.isFinite(parsed) || parsed < 1) {
|
|
154
|
+
setText(String(props.value ?? ''))
|
|
155
|
+
return
|
|
156
|
+
}
|
|
157
|
+
props.onCommit(parsed)
|
|
158
|
+
return
|
|
159
|
+
}
|
|
160
|
+
props.onCommit(text)
|
|
161
|
+
},
|
|
162
|
+
onKeyDown: function (event) {
|
|
163
|
+
if (event.key === 'Enter') event.currentTarget.blur()
|
|
164
|
+
},
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
return h(
|
|
168
|
+
'div',
|
|
169
|
+
{ style: rowStyle },
|
|
170
|
+
h('div', { style: labelStyle }, props.label),
|
|
171
|
+
props.description ? Hint(props.description) : null,
|
|
172
|
+
h(
|
|
173
|
+
'div',
|
|
174
|
+
{ style: { display: 'flex', gap: '8px', alignItems: 'center' } },
|
|
175
|
+
control,
|
|
176
|
+
h(
|
|
177
|
+
'button',
|
|
178
|
+
{
|
|
179
|
+
type: 'button',
|
|
180
|
+
disabled: props.disabled || props.overridden !== true,
|
|
181
|
+
title: props.resetTitle,
|
|
182
|
+
onClick: function () {
|
|
183
|
+
props.onReset()
|
|
184
|
+
},
|
|
185
|
+
style: Object.assign({}, inputStyle, {
|
|
186
|
+
width: 'auto',
|
|
187
|
+
cursor: props.overridden === true ? 'pointer' : 'default',
|
|
188
|
+
opacity: props.overridden === true ? 1 : 0.45,
|
|
189
|
+
}),
|
|
190
|
+
},
|
|
191
|
+
props.resetLabel,
|
|
192
|
+
),
|
|
193
|
+
),
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function ModeCard(props) {
|
|
198
|
+
var selected = props.selected === true
|
|
199
|
+
return h(
|
|
200
|
+
'button',
|
|
201
|
+
{
|
|
202
|
+
type: 'button',
|
|
203
|
+
disabled: props.disabled === true,
|
|
204
|
+
'aria-pressed': selected,
|
|
205
|
+
onClick: props.onSelect,
|
|
206
|
+
style: {
|
|
207
|
+
display: 'flex',
|
|
208
|
+
flexDirection: 'column',
|
|
209
|
+
gap: '4px',
|
|
210
|
+
textAlign: 'left',
|
|
211
|
+
padding: '12px 14px',
|
|
212
|
+
borderRadius: '8px',
|
|
213
|
+
border: selected ? '2px solid #4f8cff' : '1px solid rgba(128,128,128,0.35)',
|
|
214
|
+
background: selected ? 'rgba(79,140,255,0.10)' : 'transparent',
|
|
215
|
+
color: 'inherit',
|
|
216
|
+
cursor: props.disabled === true ? 'default' : 'pointer',
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
h('div', { style: { fontSize: '13px', fontWeight: 700 } }, props.title),
|
|
220
|
+
h('div', { style: hintStyle }, props.description),
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function Section(props) {
|
|
225
|
+
var form = props && props.form
|
|
226
|
+
var t = props && typeof props.t === 'function' ? props.t : function (key) { return key }
|
|
227
|
+
var localeFace = props && props.localeFace
|
|
228
|
+
var bump = React.useState(0)
|
|
229
|
+
var setBump = bump[1]
|
|
230
|
+
React.useEffect(
|
|
231
|
+
function () {
|
|
232
|
+
if (!localeFace || typeof localeFace.subscribe !== 'function') return undefined
|
|
233
|
+
return localeFace.subscribe(function () {
|
|
234
|
+
setBump(function (n) { return n + 1 })
|
|
235
|
+
})
|
|
236
|
+
},
|
|
237
|
+
[localeFace],
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
var state = React.useState(function () {
|
|
241
|
+
return form ? form.getSnapshot() : undefined
|
|
242
|
+
})
|
|
243
|
+
var snapshot = state[0]
|
|
244
|
+
var setSnapshot = state[1]
|
|
245
|
+
React.useEffect(
|
|
246
|
+
function () {
|
|
247
|
+
if (!form) return undefined
|
|
248
|
+
setSnapshot(form.getSnapshot())
|
|
249
|
+
return form.subscribe(function () {
|
|
250
|
+
setSnapshot(form.getSnapshot())
|
|
251
|
+
})
|
|
252
|
+
},
|
|
253
|
+
[form],
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
if (!form || !snapshot) return Hint(t('noService'))
|
|
257
|
+
if (snapshot.status === 'loading') return Hint(t('loading'))
|
|
258
|
+
if (snapshot.status === 'unavailable' || snapshot.value === undefined) return Hint(t('unavailable'))
|
|
259
|
+
|
|
260
|
+
var value = snapshot.value
|
|
261
|
+
var user = snapshot.user && typeof snapshot.user === 'object' ? snapshot.user : {}
|
|
262
|
+
var writable = snapshot.writable === true
|
|
263
|
+
var set = function (field, next) {
|
|
264
|
+
if (!writable) return
|
|
265
|
+
void form.set(field, next)
|
|
266
|
+
}
|
|
267
|
+
var unset = function (field) {
|
|
268
|
+
if (!writable) return
|
|
269
|
+
void form.unset(field)
|
|
270
|
+
}
|
|
271
|
+
var overridden = function (field) {
|
|
272
|
+
return Object.prototype.hasOwnProperty.call(user, field)
|
|
273
|
+
}
|
|
274
|
+
var field = function (id, extra) {
|
|
275
|
+
return Object.assign(
|
|
276
|
+
{
|
|
277
|
+
resetLabel: t('reset'),
|
|
278
|
+
resetTitle: t('resetTitle'),
|
|
279
|
+
disabled: !writable,
|
|
280
|
+
overridden: overridden(id),
|
|
281
|
+
onCommit: function (next) {
|
|
282
|
+
set(id, next)
|
|
283
|
+
},
|
|
284
|
+
onReset: function () {
|
|
285
|
+
unset(id)
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
extra,
|
|
289
|
+
)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
var mode = value.mode === 'expand' ? 'expand' : 'proxy'
|
|
293
|
+
|
|
294
|
+
return h(
|
|
295
|
+
'div',
|
|
296
|
+
{ style: { display: 'flex', flexDirection: 'column', gap: '6px' } },
|
|
297
|
+
Hint(t('intro')),
|
|
298
|
+
h(Field, field('enabled', {
|
|
299
|
+
label: t('enableLabel'),
|
|
300
|
+
description: t('enableDesc'),
|
|
301
|
+
onLabel: t('enableOn'),
|
|
302
|
+
offLabel: t('enableOff'),
|
|
303
|
+
type: 'switch',
|
|
304
|
+
value: value.enabled === true,
|
|
305
|
+
})),
|
|
306
|
+
h('div', { style: rowStyle },
|
|
307
|
+
h('div', { style: labelStyle }, t('modeLabel')),
|
|
308
|
+
h('div', { style: { display: 'flex', flexDirection: 'column', gap: '8px' } },
|
|
309
|
+
h(ModeCard, {
|
|
310
|
+
title: t('modeProxyTitle'),
|
|
311
|
+
description: t('modeProxyDesc'),
|
|
312
|
+
selected: mode === 'proxy',
|
|
313
|
+
disabled: !writable,
|
|
314
|
+
onSelect: function () {
|
|
315
|
+
set('mode', 'proxy')
|
|
316
|
+
},
|
|
317
|
+
}),
|
|
318
|
+
h(ModeCard, {
|
|
319
|
+
title: t('modeExpandTitle'),
|
|
320
|
+
description: t('modeExpandDesc'),
|
|
321
|
+
selected: mode === 'expand',
|
|
322
|
+
disabled: !writable,
|
|
323
|
+
onSelect: function () {
|
|
324
|
+
set('mode', 'expand')
|
|
325
|
+
},
|
|
326
|
+
}),
|
|
327
|
+
),
|
|
328
|
+
),
|
|
329
|
+
h(Field, field('coreTools', {
|
|
330
|
+
label: t('coreLabel'),
|
|
331
|
+
description: t('coreDesc'),
|
|
332
|
+
type: 'textarea',
|
|
333
|
+
value: value.coreTools,
|
|
334
|
+
})),
|
|
335
|
+
h(Field, field('maxActive', {
|
|
336
|
+
label: t('maxActiveLabel'),
|
|
337
|
+
description: t('maxActiveDesc'),
|
|
338
|
+
type: 'number',
|
|
339
|
+
value: value.maxActive,
|
|
340
|
+
})),
|
|
341
|
+
h(Field, field('searchLimit', {
|
|
342
|
+
label: t('searchLimitLabel'),
|
|
343
|
+
description: t('searchLimitDesc'),
|
|
344
|
+
type: 'number',
|
|
345
|
+
value: value.searchLimit,
|
|
346
|
+
})),
|
|
347
|
+
writable ? null : Hint(t('readOnly')),
|
|
348
|
+
)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function apply(ctx) {
|
|
352
|
+
var locale = ctx.locale
|
|
353
|
+
var t = locale && typeof locale.bind === 'function' ? locale.bind(NS) : function (key) { return key }
|
|
354
|
+
|
|
355
|
+
if (locale && typeof locale.register === 'function') {
|
|
356
|
+
ctx.effect(
|
|
357
|
+
function () {
|
|
358
|
+
var disposers = []
|
|
359
|
+
for (var id of ['en', 'zh']) {
|
|
360
|
+
try {
|
|
361
|
+
disposers.push(locale.register(NS, id, MESSAGES[id]))
|
|
362
|
+
} catch (error) {
|
|
363
|
+
// keep the remaining locales; the fallback chain covers the gap
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return function () {
|
|
367
|
+
for (var dispose of disposers) {
|
|
368
|
+
try {
|
|
369
|
+
dispose()
|
|
370
|
+
} catch (error) {
|
|
371
|
+
// disposers are idempotent; ignore
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
'tool-drawer: dictionaries',
|
|
377
|
+
)
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
var forms = ctx.configForms
|
|
381
|
+
if (!forms || typeof forms.get !== 'function') return
|
|
382
|
+
var form = forms.get(NS)
|
|
383
|
+
var register = function () {
|
|
384
|
+
return ctx.slots.inject('settings.section', function () {
|
|
385
|
+
return ctx.slots.register(
|
|
386
|
+
{
|
|
387
|
+
name: 'settings.section',
|
|
388
|
+
id: NS,
|
|
389
|
+
order: 56,
|
|
390
|
+
label: function () {
|
|
391
|
+
return t('sectionLabel')
|
|
392
|
+
},
|
|
393
|
+
locale: NS,
|
|
394
|
+
inject: function () {
|
|
395
|
+
return { form: form, t: t, localeFace: locale }
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
Section,
|
|
399
|
+
)
|
|
400
|
+
})
|
|
401
|
+
}
|
|
402
|
+
if (typeof forms.whileServed !== 'function') {
|
|
403
|
+
ctx.effect(register, 'tool-drawer: settings section')
|
|
404
|
+
return
|
|
405
|
+
}
|
|
406
|
+
ctx.effect(
|
|
407
|
+
function () {
|
|
408
|
+
return forms.whileServed([NS], register)
|
|
409
|
+
},
|
|
410
|
+
'tool-drawer: settings section',
|
|
411
|
+
)
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
exports.apply = apply
|
|
415
|
+
exports.inject = inject
|
|
416
|
+
exports.MESSAGES = MESSAGES
|
|
417
|
+
return module.exports
|
|
418
|
+
},
|
|
419
|
+
})
|
package/lib/drawer.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-tool-drawer — pure helpers.
|
|
3
|
+
*
|
|
4
|
+
* Everything here is deterministic and side-effect free so it can be unit
|
|
5
|
+
* tested without a running harness: config normalization, the hidden-tool
|
|
6
|
+
* manifest text, keyword ranking, and the group labels.
|
|
7
|
+
*
|
|
8
|
+
* @module dsh-tool-drawer/drawer
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** Tools the model always sees, even when the drawer is on. */
|
|
12
|
+
export const DEFAULT_CORE = [
|
|
13
|
+
'read',
|
|
14
|
+
'write',
|
|
15
|
+
'edit',
|
|
16
|
+
'glob',
|
|
17
|
+
'grep',
|
|
18
|
+
'pwsh',
|
|
19
|
+
'todo_write',
|
|
20
|
+
'skill',
|
|
21
|
+
'ask_user_question',
|
|
22
|
+
'present',
|
|
23
|
+
// Named directly by DSH's own instructions, so a direct call is expected
|
|
24
|
+
// mid-turn: background jobs and agent-to-agent messaging.
|
|
25
|
+
'job_output',
|
|
26
|
+
'job_list',
|
|
27
|
+
'job_kill',
|
|
28
|
+
'send_message',
|
|
29
|
+
'list_agents',
|
|
30
|
+
'wait_agent',
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
/** The bridge tools this plugin registers; always visible. */
|
|
34
|
+
export const BRIDGE_NAMES = ['find_tool', 'describe_tool', 'use_tool']
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The PTC transport. `dsh-tools` collapses a strict `ptc` scope's table to this
|
|
38
|
+
* single name; hiding it would leave the model with nothing callable.
|
|
39
|
+
*/
|
|
40
|
+
export const ALWAYS_KEEP = ['run_code']
|
|
41
|
+
|
|
42
|
+
/** Context name used for the manifest, matching the plugin's namespace. */
|
|
43
|
+
export const MANIFEST_CONTEXT = 'tool-drawer:catalog'
|
|
44
|
+
|
|
45
|
+
/** Modes accepted from config. */
|
|
46
|
+
export const MODES = ['proxy', 'expand']
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Split a comma/whitespace separated tool list.
|
|
50
|
+
* @param {unknown} raw - config value.
|
|
51
|
+
* @returns {string[]} unique names, order preserved.
|
|
52
|
+
*/
|
|
53
|
+
export function parseToolList(raw) {
|
|
54
|
+
if (typeof raw !== 'string') return []
|
|
55
|
+
const seen = new Set()
|
|
56
|
+
const out = []
|
|
57
|
+
for (const part of raw.split(/[\s,,]+/u)) {
|
|
58
|
+
const name = part.trim()
|
|
59
|
+
if (name === '' || seen.has(name)) continue
|
|
60
|
+
seen.add(name)
|
|
61
|
+
out.push(name)
|
|
62
|
+
}
|
|
63
|
+
return out
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Normalize the live plugin config.
|
|
68
|
+
* @param {Record<string, unknown>} raw - plugin config as mounted by the profile.
|
|
69
|
+
* @returns {{enabled: boolean, mode: string, core: Set<string>, maxActive: number, searchLimit: number}}
|
|
70
|
+
*/
|
|
71
|
+
export function resolveConfig(raw) {
|
|
72
|
+
const source = raw !== null && typeof raw === 'object' ? raw : {}
|
|
73
|
+
const mode = MODES.includes(source.mode) ? source.mode : 'proxy'
|
|
74
|
+
const listed = parseToolList(source.coreTools)
|
|
75
|
+
const maxActive = Number(source.maxActive)
|
|
76
|
+
const searchLimit = Number(source.searchLimit)
|
|
77
|
+
return {
|
|
78
|
+
enabled: source.enabled !== false,
|
|
79
|
+
mode,
|
|
80
|
+
core: new Set(listed.length > 0 ? listed : DEFAULT_CORE),
|
|
81
|
+
maxActive: Number.isFinite(maxActive) ? Math.max(1, Math.min(128, Math.trunc(maxActive))) : 20,
|
|
82
|
+
searchLimit: Number.isFinite(searchLimit) ? Math.max(1, Math.min(20, Math.trunc(searchLimit))) : 6,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Names this scope may see right now.
|
|
88
|
+
* @param {{mode: string, core: Set<string>}} config - normalized config.
|
|
89
|
+
* @param {Iterable<string>} active - expanded names (expand mode only).
|
|
90
|
+
* @returns {(name: string) => boolean} membership test.
|
|
91
|
+
*/
|
|
92
|
+
export function keepPredicate(config, active) {
|
|
93
|
+
const keep = new Set(BRIDGE_NAMES)
|
|
94
|
+
for (const name of ALWAYS_KEEP) keep.add(name)
|
|
95
|
+
for (const name of config.core) keep.add(name)
|
|
96
|
+
if (config.mode === 'expand') for (const name of active) keep.add(name)
|
|
97
|
+
return (name) => keep.has(name)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Group a tool name for the manifest listing.
|
|
102
|
+
* @param {string} name - tool name.
|
|
103
|
+
* @returns {string} display group.
|
|
104
|
+
*/
|
|
105
|
+
export function groupOf(name) {
|
|
106
|
+
if (name.startsWith('mcp__')) {
|
|
107
|
+
const server = name.split('__')[1]
|
|
108
|
+
if (server) return `mcp:${server}`
|
|
109
|
+
}
|
|
110
|
+
return '其他'
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Shorten a description to a single readable line.
|
|
115
|
+
* @param {string} text - raw description.
|
|
116
|
+
* @param {number} [max] - maximum characters.
|
|
117
|
+
* @returns {string} trimmed single-line text.
|
|
118
|
+
*/
|
|
119
|
+
export function oneLine(text, max = 90) {
|
|
120
|
+
const flat = String(text ?? '').replace(/\s+/gu, ' ').trim()
|
|
121
|
+
if (flat.length <= max) return flat
|
|
122
|
+
return `${flat.slice(0, max - 1)}…`
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Render the hidden-tool manifest appended to the system prompt.
|
|
127
|
+
*
|
|
128
|
+
* Deliberately names-only: the model gets a compact index, and asks for detail
|
|
129
|
+
* with `find_tool` / `describe_tool`. That keeps the standing cost near a
|
|
130
|
+
* thousand tokens even with a hundred tools.
|
|
131
|
+
*
|
|
132
|
+
* @param {readonly {name: string, description?: string}[]} hidden - tools not currently visible.
|
|
133
|
+
* @param {string} mode - active mode.
|
|
134
|
+
* @returns {string} manifest text, or '' when nothing is hidden.
|
|
135
|
+
*/
|
|
136
|
+
export function buildManifest(hidden, mode) {
|
|
137
|
+
if (!Array.isArray(hidden) || hidden.length === 0) return ''
|
|
138
|
+
const groups = new Map()
|
|
139
|
+
for (const tool of hidden) {
|
|
140
|
+
const group = groupOf(tool.name)
|
|
141
|
+
if (!groups.has(group)) groups.set(group, [])
|
|
142
|
+
groups.get(group).push(tool.name)
|
|
143
|
+
}
|
|
144
|
+
const ordered = [...groups.entries()].sort(([a], [b]) => {
|
|
145
|
+
if (a === '其他') return 1
|
|
146
|
+
if (b === '其他') return -1
|
|
147
|
+
return a.localeCompare(b)
|
|
148
|
+
})
|
|
149
|
+
const lines = []
|
|
150
|
+
lines.push(`[工具抽屉] 另有 ${hidden.length} 个工具没有直接放进工具表,需要时按下面的步骤取用:`)
|
|
151
|
+
lines.push('· find_tool("关键词") 查找 → describe_tool(name) 看参数 → use_tool(name, {...}) 执行。')
|
|
152
|
+
if (mode === 'expand') {
|
|
153
|
+
lines.push('· 搜索到的工具会留在工具表里,之后直接调用即可。')
|
|
154
|
+
}
|
|
155
|
+
lines.push('')
|
|
156
|
+
for (const [group, names] of ordered) {
|
|
157
|
+
lines.push(`${group}(${names.length}):${names.join('、')}`)
|
|
158
|
+
}
|
|
159
|
+
return lines.join('\n')
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Rank tools against a natural-language or keyword query.
|
|
164
|
+
*
|
|
165
|
+
* Word-order independent, case insensitive, name hits weigh more than
|
|
166
|
+
* description hits, and a query that matches nothing returns an empty list so
|
|
167
|
+
* the caller can offer a hint instead of a wrong guess.
|
|
168
|
+
*
|
|
169
|
+
* @param {readonly {name: string, description?: string}[]} tools - searchable catalog.
|
|
170
|
+
* @param {string} query - user/model query.
|
|
171
|
+
* @param {number} limit - maximum matches.
|
|
172
|
+
* @returns {{name: string, description: string, score: number}[]} ranked matches.
|
|
173
|
+
*/
|
|
174
|
+
export function keywordSearch(tools, query, limit) {
|
|
175
|
+
const words = String(query ?? '')
|
|
176
|
+
.toLowerCase()
|
|
177
|
+
.split(/[^a-z0-9_\u4e00-\u9fff]+/u)
|
|
178
|
+
.filter((word) => word.length > 0)
|
|
179
|
+
const bounded = Math.max(1, Math.min(50, Math.trunc(Number(limit) || 6)))
|
|
180
|
+
if (words.length === 0) return []
|
|
181
|
+
const scored = []
|
|
182
|
+
for (const tool of tools) {
|
|
183
|
+
const name = String(tool.name).toLowerCase()
|
|
184
|
+
const description = String(tool.description ?? '').toLowerCase()
|
|
185
|
+
const parts = name.split(/[_\W]+/u).filter(Boolean)
|
|
186
|
+
let score = 0
|
|
187
|
+
for (const word of words) {
|
|
188
|
+
if (name === word) score += 40
|
|
189
|
+
else if (parts.includes(word)) score += 16
|
|
190
|
+
else if (name.includes(word)) score += 10
|
|
191
|
+
if (description.includes(word)) score += 3
|
|
192
|
+
}
|
|
193
|
+
if (score > 0) scored.push({ name: tool.name, description: oneLine(tool.description, 120), score })
|
|
194
|
+
}
|
|
195
|
+
scored.sort((a, b) => b.score - a.score || a.name.localeCompare(b.name))
|
|
196
|
+
return scored.slice(0, bounded)
|
|
197
|
+
}
|
package/lib/gate.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-tool-drawer — the resolve gate.
|
|
3
|
+
*
|
|
4
|
+
* `dsh-tools` resolves each step's admission set with `tools.resolve()`; the
|
|
5
|
+
* system-prompt tool provider then renders `definitions(scope, toolSet)` into
|
|
6
|
+
* the model-facing table. Wrapping that one method is therefore the smallest
|
|
7
|
+
* seam that changes the table without touching any registration, preset, or
|
|
8
|
+
* provider — and execution reads the same set, so a hidden tool is rejected as
|
|
9
|
+
* `UNKNOWN_TOOL` instead of becoming a phantom.
|
|
10
|
+
*
|
|
11
|
+
* @module dsh-tool-drawer/gate
|
|
12
|
+
*/
|
|
13
|
+
import { keepPredicate } from './drawer.js'
|
|
14
|
+
|
|
15
|
+
/** Marks the un-filtered set on a wrapped {@link ResolvedToolSet}. */
|
|
16
|
+
export const FULL_SET = Symbol('tool-drawer:full-set')
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Wrap one resolved set with a filtered `view`.
|
|
20
|
+
* @param {{dispose: () => void, view: (scope: unknown) => Map<string, unknown>}} settled - original set.
|
|
21
|
+
* @param {(name: string) => boolean} keep - tool names that stay visible.
|
|
22
|
+
* @returns {object} wrapped set carrying the original under {@link FULL_SET}.
|
|
23
|
+
*/
|
|
24
|
+
export function wrapToolSet(settled, keep) {
|
|
25
|
+
const wrapped = {
|
|
26
|
+
dispose: settled.dispose,
|
|
27
|
+
view(scope) {
|
|
28
|
+
const view = settled.view(scope)
|
|
29
|
+
// A broken predicate must never take a step down: fall back to the
|
|
30
|
+
// unfiltered view, which is exactly what the host would have rendered.
|
|
31
|
+
try {
|
|
32
|
+
let hidden = 0
|
|
33
|
+
const filtered = new Map()
|
|
34
|
+
for (const [toolName, definition] of view) {
|
|
35
|
+
if (keep(toolName)) filtered.set(toolName, definition)
|
|
36
|
+
else hidden += 1
|
|
37
|
+
}
|
|
38
|
+
return hidden === 0 ? view : filtered
|
|
39
|
+
} catch {
|
|
40
|
+
return view
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
Object.defineProperty(wrapped, FULL_SET, { value: settled, enumerable: false })
|
|
45
|
+
return wrapped
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Install the gate on a tools service.
|
|
50
|
+
* @param {object} tools - the `tools` service instance.
|
|
51
|
+
* @param {{readConfig: () => {enabled: boolean, mode: string, core: Set<string>}, activeNames: (agent: unknown) => Iterable<string>}} hooks - live config and activation state.
|
|
52
|
+
* @returns {() => void} uninstall, restoring the exact previous method.
|
|
53
|
+
*/
|
|
54
|
+
export function installResolveGate(tools, hooks) {
|
|
55
|
+
const ownDescriptor = Object.getOwnPropertyDescriptor(tools, 'resolve')
|
|
56
|
+
const original = tools.resolve
|
|
57
|
+
|
|
58
|
+
tools.resolve = async function drawerResolve(input) {
|
|
59
|
+
const settled = await original.call(this, input)
|
|
60
|
+
let effective
|
|
61
|
+
try {
|
|
62
|
+
effective = hooks.readConfig()
|
|
63
|
+
} catch {
|
|
64
|
+
return settled
|
|
65
|
+
}
|
|
66
|
+
if (!effective.enabled) return settled
|
|
67
|
+
const agent = input !== null && typeof input === 'object' ? input.agent : undefined
|
|
68
|
+
const active = effective.mode === 'expand' && agent !== undefined ? hooks.activeNames(agent) : []
|
|
69
|
+
return wrapToolSet(settled, keepPredicate(effective, active))
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return function uninstall() {
|
|
73
|
+
if (ownDescriptor !== undefined) Object.defineProperty(tools, 'resolve', ownDescriptor)
|
|
74
|
+
else delete tools.resolve
|
|
75
|
+
}
|
|
76
|
+
}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-tool-drawer — host half.
|
|
3
|
+
*
|
|
4
|
+
* DSH resolves the model-facing tool table from `tools.resolve()` once per
|
|
5
|
+
* step: `preStep` calls it, the `system-prompt` tool provider renders
|
|
6
|
+
* `definitions(scope, toolSet)`, and the session log records the result. The
|
|
7
|
+
* provider (llama.cpp, DeepSeek, …) only ever sees that final list, so shrinking
|
|
8
|
+
* it here is provider independent and needs no `deferLoading` support.
|
|
9
|
+
*
|
|
10
|
+
* Two modes:
|
|
11
|
+
* - `proxy` (default): the table holds the core set plus three bridge tools.
|
|
12
|
+
* Everything else is reachable through `find_tool` → `describe_tool` →
|
|
13
|
+
* `use_tool`, which executes through the normal tool pipeline.
|
|
14
|
+
* - `expand`: the same bridge, but searched or called tools are added to the
|
|
15
|
+
* agent's visible set so the next step can call them directly.
|
|
16
|
+
*
|
|
17
|
+
* Nothing is persisted and no registration is mutated: removing the plugin
|
|
18
|
+
* restores the stock table exactly.
|
|
19
|
+
*
|
|
20
|
+
* @module dsh-tool-drawer
|
|
21
|
+
*/
|
|
22
|
+
import Schema from '@deepseek-ai/schemastery'
|
|
23
|
+
import { FULL_SET, installResolveGate } from './gate.js'
|
|
24
|
+
import {
|
|
25
|
+
ALWAYS_KEEP,
|
|
26
|
+
BRIDGE_NAMES,
|
|
27
|
+
DEFAULT_CORE,
|
|
28
|
+
MANIFEST_CONTEXT,
|
|
29
|
+
buildManifest,
|
|
30
|
+
keepPredicate,
|
|
31
|
+
keywordSearch,
|
|
32
|
+
oneLine,
|
|
33
|
+
resolveConfig,
|
|
34
|
+
} from './drawer.js'
|
|
35
|
+
|
|
36
|
+
/** Settings namespace == bundle row id. */
|
|
37
|
+
export const name = 'tool-drawer'
|
|
38
|
+
|
|
39
|
+
/** Services resolved before `apply` runs. */
|
|
40
|
+
export const inject = ['tools', 'systemPrompt']
|
|
41
|
+
|
|
42
|
+
export const Config = Schema.object({
|
|
43
|
+
enabled: Schema.boolean()
|
|
44
|
+
.default(true)
|
|
45
|
+
.description('总开关。关掉后 DSH 恢复原样,所有工具直接可用。')
|
|
46
|
+
.volatile(),
|
|
47
|
+
mode: Schema.string()
|
|
48
|
+
.default('proxy')
|
|
49
|
+
.description('proxy = 代理模式(推荐,最省上下文);expand = 膨胀模式(用过的工具留在工具表里,调用更准但更占地方)')
|
|
50
|
+
.volatile(),
|
|
51
|
+
coreTools: Schema.string()
|
|
52
|
+
.default(DEFAULT_CORE.join(', '))
|
|
53
|
+
.description('常驻工具:始终直接可用,不需要搜索。逗号分隔。')
|
|
54
|
+
.volatile(),
|
|
55
|
+
maxActive: Schema.number()
|
|
56
|
+
.step(1)
|
|
57
|
+
.min(1)
|
|
58
|
+
.max(128)
|
|
59
|
+
.default(20)
|
|
60
|
+
.description('膨胀模式下最多同时展开几个工具,超出的先收起来。')
|
|
61
|
+
.volatile(),
|
|
62
|
+
searchLimit: Schema.number()
|
|
63
|
+
.step(1)
|
|
64
|
+
.min(1)
|
|
65
|
+
.max(20)
|
|
66
|
+
.default(6)
|
|
67
|
+
.description('每次搜索最多返回几个工具。')
|
|
68
|
+
.volatile(),
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
/** Canonical output schema: a plain JSON object, rendered by each tool. */
|
|
72
|
+
const OBJECT_OUTPUT = { type: 'object', additionalProperties: true, properties: {} }
|
|
73
|
+
|
|
74
|
+
/** Execution call ids are strings; anything opaque works at runtime. */
|
|
75
|
+
let callSequence = 0
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Install the drawer.
|
|
79
|
+
* @param {import('@deepseek-ai/cordis').Context} ctx - plugin context.
|
|
80
|
+
* @param {Record<string, unknown>} config - mounted config.
|
|
81
|
+
*/
|
|
82
|
+
export function apply(ctx, config) {
|
|
83
|
+
const raw = config !== null && typeof config === 'object' ? config : {}
|
|
84
|
+
const readConfig = () => resolveConfig(raw)
|
|
85
|
+
|
|
86
|
+
/** Per-agent activation state (`expand` mode only). */
|
|
87
|
+
const states = new WeakMap()
|
|
88
|
+
/** Inner tool content held between `execute` and `finalizeContent`. */
|
|
89
|
+
const held = new Map()
|
|
90
|
+
|
|
91
|
+
function stateOf(agent) {
|
|
92
|
+
let state = states.get(agent)
|
|
93
|
+
if (state === undefined) {
|
|
94
|
+
state = { active: new Map() }
|
|
95
|
+
states.set(agent, state)
|
|
96
|
+
}
|
|
97
|
+
return state
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function activate(agent, names, maxActive) {
|
|
101
|
+
if (agent === undefined) return
|
|
102
|
+
const state = stateOf(agent)
|
|
103
|
+
for (const toolName of names) {
|
|
104
|
+
state.active.delete(toolName)
|
|
105
|
+
state.active.set(toolName, true)
|
|
106
|
+
}
|
|
107
|
+
while (state.active.size > maxActive) {
|
|
108
|
+
const oldest = state.active.keys().next().value
|
|
109
|
+
if (oldest === undefined) break
|
|
110
|
+
state.active.delete(oldest)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function catalogOf(agent) {
|
|
115
|
+
try {
|
|
116
|
+
return ctx.tools.definitions(agent !== undefined ? agent : undefined)
|
|
117
|
+
} catch {
|
|
118
|
+
return []
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Tools this step already admitted through their own `when` conditions, before
|
|
124
|
+
* the drawer filter. Searching the unfiltered registry would offer tools the
|
|
125
|
+
* execution path then refuses, so the admitted set is the honest catalog.
|
|
126
|
+
* @param {unknown} agent - the step's agent.
|
|
127
|
+
* @param {object} [toolSet] - the step's (wrapped) resolution.
|
|
128
|
+
* @returns {object[]} tool definitions.
|
|
129
|
+
*/
|
|
130
|
+
function admittedOf(agent, toolSet) {
|
|
131
|
+
const full = toolSet?.[FULL_SET]
|
|
132
|
+
if (full !== undefined) {
|
|
133
|
+
try {
|
|
134
|
+
const view = full.view(agent)
|
|
135
|
+
if (view !== undefined && typeof view.values === 'function' && view.size > 0) return [...view.values()]
|
|
136
|
+
} catch {
|
|
137
|
+
// fall through to the registry view
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return catalogOf(agent)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// ---- the gate: shrink `resolve` before the provider renders it ----------
|
|
144
|
+
const uninstallGate = installResolveGate(ctx.tools, {
|
|
145
|
+
readConfig,
|
|
146
|
+
activeNames: (agent) => (states.has(agent) ? states.get(agent).active.keys() : []),
|
|
147
|
+
})
|
|
148
|
+
ctx.effect(() => uninstallGate, 'tool-drawer: resolve gate')
|
|
149
|
+
|
|
150
|
+
// ---- bridge tools -------------------------------------------------------
|
|
151
|
+
const searchTool = {
|
|
152
|
+
name: 'find_tool',
|
|
153
|
+
description:
|
|
154
|
+
'在"工具抽屉"里按关键词查找工具。这个插件把不常用的工具收起来了:先搜索拿到名字,需要参数就调 describe_tool,最后用 use_tool 执行。',
|
|
155
|
+
parameters: {
|
|
156
|
+
type: 'object',
|
|
157
|
+
properties: {
|
|
158
|
+
query: { type: 'string', description: '关键词,中英文都行,例如「图片」「workflow」「web」「mcp」' },
|
|
159
|
+
limit: { type: 'integer', description: '最多返回几个,默认取插件设置' },
|
|
160
|
+
},
|
|
161
|
+
required: ['query'],
|
|
162
|
+
additionalProperties: false,
|
|
163
|
+
},
|
|
164
|
+
output: {
|
|
165
|
+
schema: OBJECT_OUTPUT,
|
|
166
|
+
render(_args, value) {
|
|
167
|
+
const matches = Array.isArray(value?.matches) ? value.matches : []
|
|
168
|
+
if (matches.length === 0) {
|
|
169
|
+
return [{ type: 'text', text: `没有找到匹配的工具。${value?.hint ?? '换个关键词试试,或者用 describe_tool 直接查名字。'}` }]
|
|
170
|
+
}
|
|
171
|
+
const lines = matches.map((match) => `· ${match.name} — ${match.description ?? ''}`)
|
|
172
|
+
const tail =
|
|
173
|
+
value?.mode === 'expand'
|
|
174
|
+
? '这些工具已放进工具表,下一步可以直接调用。'
|
|
175
|
+
: '需要参数就调 describe_tool(name),执行用 use_tool(name, {...})。'
|
|
176
|
+
return [{ type: 'text', text: `${lines.join('\n')}\n\n${tail}` }]
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
async execute(args, exec) {
|
|
180
|
+
const effective = readConfig()
|
|
181
|
+
const query = String(args?.query ?? '')
|
|
182
|
+
const limit = Number.isFinite(Number(args?.limit)) ? Number(args.limit) : effective.searchLimit
|
|
183
|
+
const catalog = admittedOf(exec.agent, exec.toolSet)
|
|
184
|
+
const keep = keepPredicate(effective, [])
|
|
185
|
+
const searchable = catalog.filter((definition) => !keep(definition.name) && !BRIDGE_NAMES.includes(definition.name))
|
|
186
|
+
const matches = keywordSearch(searchable, query, limit)
|
|
187
|
+
if (effective.mode === 'expand' && matches.length > 0) {
|
|
188
|
+
activate(exec.agent, matches.map((match) => match.name), effective.maxActive)
|
|
189
|
+
}
|
|
190
|
+
const result = {
|
|
191
|
+
mode: effective.mode,
|
|
192
|
+
matches: matches.map((match) => ({ name: match.name, description: match.description })),
|
|
193
|
+
}
|
|
194
|
+
if (matches.length === 0) {
|
|
195
|
+
result.hint = `没有找到与「${query}」相关的工具;可以换关键词,或调 describe_tool 直接查已知名字。`
|
|
196
|
+
}
|
|
197
|
+
return result
|
|
198
|
+
},
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const describeTool = {
|
|
202
|
+
name: 'describe_tool',
|
|
203
|
+
description: '查看"工具抽屉"里某个工具的完整说明和参数格式。执行前用它确认参数怎么填。',
|
|
204
|
+
parameters: {
|
|
205
|
+
type: 'object',
|
|
206
|
+
properties: {
|
|
207
|
+
name: { type: 'string', description: '工具名,例如 mcp__comfy-mcp__generate_image' },
|
|
208
|
+
},
|
|
209
|
+
required: ['name'],
|
|
210
|
+
additionalProperties: false,
|
|
211
|
+
},
|
|
212
|
+
output: {
|
|
213
|
+
schema: OBJECT_OUTPUT,
|
|
214
|
+
render(_args, value) {
|
|
215
|
+
if (value?.isError === true) return [{ type: 'text', text: String(value?.text ?? '工具不存在') }]
|
|
216
|
+
return [
|
|
217
|
+
{
|
|
218
|
+
type: 'text',
|
|
219
|
+
text: `工具:${value.name}\n说明:${value.description ?? '(无)'}\n参数:${value.parameters ?? '{}'}\n\n调用:use_tool({ name: "${value.name}", arguments: { ... } })`,
|
|
220
|
+
},
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
execute(args, exec) {
|
|
225
|
+
const toolName = String(args?.name ?? '').trim()
|
|
226
|
+
const definition = admittedOf(exec.agent, exec.toolSet).find((entry) => entry.name === toolName)
|
|
227
|
+
if (definition === undefined) {
|
|
228
|
+
return { isError: true, text: `没有这个工具:${toolName || '(空)'}。先用 find_tool 查一下。` }
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
name: definition.name,
|
|
232
|
+
description: oneLine(definition.description, 400),
|
|
233
|
+
parameters: JSON.stringify(definition.parameters ?? {}, null, 2),
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const callTool = {
|
|
239
|
+
name: 'use_tool',
|
|
240
|
+
description:
|
|
241
|
+
'执行"工具抽屉"里的工具。arguments 填该工具的参数对象(先用 describe_tool 确认格式)。返回内容就是那个工具的真实结果。',
|
|
242
|
+
parameters: {
|
|
243
|
+
type: 'object',
|
|
244
|
+
properties: {
|
|
245
|
+
name: { type: 'string', description: '工具名' },
|
|
246
|
+
arguments: { type: 'object', additionalProperties: true, description: '该工具的参数对象;没有参数就省略' },
|
|
247
|
+
},
|
|
248
|
+
required: ['name'],
|
|
249
|
+
additionalProperties: false,
|
|
250
|
+
},
|
|
251
|
+
output: {
|
|
252
|
+
schema: OBJECT_OUTPUT,
|
|
253
|
+
render(_args, value) {
|
|
254
|
+
const text = String(value?.text ?? '')
|
|
255
|
+
const prefix = value?.isError === true ? `工具 ${value?.tool ?? ''} 报错:\n` : ''
|
|
256
|
+
return [{ type: 'text', text: `${prefix}${text === '' ? '(无输出)' : text}` }]
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
finalizeContent(exec) {
|
|
260
|
+
const content = held.get(exec.callId)
|
|
261
|
+
if (content === undefined) return undefined
|
|
262
|
+
held.delete(exec.callId)
|
|
263
|
+
return content.length > 0 ? content : undefined
|
|
264
|
+
},
|
|
265
|
+
async execute(args, exec) {
|
|
266
|
+
const toolName = String(args?.name ?? '').trim()
|
|
267
|
+
if (toolName === '') throw new Error('use_tool 需要 name 参数:要调用哪个工具')
|
|
268
|
+
if (BRIDGE_NAMES.includes(toolName)) throw new Error(`桥接工具不能通过 use_tool 调用自己:${toolName}`)
|
|
269
|
+
const definition = admittedOf(exec.agent, exec.toolSet).find((entry) => entry.name === toolName)
|
|
270
|
+
if (definition === undefined) {
|
|
271
|
+
throw new Error(`没有这个工具:${toolName}。先 find_tool 查找,或用 describe_tool 确认名字。`)
|
|
272
|
+
}
|
|
273
|
+
const effective = readConfig()
|
|
274
|
+
const unfiltered = exec.toolSet?.[FULL_SET] ?? exec.toolSet
|
|
275
|
+
callSequence += 1
|
|
276
|
+
const callId = `tw-${Date.now().toString(36)}-${callSequence}`
|
|
277
|
+
const payload = args?.arguments !== null && typeof args?.arguments === 'object' ? args.arguments : {}
|
|
278
|
+
let batch
|
|
279
|
+
try {
|
|
280
|
+
batch = await ctx.tools.execute({
|
|
281
|
+
calls: [{ type: 'tool-call', id: callId, name: toolName, arguments: JSON.stringify(payload) }],
|
|
282
|
+
signal: exec.signal,
|
|
283
|
+
agent: exec.agent,
|
|
284
|
+
toolSet: unfiltered,
|
|
285
|
+
})
|
|
286
|
+
} catch (error) {
|
|
287
|
+
return { tool: toolName, isError: true, text: `调用失败:${error instanceof Error ? error.message : String(error)}` }
|
|
288
|
+
}
|
|
289
|
+
const outcome = batch?.results?.[0]?.result
|
|
290
|
+
if (outcome === undefined) throw new Error(`工具 ${toolName} 没有返回结果`)
|
|
291
|
+
const content = Array.isArray(outcome.content) ? outcome.content : []
|
|
292
|
+
held.set(exec.callId, content)
|
|
293
|
+
if (held.size > 64) held.delete(held.keys().next().value)
|
|
294
|
+
if (effective.mode === 'expand') activate(exec.agent, [toolName], effective.maxActive)
|
|
295
|
+
const text = content
|
|
296
|
+
.filter((block) => block !== null && typeof block === 'object' && block.type === 'text')
|
|
297
|
+
.map((block) => String(block.text ?? ''))
|
|
298
|
+
.join('\n')
|
|
299
|
+
return { tool: toolName, isError: outcome.isError === true, text }
|
|
300
|
+
},
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
for (const definition of [searchTool, describeTool, callTool]) {
|
|
304
|
+
ctx.effect(() => {
|
|
305
|
+
try {
|
|
306
|
+
const dispose = ctx.tools.register(definition)
|
|
307
|
+
return () => dispose()
|
|
308
|
+
} catch (error) {
|
|
309
|
+
// A name collision (e.g. another tool-search plugin) must not take the
|
|
310
|
+
// whole profile down; the remaining bridge tools still work.
|
|
311
|
+
ctx.logger?.warn?.(`tool-drawer: ${definition.name} 注册失败:${String(error)}`)
|
|
312
|
+
return () => {}
|
|
313
|
+
}
|
|
314
|
+
}, `tool-drawer: ${definition.name}`)
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// ---- the drawer index ---------------------------------------------------
|
|
318
|
+
ctx.on(
|
|
319
|
+
'system-prompt/assemble',
|
|
320
|
+
async (assembly, context, next) => {
|
|
321
|
+
const settled = await next()
|
|
322
|
+
try {
|
|
323
|
+
const effective = readConfig()
|
|
324
|
+
if (!effective.enabled) return settled
|
|
325
|
+
const agent = context?.agent ?? context?.scope
|
|
326
|
+
const all = admittedOf(agent, context?.toolSet)
|
|
327
|
+
const visible = new Set(
|
|
328
|
+
(context?.toolSet !== undefined ? ctx.tools.definitions(agent, context.toolSet) : all).map((entry) => entry.name),
|
|
329
|
+
)
|
|
330
|
+
const hidden = all.filter((entry) => !visible.has(entry.name) && !ALWAYS_KEEP.includes(entry.name))
|
|
331
|
+
const text = buildManifest(hidden, effective.mode)
|
|
332
|
+
if (text === '') return settled
|
|
333
|
+
const contexts = Array.isArray(settled?.contexts) ? settled.contexts : []
|
|
334
|
+
if (contexts.some((entry) => entry?.name === MANIFEST_CONTEXT)) return settled
|
|
335
|
+
return { ...settled, contexts: [...contexts, { name: MANIFEST_CONTEXT, text }] }
|
|
336
|
+
} catch (error) {
|
|
337
|
+
ctx.logger?.debug?.(`tool-drawer: manifest skipped (${String(error)})`)
|
|
338
|
+
return settled
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
)
|
|
342
|
+
}
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,94 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-tool-drawer",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Keep DeepSeek Harness's tool list small: the tools you use sit on the desk, everything else waits in a drawer and is fetched on demand.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/index.js",
|
|
9
|
+
"./client": "./lib/client.js",
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
"./locale/*.json": "./locale/*.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"lib",
|
|
15
|
+
"cordis.patch.yml",
|
|
16
|
+
"README.md",
|
|
17
|
+
"README-zh.md",
|
|
18
|
+
"LICENSE",
|
|
19
|
+
"locale"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "node --test tests/drawer.test.js tests/gate.test.js tests/smoke.test.js tests/docs.test.js"
|
|
23
|
+
},
|
|
24
|
+
"dsh": {
|
|
25
|
+
"bundle": {
|
|
26
|
+
"patch": "./cordis.patch.yml"
|
|
27
|
+
},
|
|
28
|
+
"client": {
|
|
29
|
+
"platform": "web",
|
|
30
|
+
"inject": [
|
|
31
|
+
"@deepseek-ai/dsh-client-ui-settings"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"verifiedWith": "0.2.2-rc.3",
|
|
35
|
+
"compatibility": {
|
|
36
|
+
"dsh": ">=0.2.2-rc.3",
|
|
37
|
+
"dshReleases": {
|
|
38
|
+
"0.2.2-rc.3": "compatible"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@deepseek-ai/cordis": "^4.1.0",
|
|
44
|
+
"@deepseek-ai/dsh-system-prompt": ">=0.2.2-rc.3",
|
|
45
|
+
"@deepseek-ai/dsh-tools": ">=0.2.2-rc.3",
|
|
46
|
+
"@deepseek-ai/schemastery": "^3.18.2"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"@deepseek-ai/cordis": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"@deepseek-ai/dsh-tools": {
|
|
53
|
+
"optional": true
|
|
54
|
+
},
|
|
55
|
+
"@deepseek-ai/dsh-system-prompt": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"@deepseek-ai/schemastery": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@deepseek-ai/schemastery": "^3.18.2"
|
|
64
|
+
},
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
67
|
+
},
|
|
68
|
+
"packageManager": "pnpm@11.7.0",
|
|
69
|
+
"license": "MIT",
|
|
70
|
+
"author": "zyd232",
|
|
71
|
+
"repository": {
|
|
72
|
+
"type": "git",
|
|
73
|
+
"url": "git+https://github.com/zyd232/dsh-tool-drawer.git"
|
|
74
|
+
},
|
|
75
|
+
"homepage": "https://github.com/zyd232/dsh-tool-drawer#readme",
|
|
76
|
+
"bugs": {
|
|
77
|
+
"url": "https://github.com/zyd232/dsh-tool-drawer/issues"
|
|
78
|
+
},
|
|
79
|
+
"keywords": [
|
|
80
|
+
"dsh-plugin",
|
|
81
|
+
"deepseek-harness",
|
|
82
|
+
"dsh",
|
|
83
|
+
"cordis",
|
|
84
|
+
"tool-drawer",
|
|
85
|
+
"progressive-disclosure",
|
|
86
|
+
"lazy-loading",
|
|
87
|
+
"context-window",
|
|
88
|
+
"tool-search"
|
|
89
|
+
],
|
|
90
|
+
"publishConfig": {
|
|
91
|
+
"registry": "https://registry.npmjs.org",
|
|
92
|
+
"access": "public"
|
|
93
|
+
}
|
|
94
|
+
}
|