dsh-desktop-kit 2.10.0 → 2.12.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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.12.0 (2026-11-12)
4
+
5
+ - **Параллельная команда.** `project_agent action=team names=[...] task=...` запускает 2–6 **read-only** ролей на одной задаче; каждая получает свой контекст и отдельный run.
6
+ - **Безопасность.** Team отклоняет пишущих агентов, дубликаты и размеры вне 2–6; общий cwd только для read-only.
7
+ - **UI.** Секция «Параллельная команда» в Агентах: подсказка и доступные read-only роли.
8
+ - **Тесты.** `team-agents-tests`; UI 390/768/1440 без overflow.
9
+
10
+ ## 2.11.0 (2026-11-12)
11
+
12
+ - **MCP elicitation.** Opt-in `elicitation: true`; `elicitation/create` открывает глобальную форму DSH с Accept/Decline/Cancel, валидацией плоской JSON-схемы и таймаутом.
13
+ - **UI.** Глобальный overlay `shell.overlay` (не только Settings), поля string/number/integer/boolean/enum, очередь и счётчик запросов.
14
+ - **Безопасность.** Неизвестные поля отклоняются, required/min/max проверяются на хосте, лимиты 4 КБ и 5 запросов, decline/cancel не отправляют content.
15
+ - **Тесты.** `mcp-elicitation-tests`: accept/decline/cancel, required, unknown field, max, timeout queue limits.
16
+ - **Elicitation UI.** 390/768/1440: overflow 0, console 0, markup 0; исправлены CSS-переменные overlay.
17
+
3
18
  ## 2.10.0 (2026-11-12)
4
19
 
5
20
  - **MCP sampling.** Opt-in `sampling: true`; серверный `sampling/createMessage` идёт через DSH approval-карточку с preview, затем в модель текущей сессии.
package/README.md CHANGED
@@ -4,17 +4,17 @@
4
4
 
5
5
  Набор из **16 плагинов и 30 навыков** для DeepSeek Harness 0.2.x: русский интерфейс, автопилот навыков, токен-лаборатория, студия навыков, память проектов, обмен памятью между машинами (GitHub и USB), guardrails, карта репозитория, чекпоинты, plan mode, browser QA, GitHub review, Claude Code-подобные hooks/agents/commands, перенос чатов и резервные копии профиля.
6
6
 
7
- ![DSH Desktop Kit 2.7](https://unpkg.com/dsh-desktop-kit@2.10.0/docs/images/hero.png)
7
+ ![DSH Desktop Kit 2.7](https://unpkg.com/dsh-desktop-kit@2.12.0/docs/images/hero.png)
8
8
 
9
9
  ## MCP: подключения без JSON
10
10
 
11
- Настройки → **MCP**: пресеты GitHub, PostgreSQL и Filesystem, живые статусы, health, список tools и безопасное хранение токенов в `~/.dsh/mcp.secrets.json`. Промпты сервера открываются кнопкой **Prompts**: аргументы, запуск и копирование результата. HTTP-серверы подключаются через **OAuth 2.1 + PKCE**, а **sampling** включается отдельно и проходит через approval-карточку DSH.
11
+ Настройки → **MCP**: пресеты GitHub, PostgreSQL и Filesystem, живые статусы, health, список tools и безопасное хранение токенов в `~/.dsh/mcp.secrets.json`. Промпты сервера открываются кнопкой **Prompts**: аргументы, запуск и копирование результата. HTTP-серверы подключаются через **OAuth 2.1 + PKCE**, **sampling** идёт через approval-карточку DSH, а **elicitation** — через глобальную форму с Accept/Decline.
12
12
 
13
- ![MCP Settings](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-mcp-manager/screenshots/settings-1440.png)
13
+ ![MCP Settings](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-mcp-manager/screenshots/settings-1440.png)
14
14
 
15
- ![MCP на 390px](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-mcp-manager/screenshots/settings-390.png)
15
+ ![MCP на 390px](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-mcp-manager/screenshots/settings-390.png)
16
16
 
17
- ![Добавление MCP-сервера](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-mcp-manager/screenshots/modal-390.png)
17
+ ![Добавление MCP-сервера](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-mcp-manager/screenshots/modal-390.png)
18
18
 
19
19
  ## Права и субагенты
20
20
 
@@ -25,11 +25,11 @@
25
25
  - **Worktrees и фоновые агенты.** `project_worktree` создаёт ветку `dsh/<slug>` и отдельную папку `.dsh/worktrees/<slug>`; `project_agent ... worktree=auto background=true` запускает агента в изоляции, а страница **Агенты** показывает worktrees и очередь запусков с кнопкой «Остановить».
26
26
  - **Инструкции проекта.** `AGENTS.md` и `CLAUDE.md` читаются иерархически (root → вложенные папки → `.dsh`) с `@import`; MCP roots сообщает серверу корень проекта.
27
27
 
28
- ![Агенты проекта](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-agent-extensions/screenshots/agents-1440.png)
28
+ ![Агенты проекта](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-agent-extensions/screenshots/agents-1440.png)
29
29
 
30
- ![Права и ограничения](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-guardrails/screenshots/permissions-1440.png)
30
+ ![Права и ограничения](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-guardrails/screenshots/permissions-1440.png)
31
31
 
32
- **v2.10.0** · MIT · проверено на DSH `0.2.1-rc.5` и `0.2.2-rc.1` (Windows 11) · без внешних зависимостей и телеметрии
32
+ **v2.12.0** · MIT · проверено на DSH `0.2.1-rc.5` и `0.2.2-rc.1` (Windows 11) · без внешних зависимостей и телеметрии
33
33
 
34
34
  **План развития:** [docs/ROADMAP-3.0.md](docs/ROADMAP-3.0.md) — Memory Fabric, семантическое
35
35
  слияние, локальный индекс памяти, шифрованные переносы, Memory Hub и npm trusted publishing.
@@ -117,27 +117,27 @@
117
117
  - перед каждой синхронизацией проверяется, что репозиторий всё ещё приватный;
118
118
  - секреты и PII вычищаются, домашние пути заменяются токеном `%DSH_HOME%`; LLM не вызывается — **0 токенов**.
119
119
 
120
- ![Настройки памяти проектов](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-memory-bridge/docs/images/settings-light.png)
120
+ ![Настройки памяти проектов](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-memory-bridge/docs/images/settings-light.png)
121
121
 
122
- ![Конфликты досье](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-memory-bridge/docs/images/conflicts.png)
122
+ ![Конфликты досье](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-memory-bridge/docs/images/conflicts.png)
123
123
 
124
124
  ## Скриншоты
125
125
 
126
126
  ### Skills Studio: каталог, стоимость и редактор
127
127
 
128
- ![Каталог навыков](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-gkb-ru-ui/screenshots/02-skills-1440-light.png)
128
+ ![Каталог навыков](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-gkb-ru-ui/screenshots/02-skills-1440-light.png)
129
129
 
130
- ![Редактор навыка](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-gkb-ru-ui/screenshots/03-skills-editor-1440-light.png)
130
+ ![Редактор навыка](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-gkb-ru-ui/screenshots/03-skills-editor-1440-light.png)
131
131
 
132
132
  ### Token Lab: куда уходит контекст
133
133
 
134
- ![Токен-лаборатория](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-token-lab/screenshots/01-token-lab-1440-light.png)
134
+ ![Токен-лаборатория](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-token-lab/screenshots/01-token-lab-1440-light.png)
135
135
 
136
136
  ### Тёмная тема и мобильный
137
137
 
138
- ![Тёмная тема](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-gkb-ru-ui/screenshots/04-skills-1440-dark.png)
138
+ ![Тёмная тема](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-gkb-ru-ui/screenshots/04-skills-1440-dark.png)
139
139
 
140
- ![Каталог навыков на 390 px](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-gkb-ru-ui/screenshots/05-skills-390-light.png)
140
+ ![Каталог навыков на 390 px](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-gkb-ru-ui/screenshots/05-skills-390-light.png)
141
141
 
142
142
  ## Окно-напоминание: пиковый тариф
143
143
 
@@ -147,11 +147,11 @@ DeepSeek включает двойной тариф в пиковые часы (
147
147
  - **в окне** — красная карточка: причина, границы окна в местном времени и UTC, живой отсчёт до конца и рекомендация, когда вернуться;
148
148
  - **после окна** — карточка исчезает; состояние всегда доступно через `window.__DSH_PEAK_GUARD__.state()`.
149
149
 
150
- ![Окно-напоминание: светлая тема](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-peak-guard/screenshots/03-peak-card-1440-light.png)
150
+ ![Окно-напоминание: светлая тема](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-peak-guard/screenshots/03-peak-card-1440-light.png)
151
151
 
152
- ![Окно-напоминание: тёмная тема](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-peak-guard/screenshots/04-peak-card-1440-dark.png)
152
+ ![Окно-напоминание: тёмная тема](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-peak-guard/screenshots/04-peak-card-1440-dark.png)
153
153
 
154
- ![Окно-напоминание на 390 px](https://unpkg.com/dsh-desktop-kit@2.10.0/plugins/dsh-peak-guard/screenshots/05-peak-card-390-light.png)
154
+ ![Окно-напоминание на 390 px](https://unpkg.com/dsh-desktop-kit@2.12.0/plugins/dsh-peak-guard/screenshots/05-peak-card-390-light.png)
155
155
 
156
156
  Подробности и настройки — [plugins/dsh-peak-guard/README.md](plugins/dsh-peak-guard/README.md).
157
157
 
package/client.js CHANGED
@@ -6936,6 +6936,8 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
6936
6936
  .mcp-prompt-card b{display:block;font-size:13px}
6937
6937
  .mcp-prompt-card span{display:block;color:var(--mcp-muted);font-size:12px;line-height:1.4;margin-top:3px}
6938
6938
  .mcp-prompt-output{margin:0;padding:12px;border:1px solid var(--mcp-line);border-radius:10px;background:var(--mcp-soft);color:var(--mcp-text);font:12px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre-wrap;overflow-wrap:anywhere;max-height:38vh;overflow:auto}
6939
+ .mcp-elicit{--mcp-line:var(--dsw-alias-border-l1,rgba(20,40,36,.13));--mcp-soft:var(--dsw-alias-bg-layer-1,#f4f7f5);--mcp-panel:var(--dsw-alias-bg-layer-2,#fff);--mcp-text:var(--dsw-alias-label-primary,#17231f);--mcp-muted:var(--dsw-alias-label-secondary,#61706b);--mcp-accent:var(--dsw-alias-brand-primary,#0f766e);--mcp-accent-soft:rgba(15,118,110,.07);pointer-events:auto;z-index:90}
6940
+ .mcp-elicit-message{margin:0;color:var(--mcp-text);font-size:13px;line-height:1.5;max-height:22vh;overflow:auto;overflow-wrap:anywhere}
6939
6941
  .mcp-empty{border:1px dashed var(--mcp-line);border-radius:18px;padding:26px;background:linear-gradient(160deg,var(--mcp-soft),transparent 75%);display:flex;flex-direction:column;gap:12px;align-items:flex-start}
6940
6942
  .mcp-empty h3{margin:0;font-size:18px;letter-spacing:-.015em}
6941
6943
  .mcp-empty p{margin:0;color:var(--mcp-muted);font-size:13px;line-height:1.5;max-width:60ch}
@@ -7145,10 +7147,16 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
7145
7147
  h("input", { type: "checkbox", checked: form.trusted, onChange: (event) => set({ trusted: event.target.checked }) }),
7146
7148
  h("span", null, "Я доверяю этому серверу. Он сможет выполнять команды и читать данные, к которым у него есть доступ."),
7147
7149
  ),
7148
- h("label", { className: "mcp-check wide" },
7149
- h("input", { type: "checkbox", checked: form.sampling === true, onChange: (event) => set({ sampling: event.target.checked }) }),
7150
- h("span", null, "Разрешить sampling: сервер сможет попросить модель сгенерировать текст. Каждый запрос показывает approval-карточку, tools запрещены, лимит 1024 токена."),
7151
- ),
7150
+ form.transport === "stdio" ? h(React.Fragment, null,
7151
+ h("label", { className: "mcp-check wide" },
7152
+ h("input", { type: "checkbox", checked: form.sampling === true, onChange: (event) => set({ sampling: event.target.checked }) }),
7153
+ h("span", null, "Разрешить sampling: сервер сможет попросить модель сгенерировать текст. Каждый запрос показывает approval-карточку, tools запрещены, лимит 1024 токена."),
7154
+ ),
7155
+ h("label", { className: "mcp-check wide" },
7156
+ h("input", { type: "checkbox", checked: form.elicitation === true, onChange: (event) => set({ elicitation: event.target.checked }) }),
7157
+ h("span", null, "Разрешить elicitation: сервер сможет запросить структурированные данные через форму DSH. Каждый запрос можно принять или отклонить."),
7158
+ ),
7159
+ ) : null,
7152
7160
  ),
7153
7161
  h("p", { className: "mcp-note" }, "Секрет сохраняется в ~/.dsh/mcp.secrets.json с правами 0600 и не попадает в mcp.json или лог."),
7154
7162
  h("div", { className: "mcp-form-actions" },
@@ -7313,8 +7321,9 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
7313
7321
  token: "",
7314
7322
  trusted: preset.trusted === true,
7315
7323
  sampling: false,
7324
+ elicitation: false,
7316
7325
  });
7317
- const openManual = () => setForm({ edit: false, id: "", transport: "stdio", command: "npx", args: "-y\n", url: "", tokenEnv: "MCP_TOKEN", tokenHeader: "Authorization", tokenLabel: "Токен", tokenPlaceholder: "", token: "", trusted: false, sampling: false });
7326
+ const openManual = () => setForm({ edit: false, id: "", transport: "stdio", command: "npx", args: "-y\n", url: "", tokenEnv: "MCP_TOKEN", tokenHeader: "Authorization", tokenLabel: "Токен", tokenPlaceholder: "", token: "", trusted: false, sampling: false, elicitation: false });
7318
7327
 
7319
7328
  const servers = data?.servers ?? [];
7320
7329
  const connected = servers.filter((server) => server.connected).length;
@@ -7398,6 +7407,134 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
7398
7407
  );
7399
7408
  }
7400
7409
 
7410
+ function ElicitationHost() {
7411
+ const [items, setItems] = useState([]);
7412
+ const [values, setValues] = useState({});
7413
+ const [busy, setBusy] = useState(false);
7414
+ const [error, setError] = useState("");
7415
+ const current = items[0];
7416
+
7417
+ useEffect(() => {
7418
+ let stopped = false;
7419
+ const refresh = async () => {
7420
+ if (document.hidden) return;
7421
+ try {
7422
+ const result = await call(window.__DSH_MCP_CTX__, "elicitations");
7423
+ if (!stopped) setItems(Array.isArray(result.items) ? result.items : []);
7424
+ } catch { /* host may be restarting */ }
7425
+ };
7426
+ void refresh();
7427
+ const timer = setInterval(refresh, 2500);
7428
+ const onVisible = () => { if (!document.hidden) void refresh(); };
7429
+ document.addEventListener("visibilitychange", onVisible);
7430
+ return () => {
7431
+ stopped = true;
7432
+ clearInterval(timer);
7433
+ document.removeEventListener("visibilitychange", onVisible);
7434
+ };
7435
+ }, []);
7436
+
7437
+ useEffect(() => {
7438
+ if (!current) { setValues({}); return; }
7439
+ const next = {};
7440
+ for (const [key, property] of Object.entries(current.schema?.properties ?? {})) {
7441
+ if (property?.type === "boolean") next[key] = false;
7442
+ else if (property?.enum?.length) next[key] = property.enum[0];
7443
+ else next[key] = "";
7444
+ }
7445
+ setValues(next);
7446
+ setError("");
7447
+ }, [current?.id]);
7448
+
7449
+ if (!current) return null;
7450
+ const properties = Object.entries(current.schema?.properties ?? {});
7451
+ const required = Array.isArray(current.schema?.required) ? current.schema.required : [];
7452
+
7453
+ const respond = async (action) => {
7454
+ setBusy(true);
7455
+ setError("");
7456
+ try {
7457
+ await call(window.__DSH_MCP_CTX__, "elicitation", {
7458
+ id: current.id,
7459
+ action,
7460
+ ...(action === "accept" ? { content: values } : {}),
7461
+ });
7462
+ setItems((list) => list.slice(1));
7463
+ } catch (cause) {
7464
+ setError(cause instanceof Error ? cause.message : String(cause));
7465
+ } finally {
7466
+ setBusy(false);
7467
+ }
7468
+ };
7469
+
7470
+ return h("div", { className: "mcp-overlay mcp-elicit" },
7471
+ h("div", { className: "mcp-modal", role: "dialog", "aria-modal": "true", "aria-labelledby": "mcp-elicit-title" },
7472
+ h("div", { className: "mcp-modal-head" },
7473
+ h("div", null,
7474
+ h("h2", { id: "mcp-elicit-title" }, "Запрос данных"),
7475
+ h("p", null, `Сервер «${current.serverId}» просит заполнить форму.`),
7476
+ ),
7477
+ items.length > 1 ? h("span", { className: "mcp-badge" }, `${items.length} в очереди`) : null,
7478
+ ),
7479
+ h("p", { className: "mcp-elicit-message" }, current.message),
7480
+ error ? h("div", { className: "mcp-error", role: "alert" }, error) : null,
7481
+ h("div", { className: "mcp-form" },
7482
+ properties.length === 0 ? h("p", { className: "mcp-note", style: { gridColumn: "1/-1" } }, "Сервер не запросил полей — можно просто подтвердить.") : null,
7483
+ properties.map(([key, property], index) => {
7484
+ const id = `mcp-elicit-field-${index}`;
7485
+ if (property?.type === "boolean") {
7486
+ return h("label", { className: "mcp-check wide", key }, h("input", {
7487
+ type: "checkbox",
7488
+ checked: values[key] === true,
7489
+ onChange: (event) => setValues((currentValues) => ({ ...currentValues, [key]: event.target.checked })),
7490
+ }), h("span", null, property.title || key, required.includes(key) ? " *" : ""));
7491
+ }
7492
+ if (Array.isArray(property?.enum)) {
7493
+ return h("div", { className: "mcp-field", key },
7494
+ h("label", { htmlFor: id }, property.title || key, required.includes(key) ? " *" : ""),
7495
+ h("select", {
7496
+ id,
7497
+ value: values[key] ?? "",
7498
+ onChange: (event) => setValues((currentValues) => ({ ...currentValues, [key]: event.target.value })),
7499
+ }, property.enum.map((option) => h("option", { key: String(option), value: String(option) }, String(option)))),
7500
+ );
7501
+ }
7502
+ if (property?.type === "number" || property?.type === "integer") {
7503
+ return h("div", { className: "mcp-field", key },
7504
+ h("label", { htmlFor: id }, property.title || key, required.includes(key) ? " *" : ""),
7505
+ h("input", {
7506
+ id,
7507
+ type: "number",
7508
+ value: values[key] ?? "",
7509
+ min: property.minimum,
7510
+ max: property.maximum,
7511
+ onChange: (event) => setValues((currentValues) => ({ ...currentValues, [key]: event.target.value === "" ? "" : Number(event.target.value) })),
7512
+ }),
7513
+ );
7514
+ }
7515
+ if (property?.type === "string") {
7516
+ return h("div", { className: `mcp-field${String(property.description || "").length > 40 ? " wide" : ""}`, key },
7517
+ h("label", { htmlFor: id }, property.title || key, required.includes(key) ? " *" : ""),
7518
+ h("input", {
7519
+ id,
7520
+ value: values[key] ?? "",
7521
+ placeholder: property.description || "",
7522
+ onChange: (event) => setValues((currentValues) => ({ ...currentValues, [key]: event.target.value })),
7523
+ }),
7524
+ );
7525
+ }
7526
+ return h("div", { className: "mcp-error wide", key }, `Поле «${key}» имеет неподдерживаемый тип.`);
7527
+ }),
7528
+ h("div", { className: "mcp-form-actions", style: { gridColumn: "1/-1" } },
7529
+ h("button", { className: "mcp-btn ghost", type: "button", disabled: busy, onClick: () => respond("decline") }, "Отклонить"),
7530
+ h("button", { className: "mcp-btn ghost", type: "button", disabled: busy, onClick: () => respond("cancel") }, "Отмена"),
7531
+ h("button", { className: "mcp-btn primary", type: "button", disabled: busy, onClick: () => respond("accept") }, busy ? "Отправляем…" : "Подтвердить"),
7532
+ ),
7533
+ ),
7534
+ ),
7535
+ );
7536
+ }
7537
+
7401
7538
  function apply(ctx) {
7402
7539
  window.__DSH_MCP_CTX__ = ctx;
7403
7540
  ctx.effect(() => {
@@ -7411,7 +7548,13 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
7411
7548
  name: "settings.section",
7412
7549
  id: "mcp-manager",
7413
7550
  order: 35,
7414
- label: () => "MCP", }, McpSection)), "mcp-manager: settings");
7551
+ label: () => "MCP",
7552
+ }, McpSection)), "mcp-manager: settings");
7553
+ ctx.effect(() => ctx.slots.inject("shell.overlay", () => ctx.slots.register({
7554
+ name: "shell.overlay",
7555
+ id: "mcp-elicitation",
7556
+ order: 700,
7557
+ }, ElicitationHost)), "mcp-manager: elicitation overlay");
7415
7558
  }
7416
7559
 
7417
7560
  exports.apply = apply;
@@ -7596,6 +7739,13 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
7596
7739
  h("pre", { className: "ag-code" }, "---\nname: reviewer\ndescription: Ревью диффа\nmodel: deepseek-flash\ntools: read, grep\npermission: read-only\n---\n\nТы ревьюер. Верни только findings."),
7597
7740
  ) : null,
7598
7741
  agents.length > 0 ? h("div", { className: "ag-grid" }, agents.map((agent) => h(AgentCard, { key: agent.name, agent }))) : null,
7742
+ h("div", { className: "ag-section" },
7743
+ h("h3", null, "Параллельная команда"),
7744
+ h("p", { className: "ag-hint" }, "`project_agent action=team names=[reviewer,researcher] task=...` запускает 2–6 read-only ролей на одной задаче. Каждая получает свой контекст; результаты — в «Фоновых запусках»."),
7745
+ agents.filter((agent) => agent.permission === "read-only").length > 0
7746
+ ? h("div", { className: "ag-tools" }, agents.filter((agent) => agent.permission === "read-only").map((agent) => h("span", { key: agent.name, className: "ag-tool" }, agent.name)))
7747
+ : h("div", { className: "ag-mini-empty" }, "Нужна хотя бы одна read-only роль: team не запускает пишущих агентов в общем cwd."),
7748
+ ),
7599
7749
  h("div", { className: "ag-section" },
7600
7750
  h("h3", null, "Worktrees"),
7601
7751
  h("p", { className: "ag-hint" }, "Изолированные рабочие копии: `project_worktree create` или `project_agent` с `worktree=auto`."),
@@ -7875,7 +8025,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
7875
8025
  if (__kitErrors.length <= 5) console.error("[dsh-desktop-kit] registration failed:", label, message);
7876
8026
  };
7877
8027
  try {
7878
- window.__DSH_DESKTOP_KIT__ = { version: "2.10.0", parts: __partNames, errors: __kitErrors, ready: false };
8028
+ window.__DSH_DESKTOP_KIT__ = { version: "2.12.0", parts: __partNames, errors: __kitErrors, ready: false };
7879
8029
  } catch {}
7880
8030
  const __inject = [];
7881
8031
  for (const __part of __parts) {
@@ -0,0 +1,29 @@
1
+ # DSH Desktop Kit 2.11.0 — тест
2
+
3
+ Дата: 2026-11-12.
4
+
5
+ ## MCP elicitation
6
+
7
+ - Per-server `elicitation: true` (по умолчанию false).
8
+ - `elicitation/create` → global `shell.overlay` форма.
9
+ - Accept/Decline/Cancel; accept валидируется по схеме.
10
+ - Поддержаны string, number/integer, boolean, enum.
11
+ - Required, minimum, maximum, unknown field проверяются.
12
+ - Лимиты: message/value 4000, 5 pending, timeout 5 минут.
13
+ - Очередь пересоздаётся после restart manager.
14
+
15
+ ## UI
16
+
17
+ - Глобальный overlay поверх всех колонок, pointer-events auto.
18
+ - Счётчик очереди, ошибки, адаптив 390/768/1440.
19
+ - Скриншоты/аудит: overflow 0, console 0, markup 0.
20
+
21
+ ## Тесты
22
+
23
+ - `tools/mcp-elicitation-tests.mjs` — OK.
24
+ - `npm test` — exit 0.
25
+ - `build:client` / `check:client` — OK.
26
+
27
+ ## Ограничение
28
+
29
+ Плоская схема; вложенные object/array не поддержаны. Только stdio transport.
@@ -0,0 +1,26 @@
1
+ # DSH Desktop Kit 2.12.0 — тест
2
+
3
+ Дата: 2026-11-12.
4
+
5
+ ## Team
6
+
7
+ - `project_agent action=team names=[...] task=...`.
8
+ - 2–6 уникальных read-only агентов.
9
+ - Каждый — отдельный background run; результаты в «Фоновых запусках».
10
+ - Пишущие роли, дубликаты и неверный размер отклоняются.
11
+ - Общий cwd безопасен, потому что write запрещён политикой роли.
12
+
13
+ ## UI
14
+
15
+ - Секция «Параллельная команда» в Агентах.
16
+ - 390/768/1440: overflow 0, console 0, markup 0.
17
+
18
+ ## Тесты
19
+
20
+ - `tools/team-agents-tests.mjs` — OK.
21
+ - `npm test` — exit 0.
22
+ - `build:client` / `check:client` — OK.
23
+
24
+ ## Ограничение
25
+
26
+ Это параллельный анализ, не обмен сообщениями между агентами.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-desktop-kit",
3
- "version": "2.10.0",
3
+ "version": "2.12.0",
4
4
  "description": "DeepSeek Harness desktop kit 2.7: 16 plugins and 30 skills — self-applying skills, token lab, Skills Studio, project memory, GitHub and USB memory transfer, guardrails, repo map, checkpoints, plan mode, browser QA, GitHub review, Claude Code-like hooks/agents/commands, Russian UI, peak guard, chat move and profile transfer.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -74,7 +74,7 @@
74
74
  "build:client": "node tools/build-client.mjs",
75
75
  "build:skills": "node tools/build-skill-manifest.mjs",
76
76
  "check:client": "node tools/check-client.mjs client.js",
77
- "test": "node tools/smoke-tests.mjs && node tools/memory-tests.mjs && node tools/skills-sync-tests.mjs && node tools/kit-upgrade-tests.mjs && node plugins/dsh-profile-transfer/test/transfer.test.mjs && node --test plugins/dsh-memory-bridge/test/bridge.test.mjs plugins/dsh-memory-bridge/test/github.test.mjs plugins/dsh-memory-bridge/test/merge.test.mjs plugins/dsh-memory-bridge/test/user-specific.test.mjs && node tools/repo-map-tests.mjs && node tools/checkpoints-tests.mjs && node tools/plan-mode-tests.mjs && node tools/browser-qa-tests.mjs && node tools/ui-gate-tests.mjs && node tools/agent-extensions-tests.mjs && node tools/mcp-manager-tests.mjs && node tools/github-review-tests.mjs && node tools/instructions-tests.mjs && node tools/mcp-sampling-tests.mjs && node tools/mcp-oauth-tests.mjs && node tools/worktrees-tests.mjs && node tools/background-agents-tests.mjs && node tools/permissions-ui-tests.mjs && node plugins/dsh-guardrails/tools/guardrails-tests.mjs",
77
+ "test": "node tools/smoke-tests.mjs && node tools/memory-tests.mjs && node tools/skills-sync-tests.mjs && node tools/kit-upgrade-tests.mjs && node plugins/dsh-profile-transfer/test/transfer.test.mjs && node --test plugins/dsh-memory-bridge/test/bridge.test.mjs plugins/dsh-memory-bridge/test/github.test.mjs plugins/dsh-memory-bridge/test/merge.test.mjs plugins/dsh-memory-bridge/test/user-specific.test.mjs && node tools/repo-map-tests.mjs && node tools/checkpoints-tests.mjs && node tools/plan-mode-tests.mjs && node tools/browser-qa-tests.mjs && node tools/ui-gate-tests.mjs && node tools/agent-extensions-tests.mjs && node tools/mcp-manager-tests.mjs && node tools/github-review-tests.mjs && node tools/instructions-tests.mjs && node tools/mcp-elicitation-tests.mjs && node tools/mcp-sampling-tests.mjs && node tools/mcp-oauth-tests.mjs && node tools/worktrees-tests.mjs && node tools/team-agents-tests.mjs && node tools/background-agents-tests.mjs && node tools/permissions-ui-tests.mjs && node plugins/dsh-guardrails/tools/guardrails-tests.mjs",
78
78
  "skills:cost": "node tools/skill-cost.mjs",
79
79
  "skills:check": "node tools/skill-cost.mjs --check",
80
80
  "release": "node tools/release.mjs"
@@ -183,6 +183,13 @@ window.__ModuleLoader__.load({
183
183
  h("pre", { className: "ag-code" }, "---\nname: reviewer\ndescription: Ревью диффа\nmodel: deepseek-flash\ntools: read, grep\npermission: read-only\n---\n\nТы ревьюер. Верни только findings."),
184
184
  ) : null,
185
185
  agents.length > 0 ? h("div", { className: "ag-grid" }, agents.map((agent) => h(AgentCard, { key: agent.name, agent }))) : null,
186
+ h("div", { className: "ag-section" },
187
+ h("h3", null, "Параллельная команда"),
188
+ h("p", { className: "ag-hint" }, "`project_agent action=team names=[reviewer,researcher] task=...` запускает 2–6 read-only ролей на одной задаче. Каждая получает свой контекст; результаты — в «Фоновых запусках»."),
189
+ agents.filter((agent) => agent.permission === "read-only").length > 0
190
+ ? h("div", { className: "ag-tools" }, agents.filter((agent) => agent.permission === "read-only").map((agent) => h("span", { key: agent.name, className: "ag-tool" }, agent.name)))
191
+ : h("div", { className: "ag-mini-empty" }, "Нужна хотя бы одна read-only роль: team не запускает пишущих агентов в общем cwd."),
192
+ ),
186
193
  h("div", { className: "ag-section" },
187
194
  h("h3", null, "Worktrees"),
188
195
  h("p", { className: "ag-hint" }, "Изолированные рабочие копии: `project_worktree create` или `project_agent` с `worktree=auto`."),
@@ -11,7 +11,7 @@ import fs from "node:fs";
11
11
  import path from "node:path";
12
12
  import { registerProjectHooks } from "./lib/hooks.js";
13
13
  import { createCheckpoint } from "./lib/checkpoints.js";
14
- import { runProjectAgent } from "./lib/agents.js";
14
+ import { runProjectAgent, runProjectTeam } from "./lib/agents.js";
15
15
  import { cancelRun, listRuns } from "./lib/agents.js";
16
16
  import { createWorktree, removeWorktree, worktreeSummary } from "./lib/worktrees.js";
17
17
  import { registerChildPolicyHook } from "./lib/policy.js";
@@ -40,13 +40,14 @@ function toolDefinition(ctx) {
40
40
  return {
41
41
  name: TOOL,
42
42
  description:
43
- "Run or list project-local custom agents from `.dsh/agents/*.md`. `run` starts a child agent; `background=true` returns immediately with a run id; `worktree=true|slug` runs the child in an isolated git worktree. `status` lists runs, `cancel` stops one. Use for repeated specialised work (reviewer, researcher, SEO, migration).",
43
+ "Run or list project-local custom agents from `.dsh/agents/*.md`. `run` starts a child agent; `background=true` returns immediately with a run id; `worktree=true|slug` runs the child in an isolated git worktree. `team` starts 2–6 read-only agents on the same task in parallel (analysis, not messaging). `status` lists runs, `cancel` stops one. Use for repeated specialised work (reviewer, researcher, SEO, migration).",
44
44
  parameters: {
45
45
  type: "object",
46
46
  additionalProperties: false,
47
47
  properties: {
48
- action: { type: "string", enum: ["list", "run", "status", "cancel"], description: "list agents, run one, list background runs, or cancel a run" },
48
+ action: { type: "string", enum: ["list", "run", "team", "status", "cancel"], description: "list agents, run one, start a read-only team, list background runs, or cancel a run" },
49
49
  name: { type: "string", description: "Agent name from `.dsh/agents/<name>.md`" },
50
+ names: { type: "array", items: { type: "string" }, maxItems: 6, description: "For team: 2–6 read-only agent names" },
50
51
  task: { type: "string", description: "Task/prompt for the child agent (required for run)" },
51
52
  background: { type: "boolean", description: "Return immediately with a durable run id instead of waiting for the child" },
52
53
  worktree: { type: "string", description: "Run in a git worktree: `auto` picks a name, or pass a lowercase slug" },
@@ -80,10 +81,25 @@ function toolDefinition(ctx) {
80
81
  return { ok: false, text: `project_agent cancel ${id}: ${error instanceof Error ? error.message : String(error)}` };
81
82
  }
82
83
  }
83
- if (input?.action !== "run") return { ok: false, text: "project_agent: action must be list, run, status or cancel" };
84
- const name = String(input?.name ?? "").trim();
84
+ if (input?.action !== "run" && input?.action !== "team") return { ok: false, text: "project_agent: action must be list, run, team, status or cancel" };
85
85
  const task = String(input?.task ?? "").trim();
86
- if (!name || !task) return { ok: false, text: "project_agent: name and task are required for run" };
86
+ if (!task) return { ok: false, text: `project_agent: task is required for ${input.action}` };
87
+ if (input.action === "team") {
88
+ const names = Array.isArray(input?.names) ? [...new Set(input.names.map((item) => String(item).trim()).filter(Boolean))] : [];
89
+ if (names.length < 2 || names.length > 6) return { ok: false, text: "project_agent team: names must contain 2–6 unique agents" };
90
+ const definitions = [];
91
+ for (const name of names) {
92
+ const definition = agents.find((agent) => agent.name === name);
93
+ if (!definition) return { ok: false, text: `project_agent team: unknown agent "${name}"` };
94
+ if (definition.permission !== "read-only") return { ok: false, text: `project_agent team: "${name}" is not read-only; team runs share the project cwd` };
95
+ definitions.push(definition);
96
+ }
97
+ const results = await runProjectTeam(ctx, exec, definitions, task);
98
+ const text = results.map((result) => `${result.ok ? "✓" : "✗"} ${result.name}${result.id ? ` · ${result.id}` : ""}${result.error ? ` — ${result.error}` : ""}`).join("\n");
99
+ return { ok: results.every((result) => result.ok), text: `project_agent team:\n${text}`, runs: results };
100
+ }
101
+ const name = String(input?.name ?? "").trim();
102
+ if (!name) return { ok: false, text: "project_agent: name is required for run" };
87
103
  const definition = agents.find((agent) => agent.name === name);
88
104
  if (!definition) return { ok: false, text: `project_agent: unknown agent "${name}"` };
89
105
  let worktree = null;
@@ -29,8 +29,7 @@ function remember(record, activation, projectRoot, signal, onAbort) {
29
29
  background.set(record.id, { record, activation, projectRoot, signal, onAbort });
30
30
  }
31
31
 
32
- export async function runProjectAgent(ctx, exec, definition, task, options = {}) {
33
- const subagents = ctx.get("subagents");
32
+ export async function runProjectAgent(ctx, exec, definition, task, options = {}) { const subagents = ctx.get("subagents");
34
33
  if (!subagents || typeof subagents.startActivation !== "function") {
35
34
  throw new Error("subagents service is unavailable");
36
35
  }
@@ -160,8 +159,25 @@ export async function runProjectAgent(ctx, exec, definition, task, options = {})
160
159
  }
161
160
  }
162
161
 
163
- export function listRuns(projectRoot) {
164
- const persisted = loadRuns(projectRoot);
162
+ /**
163
+ * Start a read-only team. Each member gets the same task and its own child
164
+ * context; no member can write, so sharing the project cwd is safe. This is
165
+ * parallel analysis, not inter-agent messaging.
166
+ */
167
+ export async function runProjectTeam(ctx, exec, definitions, task, options = {}) {
168
+ const runs = [];
169
+ for (const definition of definitions) {
170
+ try {
171
+ const result = await runProjectAgent(ctx, exec, definition, task, { ...options, background: true });
172
+ runs.push({ name: definition.name, ok: !result.error, id: result.id, text: result.text, error: result.error ?? "" });
173
+ } catch (error) {
174
+ runs.push({ name: definition.name, ok: false, id: null, text: "", error: error instanceof Error ? error.message : String(error) });
175
+ }
176
+ }
177
+ return runs;
178
+ }
179
+
180
+ export function listRuns(projectRoot) { const persisted = loadRuns(projectRoot);
165
181
  return persisted.map((run) => {
166
182
  const live = background.get(run.id);
167
183
  return {
@@ -1,6 +1,6 @@
1
1
  # dsh-mcp-manager
2
2
 
3
- MCP-серверы для DSH без SDK-зависимости: stdio и streamable HTTP, tools, resources, prompts, **OAuth 2.1**, **sampling**, trust-гейт и премиальный экран в Settings.
3
+ MCP-серверы для DSH без SDK-зависимости: stdio и streamable HTTP, tools, resources, prompts, **OAuth 2.1**, **sampling**, **elicitation**, trust-гейт и премиальный экран в Settings.
4
4
 
5
5
  ![MCP Settings](screenshots/settings-1440.png)
6
6
 
@@ -15,6 +15,7 @@ MCP-серверы для DSH без SDK-зависимости: stdio и stream
15
15
  - «Prompts» — промпты сервера: аргументы, запуск и копирование результата;
16
16
  - **«Войти» / «OAuth»** у HTTP-сервера — authorization code + PKCE в браузере; токен хранится в `~/.dsh/mcp.oauth.json` (0600) и не попадает в `mcp.json`;
17
17
  - **Sampling** — отдельный opt-in: сервер может попросить модель, но каждый запрос идёт через approval-карточку DSH;
18
+ - **Elicitation** — отдельный opt-in: сервер может запросить структурированные данные через глобальную форму DSH с Accept/Decline/Cancel;
18
19
  - «Добавить сервер» — пресеты GitHub / PostgreSQL / Filesystem или ручная форма;
19
20
  - токен сохраняется в `~/.dsh/mcp.secrets.json` (0600), а в `mcp.json` остаётся только `${secret:…}`;
20
21
  - новые tools появляются в **новом чате** после подключения.
@@ -62,6 +63,16 @@ Sampling выключен по умолчанию. Включите его га
62
63
 
63
64
  Это безопасный first version: prompt preview показывается, но не редактируется в approval-карточке.
64
65
 
66
+ ## Elicitation
67
+
68
+ Elicitation тоже выключен по умолчанию (`"elicitation": true`). Запрос сервера появляется **глобальной формой** поверх DSH, а не только внутри Settings:
69
+
70
+ - поддержаны поля `string`, `number`/`integer`, `boolean`, `enum`;
71
+ - обязательные поля и границы (`minimum`/`maximum`) проверяются на хосте;
72
+ - неизвестные поля отклоняются, сообщение и значения ограничены по длине;
73
+ - `accept` отправляет только валидированный `content`, `decline`/`cancel` закрывают запрос;
74
+ - пять одновременных запросов — предел, таймаут 5 минут, при перезапуске менеджера очередь очищается.
75
+
65
76
  ## Prompts
66
77
 
67
78
  Промпт — это готовый запрос с аргументами, который отдаёт сам MCP-сервер. Нажмите **Prompts**, заполните поля и получите текст. Результат можно скопировать одной кнопкой.
@@ -124,6 +135,7 @@ Sampling выключен по умолчанию. Включите его га
124
135
  ## Ограничения
125
136
 
126
137
  - Sampling: только opt-in, без tools; approval-карточка показывает preview, но не редактирует prompt.
138
+ - Elicitation: только opt-in, плоская схема; вложенные object/array не поддержаны.
127
139
  - OAuth поддерживает dynamic registration; серверы только со статическим client_id пока не подключаются автоматически.
128
140
  - HTTP-транспорт поддерживает JSON и простой SSE-ответ; интерактивный SSE-стрим с серверными запросами не реализован.
129
141
  - MCP-сервер — произвольный процесс. Доверяйте только своим конфигам.
@@ -71,6 +71,8 @@ window.__ModuleLoader__.load({
71
71
  .mcp-prompt-card b{display:block;font-size:13px}
72
72
  .mcp-prompt-card span{display:block;color:var(--mcp-muted);font-size:12px;line-height:1.4;margin-top:3px}
73
73
  .mcp-prompt-output{margin:0;padding:12px;border:1px solid var(--mcp-line);border-radius:10px;background:var(--mcp-soft);color:var(--mcp-text);font:12px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre-wrap;overflow-wrap:anywhere;max-height:38vh;overflow:auto}
74
+ .mcp-elicit{--mcp-line:var(--dsw-alias-border-l1,rgba(20,40,36,.13));--mcp-soft:var(--dsw-alias-bg-layer-1,#f4f7f5);--mcp-panel:var(--dsw-alias-bg-layer-2,#fff);--mcp-text:var(--dsw-alias-label-primary,#17231f);--mcp-muted:var(--dsw-alias-label-secondary,#61706b);--mcp-accent:var(--dsw-alias-brand-primary,#0f766e);--mcp-accent-soft:rgba(15,118,110,.07);pointer-events:auto;z-index:90}
75
+ .mcp-elicit-message{margin:0;color:var(--mcp-text);font-size:13px;line-height:1.5;max-height:22vh;overflow:auto;overflow-wrap:anywhere}
74
76
  .mcp-empty{border:1px dashed var(--mcp-line);border-radius:18px;padding:26px;background:linear-gradient(160deg,var(--mcp-soft),transparent 75%);display:flex;flex-direction:column;gap:12px;align-items:flex-start}
75
77
  .mcp-empty h3{margin:0;font-size:18px;letter-spacing:-.015em}
76
78
  .mcp-empty p{margin:0;color:var(--mcp-muted);font-size:13px;line-height:1.5;max-width:60ch}
@@ -280,10 +282,16 @@ window.__ModuleLoader__.load({
280
282
  h("input", { type: "checkbox", checked: form.trusted, onChange: (event) => set({ trusted: event.target.checked }) }),
281
283
  h("span", null, "Я доверяю этому серверу. Он сможет выполнять команды и читать данные, к которым у него есть доступ."),
282
284
  ),
283
- h("label", { className: "mcp-check wide" },
284
- h("input", { type: "checkbox", checked: form.sampling === true, onChange: (event) => set({ sampling: event.target.checked }) }),
285
- h("span", null, "Разрешить sampling: сервер сможет попросить модель сгенерировать текст. Каждый запрос показывает approval-карточку, tools запрещены, лимит 1024 токена."),
286
- ),
285
+ form.transport === "stdio" ? h(React.Fragment, null,
286
+ h("label", { className: "mcp-check wide" },
287
+ h("input", { type: "checkbox", checked: form.sampling === true, onChange: (event) => set({ sampling: event.target.checked }) }),
288
+ h("span", null, "Разрешить sampling: сервер сможет попросить модель сгенерировать текст. Каждый запрос показывает approval-карточку, tools запрещены, лимит 1024 токена."),
289
+ ),
290
+ h("label", { className: "mcp-check wide" },
291
+ h("input", { type: "checkbox", checked: form.elicitation === true, onChange: (event) => set({ elicitation: event.target.checked }) }),
292
+ h("span", null, "Разрешить elicitation: сервер сможет запросить структурированные данные через форму DSH. Каждый запрос можно принять или отклонить."),
293
+ ),
294
+ ) : null,
287
295
  ),
288
296
  h("p", { className: "mcp-note" }, "Секрет сохраняется в ~/.dsh/mcp.secrets.json с правами 0600 и не попадает в mcp.json или лог."),
289
297
  h("div", { className: "mcp-form-actions" },
@@ -448,8 +456,9 @@ window.__ModuleLoader__.load({
448
456
  token: "",
449
457
  trusted: preset.trusted === true,
450
458
  sampling: false,
459
+ elicitation: false,
451
460
  });
452
- const openManual = () => setForm({ edit: false, id: "", transport: "stdio", command: "npx", args: "-y\n", url: "", tokenEnv: "MCP_TOKEN", tokenHeader: "Authorization", tokenLabel: "Токен", tokenPlaceholder: "", token: "", trusted: false, sampling: false });
461
+ const openManual = () => setForm({ edit: false, id: "", transport: "stdio", command: "npx", args: "-y\n", url: "", tokenEnv: "MCP_TOKEN", tokenHeader: "Authorization", tokenLabel: "Токен", tokenPlaceholder: "", token: "", trusted: false, sampling: false, elicitation: false });
453
462
 
454
463
  const servers = data?.servers ?? [];
455
464
  const connected = servers.filter((server) => server.connected).length;
@@ -533,6 +542,134 @@ window.__ModuleLoader__.load({
533
542
  );
534
543
  }
535
544
 
545
+ function ElicitationHost() {
546
+ const [items, setItems] = useState([]);
547
+ const [values, setValues] = useState({});
548
+ const [busy, setBusy] = useState(false);
549
+ const [error, setError] = useState("");
550
+ const current = items[0];
551
+
552
+ useEffect(() => {
553
+ let stopped = false;
554
+ const refresh = async () => {
555
+ if (document.hidden) return;
556
+ try {
557
+ const result = await call(window.__DSH_MCP_CTX__, "elicitations");
558
+ if (!stopped) setItems(Array.isArray(result.items) ? result.items : []);
559
+ } catch { /* host may be restarting */ }
560
+ };
561
+ void refresh();
562
+ const timer = setInterval(refresh, 2500);
563
+ const onVisible = () => { if (!document.hidden) void refresh(); };
564
+ document.addEventListener("visibilitychange", onVisible);
565
+ return () => {
566
+ stopped = true;
567
+ clearInterval(timer);
568
+ document.removeEventListener("visibilitychange", onVisible);
569
+ };
570
+ }, []);
571
+
572
+ useEffect(() => {
573
+ if (!current) { setValues({}); return; }
574
+ const next = {};
575
+ for (const [key, property] of Object.entries(current.schema?.properties ?? {})) {
576
+ if (property?.type === "boolean") next[key] = false;
577
+ else if (property?.enum?.length) next[key] = property.enum[0];
578
+ else next[key] = "";
579
+ }
580
+ setValues(next);
581
+ setError("");
582
+ }, [current?.id]);
583
+
584
+ if (!current) return null;
585
+ const properties = Object.entries(current.schema?.properties ?? {});
586
+ const required = Array.isArray(current.schema?.required) ? current.schema.required : [];
587
+
588
+ const respond = async (action) => {
589
+ setBusy(true);
590
+ setError("");
591
+ try {
592
+ await call(window.__DSH_MCP_CTX__, "elicitation", {
593
+ id: current.id,
594
+ action,
595
+ ...(action === "accept" ? { content: values } : {}),
596
+ });
597
+ setItems((list) => list.slice(1));
598
+ } catch (cause) {
599
+ setError(cause instanceof Error ? cause.message : String(cause));
600
+ } finally {
601
+ setBusy(false);
602
+ }
603
+ };
604
+
605
+ return h("div", { className: "mcp-overlay mcp-elicit" },
606
+ h("div", { className: "mcp-modal", role: "dialog", "aria-modal": "true", "aria-labelledby": "mcp-elicit-title" },
607
+ h("div", { className: "mcp-modal-head" },
608
+ h("div", null,
609
+ h("h2", { id: "mcp-elicit-title" }, "Запрос данных"),
610
+ h("p", null, `Сервер «${current.serverId}» просит заполнить форму.`),
611
+ ),
612
+ items.length > 1 ? h("span", { className: "mcp-badge" }, `${items.length} в очереди`) : null,
613
+ ),
614
+ h("p", { className: "mcp-elicit-message" }, current.message),
615
+ error ? h("div", { className: "mcp-error", role: "alert" }, error) : null,
616
+ h("div", { className: "mcp-form" },
617
+ properties.length === 0 ? h("p", { className: "mcp-note", style: { gridColumn: "1/-1" } }, "Сервер не запросил полей — можно просто подтвердить.") : null,
618
+ properties.map(([key, property], index) => {
619
+ const id = `mcp-elicit-field-${index}`;
620
+ if (property?.type === "boolean") {
621
+ return h("label", { className: "mcp-check wide", key }, h("input", {
622
+ type: "checkbox",
623
+ checked: values[key] === true,
624
+ onChange: (event) => setValues((currentValues) => ({ ...currentValues, [key]: event.target.checked })),
625
+ }), h("span", null, property.title || key, required.includes(key) ? " *" : ""));
626
+ }
627
+ if (Array.isArray(property?.enum)) {
628
+ return h("div", { className: "mcp-field", key },
629
+ h("label", { htmlFor: id }, property.title || key, required.includes(key) ? " *" : ""),
630
+ h("select", {
631
+ id,
632
+ value: values[key] ?? "",
633
+ onChange: (event) => setValues((currentValues) => ({ ...currentValues, [key]: event.target.value })),
634
+ }, property.enum.map((option) => h("option", { key: String(option), value: String(option) }, String(option)))),
635
+ );
636
+ }
637
+ if (property?.type === "number" || property?.type === "integer") {
638
+ return h("div", { className: "mcp-field", key },
639
+ h("label", { htmlFor: id }, property.title || key, required.includes(key) ? " *" : ""),
640
+ h("input", {
641
+ id,
642
+ type: "number",
643
+ value: values[key] ?? "",
644
+ min: property.minimum,
645
+ max: property.maximum,
646
+ onChange: (event) => setValues((currentValues) => ({ ...currentValues, [key]: event.target.value === "" ? "" : Number(event.target.value) })),
647
+ }),
648
+ );
649
+ }
650
+ if (property?.type === "string") {
651
+ return h("div", { className: `mcp-field${String(property.description || "").length > 40 ? " wide" : ""}`, key },
652
+ h("label", { htmlFor: id }, property.title || key, required.includes(key) ? " *" : ""),
653
+ h("input", {
654
+ id,
655
+ value: values[key] ?? "",
656
+ placeholder: property.description || "",
657
+ onChange: (event) => setValues((currentValues) => ({ ...currentValues, [key]: event.target.value })),
658
+ }),
659
+ );
660
+ }
661
+ return h("div", { className: "mcp-error wide", key }, `Поле «${key}» имеет неподдерживаемый тип.`);
662
+ }),
663
+ h("div", { className: "mcp-form-actions", style: { gridColumn: "1/-1" } },
664
+ h("button", { className: "mcp-btn ghost", type: "button", disabled: busy, onClick: () => respond("decline") }, "Отклонить"),
665
+ h("button", { className: "mcp-btn ghost", type: "button", disabled: busy, onClick: () => respond("cancel") }, "Отмена"),
666
+ h("button", { className: "mcp-btn primary", type: "button", disabled: busy, onClick: () => respond("accept") }, busy ? "Отправляем…" : "Подтвердить"),
667
+ ),
668
+ ),
669
+ ),
670
+ );
671
+ }
672
+
536
673
  function apply(ctx) {
537
674
  window.__DSH_MCP_CTX__ = ctx;
538
675
  ctx.effect(() => {
@@ -546,7 +683,13 @@ window.__ModuleLoader__.load({
546
683
  name: "settings.section",
547
684
  id: "mcp-manager",
548
685
  order: 35,
549
- label: () => "MCP", }, McpSection)), "mcp-manager: settings");
686
+ label: () => "MCP",
687
+ }, McpSection)), "mcp-manager: settings");
688
+ ctx.effect(() => ctx.slots.inject("shell.overlay", () => ctx.slots.register({
689
+ name: "shell.overlay",
690
+ id: "mcp-elicitation",
691
+ order: 700,
692
+ }, ElicitationHost)), "mcp-manager: elicitation overlay");
550
693
  }
551
694
 
552
695
  exports.apply = apply;
@@ -53,6 +53,7 @@ function publicServer(server) { return {
53
53
  enabled: server.enabled,
54
54
  trusted: server.trusted,
55
55
  sampling: server.sampling === true,
56
+ elicitation: server.elicitation === true,
56
57
  };
57
58
  }
58
59
  function presets() {
@@ -194,6 +195,12 @@ export function registerApi(ctx, manager) {
194
195
  await restartGlobal(manager);
195
196
  return { ...oauthStatus(id), pending: false, error: "" };
196
197
  });
198
+ operation("elicitations", async () => ({ items: manager.elicitations.list() }));
199
+ operation("elicitation", async (payload) => {
200
+ const id = String(payload.id ?? "");
201
+ const action = String(payload.action ?? "");
202
+ return manager.elicitations.respond(id, action, payload.content);
203
+ });
197
204
  operation("presets", async () => ({ presets: presets() }));
198
205
  operation("trust-project", async () => {
199
206
  const config = loadConfig({ cwd: process.cwd() });
@@ -210,7 +217,7 @@ export function registerApi(ctx, manager) {
210
217
  throw new Error(`для ${payload.tokenEnv} нужен токен`);
211
218
  }
212
219
  if (payload.tokenHeader && payload.token && !payload.tokenHeader) throw new Error("tokenHeader обязателен для HTTP-токена");
213
- const raw = { trusted, enabled: payload.enabled !== false, sampling: payload.sampling === true };
220
+ const raw = { trusted, enabled: payload.enabled !== false, sampling: payload.sampling === true, elicitation: payload.elicitation === true };
214
221
  if (transport === "http") {
215
222
  raw.url = String(payload.url).trim();
216
223
  const headers = {};
@@ -196,7 +196,11 @@ export class McpClient {
196
196
  {
197
197
  protocolVersion: PROTOCOL_VERSION,
198
198
  capabilities: canHandle
199
- ? { roots: { listChanged: false }, ...(this.config.sampling === true ? { sampling: {} } : {}) }
199
+ ? {
200
+ roots: { listChanged: false },
201
+ ...(this.config.sampling === true ? { sampling: {} } : {}),
202
+ ...(this.config.elicitation === true ? { elicitation: {} } : {}),
203
+ }
200
204
  : {},
201
205
  clientInfo: { name: "dsh-mcp-manager", version: "1.0.0" },
202
206
  },
@@ -156,6 +156,7 @@ function normalizeServer(id, raw, env, secrets) {
156
156
  timeoutMs: Math.max(1_000, Math.min(120_000, Number(raw.timeoutMs) || 30_000)),
157
157
  trusted: raw.trusted === true,
158
158
  sampling: raw.sampling === true,
159
+ elicitation: raw.elicitation === true,
159
160
  enabled: raw.enabled !== false,
160
161
  };
161
162
  }
@@ -0,0 +1,111 @@
1
+ /**
2
+ * MCP elicitation queue.
3
+ *
4
+ * A server request waits here until the user accepts, declines or cancels it
5
+ * in the global DSH overlay. Accept validates the flat schema: strings,
6
+ * numbers/integers, booleans and enums, bounded message/values.
7
+ */
8
+ import crypto from "node:crypto";
9
+
10
+ const MAX_PENDING = 5;
11
+ const MAX_MESSAGE = 4_000;
12
+ const MAX_VALUE = 4_000;
13
+
14
+ function typeOf(property) {
15
+ return property?.type === "integer" ? "number" : property?.type;
16
+ }
17
+
18
+ function validateContent(schema, content) {
19
+ if (!content || typeof content !== "object" || Array.isArray(content)) throw new Error("elicitation: content must be an object");
20
+ const properties = schema?.properties && typeof schema.properties === "object" ? schema.properties : {};
21
+ const required = Array.isArray(schema?.required) ? schema.required : [];
22
+ for (const key of Object.keys(content)) {
23
+ if (!Object.hasOwn(properties, key)) throw new Error(`elicitation: unknown field "${key}"`);
24
+ }
25
+ for (const key of required) {
26
+ if (!Object.hasOwn(content, key) || content[key] === "" || content[key] === null || content[key] === undefined) {
27
+ throw new Error(`elicitation: "${key}" is required`);
28
+ }
29
+ }
30
+ for (const [key, value] of Object.entries(content)) {
31
+ const property = properties[key];
32
+ const type = typeOf(property);
33
+ if (type === "string") {
34
+ if (typeof value !== "string") throw new Error(`elicitation: "${key}" must be a string`);
35
+ if (Array.isArray(property.enum) && !property.enum.includes(value)) throw new Error(`elicitation: "${key}" is not an allowed value`);
36
+ if (value.length > MAX_VALUE) throw new Error(`elicitation: "${key}" is too long`);
37
+ } else if (type === "number") {
38
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new Error(`elicitation: "${key}" must be a number`);
39
+ if (property.minimum !== undefined && value < property.minimum) throw new Error(`elicitation: "${key}" is below minimum`);
40
+ if (property.maximum !== undefined && value > property.maximum) throw new Error(`elicitation: "${key}" is above maximum`);
41
+ } else if (type === "boolean") {
42
+ if (typeof value !== "boolean") throw new Error(`elicitation: "${key}" must be a boolean`);
43
+ } else {
44
+ throw new Error(`elicitation: unsupported field type for "${key}"`);
45
+ }
46
+ }
47
+ return content;
48
+ }
49
+
50
+ export class ElicitationQueue {
51
+ constructor({ timeoutMs = 5 * 60_000 } = {}) {
52
+ this.timeoutMs = timeoutMs;
53
+ this.pending = new Map();
54
+ this.closed = false;
55
+ }
56
+
57
+ create(server, params) {
58
+ if (this.closed) throw new Error("elicitation queue is closed");
59
+ if (this.pending.size >= MAX_PENDING) throw new Error("elicitation: too many pending requests");
60
+ const message = String(params?.message ?? "").trim();
61
+ if (!message) throw new Error("elicitation: message is required");
62
+ if (message.length > MAX_MESSAGE) throw new Error("elicitation: message is too long");
63
+ const schema = params?.requestedSchema && typeof params.requestedSchema === "object" ? params.requestedSchema : { type: "object", properties: {} };
64
+ const id = `elicit-${crypto.randomUUID()}`;
65
+ let resolve;
66
+ let reject;
67
+ const promise = new Promise((res, rej) => { resolve = res; reject = rej; });
68
+ const timer = setTimeout(() => {
69
+ this.pending.delete(id);
70
+ reject(new Error("elicitation: timed out"));
71
+ }, this.timeoutMs);
72
+ timer.unref?.();
73
+ this.pending.set(id, { id, serverId: server.id, message, schema, resolve, reject, timer, createdAt: new Date().toISOString() });
74
+ return promise;
75
+ }
76
+
77
+ list() {
78
+ return [...this.pending.values()].map((entry) => ({
79
+ id: entry.id,
80
+ serverId: entry.serverId,
81
+ message: entry.message,
82
+ schema: entry.schema,
83
+ createdAt: entry.createdAt,
84
+ }));
85
+ }
86
+
87
+ respond(id, action, content) {
88
+ const entry = this.pending.get(String(id ?? ""));
89
+ if (!entry) throw new Error("elicitation: request not found");
90
+ if (!["accept", "decline", "cancel"].includes(action)) throw new Error("elicitation: invalid action");
91
+ let payload;
92
+ if (action === "accept") {
93
+ payload = { action: "accept", content: validateContent(entry.schema, content) };
94
+ } else {
95
+ payload = { action };
96
+ }
97
+ clearTimeout(entry.timer);
98
+ this.pending.delete(entry.id);
99
+ entry.resolve(payload);
100
+ return payload;
101
+ }
102
+
103
+ cancelAll(reason = "manager closed") {
104
+ for (const entry of this.pending.values()) {
105
+ clearTimeout(entry.timer);
106
+ entry.reject(new Error(`elicitation: ${reason}`));
107
+ }
108
+ this.pending.clear();
109
+ this.closed = true;
110
+ }
111
+ }
@@ -4,6 +4,7 @@
4
4
  import { McpClient } from "./client.js";
5
5
  import { getAccessToken } from "./oauth.js";
6
6
  import { runSampling } from "./sampling.js";
7
+ import { ElicitationQueue } from "./elicitation.js";
7
8
  import path from "node:path";
8
9
  import { pathToFileURL } from "node:url";
9
10
 
@@ -31,10 +32,12 @@ export class McpManager {
31
32
  this.tools = new Map();
32
33
  this.disposers = [];
33
34
  this.closed = false;
35
+ this.elicitations = new ElicitationQueue();
34
36
  }
35
37
 
36
38
  reopen() {
37
39
  this.closed = false;
40
+ if (this.elicitations.closed) this.elicitations = new ElicitationQueue();
38
41
  }
39
42
 
40
43
  toolName(serverId, toolName) {
@@ -59,6 +62,14 @@ export class McpManager {
59
62
  if (message.method === "sampling/createMessage") {
60
63
  return runSampling(this.ctx, server, message.params ?? {});
61
64
  }
65
+ if (message.method === "elicitation/create") {
66
+ if (server.elicitation !== true) {
67
+ const error = new Error(`MCP ${server.id}: elicitation is disabled for this server`);
68
+ error.code = -32601;
69
+ throw error;
70
+ }
71
+ return this.elicitations.create(server, message.params ?? {});
72
+ }
62
73
  const error = new Error(`${message.method}: not supported by DSH; elicitation requires explicit approval`);
63
74
  error.code = -32601;
64
75
  throw error;
@@ -175,6 +186,7 @@ export class McpManager {
175
186
 
176
187
  async close() {
177
188
  this.closed = true;
189
+ this.elicitations.cancelAll();
178
190
  for (const dispose of this.disposers.splice(0)) {
179
191
  try { dispose(); } catch { /* best effort */ }
180
192
  }