dsh-model-switch 0.4.67 → 0.4.69
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 +28 -0
- package/IMPLEMENTATION_PLAN.md +12 -1
- package/PRODUCT.md +3 -3
- package/README.en.md +17 -19
- package/README.md +17 -19
- package/cordis.patch.yml +9 -0
- package/lib/auto-review-CYvvootQ.js +1079 -0
- package/lib/auto-review.js +1 -1
- package/lib/automode-compat.js +1 -1
- package/lib/client.js +473 -47
- package/lib/compaction.js +1 -1
- package/lib/index.js +30 -6
- package/lib/prime-memory-compat.js +568 -1
- package/lib/prime-memory-route-DGUVfogE.js +117 -0
- package/lib/review-timeout-FB32BcnO.js +339 -0
- package/lib/review-timeout.js +1 -1
- package/lib/session-route-CRfpxarI.js +357 -0
- package/lib/session-title.js +1 -1
- package/lib/subagent-runtime-BgLqMl2z.js +424 -0
- package/lib/subagent-runtime-CluWLZio.js +412 -0
- package/lib/subagent-runtime-eNKrdb2H.js +424 -0
- package/lib/subagent-runtime.js +2 -289
- package/lib/tool-allowlist-cN9Z1XKn.js +489 -0
- package/lib/types/capabilities-rpc.d.ts +7 -0
- package/lib/types/client/ModelSwitchSettings.d.ts +6 -3
- package/lib/types/client/locales.d.ts +12 -2
- package/lib/types/client-contract.d.ts +33 -1
- package/lib/types/host-settings.d.ts +11 -0
- package/lib/types/prime-memory-compat.d.ts +7 -4
- package/lib/types/prime-memory-route.d.ts +22 -0
- package/lib/types/provider-group.d.ts +31 -3
- package/lib/types/session-route.d.ts +24 -3
- package/lib/types/subagent-runtime.d.ts +34 -0
- package/lib/types/tool-allowlist.d.ts +13 -0
- package/lib/types/vision-router-compat.d.ts +62 -0
- package/lib/types/vision-router-route.d.ts +94 -0
- package/lib/vision-router-compat-B9bkgJmh.js +312 -0
- package/lib/vision-router-compat.js +2 -0
- package/package.json +5 -1
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
/** Catalog lookup by id. */
|
|
2
|
+
const SOURCE_BY_ID = new Map([
|
|
3
|
+
{
|
|
4
|
+
id: "core",
|
|
5
|
+
kind: "core",
|
|
6
|
+
label: "DSH 核心",
|
|
7
|
+
repo: "https://github.com/deepseek-ai/deepseek-harness"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
id: "dsh-ops",
|
|
11
|
+
kind: "plugin",
|
|
12
|
+
label: "插件 · dsh-ops",
|
|
13
|
+
repo: "https://github.com/T-Auto/dsh-ops"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: "dsh-browser-cdp",
|
|
17
|
+
kind: "plugin",
|
|
18
|
+
label: "插件 · dsh-browser-cdp",
|
|
19
|
+
repo: "https://github.com/drscrewdriver/dsh-browser-cdp"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "dsh-auto-memory",
|
|
23
|
+
kind: "plugin",
|
|
24
|
+
label: "插件 · dsh-auto-memory",
|
|
25
|
+
repo: "https://github.com/AskTheWay/dsh-auto-memory"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "dsh-model-switch",
|
|
29
|
+
kind: "plugin",
|
|
30
|
+
label: "插件 · dsh-model-switch",
|
|
31
|
+
repo: "https://github.com/vandoor7-droid/dsh-model-switch"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "dsh-prime-memory",
|
|
35
|
+
kind: "plugin",
|
|
36
|
+
label: "插件 · dsh-prime-memory",
|
|
37
|
+
repo: "https://github.com/drscrewdriver/dsh-prime-memory"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "dsh-vision-router",
|
|
41
|
+
kind: "plugin",
|
|
42
|
+
label: "插件 · dsh-vision-router",
|
|
43
|
+
repo: "https://github.com/ysr666/dsh-vision-router"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "dsh-univer-office",
|
|
47
|
+
kind: "plugin",
|
|
48
|
+
label: "插件 · dsh-univer-office",
|
|
49
|
+
repo: "https://github.com/dream-num/dsh-univer-office"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "dsh-embedded-browser",
|
|
53
|
+
kind: "plugin",
|
|
54
|
+
label: "插件 · dsh-embedded-browser",
|
|
55
|
+
repo: "https://github.com/imroc/dsh-embedded-browser"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "mcp:wincu",
|
|
59
|
+
kind: "mcp",
|
|
60
|
+
label: "MCP · wincu(dsh-computer-use-win)",
|
|
61
|
+
repo: "https://github.com/Yu-tao-Li/dsh-computer-use-win"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "mcp:mineru-mcp",
|
|
65
|
+
kind: "mcp",
|
|
66
|
+
label: "MCP · mineru-mcp(@vandoor2/mineru-mcp)",
|
|
67
|
+
repo: "https://gitee.com/vandoor2/mineru-mcp"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: "qqbot-extension",
|
|
71
|
+
kind: "extension",
|
|
72
|
+
label: "QQ 机器人扩展(框架 @zaofan/dsh-qqbot)",
|
|
73
|
+
repo: "https://github.com/zaofan-make/dsh-qqbot"
|
|
74
|
+
}
|
|
75
|
+
].map((entry) => [entry.id, entry]));
|
|
76
|
+
/**
|
|
77
|
+
* Tool names the released Host owns, calibrated against dsh 0.2.1-rc.2.
|
|
78
|
+
*
|
|
79
|
+
* A name outside the catalog would otherwise be reported as core, which is the
|
|
80
|
+
* one guess a reader could act on wrongly; it resolves to `unknown` instead.
|
|
81
|
+
*/
|
|
82
|
+
const CORE_TOOLS = /* @__PURE__ */ new Set([
|
|
83
|
+
"ask_user_question",
|
|
84
|
+
"conversation_search",
|
|
85
|
+
"create_goal",
|
|
86
|
+
"create_skill",
|
|
87
|
+
"create_worktree",
|
|
88
|
+
"edit",
|
|
89
|
+
"exit_plan_mode",
|
|
90
|
+
"get_goal",
|
|
91
|
+
"glob",
|
|
92
|
+
"grep",
|
|
93
|
+
"interrupt_agent",
|
|
94
|
+
"job_kill",
|
|
95
|
+
"job_list",
|
|
96
|
+
"job_output",
|
|
97
|
+
"list_agents",
|
|
98
|
+
"list_mcp_resource_templates",
|
|
99
|
+
"list_subagent_models",
|
|
100
|
+
"list_mcp_resources",
|
|
101
|
+
"load_workspace_dependencies",
|
|
102
|
+
"present",
|
|
103
|
+
"pwsh",
|
|
104
|
+
"ralph",
|
|
105
|
+
"read",
|
|
106
|
+
"read_image",
|
|
107
|
+
"read_mcp_resource",
|
|
108
|
+
"run_code",
|
|
109
|
+
"schedule_create",
|
|
110
|
+
"schedule_delete",
|
|
111
|
+
"schedule_edit",
|
|
112
|
+
"schedule_list",
|
|
113
|
+
"schedule_update",
|
|
114
|
+
"schedule_view",
|
|
115
|
+
"send_message",
|
|
116
|
+
"session_event_read",
|
|
117
|
+
"session_event_search",
|
|
118
|
+
"session_event_trace",
|
|
119
|
+
"session_search",
|
|
120
|
+
"session_trace",
|
|
121
|
+
"sidebar_open",
|
|
122
|
+
"skill",
|
|
123
|
+
"spawn_teammate",
|
|
124
|
+
"subagent",
|
|
125
|
+
"subagent_fork",
|
|
126
|
+
"team_task_create",
|
|
127
|
+
"team_task_get",
|
|
128
|
+
"team_task_list",
|
|
129
|
+
"team_task_update",
|
|
130
|
+
"terminal_close",
|
|
131
|
+
"terminal_list",
|
|
132
|
+
"terminal_open",
|
|
133
|
+
"terminal_read",
|
|
134
|
+
"terminal_send",
|
|
135
|
+
"terminal_signal",
|
|
136
|
+
"todo_write",
|
|
137
|
+
"update_goal",
|
|
138
|
+
"wait_agent",
|
|
139
|
+
"web_fetch",
|
|
140
|
+
"web_search",
|
|
141
|
+
"web_search_pro",
|
|
142
|
+
"workflow",
|
|
143
|
+
"working_directory",
|
|
144
|
+
"write"
|
|
145
|
+
]);
|
|
146
|
+
/** MCP server name → catalog id, for the servers this allowlist knows. */
|
|
147
|
+
const MCP_SERVERS = /* @__PURE__ */ new Map([["wincu", "mcp:wincu"], ["mineru-mcp", "mcp:mineru-mcp"]]);
|
|
148
|
+
/** Plugin identity by tool-name prefix (checked before the core catalog). */
|
|
149
|
+
const PLUGIN_PREFIXES = [
|
|
150
|
+
["bcdp_", "dsh-browser-cdp"],
|
|
151
|
+
["browser_window_", "dsh-browser-cdp"],
|
|
152
|
+
["browser_embedded_", "dsh-embedded-browser"],
|
|
153
|
+
["ops_", "dsh-ops"],
|
|
154
|
+
["vision_", "dsh-vision-router"],
|
|
155
|
+
["univer_", "dsh-univer-office"]
|
|
156
|
+
];
|
|
157
|
+
/**
|
|
158
|
+
* Single plugin tools that carry no usable prefix.
|
|
159
|
+
*
|
|
160
|
+
* `memory_` is shared by two installed plugins with disjoint names, so it cannot
|
|
161
|
+
* be a prefix rule: the calibration below names each tool explicitly.
|
|
162
|
+
*/
|
|
163
|
+
const PLUGIN_TOOLS = /* @__PURE__ */ new Map([
|
|
164
|
+
["generate_image", "dsh-model-switch"],
|
|
165
|
+
["memory_add", "dsh-prime-memory"],
|
|
166
|
+
["memory_conflicts", "dsh-prime-memory"],
|
|
167
|
+
["memory_conflicts_rejected", "dsh-prime-memory"],
|
|
168
|
+
["memory_delete", "dsh-prime-memory"],
|
|
169
|
+
["memory_expand_graph_node", "dsh-prime-memory"],
|
|
170
|
+
["memory_import", "dsh-prime-memory"],
|
|
171
|
+
["memory_migrate_relation", "dsh-prime-memory"],
|
|
172
|
+
["memory_read_scene", "dsh-prime-memory"],
|
|
173
|
+
["memory_receipts", "dsh-prime-memory"],
|
|
174
|
+
["memory_reproject", "dsh-prime-memory"],
|
|
175
|
+
["memory_resolve_conflict", "dsh-prime-memory"],
|
|
176
|
+
["memory_room_admin", "dsh-prime-memory"],
|
|
177
|
+
["memory_room_review", "dsh-prime-memory"],
|
|
178
|
+
["memory_ruminate", "dsh-prime-memory"],
|
|
179
|
+
["memory_ruminate_cancel", "dsh-prime-memory"],
|
|
180
|
+
["memory_ruminate_status", "dsh-prime-memory"],
|
|
181
|
+
["memory_search", "dsh-prime-memory"],
|
|
182
|
+
["memory_search_graph", "dsh-prime-memory"],
|
|
183
|
+
["memory_skill_archive", "dsh-prime-memory"],
|
|
184
|
+
["memory_skill_list", "dsh-prime-memory"],
|
|
185
|
+
["memory_skill_pin", "dsh-prime-memory"],
|
|
186
|
+
["memory_skill_read", "dsh-prime-memory"],
|
|
187
|
+
["memory_slot_close", "dsh-prime-memory"],
|
|
188
|
+
["memory_slot_list", "dsh-prime-memory"],
|
|
189
|
+
["memory_slot_write", "dsh-prime-memory"],
|
|
190
|
+
["memory_update", "dsh-prime-memory"],
|
|
191
|
+
["memory_context", "dsh-auto-memory"],
|
|
192
|
+
["memory_delete_all", "dsh-auto-memory"],
|
|
193
|
+
["memory_list", "dsh-auto-memory"],
|
|
194
|
+
["memory_prune", "dsh-auto-memory"],
|
|
195
|
+
["memory_read", "dsh-auto-memory"],
|
|
196
|
+
["memory_write", "dsh-auto-memory"]
|
|
197
|
+
]);
|
|
198
|
+
/** `<base>__<owner>` — the extension-tool naming the QQ bot framework uses. */
|
|
199
|
+
const EXTENSION_TOOL = /^([A-Za-z0-9_-]+)__(.+)$/;
|
|
200
|
+
/**
|
|
201
|
+
* Default allowlist: every pure-read tool this deployment exposes plus the
|
|
202
|
+
* no-side-effect and autonomy entries the user explicitly released, calibrated
|
|
203
|
+
* on a live desktop profile (105 tools) at dsh 0.2.1-rc.2.
|
|
204
|
+
*
|
|
205
|
+
* Grouped by origin so a reader can trace each entry through {@link SOURCE_CATALOG}.
|
|
206
|
+
* Entries ending in `*` are patterns: the QQ bot extension suffixes its tools with
|
|
207
|
+
* the bot's own name, so `sessions_list__*` keeps working when the persona is
|
|
208
|
+
* renamed.
|
|
209
|
+
*
|
|
210
|
+
* Everything here follows one rule: releasing it must not let a side effect escape
|
|
211
|
+
* the reviewer. Calls that merely dispatch, ask, present, wait or navigate qualify
|
|
212
|
+
* because the work they trigger still runs under the same auto preset. Delegation
|
|
213
|
+
* tools (`subagent`, `subagent_fork`, `spawn_teammate`) deliberately stay out: a
|
|
214
|
+
* child session seeds its preset from `permissionPresets.current(parent.session)`,
|
|
215
|
+
* and this bypass answers `'custom'` for an allowlisted call in flight — releasing
|
|
216
|
+
* them would hand the child no `auto` preset at all, i.e. no review.
|
|
217
|
+
* Beyond that rule sit the entries the user explicitly released (2026-10-24:
|
|
218
|
+
* goal/schedule/terminal creation; 2026-11-20: the vision model calls, the
|
|
219
|
+
* mineru document_parse task, todo/goal updates, and the prime-memory write
|
|
220
|
+
* tools). These do have side effects — vision calls spend the configured
|
|
221
|
+
* backend's quota and send image content to it, document_parse spawns a parse
|
|
222
|
+
* task, the memory tools mutate the memory store — but everything they enable
|
|
223
|
+
* stays inside the same session and auto preset. Releasing them only skips the
|
|
224
|
+
* reviewer; it grants no permission the preset did not already grant. The
|
|
225
|
+
* delegation spawns stay excluded regardless: a child session seeds its preset
|
|
226
|
+
* from the parent's in-flight bypass answer, so releasing them would strip the
|
|
227
|
+
* child of the auto preset entirely (see DELEGATION_SPAWNS in the tests).
|
|
228
|
+
* schedule_edit was reviewed on 2026-11-20 and deliberately kept OUT: it can
|
|
229
|
+
* modify or delete tasks other sessions created.
|
|
230
|
+
*/
|
|
231
|
+
const DEFAULT_READ_ONLY_TOOLS = [
|
|
232
|
+
"read",
|
|
233
|
+
"grep",
|
|
234
|
+
"glob",
|
|
235
|
+
"read_image",
|
|
236
|
+
"skill",
|
|
237
|
+
"web_search",
|
|
238
|
+
"web_search_pro",
|
|
239
|
+
"web_fetch",
|
|
240
|
+
"load_workspace_dependencies",
|
|
241
|
+
"ask_user_question",
|
|
242
|
+
"present",
|
|
243
|
+
"sidebar_open",
|
|
244
|
+
"exit_plan_mode",
|
|
245
|
+
"job_list",
|
|
246
|
+
"job_output",
|
|
247
|
+
"terminal_list",
|
|
248
|
+
"terminal_read",
|
|
249
|
+
"list_agents",
|
|
250
|
+
"team_task_list",
|
|
251
|
+
"team_task_get",
|
|
252
|
+
"get_goal",
|
|
253
|
+
"schedule_list",
|
|
254
|
+
"wait_agent",
|
|
255
|
+
"send_message",
|
|
256
|
+
"team_task_create",
|
|
257
|
+
"list_mcp_resources",
|
|
258
|
+
"list_mcp_resource_templates",
|
|
259
|
+
"read_mcp_resource",
|
|
260
|
+
"session_search",
|
|
261
|
+
"session_event_search",
|
|
262
|
+
"session_event_read",
|
|
263
|
+
"session_event_trace",
|
|
264
|
+
"session_trace",
|
|
265
|
+
"create_goal",
|
|
266
|
+
"schedule_create",
|
|
267
|
+
"terminal_open",
|
|
268
|
+
"ops_read_files",
|
|
269
|
+
"ops_discover_tools",
|
|
270
|
+
"bcdp_status",
|
|
271
|
+
"bcdp_help",
|
|
272
|
+
"bcdp_doctor",
|
|
273
|
+
"bcdp_snapshot",
|
|
274
|
+
"browser_window_status",
|
|
275
|
+
"memory_list",
|
|
276
|
+
"memory_read",
|
|
277
|
+
"memory_search",
|
|
278
|
+
"memory_search_graph",
|
|
279
|
+
"memory_expand_graph_node",
|
|
280
|
+
"memory_read_scene",
|
|
281
|
+
"memory_skill_list",
|
|
282
|
+
"memory_skill_read",
|
|
283
|
+
"memory_slot_list",
|
|
284
|
+
"memory_receipts",
|
|
285
|
+
"memory_conflicts",
|
|
286
|
+
"memory_conflicts_rejected",
|
|
287
|
+
"memory_ruminate_status",
|
|
288
|
+
"ops_glob",
|
|
289
|
+
"ops_grep",
|
|
290
|
+
"ops_inspect_local_file",
|
|
291
|
+
"ops_read_docx",
|
|
292
|
+
"ops_diff",
|
|
293
|
+
"ops_result",
|
|
294
|
+
"bcdp_captcha",
|
|
295
|
+
"bcdp_page_info",
|
|
296
|
+
"bcdp_read_element",
|
|
297
|
+
"bcdp_screenshot",
|
|
298
|
+
"browser_embedded_status",
|
|
299
|
+
"browser_embedded_snapshot",
|
|
300
|
+
"browser_embedded_screenshot",
|
|
301
|
+
"browser_embedded_ask_human",
|
|
302
|
+
"conversation_search",
|
|
303
|
+
"mcp__wincu__windows_computer_use_accessibility_tree",
|
|
304
|
+
"mcp__wincu__windows_computer_use_element_info",
|
|
305
|
+
"mcp__wincu__windows_computer_use_find",
|
|
306
|
+
"mcp__wincu__windows_computer_use_health",
|
|
307
|
+
"mcp__wincu__windows_computer_use_list_windows",
|
|
308
|
+
"mcp__wincu__windows_computer_use_ocr",
|
|
309
|
+
"mcp__wincu__windows_computer_use_screenshot",
|
|
310
|
+
"mcp__wincu__windows_computer_use_snapshot",
|
|
311
|
+
"mcp__wincu__windows_computer_use_tools",
|
|
312
|
+
"mcp__wincu__windows_computer_use_wait",
|
|
313
|
+
"mcp__wincu__windows_computer_use_wait_for",
|
|
314
|
+
"schedule_view",
|
|
315
|
+
"vision_colors",
|
|
316
|
+
"vision_crop",
|
|
317
|
+
"vision_trace",
|
|
318
|
+
"vision_extract_foreground",
|
|
319
|
+
"vision_materialize",
|
|
320
|
+
"vision_pixel_diff",
|
|
321
|
+
"vision_html_screenshot",
|
|
322
|
+
"vision_present",
|
|
323
|
+
"univer_status",
|
|
324
|
+
"univer_inspect",
|
|
325
|
+
"univer_lint",
|
|
326
|
+
"univer_api",
|
|
327
|
+
"mcp__mineru-mcp__get_task_progress",
|
|
328
|
+
"mcp__mineru-mcp__get_recent_logs",
|
|
329
|
+
"mcp__mineru-mcp__wait_for_task",
|
|
330
|
+
"vision_describe",
|
|
331
|
+
"vision_bootstrap",
|
|
332
|
+
"vision_ground",
|
|
333
|
+
"vision_detect",
|
|
334
|
+
"vision_ocr",
|
|
335
|
+
"vision_long_screenshot_ocr",
|
|
336
|
+
"mcp__mineru-mcp__document_parse",
|
|
337
|
+
"todo_write",
|
|
338
|
+
"update_goal",
|
|
339
|
+
"list_subagent_models",
|
|
340
|
+
"memory_write",
|
|
341
|
+
"memory_resolve_conflict",
|
|
342
|
+
"memory_room_admin",
|
|
343
|
+
"memory_room_review",
|
|
344
|
+
"memory_ruminate",
|
|
345
|
+
"memory_skill_archive",
|
|
346
|
+
"memory_skill_pin",
|
|
347
|
+
"memory_slot_close",
|
|
348
|
+
"memory_slot_write",
|
|
349
|
+
"memory_add",
|
|
350
|
+
"memory_update",
|
|
351
|
+
"memory_delete",
|
|
352
|
+
"memory_import",
|
|
353
|
+
"memory_migrate_relation",
|
|
354
|
+
"memory_reproject",
|
|
355
|
+
"memory_ruminate_cancel",
|
|
356
|
+
"sessions_list__*",
|
|
357
|
+
"bing_search__*"
|
|
358
|
+
];
|
|
359
|
+
/**
|
|
360
|
+
* Validate one allowlist entry.
|
|
361
|
+
*
|
|
362
|
+
* `*` is a suffix wildcard: the entry must keep at least one literal leading
|
|
363
|
+
* character, so a stray `*` can never turn the list into "allow everything".
|
|
364
|
+
*
|
|
365
|
+
* @param entry - the raw entry as typed in settings.
|
|
366
|
+
* @returns `ok`, or the specific problem.
|
|
367
|
+
*/
|
|
368
|
+
function validateAllowEntry(entry) {
|
|
369
|
+
const trimmed = entry.trim();
|
|
370
|
+
if (trimmed === "") return "empty";
|
|
371
|
+
if (/^\*+$/.test(trimmed)) return "bare-wildcard";
|
|
372
|
+
if (trimmed.startsWith("*")) return "leading-wildcard";
|
|
373
|
+
return "ok";
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Whether a tool name matches one allowlist entry.
|
|
377
|
+
*
|
|
378
|
+
* Exact names match exactly; an entry may end in `*`, which matches any
|
|
379
|
+
* remaining characters (including none). Invalid entries never match.
|
|
380
|
+
*
|
|
381
|
+
* @param name - the tool name from `exec.name`.
|
|
382
|
+
* @param entry - one allowlist entry.
|
|
383
|
+
* @returns true when the call may skip review.
|
|
384
|
+
*/
|
|
385
|
+
function matchesAllowPattern(name, entry) {
|
|
386
|
+
if (name === "" || validateAllowEntry(entry) !== "ok") return false;
|
|
387
|
+
const trimmed = entry.trim();
|
|
388
|
+
const star = trimmed.indexOf("*");
|
|
389
|
+
if (star === -1) return name === trimmed;
|
|
390
|
+
const prefix = trimmed.slice(0, star);
|
|
391
|
+
const suffix = trimmed.slice(star + 1);
|
|
392
|
+
if (!name.startsWith(prefix) || !name.endsWith(suffix)) return false;
|
|
393
|
+
return name.length >= prefix.length + suffix.length;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Whether a tool name is covered by an allowlist.
|
|
397
|
+
* @param name - the tool name under review.
|
|
398
|
+
* @param allowlist - configured entries, patterns included.
|
|
399
|
+
* @returns true when at least one entry matches.
|
|
400
|
+
*/
|
|
401
|
+
function isAllowedByList(name, allowlist) {
|
|
402
|
+
return allowlist.some((entry) => matchesAllowPattern(name, entry));
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Resolve the origin of one tool name for display.
|
|
406
|
+
*
|
|
407
|
+
* Resolution order: MCP bridge → `<tool>__<owner>` extension → plugin prefix →
|
|
408
|
+
* plugin table → core catalog → unknown. Only the first two are structural; the
|
|
409
|
+
* rest are calibrated names, so an unlisted tool is reported as unknown rather
|
|
410
|
+
* than guessed into a package.
|
|
411
|
+
*
|
|
412
|
+
* @param name - the tool name.
|
|
413
|
+
* @returns The origin, with its repository when known.
|
|
414
|
+
*/
|
|
415
|
+
function resolveToolSource(name) {
|
|
416
|
+
const trimmed = name.trim().replace(/\*+$/, "");
|
|
417
|
+
const mcp = /^mcp__([A-Za-z0-9_-]+)__/.exec(trimmed);
|
|
418
|
+
if (mcp !== null) {
|
|
419
|
+
const server = mcp[1];
|
|
420
|
+
const entry = SOURCE_BY_ID.get(MCP_SERVERS.get(server) ?? "");
|
|
421
|
+
if (entry !== void 0) return {
|
|
422
|
+
kind: "mcp",
|
|
423
|
+
label: entry.label,
|
|
424
|
+
repo: entry.repo,
|
|
425
|
+
owner: server
|
|
426
|
+
};
|
|
427
|
+
return {
|
|
428
|
+
kind: "mcp",
|
|
429
|
+
label: `MCP · ${server}`,
|
|
430
|
+
owner: server
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
const extension = EXTENSION_TOOL.exec(trimmed);
|
|
434
|
+
if (extension !== null && !trimmed.startsWith("mcp__")) {
|
|
435
|
+
const entry = SOURCE_BY_ID.get("qqbot-extension");
|
|
436
|
+
const base = extension[1];
|
|
437
|
+
const owner = extension[2];
|
|
438
|
+
return {
|
|
439
|
+
kind: "extension",
|
|
440
|
+
label: `扩展 · ${base}__${owner}`,
|
|
441
|
+
...entry === void 0 ? {} : { repo: entry.repo },
|
|
442
|
+
owner
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
if (trimmed.endsWith("__")) {
|
|
446
|
+
const entry = SOURCE_BY_ID.get("qqbot-extension");
|
|
447
|
+
return {
|
|
448
|
+
kind: "extension",
|
|
449
|
+
label: `扩展 · ${trimmed.slice(0, -2)}__*`,
|
|
450
|
+
...entry === void 0 ? {} : { repo: entry.repo },
|
|
451
|
+
owner: "*"
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
for (const [prefix, id] of PLUGIN_PREFIXES) {
|
|
455
|
+
if (!trimmed.startsWith(prefix)) continue;
|
|
456
|
+
const entry = SOURCE_BY_ID.get(id);
|
|
457
|
+
if (entry !== void 0) return {
|
|
458
|
+
kind: "plugin",
|
|
459
|
+
label: entry.label,
|
|
460
|
+
repo: entry.repo,
|
|
461
|
+
owner: id
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
const plugin = PLUGIN_TOOLS.get(trimmed);
|
|
465
|
+
if (plugin !== void 0) {
|
|
466
|
+
const entry = SOURCE_BY_ID.get(plugin);
|
|
467
|
+
if (entry !== void 0) return {
|
|
468
|
+
kind: "plugin",
|
|
469
|
+
label: entry.label,
|
|
470
|
+
repo: entry.repo,
|
|
471
|
+
owner: plugin
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
if (CORE_TOOLS.has(trimmed)) {
|
|
475
|
+
const entry = SOURCE_BY_ID.get("core");
|
|
476
|
+
return {
|
|
477
|
+
kind: "core",
|
|
478
|
+
label: entry?.label ?? "DSH 核心",
|
|
479
|
+
...entry === void 0 ? {} : { repo: entry.repo },
|
|
480
|
+
owner: "core"
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
return {
|
|
484
|
+
kind: "unknown",
|
|
485
|
+
label: "未知来源"
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
//#endregion
|
|
489
|
+
export { isAllowedByList as n, resolveToolSource as r, DEFAULT_READ_ONLY_TOOLS as t };
|
|
@@ -27,6 +27,13 @@ export interface ReviewStatus {
|
|
|
27
27
|
readonly routeSkipped?: string | undefined;
|
|
28
28
|
readonly replays?: number | undefined;
|
|
29
29
|
} | undefined;
|
|
30
|
+
/** Vision-plugin adapter state: whether our backend-chain head reached dsh-vision-router. */
|
|
31
|
+
readonly visionRouter?: {
|
|
32
|
+
readonly installed: boolean;
|
|
33
|
+
readonly route?: string | undefined;
|
|
34
|
+
readonly routeSkipped?: string | undefined;
|
|
35
|
+
readonly replays?: number | undefined;
|
|
36
|
+
} | undefined;
|
|
30
37
|
/** Review-timeout adapter state: the write and the runtime reload behind it. */
|
|
31
38
|
readonly reviewTimeout?: {
|
|
32
39
|
readonly configuredMs?: number | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
3
3
|
import type { InjectFace, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
4
|
-
import { type CapabilityRouteView, type ModelSwitchSettingsView, type ReviewStatusView, type SubagentSettingsView, type ToolCatalogRow } from '../client-contract.js';
|
|
4
|
+
import { type CapabilityRouteView, type MemoryRouteView, type ModelSwitchSettingsView, type ReviewStatusView, type SubagentSettingsView, type ToolCatalogRow } from '../client-contract.js';
|
|
5
5
|
import { type ProviderGroupConfig } from '../provider-group.js';
|
|
6
6
|
import type { RuntimeCapabilities } from '../runtime-capabilities.js';
|
|
7
7
|
import { type CapabilitiesSnapshot } from './search-capabilities.js';
|
|
@@ -17,7 +17,8 @@ export interface ModelSwitchSettingsFace {
|
|
|
17
17
|
autoReviewSettings: ConfigViewForm<CapabilityRouteView>;
|
|
18
18
|
compactionSettings: ConfigViewForm<CapabilityRouteView>;
|
|
19
19
|
titleSettings: ConfigViewForm<CapabilityRouteView>;
|
|
20
|
-
memorySettings: ConfigViewForm<
|
|
20
|
+
memorySettings: ConfigViewForm<MemoryRouteView>;
|
|
21
|
+
visionSettings: ConfigViewForm<CapabilityRouteView>;
|
|
21
22
|
switchSettings: Pick<ConfigForm<ModelSwitchSettingsView>, 'getSnapshot' | 'subscribe'>;
|
|
22
23
|
};
|
|
23
24
|
capabilities: RuntimeCapabilities;
|
|
@@ -26,7 +27,9 @@ export interface ModelSwitchSettingsFace {
|
|
|
26
27
|
* write can never leave a half-written provider/model pair behind.
|
|
27
28
|
*/
|
|
28
29
|
saveSubagent: (ops: readonly ConfigViewOp<SubagentSettingsView>[]) => Promise<void>;
|
|
29
|
-
saveCapability: (route: 'search' | 'image' | 'autoReview' | 'compaction' | 'title' | 'memory', ops: readonly ConfigViewOp<CapabilityRouteView>[]) => Promise<void>;
|
|
30
|
+
saveCapability: (route: 'search' | 'image' | 'autoReview' | 'compaction' | 'title' | 'memory' | 'vision', ops: readonly ConfigViewOp<CapabilityRouteView>[]) => Promise<void>;
|
|
31
|
+
/** The memory row save; its ops carry the reasoning-effort field alongside the pair. */
|
|
32
|
+
saveMemory: (ops: readonly ConfigViewOp<MemoryRouteView>[]) => Promise<void>;
|
|
30
33
|
/** Persist the read-only skip switch and its allowlist as one atomic write. */
|
|
31
34
|
saveReviewAllowlist: (value: {
|
|
32
35
|
enabled: boolean;
|
|
@@ -49,11 +49,21 @@ export declare const zh: {
|
|
|
49
49
|
readonly memoryFollow: "跟随记忆插件默认";
|
|
50
50
|
readonly memoryHelp: "为 dsh-prime-memory 的记忆蒸馏指定路由;两个字段都留空时跟随该插件自己的默认模型。保存后立即生效(写入该插件自己的 live 设置,运行中的实例会读到);只有反复重试仍写不进去时才回落到静态路由(下次启动生效)。";
|
|
51
51
|
readonly memoryRouteHelp: "按部署默认供应商的配置组解析;该供应商没有组时使用这里填写的平面默认。优先写该行的 live 设置(立即生效),不可用时写静态路由(llm.provider/llm.model),启动时生效。";
|
|
52
|
+
readonly memoryEffort: "思考强度";
|
|
53
|
+
readonly effortAuto: "自动(跟随模型)";
|
|
54
|
+
readonly vision: "识图模型";
|
|
55
|
+
readonly visionFollow: "跟随 Vision Router 默认";
|
|
56
|
+
readonly visionHelp: "为 dsh-vision-router 的识图后端链指定首选路由;两个字段都留空时该插件使用自己的后端链。配置后作为链首行写入(其余行保留为降级后备),经官方 ConfigEditor 热生效、无需重启。应选择支持图片输入的模型。";
|
|
57
|
+
readonly visionRouteHelp: "按部署默认供应商的配置组解析;该供应商没有组时使用这里填写的平面默认。清空两个字段后,识图链路交还 Vision Router 自己管理。";
|
|
58
|
+
readonly visionLinked: "已接管识图路由:{route}。";
|
|
59
|
+
readonly visionLinkedMissing: "未检测到 dsh-vision-router 插件;安装后自动接管。";
|
|
60
|
+
readonly visionLinkedUnset: "识图路由未配置,Vision Router 使用自身后端链。";
|
|
61
|
+
readonly visionLinkedRejected: "识图后端链写入被拒绝,详见宿主日志。";
|
|
52
62
|
readonly providerGroups: "供应商配置组";
|
|
53
63
|
readonly providerGroupsCard: "按供应商预设路由";
|
|
54
64
|
readonly providerGroupsSummary: "使用该供应商的会话自动采用对应组";
|
|
55
|
-
readonly providerGroupsHelp: "
|
|
56
|
-
readonly providerGroupsBodyHelp: "
|
|
65
|
+
readonly providerGroupsHelp: "为压缩、自动审查、会话命名、记忆蒸馏、识图与子代理按供应商分别保存路由。";
|
|
66
|
+
readonly providerGroupsBodyHelp: "每个供应商保存一组压缩、自动审查、会话命名、记忆蒸馏、识图与子代理路由。会话自身的供应商与该组一致时,这些能力按组实时解析,未固定项回落到上方卡片里的全局设置。同一供应商开/关视觉(-vision 孪生路由)共用同一个组。切换某个会话的模型不会写入任何全局设置,因此不同供应商的多个会话并行时互不影响,会话中切换供应商后下一次调用也会立即跟随新供应商的配置组。";
|
|
57
67
|
readonly providerGroupPick: "选择供应商以编辑其配置组。";
|
|
58
68
|
readonly providerGroupDelete: "删除该组";
|
|
59
69
|
readonly groupOverridesLabel: "组覆盖:{pins};无组时用上方默认值";
|
|
@@ -23,6 +23,11 @@ export interface ModelSwitchSettingsView {
|
|
|
23
23
|
/** Distillation route for the memory plugin; both unset means it keeps its own default. */
|
|
24
24
|
memoryProvider?: string;
|
|
25
25
|
memoryModel?: string;
|
|
26
|
+
/** Distillation reasoning effort; unset means the memory plugin's auto resolution. */
|
|
27
|
+
memoryReasoningEffort?: string;
|
|
28
|
+
/** Vision backend route for dsh-vision-router; both unset means it keeps its own chain. */
|
|
29
|
+
visionProvider?: string;
|
|
30
|
+
visionModel?: string;
|
|
26
31
|
/** Raw saved per-provider groups; edited whole through the provider-groups card. */
|
|
27
32
|
providerGroups?: ProviderGroupsStorage;
|
|
28
33
|
}
|
|
@@ -36,6 +41,12 @@ export interface CapabilityRouteView {
|
|
|
36
41
|
provider?: string;
|
|
37
42
|
model?: string;
|
|
38
43
|
}
|
|
44
|
+
/** The memory distillation route plus the reasoning effort a distillation call carries. */
|
|
45
|
+
export interface MemoryRouteView {
|
|
46
|
+
provider?: string;
|
|
47
|
+
model?: string;
|
|
48
|
+
reasoningEffort?: string;
|
|
49
|
+
}
|
|
39
50
|
export declare const SUBAGENT_SETTINGS_FIELDS: Readonly<{
|
|
40
51
|
readonly mode: "subagentMode";
|
|
41
52
|
readonly provider: "subagentProvider";
|
|
@@ -90,6 +101,12 @@ export declare const TITLE_SETTINGS_FIELDS: Readonly<{
|
|
|
90
101
|
export declare const MEMORY_SETTINGS_FIELDS: Readonly<{
|
|
91
102
|
readonly provider: "memoryProvider";
|
|
92
103
|
readonly model: "memoryModel";
|
|
104
|
+
readonly reasoningEffort: "memoryReasoningEffort";
|
|
105
|
+
}>;
|
|
106
|
+
/** Vision backend route handed to dsh-vision-router when it follows its own chain. */
|
|
107
|
+
export declare const VISION_SETTINGS_FIELDS: Readonly<{
|
|
108
|
+
readonly provider: "visionProvider";
|
|
109
|
+
readonly model: "visionModel";
|
|
93
110
|
}>;
|
|
94
111
|
export declare function deriveSubagentSettings(settings: ModelSwitchSettingsView): SubagentSettingsView;
|
|
95
112
|
export declare function deriveSearchSettings(settings: ModelSwitchSettingsView): CapabilityRouteView;
|
|
@@ -97,7 +114,8 @@ export declare function deriveImageSettings(settings: ModelSwitchSettingsView):
|
|
|
97
114
|
export declare function deriveAutoReviewSettings(settings: ModelSwitchSettingsView): CapabilityRouteView;
|
|
98
115
|
export declare function deriveCompactionSettings(settings: ModelSwitchSettingsView): CapabilityRouteView;
|
|
99
116
|
export declare function deriveTitleSettings(settings: ModelSwitchSettingsView): CapabilityRouteView;
|
|
100
|
-
export declare function deriveMemorySettings(settings: ModelSwitchSettingsView):
|
|
117
|
+
export declare function deriveMemorySettings(settings: ModelSwitchSettingsView): MemoryRouteView;
|
|
118
|
+
export declare function deriveVisionSettings(settings: ModelSwitchSettingsView): CapabilityRouteView;
|
|
101
119
|
/** Whether both fields of a model route form a complete pair; an incomplete pair stays off. */
|
|
102
120
|
export declare function routePairConfigured(route: CapabilityRouteView | undefined): boolean;
|
|
103
121
|
/** Live reviewer counters shown beside the allowlist editor. */
|
|
@@ -112,6 +130,20 @@ export interface ReviewStatusView {
|
|
|
112
130
|
readonly added: number;
|
|
113
131
|
readonly skipped: number;
|
|
114
132
|
} | undefined;
|
|
133
|
+
/** Memory-plugin adapter state: whether our distillation route reached the plugin. */
|
|
134
|
+
readonly primeMemory?: {
|
|
135
|
+
readonly installed: boolean;
|
|
136
|
+
readonly route?: string | undefined;
|
|
137
|
+
readonly routeSkipped?: string | undefined;
|
|
138
|
+
readonly replays?: number | undefined;
|
|
139
|
+
} | undefined;
|
|
140
|
+
/** Vision-plugin adapter state: whether our backend-chain head reached dsh-vision-router. */
|
|
141
|
+
readonly visionRouter?: {
|
|
142
|
+
readonly installed: boolean;
|
|
143
|
+
readonly route?: string | undefined;
|
|
144
|
+
readonly routeSkipped?: string | undefined;
|
|
145
|
+
readonly replays?: number | undefined;
|
|
146
|
+
} | undefined;
|
|
115
147
|
}
|
|
116
148
|
/**
|
|
117
149
|
* Decode the reviewer counters from a `tools` RPC payload.
|
|
@@ -54,6 +54,12 @@ export interface ModelSwitchSettings {
|
|
|
54
54
|
memoryProvider?: string;
|
|
55
55
|
/** Distillation model for the memory plugin; set together with `memoryProvider`. */
|
|
56
56
|
memoryModel?: string;
|
|
57
|
+
/** Distillation reasoning effort; unset/blank keeps the memory plugin's auto resolution. */
|
|
58
|
+
memoryReasoningEffort?: string;
|
|
59
|
+
/** Vision backend provider for dsh-vision-router; both fields unset = that plugin's own chain. */
|
|
60
|
+
visionProvider?: string;
|
|
61
|
+
/** Vision backend model for dsh-vision-router; set together with `visionProvider`. */
|
|
62
|
+
visionModel?: string;
|
|
57
63
|
/** Per-provider compaction/subagent/review presets, keyed by provider id; absent when no group is saved. */
|
|
58
64
|
providerGroups?: ProviderGroups;
|
|
59
65
|
}
|
|
@@ -82,6 +88,11 @@ export interface Config {
|
|
|
82
88
|
/** Distillation route handed to the memory plugin when it follows its default. */
|
|
83
89
|
memoryProvider: Volatile<string | undefined>;
|
|
84
90
|
memoryModel: Volatile<string | undefined>;
|
|
91
|
+
/** Distillation reasoning effort handed to the memory plugin; blank = its auto resolution. */
|
|
92
|
+
memoryReasoningEffort: Volatile<string | undefined>;
|
|
93
|
+
/** Vision backend route handed to dsh-vision-router when it follows its own chain. */
|
|
94
|
+
visionProvider: Volatile<string | undefined>;
|
|
95
|
+
visionModel: Volatile<string | undefined>;
|
|
85
96
|
/** Saved per-provider capability groups as one entry per provider; entry route fields are '' when the capability stays at its default. */
|
|
86
97
|
providerGroups: Volatile<readonly ProviderGroupEntry[]>;
|
|
87
98
|
}
|