@omdp/dsh-connector 0.3.0 → 0.3.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/index.js +15 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -41,7 +41,7 @@ const TRANSPORTS = new Set(['stdio', 'streamable-http'])
|
|
|
41
41
|
// patch file itself (NUL, control chars). Tab/newline are already rejected by
|
|
42
42
|
// the single-token rules; this catches the rest defensively.
|
|
43
43
|
const CONTROL_CHARS = /[\x00-\x1f\x7f]/
|
|
44
|
-
export const inject = ['webServer']
|
|
44
|
+
export const inject = ['webServer', 'settings']
|
|
45
45
|
|
|
46
46
|
// ── MCP 工具过滤(tool-filter, 0.3.0 新增)────────────────────────────
|
|
47
47
|
// dsh-mcp-client 的 Config schema 是封闭的:未知键会拒收并导致下次启动失败,
|
|
@@ -924,14 +924,22 @@ async function readBody(req) {
|
|
|
924
924
|
|
|
925
925
|
export function apply(ctx) {
|
|
926
926
|
// ── 工具过滤三件套之 (0):settings namespace 注册 + 快照缓存 ──
|
|
927
|
-
// settings
|
|
927
|
+
// settings 经声明式 inject 依赖保证就绪(见上方 export const inject),
|
|
928
|
+
// 这里同步拿服务;万一缺失不炸,过滤保持全放行(零回归)。
|
|
929
|
+
// 注:cordis 的 ctx.inject(deps, cb) 回调按 (ctx, config) 调用,不是服务展开,
|
|
930
|
+
// 不能拿回调参数当 service 用 —— 0.3.0 曾因此 register 从未落地。
|
|
931
|
+
const settings = ctx.get('settings')
|
|
928
932
|
let toolFilters = {}
|
|
929
933
|
const refreshFilters = () => { toolFilters = readToolFilters(ctx) }
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
934
|
+
if (settings) {
|
|
935
|
+
try {
|
|
936
|
+
const scope = settings.register(CONNECTOR_SETTINGS_NS, ToolFilterSchema, { base: { toolFilters: {} } })
|
|
937
|
+
refreshFilters()
|
|
938
|
+
ctx.effect(() => scope.watch(() => refreshFilters()), 'connector: watch tool filters')
|
|
939
|
+
} catch (error) {
|
|
940
|
+
console.error('[dsh-connector] register tool filter settings failed:', error?.message ?? error)
|
|
941
|
+
}
|
|
942
|
+
}
|
|
935
943
|
|
|
936
944
|
// ── 三件套之 (1):prompt 层过滤 —— 被滤掉的工具不进模型 schema ──
|
|
937
945
|
// tools provider 在每次 assembly 时求值,读最新快照;无 tools/systemPrompt
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omdp/dsh-connector",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Unified DeepSeek Harness connector: edit MCP servers (cordis.patch.yml), user skills (~/.dsh/skills) and browse the ModelScope MCP/Skills marketplaces from one Web UI settings page.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|