@tokensapi/dsh-progressive-tools 0.1.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,124 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and releases follow
5
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [Tokens 0.1.0] - 2026-08-28
10
+
11
+ ### Added
12
+
13
+ - Tokens-owned package and Cordis identities for marketplace distribution.
14
+ - A product-tuned stable direct surface for common file, shell, Skill, task,
15
+ interaction, and file-return tools.
16
+ - Exact DSH `0.1.0-rc.8` development and peer compatibility, including a
17
+ fully pinned rc.8 test graph.
18
+ - Package identity tests and retained upstream MIT attribution.
19
+
20
+ ### Based on
21
+
22
+ - Upstream `dsh-progressive-tools` 0.3.0 at commit
23
+ `8d516b9933d5b7812ab39c929fd9ee5df66d5221`.
24
+
25
+ ## [0.3.0] - 2026-08-25
26
+
27
+ Upgrading changes the stable discovery prompt text, so every deployment pays
28
+ one context-cache cold start on the first request after the upgrade; the
29
+ prefix is byte-stable again from the second request onward.
30
+
31
+ ### Added
32
+
33
+ - Family-wide discovery: each stable search match lists every member tool name
34
+ of its family (`groupTools`), and the whole family becomes dispatchable from
35
+ that one search, so a plugin's tool surface is no longer truncated to the
36
+ top-ranked slice.
37
+ - Stable-proxy `status` action lists every deferred family with member tool
38
+ names, giving the model a catalog-browsing fallback when a search query has
39
+ no lexical overlap.
40
+ - `statusGrantsDiscovery` option (default `false`): when enabled, one `status`
41
+ listing makes every cataloged name dispatchable. The default keeps dispatch
42
+ behind a seen schema and the rejection message points to the deterministic
43
+ exact-name recovery search.
44
+ - Generic verb prefixes (`get`, `list`, `create`, ...) never merge into
45
+ automatic families, so unrelated plugins sharing a prefix stay separate.
46
+ - The built-in image-generation family covers generation task helpers such as
47
+ `get_image_generation_task` and `cancel_image_generation_task`.
48
+ - CJK character-bigram tokenization so queries without space-delimited words
49
+ match deferred definitions and family metadata without configured aliases.
50
+ - `tool_dispatch` delegates its parallel-scheduling classification to the
51
+ target tool, so concurrency-safe deferred tools keep overlapping execution.
52
+ - Documentation: an ecosystem onboarding checklist (`alwaysVisible` for
53
+ high-frequency tools, `skillBindings` for Skill-shipping packages, explicit
54
+ `groups` for unconventional names).
55
+
56
+ ### Changed
57
+
58
+ - Search results now record per-call discovery increments in the rendered
59
+ text, plus a cumulative `discoveredCount`; the cumulative name list moved to
60
+ presentation metadata, so conversation growth stays bounded and resume
61
+ restores full state from the latest surviving entry.
62
+ - The stable discovery prompt clarifies that names mentioned elsewhere in the
63
+ prompt still require discovery, and points to `status` for catalog browsing.
64
+ - `max_results` values outside the configured range are clamped instead of
65
+ rejected, matching upstream tool-search semantics.
66
+
67
+ ### Fixed
68
+
69
+ - The routing guard prepares per-agent state on demand, closing a
70
+ direct-call window before the first assembly or session-start event.
71
+ - Discovered-tool state survives registry refreshes such as provider
72
+ reconnects; dispatch validates catalog membership at call time.
73
+ - Dispatch failures preserve the real tool's structured error code instead of
74
+ collapsing it into an unstructured message.
75
+
76
+ ## [0.2.0] - 2026-08-25
77
+
78
+ ### Added
79
+
80
+ - Cache-stable `stable-proxy` mode as the new default.
81
+ - Fixed first-request surface with `tool_search`, `tool_dispatch`, and
82
+ configurable common direct tools.
83
+ - Exact definition search with BM25-style lexical ranking over nested schema
84
+ text and multilingual family aliases.
85
+ - Nested real-tool dispatch through the complete DSH execution pipeline.
86
+ - Monotonic routing guard for direct-call and Code Mode bypass prevention.
87
+ - Stable Code Mode SDK projection and conservative tool-guidance deferral.
88
+ - Real AgentLoop request regression test for first-request and prefix stability.
89
+
90
+ ### Fixed
91
+
92
+ - First request no longer sends the full tool catalog before progressive state
93
+ takes effect.
94
+ - Dynamic-mode search and Skill activation now affect the immediately following
95
+ request instead of lagging one request boundary.
96
+ - Request lifecycle documentation now matches the official assembly order.
97
+
98
+ ### Changed
99
+
100
+ - Search returns exact tool definitions in stable mode instead of activating a
101
+ whole family.
102
+ - Agent-scoped tools can be deferred in stable mode.
103
+ - `dynamic` is now an explicit compatibility mode.
104
+
105
+ ## [0.1.0] - 2026-08-25
106
+
107
+ ### Added
108
+
109
+ - Per-agent progressive tool discovery through the official scoped restriction
110
+ API.
111
+ - Configurable family rules, multilingual aliases, and automatic fallback
112
+ grouping.
113
+ - Token-budget, LRU, family-cap, and turn-TTL retention controls.
114
+ - Optional skill-to-family activation bindings.
115
+ - Dynamic registry refresh and reversible lifecycle cleanup.
116
+ - Resume restoration for top-level and nested discovery calls.
117
+ - Bundle manifest, GitHub source-install build path, documentation, tests, and
118
+ continuous integration.
119
+
120
+ [Unreleased]: https://github.com/TokensAPI/tokens_DshProgressiveTools_code/compare/v0.1.0...HEAD
121
+ [Tokens 0.1.0]: https://github.com/TokensAPI/tokens_DshProgressiveTools_code/releases/tag/v0.1.0
122
+ [0.3.0]: https://github.com/everclear077/dsh-progressive-tools/compare/v0.2.0...v0.3.0
123
+ [0.2.0]: https://github.com/everclear077/dsh-progressive-tools/compare/v0.1.0...v0.2.0
124
+ [0.1.0]: https://github.com/everclear077/dsh-progressive-tools/releases/tag/v0.1.0
@@ -0,0 +1,32 @@
1
+ # Contributing
2
+
3
+ Contributions are welcome through focused issues and pull requests.
4
+
5
+ ## Development setup
6
+
7
+ Requirements:
8
+
9
+ - Node.js `^22.19.0` or `>=24.0.0`
10
+ - pnpm 11
11
+
12
+ ```sh
13
+ pnpm install
14
+ pnpm run check
15
+ ```
16
+
17
+ ## Change guidelines
18
+
19
+ - Keep runtime behavior on public DeepSeek Harness services and events.
20
+ - Preserve per-agent isolation and reversible Cordis cleanup.
21
+ - Keep prompt projection and execution routing aligned. Any newly deferred path
22
+ must be covered by the monotonic routing guard and an end-to-end request test.
23
+ - Add tests for behavior changes, including resume or unload behavior when
24
+ relevant.
25
+ - Update README, configuration reference, architecture notes, and changelog when
26
+ public behavior changes.
27
+ - Keep commits focused and use Conventional Commit subjects.
28
+
29
+ ## Pull requests
30
+
31
+ Describe the user-visible problem, the chosen behavior, compatibility impact,
32
+ and verification performed. Keep unrelated refactors out of the same change.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 everclear077
4
+ Copyright (c) 2026 TokensAPI contributors
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,246 @@
1
+ # Tokens Progressive Tools
2
+
3
+ [![CI](https://github.com/TokensAPI/tokens_DshProgressiveTools_code/actions/workflows/ci.yml/badge.svg)](https://github.com/TokensAPI/tokens_DshProgressiveTools_code/actions/workflows/ci.yml)
4
+ [![version](https://img.shields.io/badge/version-0.1.0-blue.svg)](./CHANGELOG.md)
5
+ [![license](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)
6
+
7
+ TokensCowork's cache-stable progressive tool discovery for DeepSeek Harness. The default mode
8
+ sends a small, fixed tool surface on the first request, keeps the complete
9
+ catalog in process memory, and executes discovered tools through the ordinary
10
+ Harness pipeline.
11
+
12
+ [中文文档](./README.zh-CN.md)
13
+
14
+ ## Why
15
+
16
+ Every visible tool definition consumes input tokens on every request. Changing
17
+ that definition list later also changes the request prefix and reduces context
18
+ cache reuse. Progressive disclosure needs both properties at once:
19
+
20
+ - a small first request;
21
+ - a byte-stable tool and system prefix across later requests.
22
+
23
+ The default `stable-proxy` mode provides that contract:
24
+
25
+ ```text
26
+ complete registry (process memory)
27
+
28
+ ├── exact searchable definitions
29
+
30
+ └── fixed request surface
31
+ ├── tool_search
32
+ ├── tool_dispatch
33
+ └── common direct tools
34
+
35
+ tool_search result ────┴──► append exact matches to conversation history
36
+
37
+ └── tool_dispatch ──► normal DSH execution pipeline
38
+ ```
39
+
40
+ Search changes conversation history, not the top-level tool list. Approval,
41
+ guards, argument validation, timeout wrappers, result policy, deferred context,
42
+ and cancellation still run for the selected real tool.
43
+
44
+ ## Features
45
+
46
+ - Minimal tool definitions on the actual first AgentLoop request.
47
+ - Byte-stable native tool list and Code Mode SDK across discovery calls.
48
+ - Exact tool matches with full name, description, and parameter schema.
49
+ - Family-wide discovery: each match names every sibling tool of its family, so
50
+ one search opens a plugin's complete dispatchable surface.
51
+ - Browsable `status` catalog listing, with an optional
52
+ `statusGrantsDiscovery` grant for trusted deployments.
53
+ - Bounded conversation growth: search results record per-call discovery
54
+ increments while resume state travels in presentation metadata.
55
+ - Deterministic BM25-style lexical ranking over names, descriptions, nested
56
+ parameter descriptions, enums, family metadata, and multilingual aliases.
57
+ - Stable `tool_dispatch` transport with runtime schema validation through the
58
+ original tool definition.
59
+ - Monotonic guard that rejects direct calls to deferred tools and permits only
60
+ dispatcher-owned nested execution trees.
61
+ - Support for inherited and agent-scoped tools.
62
+ - Durable discovery reconstruction for top-level and Code Mode search calls.
63
+ - Optional skill-to-family discovery bindings.
64
+ - `dynamic` compatibility mode for deployments that require native definitions
65
+ after activation.
66
+ - Reversible Cordis effects for unload and configuration reload.
67
+
68
+ ## Requirements
69
+
70
+ - Node.js `^22.19.0` or `>=24.0.0`
71
+ - DeepSeek Harness `0.1.0-rc.8`
72
+ - pnpm for source installation and development
73
+
74
+ ## Install
75
+
76
+ ```sh
77
+ dsh plugin --profile web add @tokensapi/dsh-progressive-tools
78
+ ```
79
+
80
+ Source installs run the package `prepare` script. If pnpm asks for build
81
+ authorization, add the exact package key it reports to the profile's
82
+ `pnpm-workspace.yaml`:
83
+
84
+ ```yaml
85
+ allowBuilds:
86
+ '@tokensapi/dsh-progressive-tools': true
87
+ ```
88
+
89
+ Verify the composed layer before starting the profile:
90
+
91
+ ```sh
92
+ dsh --profile web --dump-config
93
+ ```
94
+
95
+ The dump should contain the `tokens-progressive-tools` row contributed by this bundle.
96
+
97
+ ## Use
98
+
99
+ The default direct surface contains:
100
+
101
+ - `tool_search`;
102
+ - `tool_dispatch`;
103
+ - `read`, `write`, `edit`, `glob`, `grep`, `bash`, `skill`,
104
+ `ask_user_question`, `todo_write`, `dsh_im_return_file`, `report`,
105
+ `submit_*`, and `structured_output*` when registered;
106
+ - reserved Harness presentation transports when the active tool mode needs
107
+ them.
108
+
109
+ No special wording is required in an ordinary conversation. A stable system
110
+ instruction tells the agent to search before declaring a capability
111
+ unavailable.
112
+
113
+ Discovery returns exact definitions:
114
+
115
+ ```json
116
+ {
117
+ "query": "browser navigation",
118
+ "max_results": 3
119
+ }
120
+ ```
121
+
122
+ The next call uses one returned definition:
123
+
124
+ ```json
125
+ {
126
+ "name": "browser_open",
127
+ "arguments": {
128
+ "url": "https://example.com"
129
+ }
130
+ }
131
+ ```
132
+
133
+ Each match also lists every member tool name of its family, and the whole
134
+ family becomes dispatchable from that one search — siblings that did not make
135
+ the top-ranked slice can be dispatched by name or schema-loaded with one
136
+ exact-name query.
137
+
138
+ `tool_search` also accepts `{"action":"status"}`, which lists every deferred
139
+ family with its member tool names alongside catalog and savings estimates. By
140
+ default the listing is browse-only: dispatching an unseen name still requires
141
+ one exact-name search, and the rejection message says so. Deployments that
142
+ prefer immediate access can set `statusGrantsDiscovery: true`. Search results
143
+ are append-only conversation content; they never add native definitions to the
144
+ top-level request.
145
+
146
+ ## Configure
147
+
148
+ The default configuration is intentionally small:
149
+
150
+ ```yaml
151
+ - id: tokens-progressive-tools
152
+ config:
153
+ mode: stable-proxy
154
+ toolName: tool_search
155
+ dispatchToolName: tool_dispatch
156
+ maxResults: 5
157
+ requireDiscovery: true
158
+ statusGrantsDiscovery: false
159
+ deferToolGuidance: true
160
+ alwaysVisible:
161
+ - read
162
+ - write
163
+ - edit
164
+ - glob
165
+ - grep
166
+ - bash
167
+ - skill
168
+ - ask_user_question
169
+ - todo_write
170
+ - dsh_im_return_file
171
+ - report
172
+ - submit_*
173
+ - structured_output*
174
+ ```
175
+
176
+ Family rules improve search without changing the stable request surface:
177
+
178
+ ```yaml
179
+ - id: tokens-progressive-tools
180
+ config:
181
+ groups:
182
+ - id: browser
183
+ description: Browser navigation and page interaction
184
+ aliases: [browser, web page, 浏览器]
185
+ include: [browser_*]
186
+ - id: database
187
+ description: Database inspection and queries
188
+ aliases: [database, sql, 数据库]
189
+ include: [db_*, sql_*]
190
+ ```
191
+
192
+ See [configuration](./docs/configuration.md) for every option, the
193
+ plugin-ecosystem onboarding checklist (`alwaysVisible` for high-frequency
194
+ tools, `skillBindings` for Skill-shipping packages, explicit `groups` for
195
+ unconventional names), and the migration notes for `dynamic` mode. The
196
+ [progressive disclosure model](./docs/progressive-disclosure.md) maps Skills,
197
+ exact tool definitions, execution, and provider capability gaps.
198
+
199
+ ## Execution and security semantics
200
+
201
+ Stable mode filters the authoritative prompt assembly instead of changing the
202
+ registry view. A direct call to a deferred name is then denied by a monotonic
203
+ tool guard. `tool_dispatch` creates a nested execution with the original agent,
204
+ signal, root call identity, arguments, and real tool name, so normal DSH policy
205
+ continues to apply to that real tool.
206
+
207
+ The guard is a routing invariant, not a replacement for approval or sandbox
208
+ policy. Security-sensitive deployments should keep their existing controls
209
+ enabled.
210
+
211
+ ## Trade-offs
212
+
213
+ - Deferred tools lose provider-native argument grammar at the outer request.
214
+ Their original schema is validated at dispatch time by DSH.
215
+ - A task may need one discovery call before execution.
216
+ - Family siblings become dispatchable before their schemas were shown; the
217
+ pipeline still validates every call, but complex or side-effectful siblings
218
+ are best schema-loaded first with one exact-name search.
219
+ - Search is deterministic lexical ranking, not an embedding service.
220
+ - Search results add only matched definitions to conversation history, but those
221
+ definitions remain there until normal compaction.
222
+ - A registry or composition change can legitimately alter the next prompt.
223
+ Discovery alone does not.
224
+
225
+ ## Development
226
+
227
+ ```sh
228
+ pnpm install
229
+ pnpm run check
230
+ ```
231
+
232
+ The test suite includes a real AgentLoop request test that captures the first
233
+ wire-ready tool array and verifies that discovery leaves both tools and system
234
+ text unchanged.
235
+
236
+ The implementation follows the public references for
237
+ [architecture](https://deepseek-harness.github.io/deepseek-harness/reference/),
238
+ [system prompt assembly](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/system-prompt),
239
+ [tool execution](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/tools),
240
+ [skills](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/skills),
241
+ and [plugin packaging](https://deepseek-harness.github.io/deepseek-harness/develop/basic/publish).
242
+
243
+ ## License
244
+
245
+ [MIT](./LICENSE). The upstream origin and retained attribution are recorded in
246
+ [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,216 @@
1
+ # Tokens 渐进式工具
2
+
3
+ 为 TokensCowork 提供缓存稳定的渐进式工具发现。默认模式从真实首个请求
4
+ 开始只发送固定的小工具面,完整目录保留在进程内,搜索到的工具仍通过 DSH
5
+ 原有执行管线完成调用。
6
+
7
+ [English](./README.md)
8
+
9
+ ## 解决的问题
10
+
11
+ 每个可见工具的名称、描述和参数 schema 都会重复占用请求 token。如果后续
12
+ 再动态改变工具列表,请求前缀也会变化,导致上下文缓存无法继续复用。
13
+
14
+ 默认的 `stable-proxy` 模式同时保证:
15
+
16
+ - 第一次请求就是精简工具面;
17
+ - 搜索前后顶层工具定义和系统文本保持逐字节稳定。
18
+
19
+ ```text
20
+ 完整工具注册表(仅进程内)
21
+
22
+ ├── 可搜索的精确工具定义
23
+
24
+ └── 固定请求工具面
25
+ ├── tool_search
26
+ ├── tool_dispatch
27
+ └── 少量高频直连工具
28
+
29
+ tool_search 结果 ─────┴──► 把命中的精确定义追加到对话历史
30
+
31
+ └── tool_dispatch ──► DSH 原有执行管线
32
+ ```
33
+
34
+ 搜索只追加对话历史,不改变顶层 `tools` 数组。真实工具原有的审批、guard、
35
+ 参数校验、超时、结果策略、延迟上下文和取消信号仍然生效。
36
+
37
+ ## 主要能力
38
+
39
+ - 真实 AgentLoop 第一次请求即发送最小工具定义。
40
+ - 搜索前后原生工具数组和 Code Mode SDK 保持稳定。
41
+ - 返回精确工具名称、完整描述和参数 schema,不再激活整个工具族。
42
+ - 工具族级发现:每条命中同时列出所属工具族的全部成员名,一次搜索即可
43
+ 铺开一个插件的完整可分发工具面。
44
+ - `status` 动作可浏览完整目录;可选 `statusGrantsDiscovery` 供受信任部署
45
+ 一次性解锁全部名字。
46
+ - 对话体量有界增长:搜索结果只记录本次新增的发现名单,恢复所需的累积
47
+ 状态走呈现元数据,不占对话 token。
48
+ - 确定性的 BM25 风格词法排序,覆盖工具名、描述、嵌套参数说明、枚举、
49
+ 工具族元数据及多语言别名。
50
+ - `tool_dispatch` 使用原始工具定义进行运行时参数校验和执行。
51
+ - 单调 guard 阻止隐藏工具被直接调用,只允许分发器拥有的嵌套调用树进入。
52
+ - 同时支持继承工具和 Agent 自有工具的渐进式隐藏。
53
+ - 从顶层结果和 Code Mode 日志恢复已发现工具。
54
+ - 可选 Skill 到工具族的发现联动。
55
+ - 保留 `dynamic` 兼容模式,供必须动态暴露原生 schema 的场景使用。
56
+ - Cordis effect 完整可逆,支持卸载和配置重载。
57
+
58
+ ## 安装
59
+
60
+ ```sh
61
+ dsh plugin --profile web add @tokensapi/dsh-progressive-tools
62
+ ```
63
+
64
+ 如果 pnpm 要求授权源码构建,把错误信息中给出的精确包名加入对应 profile 的
65
+ `pnpm-workspace.yaml`:
66
+
67
+ ```yaml
68
+ allowBuilds:
69
+ '@tokensapi/dsh-progressive-tools': true
70
+ ```
71
+
72
+ 安装后检查组合结果:
73
+
74
+ ```sh
75
+ dsh --profile web --dump-config
76
+ ```
77
+
78
+ 输出中应包含本 bundle 提供的 `tokens-progressive-tools` 配置行。
79
+
80
+ ## 使用
81
+
82
+ 默认直连工具面包括:
83
+
84
+ - `tool_search`;
85
+ - `tool_dispatch`;
86
+ - 已注册的 `read`、`write`、`edit`、`glob`、`grep`、`bash`、`skill`、
87
+ `ask_user_question`、`todo_write`、`dsh_im_return_file`、`report`、
88
+ `submit_*` 和 `structured_output*`;
89
+ - 当前工具呈现模式所需的 Harness 保留传输工具。
90
+
91
+ 正常对话不需要用户强制说明先调用 `tool_search`。插件会提供一段固定系统
92
+ 说明,要求在判断能力不可用前先搜索。
93
+
94
+ 搜索工具定义:
95
+
96
+ ```json
97
+ {
98
+ "query": "浏览器页面操作",
99
+ "max_results": 3
100
+ }
101
+ ```
102
+
103
+ 按搜索返回的精确 schema 分发:
104
+
105
+ ```json
106
+ {
107
+ "name": "browser_open",
108
+ "arguments": {
109
+ "url": "https://example.com"
110
+ }
111
+ }
112
+ ```
113
+
114
+ 每条命中还会列出所属工具族的全部成员名,整个工具族在同一次搜索后即可
115
+ 分发——没进入 Top-N 的兄弟工具可以直接按名字分发,或用一次精确名搜索
116
+ 先取回它的 schema。
117
+
118
+ `tool_search` 也支持 `{"action":"status"}`,会列出全部延迟工具族及其成员
119
+ 工具名,并附带目录规模和 token 估算。status 默认只用于浏览:分发未见过
120
+ 的名字仍需一次精确名搜索,拒绝信息会明确指路。需要即时放行的部署可以
121
+ 开启 `statusGrantsDiscovery: true`。搜索结果不会把命中工具加入下一次
122
+ 请求的顶层工具数组。
123
+
124
+ ## 配置
125
+
126
+ 默认配置:
127
+
128
+ ```yaml
129
+ - id: tokens-progressive-tools
130
+ config:
131
+ mode: stable-proxy
132
+ toolName: tool_search
133
+ dispatchToolName: tool_dispatch
134
+ maxResults: 5
135
+ requireDiscovery: true
136
+ statusGrantsDiscovery: false
137
+ deferToolGuidance: true
138
+ alwaysVisible:
139
+ - read
140
+ - write
141
+ - edit
142
+ - glob
143
+ - grep
144
+ - bash
145
+ - skill
146
+ - ask_user_question
147
+ - todo_write
148
+ - dsh_im_return_file
149
+ - report
150
+ - submit_*
151
+ - structured_output*
152
+ ```
153
+
154
+ 工具族只参与搜索排序,不会改变稳定请求工具面:
155
+
156
+ ```yaml
157
+ - id: tokens-progressive-tools
158
+ config:
159
+ groups:
160
+ - id: browser
161
+ description: 浏览器导航与页面交互
162
+ aliases: [browser, web page, 浏览器]
163
+ include: [browser_*]
164
+ - id: database
165
+ description: 数据库检查与查询
166
+ aliases: [database, sql, 数据库]
167
+ include: [db_*, sql_*]
168
+ ```
169
+
170
+ 完整字段、既有插件生态的接入清单(高频工具配 `alwaysVisible`、带 Skill
171
+ 的插件配 `skillBindings`、命名不规范的插件写显式 `groups` 规则)以及
172
+ `dynamic` 迁移说明见[配置参考](./docs/configuration.md)。
173
+ [渐进式披露模型](./docs/progressive-disclosure.md)进一步说明 Skills、工具定义、
174
+ 执行层和供应方能力边界之间的关系。
175
+
176
+ ## 执行与安全语义
177
+
178
+ 稳定模式在官方 `system-prompt/assemble` 边界过滤最终请求,不改变注册表本身。
179
+ 如果直接调用被延迟的工具名,单调工具 guard 会拒绝它。`tool_dispatch` 使用
180
+ 原 Agent、取消信号、根调用标识、真实工具名和参数创建嵌套执行,因此真实
181
+ 工具仍会经过 DSH 的完整策略链。
182
+
183
+ 该 guard 只维护调用路由,不替代 approval、sandbox 或其他安全策略。
184
+
185
+ ## 取舍
186
+
187
+ - 延迟工具不会出现在顶层请求的原生参数 grammar 中;DSH 会在分发时使用原始
188
+ schema 校验。
189
+ - 一项任务可能先增加一次搜索调用。
190
+ - 同族兄弟工具在 schema 展示之前即可分发;执行管线仍会校验每次调用,但
191
+ 参数复杂或有副作用的兄弟工具建议先用一次精确名搜索取回 schema。
192
+ - 搜索是确定性词法排序,不依赖向量服务。
193
+ - 只有命中的定义进入对话,但会一直保留到常规 compaction。
194
+ - 工具注册或插件组合发生真实变化时,下一次系统前缀仍可能变化;普通搜索
195
+ 不会引起变化。
196
+
197
+ ## 开发
198
+
199
+ ```sh
200
+ pnpm install
201
+ pnpm run check
202
+ ```
203
+
204
+ 测试包含真实 AgentLoop 请求捕获,验证首个请求已经精简,并验证搜索后
205
+ `tools` 数组和系统文本完全不变。
206
+
207
+ 实现依据官方的[架构参考](https://deepseek-harness.github.io/deepseek-harness/reference/)、
208
+ [系统提示子系统](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/system-prompt)、
209
+ [工具子系统](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/tools)、
210
+ [Skills 子系统](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/skills)
211
+ 和[插件发布规范](https://deepseek-harness.github.io/deepseek-harness/develop/basic/publish)。
212
+
213
+ ## 许可证
214
+
215
+ [MIT](./LICENSE)。上游来源和保留的版权归属记录在
216
+ [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md)。
package/SECURITY.md ADDED
@@ -0,0 +1,22 @@
1
+ # Security policy
2
+
3
+ ## Supported versions
4
+
5
+ Security fixes are provided for the latest released minor version.
6
+
7
+ ## Reporting a vulnerability
8
+
9
+ Use GitHub's private vulnerability reporting for this repository. Do not open a
10
+ public issue containing exploit details, credentials, or sensitive logs.
11
+
12
+ Include the affected version, deployment shape, reproduction steps, impact, and
13
+ any suggested mitigation. Acknowledgement and next-step timing will be provided
14
+ after the report is reproduced and scoped.
15
+
16
+ ## Security model
17
+
18
+ This plugin controls tool presentation and routing through the Harness
19
+ composition layer. Its monotonic guard prevents deferred names from bypassing
20
+ the dispatcher, but it is not an authorization boundary for the underlying
21
+ capability. Deployments must retain appropriate approval, sandbox, credential,
22
+ network, and policy controls.
@@ -0,0 +1,8 @@
1
+ # Third-party notices
2
+
3
+ This package is derived from `everclear077/dsh-progressive-tools` at commit
4
+ `8d516b9933d5b7812ab39c929fd9ee5df66d5221`.
5
+
6
+ The original work is Copyright (c) 2026 everclear077 and is distributed under
7
+ the MIT License reproduced in `LICENSE`. TokensAPI modifications retain that
8
+ license and attribution.
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: tokens-progressive-tools
3
+ name: '@tokensapi/dsh-progressive-tools'