@jidekaixin2dian/dsh-toolgate 0.1.6 → 0.1.7

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.7 — 2026-11-02
4
+
5
+ - 修复设置页空白:0.1.6 新增的「项目与反馈」直接读取 `ctx.locale`,而插件未声明 `locale` 服务;较新的宿主对该读取直接抛错(`cannot get property "locale" without inject`),整个 `settings.section` 条目被错误边界吞掉,点进「工具闸门」只剩空白。
6
+ - 在 `inject` 中声明 `locale`,并将该读取包在 `try/catch` 里回退到 `navigator.language`,与其他可选服务读取保持一致。
7
+ - Fix blank settings page: the 0.1.6 project/feedback block read `ctx.locale` without declaring the service. Newer hosts throw on that read, the whole `settings.section` entry is swallowed by the error boundary, and the Toolgate page renders empty. `locale` is now declared and the read falls back to `navigator.language`.
8
+ - 新增 3 项客户端渲染回归测试,覆盖「宿主拒绝 locale 服务」时设置页仍渲染,以及中英文文案跟随语言。
9
+
3
10
  ## 0.1.6 — 2026-10-31
4
11
 
5
12
  - 设置页新增「项目与反馈」入口,在预算、MCP、Skills 页面均可打开对应 GitHub 项目或新建反馈;页面加载失败时也保留入口。
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 jidekaixin2dian
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 jidekaixin2dian
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.en.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  **Bring only the tools you need into the next prompt.**
4
4
 
5
- [中文](README.md) · [npm](https://www.npmjs.com/package/@jidekaixin2dian/dsh-toolgate/v/0.1.6) · [Marketplace](https://awesome-dsh-plugin.com/p/jidekaixin2dian/dsh-toolgate/) · [Download](https://github.com/jidekaixin2dian/dsh-toolgate/releases/latest) · [Changelog](CHANGELOG.md)
5
+ [中文](README.md) · [npm](https://www.npmjs.com/package/@jidekaixin2dian/dsh-toolgate/v/0.1.7) · [Marketplace](https://awesome-dsh-plugin.com/p/jidekaixin2dian/dsh-toolgate/) · [Download](https://github.com/jidekaixin2dian/dsh-toolgate/releases/latest) · [Changelog](CHANGELOG.md)
6
6
 
7
- Many MCP servers installed, but only a few relevant to the task? Toolgate brings MCP servers, skills and tool visibility into one DSH settings page. Hide tool definitions by server and restore them when needed; configuration stays in place and MCP processes keep running.
7
+ Toolgate is an MCP server, skill and context-budget management plugin for DeepSeek Harness (DSH). Have many MCP servers installed but only a few relevant to the task? Hide tool definitions by server in one settings page and restore them when needed; configuration stays in place and MCP processes keep running.
8
8
 
9
9
  ![Tool grouping illustration; example counts are not measured savings](assets/readme-schema-v2.svg)
10
10
 
@@ -16,6 +16,8 @@ Many MCP servers installed, but only a few relevant to the task? Toolgate brings
16
16
  | MCP servers | Add, edit, enable, disable and remove stdio or streamable-http servers |
17
17
  | Skills | Search, create and toggle by Session workspace; move eligible local skills to trash |
18
18
 
19
+ For example, hide MCP tool groups unrelated to a coding task to change the tool definitions supplied with the next prompt, then restore them when needed. The page estimates tokens from schema and description length; the estimate is not a measurement of cost or speed. Settings-page budgets apply to all sessions and subagents; permitted session overrides affect only that session.
20
+
19
21
  ## Downloads
20
22
 
21
23
  | GitHub release assets · all releases | npm 0.1.5 · past 7 days |
package/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  **让下一轮 prompt 只带需要的工具。**
4
4
 
5
- [English](README.en.md) · [npm](https://www.npmjs.com/package/@jidekaixin2dian/dsh-toolgate/v/0.1.6) · [插件市场](https://awesome-dsh-plugin.com/p/jidekaixin2dian/dsh-toolgate/) · [下载](https://github.com/jidekaixin2dian/dsh-toolgate/releases/latest) · [更新记录](CHANGELOG.md)
5
+ [English](README.en.md) · [npm](https://www.npmjs.com/package/@jidekaixin2dian/dsh-toolgate/v/0.1.7) · [插件市场](https://awesome-dsh-plugin.com/p/jidekaixin2dian/dsh-toolgate/) · [下载](https://github.com/jidekaixin2dian/dsh-toolgate/releases/latest) · [更新记录](CHANGELOG.md)
6
6
 
7
- 装了很多 MCP,却只有少数工具与当前任务有关?Toolgate 把 MCP 服务器、Skill 和工具可见性放在同一个 DSH 设置页里。按服务器隐藏整组工具定义,需要时再恢复;配置保留,MCP 进程继续运行。
7
+ Toolgate 是 DeepSeek Harness(DSH)的 MCP、Skill 和上下文预算管理插件。装了很多 MCP,却只有少数工具与当前任务有关?在同一个设置页按服务器隐藏不需要的工具定义,需要时再恢复;配置保留,MCP 进程继续运行。
8
8
 
9
9
  ![工具分组示意,示例数量不代表实测节省](assets/readme-schema-v2.svg)
10
10
 
@@ -16,6 +16,8 @@
16
16
  | MCP 服务器 | 新增、编辑、启停、删除服务器;支持 stdio 与 streamable-http |
17
17
  | Skills | 按会话工作区搜索、新建、启停;可删除的本地 Skill 移到回收目录 |
18
18
 
19
+ 例如,可以在写代码时隐藏与任务无关的 MCP 工具组,下一轮再交给模型的工具定义就会变化;需要时恢复。页面按工具 schema 和描述长度估算 token,占用与实际费用或速度不是同一指标。设置页预算作用于所有会话和子代理,允许的会话覆盖只影响当前会话。
20
+
19
21
  ## 下载情况
20
22
 
21
23
  | GitHub Release 资源 · 历史累计 | npm 0.1.5 · 近 7 日 |
package/README.zh.md CHANGED
@@ -1,6 +1,6 @@
1
- # 中文说明
2
-
3
- 中文 README 已作为默认文档:[README.md](README.md)。
4
-
5
- English: [README.en.md](README.en.md)。
1
+ # 中文说明
2
+
3
+ 中文 README 已作为默认文档:[README.md](README.md)。
4
+
5
+ English: [README.en.md](README.en.md)。
6
6
 
package/cordis.patch.yml CHANGED
@@ -1,6 +1,6 @@
1
- # Bundle patch: the row loads the host half; `dsh.client` in package.json
2
- # makes the web app load ./client as the browser half.
3
- - insert:
4
- - id: dsh-toolgate
5
- name: '@jidekaixin2dian/dsh-toolgate'
1
+ # Bundle patch: the row loads the host half; `dsh.client` in package.json
2
+ # makes the web app load ./client as the browser half.
3
+ - insert:
4
+ - id: dsh-toolgate
5
+ name: '@jidekaixin2dian/dsh-toolgate'
6
6
 
package/icon.svg CHANGED
@@ -1,10 +1,10 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" role="img" aria-label="dsh-toolgate">
2
- <rect width="128" height="128" rx="24" fill="#0f172a"/>
3
- <rect x="24" y="72" width="14" height="32" rx="3" fill="#38bdf8"/>
4
- <rect x="46" y="52" width="14" height="52" rx="3" fill="#38bdf8"/>
5
- <rect x="68" y="34" width="14" height="70" rx="3" fill="#a78bfa"/>
6
- <rect x="90" y="60" width="14" height="44" rx="3" fill="#38bdf8"/>
7
- <path d="M22 30h48" stroke="#e2e8f0" stroke-width="5" stroke-linecap="round"/>
8
- <path d="M60 30l-9-7M60 30l-9 7" stroke="#e2e8f0" stroke-width="4" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
9
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" role="img" aria-label="dsh-toolgate">
2
+ <rect width="128" height="128" rx="24" fill="#0f172a"/>
3
+ <rect x="24" y="72" width="14" height="32" rx="3" fill="#38bdf8"/>
4
+ <rect x="46" y="52" width="14" height="52" rx="3" fill="#38bdf8"/>
5
+ <rect x="68" y="34" width="14" height="70" rx="3" fill="#a78bfa"/>
6
+ <rect x="90" y="60" width="14" height="44" rx="3" fill="#38bdf8"/>
7
+ <path d="M22 30h48" stroke="#e2e8f0" stroke-width="5" stroke-linecap="round"/>
8
+ <path d="M60 30l-9-7M60 30l-9 7" stroke="#e2e8f0" stroke-width="4" fill="none" stroke-linecap="round" stroke-linejoin="round"/>
9
+ </svg>
10
10
 
@@ -1,10 +1,10 @@
1
- // The settings page posts `{ op, args }` (see `api()` in client.js), while the
2
- // route handlers read operation fields directly. Accept both shapes so the
3
- // bundle and the host cannot drift apart again — and so a hand-written probe
4
- // or a future client that flattens the body still lands on the same fields.
5
- export function requestArgs(payload) {
6
- if (!payload || typeof payload !== 'object') return {}
7
- const args = payload.args
8
- return args && typeof args === 'object' && !Array.isArray(args) ? args : payload
9
- }
1
+ // The settings page posts `{ op, args }` (see `api()` in client.js), while the
2
+ // route handlers read operation fields directly. Accept both shapes so the
3
+ // bundle and the host cannot drift apart again — and so a hand-written probe
4
+ // or a future client that flattens the body still lands on the same fields.
5
+ export function requestArgs(payload) {
6
+ if (!payload || typeof payload !== 'object') return {}
7
+ const args = payload.args
8
+ return args && typeof args === 'object' && !Array.isArray(args) ? args : payload
9
+ }
10
10
 
package/lib/client.js CHANGED
@@ -371,7 +371,12 @@ const factory = (require) => {
371
371
  }
372
372
 
373
373
  function ProjectLinks() {
374
- const language = pageCtx?.locale?.language?.getSnapshot?.() || (typeof navigator === 'undefined' ? 'zh' : navigator.language)
374
+ // A direct read of an undeclared service throws on newer hosts
375
+ // ("cannot get property \"locale\" without inject"), and this component
376
+ // shares the settings section with the main page: one throw blanks both.
377
+ let language
378
+ try { language = pageCtx?.locale?.language?.getSnapshot?.() } catch { language = undefined }
379
+ language = language || (typeof navigator === 'undefined' ? 'zh' : navigator.language)
375
380
  const zh = /^zh\b/i.test(language)
376
381
  const title = zh ? '项目与反馈' : 'Project and feedback'
377
382
  const icon = path => React.createElement('svg', { viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 1.8, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true }, React.createElement('path', { d: path }))
@@ -513,7 +518,7 @@ const factory = (require) => {
513
518
 
514
519
  module.exports = {
515
520
  name: 'dsh-toolgate-client',
516
- inject: ['timer'],
521
+ inject: ['timer', 'locale'],
517
522
  apply(ctx) {
518
523
  pageCtx = ctx
519
524
  ensureCss()
package/lib/groups.js CHANGED
@@ -1,59 +1,59 @@
1
- // Pure grouping rules. Kept dependency-free so node --test can exercise them
2
- // without loading the DSH host or @deepseek-ai/dsh-tools.
3
- export const FIXED_LABELS = {
4
- skills: 'Skill 目录',
5
- memory: '记忆工具',
6
- schedule: '定时任务',
7
- }
8
- export const CORE_LABEL = '核心工具'
9
-
10
- export function groupOf(toolName) {
11
- const n = String(toolName || '')
12
- if (n.startsWith('mcp__')) {
13
- const rest = n.slice(5)
14
- const cut = rest.indexOf('__')
15
- const server = cut > 0 ? rest.slice(0, cut) : 'other'
16
- return 'mcp:' + (server.toLowerCase().replace(/[^a-z0-9_-]/g, '_').slice(0, 32) || 'other')
17
- }
18
- if (n === 'skill') return 'skills'
19
- if (n.startsWith('mnemon_')) return 'memory'
20
- if (n.startsWith('schedule_')) return 'schedule'
21
- return 'core'
22
- }
23
-
24
- export function labelOf(group) {
25
- if (group === 'core') return CORE_LABEL
26
- if (group.startsWith('mcp:')) return 'MCP · ' + group.slice(4)
27
- return FIXED_LABELS[group] || group
28
- }
29
-
30
- export function normalizeDisabled(value) {
31
- if (!Array.isArray(value)) return []
32
- const out = new Set()
33
- for (const raw of value) {
34
- let id = String(raw || '').trim().toLowerCase()
35
- // Migrate the pre-market fixed groups to generic MCP server ids.
36
- if (id === 'rea') id = 'mcp:rea'
37
- if (id === 'mcp_other') id = 'mcp:other'
38
- if (id === 'mcp') {
39
- out.add('mcp')
40
- continue
41
- }
42
- if (/^mcp:[a-z0-9_-]{1,32}$/.test(id)) {
43
- out.add(id)
44
- continue
45
- }
46
- if (Object.hasOwn(FIXED_LABELS, id)) out.add(id)
47
- }
48
- return [...out]
49
- }
50
-
51
- export function isDisabled(group, disabled) {
52
- if (group === 'core') return false
53
- return disabled.includes(group) || (group.startsWith('mcp:') && disabled.includes('mcp'))
54
- }
55
-
56
- export function matchesDisabled(toolName, disabled) {
57
- return isDisabled(groupOf(toolName), disabled)
58
- }
1
+ // Pure grouping rules. Kept dependency-free so node --test can exercise them
2
+ // without loading the DSH host or @deepseek-ai/dsh-tools.
3
+ export const FIXED_LABELS = {
4
+ skills: 'Skill 目录',
5
+ memory: '记忆工具',
6
+ schedule: '定时任务',
7
+ }
8
+ export const CORE_LABEL = '核心工具'
9
+
10
+ export function groupOf(toolName) {
11
+ const n = String(toolName || '')
12
+ if (n.startsWith('mcp__')) {
13
+ const rest = n.slice(5)
14
+ const cut = rest.indexOf('__')
15
+ const server = cut > 0 ? rest.slice(0, cut) : 'other'
16
+ return 'mcp:' + (server.toLowerCase().replace(/[^a-z0-9_-]/g, '_').slice(0, 32) || 'other')
17
+ }
18
+ if (n === 'skill') return 'skills'
19
+ if (n.startsWith('mnemon_')) return 'memory'
20
+ if (n.startsWith('schedule_')) return 'schedule'
21
+ return 'core'
22
+ }
23
+
24
+ export function labelOf(group) {
25
+ if (group === 'core') return CORE_LABEL
26
+ if (group.startsWith('mcp:')) return 'MCP · ' + group.slice(4)
27
+ return FIXED_LABELS[group] || group
28
+ }
29
+
30
+ export function normalizeDisabled(value) {
31
+ if (!Array.isArray(value)) return []
32
+ const out = new Set()
33
+ for (const raw of value) {
34
+ let id = String(raw || '').trim().toLowerCase()
35
+ // Migrate the pre-market fixed groups to generic MCP server ids.
36
+ if (id === 'rea') id = 'mcp:rea'
37
+ if (id === 'mcp_other') id = 'mcp:other'
38
+ if (id === 'mcp') {
39
+ out.add('mcp')
40
+ continue
41
+ }
42
+ if (/^mcp:[a-z0-9_-]{1,32}$/.test(id)) {
43
+ out.add(id)
44
+ continue
45
+ }
46
+ if (Object.hasOwn(FIXED_LABELS, id)) out.add(id)
47
+ }
48
+ return [...out]
49
+ }
50
+
51
+ export function isDisabled(group, disabled) {
52
+ if (group === 'core') return false
53
+ return disabled.includes(group) || (group.startsWith('mcp:') && disabled.includes('mcp'))
54
+ }
55
+
56
+ export function matchesDisabled(toolName, disabled) {
57
+ return isDisabled(groupOf(toolName), disabled)
58
+ }
59
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jidekaixin2dian/dsh-toolgate",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Manage MCP servers and skills in one place; hide or restore groups of tool definitions to control what enters the next prompt.",
5
5
  "icon": "icon.svg",
6
6
  "type": "module",