dsh-project-mcp 0.3.1 → 0.4.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/README.md +38 -23
- package/lib/client.js +15 -15
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +98 -23
- package/lib/index.js +148 -46
- package/lib/index.js.map +1 -1
- package/package.json +18 -17
- package/src/activation.ts +164 -43
- package/src/client/locales/ui.ts +6 -6
- package/src/client/plugin-config.ts +9 -9
- package/src/runtime.ts +23 -7
package/README.md
CHANGED
|
@@ -171,12 +171,12 @@ Plugin config is the `cordis.patch.yml` row (defaults shown):
|
|
|
171
171
|
credentialsFile: '' # default: $DSH_HOME/.credentials.yaml
|
|
172
172
|
allowGlobalWrite: false # let the editor write the documents of globalFiles
|
|
173
173
|
activationEnabled: true # offer MCP tools through `mcp_search_tools` + activation
|
|
174
|
-
activationSeeded:
|
|
175
|
-
activationMinCalls:
|
|
176
|
-
toolIdleMs:
|
|
174
|
+
activationSeeded: 16 # counter-seeded tools that are always offered
|
|
175
|
+
activationMinCalls: 1 # calls one tool needs before it is seeded
|
|
176
|
+
toolIdleMs: 0 # drop a session-activated tool after this long without a call; 0 keeps it for the session
|
|
177
177
|
guidanceEnabled: true # one short project-MCP guidance section in the session system prompt
|
|
178
178
|
activationAutoLimit: 12 # names the task-context tier may offer at once; 0 disables that tier
|
|
179
|
-
activationAutoStickySteps:
|
|
179
|
+
activationAutoStickySteps: 100 # extra user messages a context offer stays offered
|
|
180
180
|
activationToolBudgetChars: 40000 # serialized MCP surface above which tools are deferred; 0 defers always
|
|
181
181
|
projectMarkers: ['.git', '.dsh', '.kimi-code', 'package.json']
|
|
182
182
|
fileMarkers: ['.sln', '.slnx', '.csproj']
|
|
@@ -345,10 +345,12 @@ deployment wants, without touching the registry (this is the `disclosure` mode o
|
|
|
345
345
|
*Tool policy* above; a project can be switched to `direct` or `off` instead):
|
|
346
346
|
|
|
347
347
|
- **Hot tools are offered directly.** A tool whose project counters reached
|
|
348
|
-
`activationMinCalls` (default
|
|
349
|
-
the request from the first step on; `activationSeeded` (default
|
|
350
|
-
many names the counters may seed.
|
|
351
|
-
|
|
348
|
+
`activationMinCalls` (default 1) is seeded into a **baseline** that appears in
|
|
349
|
+
the request from the first step on; `activationSeeded` (default 16) caps how
|
|
350
|
+
many names the counters may seed. One call is enough, so the baseline follows
|
|
351
|
+
what the project really uses, and the counters only ever add names to it — a
|
|
352
|
+
tool that was called once stays offered. The counters are the ones above, so
|
|
353
|
+
the baseline is remembered across sessions and restarts.
|
|
352
354
|
- **Matching tools are offered from the task context.** The host ranks the
|
|
353
355
|
project's mounted tools against the newest task text with BM25 — over the tool
|
|
354
356
|
name and description, tokenized on case boundaries, separators and punctuation,
|
|
@@ -364,14 +366,16 @@ deployment wants, without touching the registry (this is the `disclosure` mode o
|
|
|
364
366
|
The counters keep accumulating either way, so the decision follows a project
|
|
365
367
|
as it grows.
|
|
366
368
|
- **The offered set is sticky, so it rarely changes.** A name stays offered for
|
|
367
|
-
the task text that offered it plus `activationAutoStickySteps` (default
|
|
368
|
-
later messages, one input per recomputation, so
|
|
369
|
-
list instead of following every dip of the ranking. Because the inner
|
|
370
|
-
rebuild the registry list on every step, the additions are re-applied
|
|
371
|
-
from what those listeners actually returned; when that list already
|
|
372
|
-
everything, the listener hands back the **identical** assembly object.
|
|
373
|
-
changing tool list rewrites the prompt prefix and invalidates the model's
|
|
374
|
-
cache
|
|
369
|
+
the task text that offered it plus `activationAutoStickySteps` (default 100)
|
|
370
|
+
later messages, one input per recomputation, so the whole session shares one
|
|
371
|
+
tool list instead of following every dip of the ranking. Because the inner
|
|
372
|
+
listeners rebuild the registry list on every step, the additions are re-applied
|
|
373
|
+
each time from what those listeners actually returned; when that list already
|
|
374
|
+
carries everything, the listener hands back the **identical** assembly object.
|
|
375
|
+
A changing tool list rewrites the prompt prefix and invalidates the model's
|
|
376
|
+
cache — the provider re-reads the prompt from the first altered token — so the
|
|
377
|
+
shipped window is wide enough that an offer outlives the task that produced it
|
|
378
|
+
and the list changes at most a compaction or an activation, not every turn.
|
|
375
379
|
- **The rest are found, not listed.** The plugin registers `mcp_search_tools` in
|
|
376
380
|
the session's own scope and also offers it from its own assembly listener — a
|
|
377
381
|
presentation plugin that trims the list to an allowlist would otherwise drop
|
|
@@ -390,12 +394,21 @@ deployment wants, without touching the registry (this is the `disclosure` mode o
|
|
|
390
394
|
activated tools join the offered
|
|
391
395
|
list from the **next** model step on; only the tools already listed are
|
|
392
396
|
reliable until then.
|
|
393
|
-
- **
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
397
|
+
- **What does fall away is opt-in.** The shipped `toolIdleMs: 0` disables the
|
|
398
|
+
idle sweep, so a searched tool stays offered for the rest of the session, and
|
|
399
|
+
the offered set only ever grows there. A positive `toolIdleMs` restores the
|
|
400
|
+
old behaviour: a session-activated tool that is not called within the window
|
|
401
|
+
is dropped at the next `agent/status` transition. A `compaction/end` is the one
|
|
402
|
+
boundary that shrinks the set on its own: the conversation those offers
|
|
403
|
+
belonged to is rewritten there, so the provider recomputes the prompt prefix
|
|
404
|
+
anyway and a shorter list costs nothing newly. It drops the offers the model
|
|
405
|
+
never acted on — a context match or a search it did not call — and keeps the
|
|
406
|
+
activations a call backs: a tool the model called at least once stays offered
|
|
407
|
+
from the next step on, stamped with the time of that call. A tool called
|
|
408
|
+
without ever being activated is kept for the same reason — the session used it
|
|
409
|
+
— and the context tier restarts from scratch at that boundary. The counter
|
|
410
|
+
baseline survives both — it is derived from durable counters, not from the
|
|
411
|
+
session — and a pin survives them for the same reason (*Tool policy* above).
|
|
399
412
|
|
|
400
413
|
**Where the task text comes from.** The context tier reads the session's own
|
|
401
414
|
`session/event` stream: the newest committed `user/message` supplies the text,
|
|
@@ -909,7 +922,9 @@ The publish credential is an **OIDC token**, not a repository secret: the job as
|
|
|
909
922
|
`id-token: write` and exchanges it with npm's trusted publishing (registered for this
|
|
910
923
|
repository and `npm-publish.yml` on npmjs.com), so nothing has to be rotated and a
|
|
911
924
|
stale `NODE_AUTH_TOKEN` must not be set — it would take precedence over the exchange.
|
|
912
|
-
That job pins Node 24, because the exchange needs npm ≥ 11.5.1
|
|
925
|
+
That job pins Node 24, because the exchange needs npm ≥ 11.5.1 and is performed by the
|
|
926
|
+
**npm CLI**: the pnpm 10 line has no trusted-publishing support, so `pnpm publish` there
|
|
927
|
+
would send the PUT unauthenticated and the registry would mask that as a `404`.
|
|
913
928
|
|
|
914
929
|
## Limitations
|
|
915
930
|
|
package/lib/client.js
CHANGED
|
@@ -7100,15 +7100,15 @@ const EN = {
|
|
|
7100
7100
|
configActivationSeeded: "Seeded tools",
|
|
7101
7101
|
configActivationSeededHint: "Tools offered from the first step, before any counter accrues; 0 seeds none",
|
|
7102
7102
|
configActivationMinCalls: "Calls to pin",
|
|
7103
|
-
configActivationMinCallsHint: "Calls after which the counters pin a tool directly",
|
|
7103
|
+
configActivationMinCallsHint: "Calls after which the counters pin a tool directly; 0 pins any tool with a recorded call",
|
|
7104
7104
|
configToolIdleMs: "Tool idle timeout (ms)",
|
|
7105
|
-
configToolIdleMsHint: "A tool unused for this long drops back out of the request",
|
|
7105
|
+
configToolIdleMsHint: "A tool unused for this long drops back out of the request; 0 keeps it for the whole session",
|
|
7106
7106
|
configGuidanceEnabled: "System-prompt guidance",
|
|
7107
7107
|
configGuidanceEnabledHint: "Inject the plugin’s operating notes into the session prompt",
|
|
7108
7108
|
configActivationAutoLimit: "Auto-activation limit",
|
|
7109
7109
|
configActivationAutoLimitHint: "Most tools the counters may add on their own (0–50)",
|
|
7110
7110
|
configActivationAutoStickySteps: "Sticky steps",
|
|
7111
|
-
configActivationAutoStickyStepsHint: "
|
|
7111
|
+
configActivationAutoStickyStepsHint: "Extra user messages a context offer stays offered; 0 keeps it for that message only (0–1000)",
|
|
7112
7112
|
configActivationToolBudgetChars: "Tool budget (chars)",
|
|
7113
7113
|
configActivationToolBudgetCharsHint: "Character budget for the tool schemas one request carries (≥ 1000)",
|
|
7114
7114
|
configAllowGlobalWrite: "Global writes",
|
|
@@ -7156,12 +7156,12 @@ function fallbackTranslate(key, params) {
|
|
|
7156
7156
|
*/
|
|
7157
7157
|
const CONFIG_DEFAULTS = {
|
|
7158
7158
|
activationEnabled: true,
|
|
7159
|
-
activationSeeded:
|
|
7160
|
-
activationMinCalls:
|
|
7161
|
-
toolIdleMs:
|
|
7159
|
+
activationSeeded: 16,
|
|
7160
|
+
activationMinCalls: 1,
|
|
7161
|
+
toolIdleMs: 0,
|
|
7162
7162
|
guidanceEnabled: true,
|
|
7163
7163
|
activationAutoLimit: 12,
|
|
7164
|
-
activationAutoStickySteps:
|
|
7164
|
+
activationAutoStickySteps: 100,
|
|
7165
7165
|
activationToolBudgetChars: 4e4,
|
|
7166
7166
|
allowGlobalWrite: false,
|
|
7167
7167
|
envFiles: true,
|
|
@@ -7203,7 +7203,7 @@ const ACTIVATION_FIELDS = [
|
|
|
7203
7203
|
{
|
|
7204
7204
|
key: "activationMinCalls",
|
|
7205
7205
|
kind: "integer",
|
|
7206
|
-
min:
|
|
7206
|
+
min: 0,
|
|
7207
7207
|
label: "configActivationMinCalls",
|
|
7208
7208
|
hint: "configActivationMinCallsHint"
|
|
7209
7209
|
},
|
|
@@ -7232,7 +7232,7 @@ const ACTIVATION_FIELDS = [
|
|
|
7232
7232
|
key: "activationAutoStickySteps",
|
|
7233
7233
|
kind: "integer",
|
|
7234
7234
|
min: 0,
|
|
7235
|
-
max:
|
|
7235
|
+
max: 1e3,
|
|
7236
7236
|
label: "configActivationAutoStickySteps",
|
|
7237
7237
|
hint: "configActivationAutoStickyStepsHint"
|
|
7238
7238
|
},
|
|
@@ -8014,15 +8014,15 @@ const zh = {
|
|
|
8014
8014
|
configActivationSeeded: "预置工具数",
|
|
8015
8015
|
configActivationSeededHint: "在计数累计之前,从第一步就提供的工具数;0 表示不预置",
|
|
8016
8016
|
configActivationMinCalls: "固定所需调用次数",
|
|
8017
|
-
configActivationMinCallsHint: "
|
|
8017
|
+
configActivationMinCallsHint: "调用达到此次数后,计数器会直接固定该工具;0 表示只要有过调用就固定",
|
|
8018
8018
|
configToolIdleMs: "工具闲置超时(毫秒)",
|
|
8019
|
-
configToolIdleMsHint: "
|
|
8019
|
+
configToolIdleMsHint: "工具超过此时长未使用将从请求中移除;0 表示整个会话都保留",
|
|
8020
8020
|
configGuidanceEnabled: "系统提示指引",
|
|
8021
8021
|
configGuidanceEnabledHint: "将本插件的使用说明注入会话提示",
|
|
8022
8022
|
configActivationAutoLimit: "自动激活上限",
|
|
8023
8023
|
configActivationAutoLimitHint: "计数器最多可自行加入的工具数(0–50)",
|
|
8024
8024
|
configActivationAutoStickySteps: "黏滞步数",
|
|
8025
|
-
configActivationAutoStickyStepsHint: "
|
|
8025
|
+
configActivationAutoStickyStepsHint: "按任务上下文提供的工具额外保留多少条用户消息;0 表示仅保留当前消息(0–1000)",
|
|
8026
8026
|
configActivationToolBudgetChars: "工具预算(字符)",
|
|
8027
8027
|
configActivationToolBudgetCharsHint: "单次请求携带的工具模式字符预算(≥ 1000)",
|
|
8028
8028
|
configAllowGlobalWrite: "允许全局写入",
|
|
@@ -8378,15 +8378,15 @@ const ru = {
|
|
|
8378
8378
|
configActivationSeeded: "Предустановленные инструменты",
|
|
8379
8379
|
configActivationSeededHint: "Инструменты, предлагаемые с первого шага, до накопления счётчиков; 0 — не предлагать",
|
|
8380
8380
|
configActivationMinCalls: "Вызовов до закрепления",
|
|
8381
|
-
configActivationMinCallsHint: "После стольких вызовов счётчики закрепляют инструмент
|
|
8381
|
+
configActivationMinCallsHint: "После стольких вызовов счётчики закрепляют инструмент напрямую; 0 — закрепить любой инструмент с записанным вызовом",
|
|
8382
8382
|
configToolIdleMs: "Тайм-аут простоя инструмента (мс)",
|
|
8383
|
-
configToolIdleMsHint: "Инструмент, не использованный за это время, исключается из
|
|
8383
|
+
configToolIdleMsHint: "Инструмент, не использованный за это время, исключается из запроса; 0 — оставить его на всю сессию",
|
|
8384
8384
|
configGuidanceEnabled: "Подсказки в системном промпте",
|
|
8385
8385
|
configGuidanceEnabledHint: "Добавлять рабочие заметки плагина в промпт сессии",
|
|
8386
8386
|
configActivationAutoLimit: "Лимит автоактивации",
|
|
8387
8387
|
configActivationAutoLimitHint: "Максимум инструментов, которые счётчики могут добавить сами (0–50)",
|
|
8388
8388
|
configActivationAutoStickySteps: "Шагов закрепления",
|
|
8389
|
-
configActivationAutoStickyStepsHint: "Сколько
|
|
8389
|
+
configActivationAutoStickyStepsHint: "Сколько пользовательских сообщений предложенный по контексту инструмент остаётся предложенным; 0 — только для этого сообщения (0–1000)",
|
|
8390
8390
|
configActivationToolBudgetChars: "Бюджет инструментов (символы)",
|
|
8391
8391
|
configActivationToolBudgetCharsHint: "Бюджет в символах на схемы инструментов в одном запросе (≥ 1000)",
|
|
8392
8392
|
configAllowGlobalWrite: "Глобальная запись",
|