dsh-desktop-kit 2.15.10 → 2.16.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,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.16.0 (2026-11-12)
4
+
5
+ - **`dsh-integrations`.** 17-й плагин: Marketplace, IDE bridge, sandbox audit.
6
+ - **Marketplace MVP.** Локальный каталог, SHA-256 `SKILL.md`, backup существующего навыка, установка только из локальной папки.
7
+ - **IDE bridge.** Localhost HTTP `/health` и `/context`, bearer-токен на запуск, запуск/остановка из Settings.
8
+ - **Sandbox audit.** Явно `enforcement:false`: политика DSH + kit guardrails, не OS-sandbox; документировано, что нужно для AppContainer/Job Objects.
9
+ - **UI.** Новый экран «Интеграции», скриншоты 1440/390, аудит без overflow.
10
+ - **Тесты.** `integrations-tests`: checksum, backup, mismatch, bridge auth/context.
11
+
12
+ ## 2.15.11 (2026-11-12)
13
+
14
+ - **Auto-swarm.** `project_agent action=auto` оценивает задачу (broad/security/architecture/audit/research, длина, несколько направлений) и сам запускает read-only рой или отказывается.
15
+ - **Research-aware.** Если задача требует внешних фактов, auto добавляет требование `web_search/web_fetch` + 2 источника с датами.
16
+ - **Конфиг.** `.dsh/swarm.json` → `{enabled, threshold}`.
17
+ - **Политика.** System prompt требует интернет-проверку для внешних фактов/версий/цен/референсов.
18
+ - **Тесты.** `swarm-tests`: narrow skip, broad swarm, RU-кейс, disabled.
19
+
3
20
  ## 2.15.10 (2026-11-12)
4
21
 
5
22
  - **Team presets.** `.dsh/teams/<id>.json` с `members` и `lead`; `project_agent action=team preset=review task=...`.
package/README.md CHANGED
@@ -2,41 +2,53 @@
2
2
 
3
3
  **MCP с OAuth, sampling и elicitation. Агенты, worktrees и рой с общей доской. Интерфейс, который не мешает.**
4
4
 
5
- Набор из **16 плагинов и 30 навыков** для DeepSeek Harness 0.2.x: MCP tools/resources/prompts + OAuth 2.1, sampling, elicitation; проектные агенты, worktrees, фон и read-only рой с общей доской; русский интерфейс, автопилот навыков, токен-лаборатория, студия навыков, память проектов, guardrails, карта репозитория, чекпоинты, plan mode, browser QA, GitHub review, hooks/commands и резервные копии профиля.
5
+ Набор из **17 плагинов и 30 навыков** для DeepSeek Harness 0.2.x: MCP tools/resources/prompts + OAuth 2.1, sampling, elicitation; проектные агенты, worktrees, фон и read-only рой с общей доской; русский интерфейс, автопилот навыков, токен-лаборатория, студия навыков, память проектов, guardrails, карта репозитория, чекпоинты, plan mode, browser QA, GitHub review, hooks/commands и резервные копии профиля.
6
6
 
7
- ![DSH Desktop Kit 2.7](https://unpkg.com/dsh-desktop-kit@2.15.10/docs/images/hero.png)
7
+ ![DSH Desktop Kit 2.7](https://unpkg.com/dsh-desktop-kit@2.16.0/docs/images/hero.png)
8
8
 
9
9
  ## MCP: подключения без JSON
10
10
 
11
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.15.10/plugins/dsh-mcp-manager/screenshots/settings-1440.png)
13
+ ![MCP Settings](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-mcp-manager/screenshots/settings-1440.png)
14
14
 
15
- ![MCP на 390px](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-mcp-manager/screenshots/settings-390.png)
15
+ ![MCP на 390px](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-mcp-manager/screenshots/settings-390.png)
16
16
 
17
- ![Добавление MCP-сервера](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-mcp-manager/screenshots/modal-390.png)
17
+ ![Добавление MCP-сервера](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-mcp-manager/screenshots/modal-390.png)
18
18
 
19
19
  ## Агенты, worktrees и рой
20
20
 
21
21
  - **Проектные роли** — `.dsh/agents/*.md`: `tools`, `permission` и `model` реально ограничивают ребёнка.
22
22
  - **Worktrees** — `project_worktree` создаёт ветку `dsh/<slug>` и папку `.dsh/worktrees/<slug>`; `merge` вливает чистую ветку в main и делает abort при конфликте; `project_agent worktree=auto` запускает агента в изоляции.
23
23
  - **Фон** — `background=true` возвращает run id сразу; страница **Агенты** показывает очередь и кнопку «Остановить».
24
- - **Команда** — `project_agent action=team names=[reviewer,researcher] task=...` или `preset=review` из `.dsh/teams/review.json` запускает 2–6 read-only ролей; `worktrees=true` даёт каждому писателю отдельную ветку.
24
+ - **Команда** — `project_agent action=team names=[reviewer,researcher] task=...` или `preset=review`; `action=auto` сам решает, нужен ли рой, и выбирает preset запускает 2–6 read-only ролей; `worktrees=true` даёт каждому писателю отдельную ветку.
25
25
  - **Рой и общая доска** — `team_board` хранит сообщения и задачи в `.dsh/agents/board.json` (0600, redaction, лимиты); team автоматически создаёт `teamId` и передаёт его ролям.
26
26
  - **Живые сообщения** — `team_message` отправляет текст лиду (`to="parent"`) или участнику по run id; копия каждого сообщения остаётся в board.
27
27
  - **Инструкции проекта** — `AGENTS.md`/`CLAUDE.md` иерархически (root → вложенные папки → `.dsh`) с `@import`; MCP roots сообщает корень проекта.
28
28
 
29
- ![Доска команды](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-agent-extensions/screenshots/board-1440.png)
29
+ ![Доска команды](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-agent-extensions/screenshots/board-1440.png)
30
30
 
31
- ![Доска команды на 390px](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-agent-extensions/screenshots/board-390.png)
31
+ ![Доска команды на 390px](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-agent-extensions/screenshots/board-390.png)
32
32
 
33
- ![Транскрипт фонового агента](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-agent-extensions/screenshots/transcript-1440.png)
33
+ ![Транскрипт фонового агента](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-agent-extensions/screenshots/transcript-1440.png)
34
34
 
35
- Транскрипт сохраняется в `.dsh/agents/transcripts/<run>.json` (0600) и доступен после restart.\n\n![Транскрипт на 390px](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-agent-extensions/screenshots/transcript-390.png)
35
+ Транскрипт сохраняется в `.dsh/agents/transcripts/<run>.json` (0600) и доступен после restart.\n\n![Транскрипт на 390px](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-agent-extensions/screenshots/transcript-390.png)
36
36
 
37
- ![MCP sampling](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-mcp-manager/screenshots/sampling-1440.png)
37
+ ![MCP sampling](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-mcp-manager/screenshots/sampling-1440.png)
38
38
 
39
- ![MCP elicitation](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-mcp-manager/screenshots/elicitation-1440.png)
39
+ ![MCP elicitation](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-mcp-manager/screenshots/elicitation-1440.png)
40
+
41
+ ## Интеграции
42
+
43
+ Marketplace, IDE bridge и sandbox-аудит — в одном экране **Настройки → Интеграции**:
44
+
45
+ - **Marketplace** — локальный каталог навыков с SHA-256 и backup; без загрузки по URL.
46
+ - **IDE bridge** — localhost JSON API (`/health`, `/context`) с bearer-токеном; расширение редактора — отдельный проект.
47
+ - **Sandbox** — честный аудит: DSH preset + kit guardrails — это политика, не OS sandbox.
48
+
49
+ ![Интеграции](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-integrations/screenshots/integrations-1440.png)
50
+
51
+ ![Интеграции на 390px](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-integrations/screenshots/integrations-390.png)
40
52
 
41
53
  ## Права и субагенты
42
54
 
@@ -47,11 +59,11 @@
47
59
  - **Worktrees и фоновые агенты.** `project_worktree` создаёт ветку `dsh/<slug>` и отдельную папку `.dsh/worktrees/<slug>`; `project_agent ... worktree=auto background=true` запускает агента в изоляции, а страница **Агенты** показывает worktrees и очередь запусков с кнопкой «Остановить».
48
60
  - **Инструкции проекта.** `AGENTS.md` и `CLAUDE.md` читаются иерархически (root → вложенные папки → `.dsh`) с `@import`; MCP roots сообщает серверу корень проекта.
49
61
 
50
- ![Агенты проекта](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-agent-extensions/screenshots/agents-1440.png)
62
+ ![Агенты проекта](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-agent-extensions/screenshots/agents-1440.png)
51
63
 
52
- ![Права и ограничения](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-guardrails/screenshots/permissions-1440.png)
64
+ ![Права и ограничения](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-guardrails/screenshots/permissions-1440.png)
53
65
 
54
- **v2.15.10** · MIT · проверено на DSH `0.2.1-rc.5` и `0.2.2-rc.1` (Windows 11) · без внешних зависимостей и телеметрии
66
+ **v2.16.0** · MIT · проверено на DSH `0.2.1-rc.5` и `0.2.2-rc.1` (Windows 11) · без внешних зависимостей и телеметрии
55
67
 
56
68
  **План развития:** [docs/ROADMAP-3.0.md](docs/ROADMAP-3.0.md) — Memory Fabric, семантическое
57
69
  слияние, локальный индекс памяти, шифрованные переносы, Memory Hub и npm trusted publishing.
@@ -146,27 +158,27 @@
146
158
  - перед каждой синхронизацией проверяется, что репозиторий всё ещё приватный;
147
159
  - секреты и PII вычищаются, домашние пути заменяются токеном `%DSH_HOME%`; LLM не вызывается — **0 токенов**.
148
160
 
149
- ![Настройки памяти проектов](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-memory-bridge/docs/images/settings-light.png)
161
+ ![Настройки памяти проектов](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-memory-bridge/docs/images/settings-light.png)
150
162
 
151
- ![Конфликты досье](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-memory-bridge/docs/images/conflicts.png)
163
+ ![Конфликты досье](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-memory-bridge/docs/images/conflicts.png)
152
164
 
153
165
  ## Скриншоты
154
166
 
155
167
  ### Skills Studio: каталог, стоимость и редактор
156
168
 
157
- ![Каталог навыков](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-gkb-ru-ui/screenshots/02-skills-1440-light.png)
169
+ ![Каталог навыков](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-gkb-ru-ui/screenshots/02-skills-1440-light.png)
158
170
 
159
- ![Редактор навыка](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-gkb-ru-ui/screenshots/03-skills-editor-1440-light.png)
171
+ ![Редактор навыка](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-gkb-ru-ui/screenshots/03-skills-editor-1440-light.png)
160
172
 
161
173
  ### Token Lab: куда уходит контекст
162
174
 
163
- ![Токен-лаборатория](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-token-lab/screenshots/01-token-lab-1440-light.png)
175
+ ![Токен-лаборатория](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-token-lab/screenshots/01-token-lab-1440-light.png)
164
176
 
165
177
  ### Тёмная тема и мобильный
166
178
 
167
- ![Тёмная тема](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-gkb-ru-ui/screenshots/04-skills-1440-dark.png)
179
+ ![Тёмная тема](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-gkb-ru-ui/screenshots/04-skills-1440-dark.png)
168
180
 
169
- ![Каталог навыков на 390 px](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-gkb-ru-ui/screenshots/05-skills-390-light.png)
181
+ ![Каталог навыков на 390 px](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-gkb-ru-ui/screenshots/05-skills-390-light.png)
170
182
 
171
183
  ## Окно-напоминание: пиковый тариф
172
184
 
@@ -176,11 +188,11 @@ DeepSeek включает двойной тариф в пиковые часы (
176
188
  - **в окне** — красная карточка: причина, границы окна в местном времени и UTC, живой отсчёт до конца и рекомендация, когда вернуться;
177
189
  - **после окна** — карточка исчезает; состояние всегда доступно через `window.__DSH_PEAK_GUARD__.state()`.
178
190
 
179
- ![Окно-напоминание: светлая тема](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-peak-guard/screenshots/03-peak-card-1440-light.png)
191
+ ![Окно-напоминание: светлая тема](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-peak-guard/screenshots/03-peak-card-1440-light.png)
180
192
 
181
- ![Окно-напоминание: тёмная тема](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-peak-guard/screenshots/04-peak-card-1440-dark.png)
193
+ ![Окно-напоминание: тёмная тема](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-peak-guard/screenshots/04-peak-card-1440-dark.png)
182
194
 
183
- ![Окно-напоминание на 390 px](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-peak-guard/screenshots/05-peak-card-390-light.png)
195
+ ![Окно-напоминание на 390 px](https://unpkg.com/dsh-desktop-kit@2.16.0/plugins/dsh-peak-guard/screenshots/05-peak-card-390-light.png)
184
196
 
185
197
  Подробности и настройки — [plugins/dsh-peak-guard/README.md](plugins/dsh-peak-guard/README.md).
186
198
 
package/client.js CHANGED
@@ -7764,7 +7764,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
7764
7764
  agents.length > 0 ? h("div", { className: "ag-grid" }, agents.map((agent) => h(AgentCard, { key: agent.name, agent }))) : null,
7765
7765
  h("div", { className: "ag-section" },
7766
7766
  h("h3", null, "Параллельная команда"),
7767
- h("p", { className: "ag-hint" }, "`project_agent action=team names=[reviewer,researcher] lead=coordinator task=...` запускает 2–6 read-only ролей и лида, который видит их run id, пишет им через `team_message` и ведёт задачи на board. Для пишущих добавьте `worktrees=true`."),
7767
+ h("p", { className: "ag-hint" }, "`project_agent action=auto` сам оценивает задачу: если она широкая, запускает read-only рой с лидом; `team` — вручную. `action=auto` также добавляет research-требование для внешних фактов."),
7768
7768
  agents.filter((agent) => agent.permission === "read-only").length > 0
7769
7769
  ? h("div", { className: "ag-tools" }, agents.filter((agent) => agent.permission === "read-only").map((agent) => h("span", { key: agent.name, className: "ag-tool" }, agent.name)))
7770
7770
  : h("div", { className: "ag-mini-empty" }, "Нужна хотя бы одна read-only роль: team не запускает пишущих агентов в общем cwd."),
@@ -8078,7 +8078,174 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
8078
8078
  return module.exports;
8079
8079
  })());
8080
8080
 
8081
- const __partNames = ["dsh-gkb-ru-ui","dsh-token-lab","dsh-peak-guard","dsh-session-move","dsh-profile-transfer","dsh-memory-bridge","dsh-mcp-manager","dsh-agent-extensions","dsh-guardrails"];
8081
+ /* ---- dsh-integrations ---- */
8082
+ __parts.push((function () {
8083
+ var module = { exports: {} };
8084
+ var exports = module.exports;
8085
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8086
+ const React = require("react");
8087
+ const h = React.createElement;
8088
+ const { useEffect, useState } = React;
8089
+
8090
+ const CSS = `
8091
+ .int-root{--in-line:var(--dsw-alias-border-l1,rgba(20,40,36,.13));--in-soft:var(--dsw-alias-bg-layer-1,#f4f7f5);--in-panel:var(--dsw-alias-bg-layer-2,#fff);--in-text:var(--dsw-alias-label-primary,#17231f);--in-muted:var(--dsw-alias-label-secondary,#61706b);--in-accent:var(--dsw-alias-brand-primary,#0f766e);display:flex;flex-direction:column;gap:20px;max-width:1040px;min-width:0;color:var(--in-text)}
8092
+ .int-head{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;flex-wrap:wrap}
8093
+ .int-eyebrow{margin:0 0 6px;font-size:11px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--in-accent)}
8094
+ .int-title{margin:0;font-size:clamp(24px,2.6vw,32px);line-height:1.12;letter-spacing:-.025em;font-weight:680}
8095
+ .int-sub{margin:8px 0 0;max-width:68ch;color:var(--in-muted);font-size:14px;line-height:1.5}
8096
+ .int-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
8097
+ .int-stat{padding:14px 16px;border:1px solid var(--in-line);border-radius:14px;background:linear-gradient(150deg,var(--in-panel),var(--in-soft));min-width:0}
8098
+ .int-stat b{display:block;font-size:24px;line-height:1.1;letter-spacing:-.03em;font-variant-numeric:tabular-nums}
8099
+ .int-stat span{display:block;margin-top:5px;color:var(--in-muted);font-size:11px;font-weight:650;letter-spacing:.08em;text-transform:uppercase}
8100
+ .int-section{display:flex;flex-direction:column;gap:10px;min-width:0}
8101
+ .int-section h3{margin:0;font-size:15px;letter-spacing:-.01em}
8102
+ .int-hint{margin:0;color:var(--in-muted);font-size:12px;line-height:1.5}
8103
+ .int-items{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;min-width:0}
8104
+ .int-item{border:1px solid var(--in-line);border-radius:12px;background:var(--in-panel);padding:12px;min-width:0;display:flex;flex-direction:column;gap:6px}
8105
+ .int-item-top{display:flex;justify-content:space-between;gap:8px;align-items:baseline;min-width:0}
8106
+ .int-item-top code{font:inherit;font-weight:650;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
8107
+ .int-item-top span{flex:none;font-size:9.5px;font-weight:750;letter-spacing:.06em;text-transform:uppercase;color:var(--in-muted)}
8108
+ .int-item p{margin:0;color:var(--in-muted);font-size:11.5px;line-height:1.45;overflow-wrap:anywhere}
8109
+ .int-ok{color:#0f766e}.int-bad{color:#9f1239}
8110
+ .int-btn{font:inherit;font-size:11px;font-weight:650;border:1px solid var(--in-line);background:var(--in-panel);color:var(--in-text);border-radius:8px;padding:6px 9px;cursor:pointer;min-height:30px}
8111
+ .int-btn:hover{border-color:rgba(15,118,110,.35);background:rgba(15,118,110,.05)}
8112
+ .int-btn:focus-visible{outline:2px solid var(--in-accent);outline-offset:2px}
8113
+ .int-btn.primary{background:var(--in-accent);border-color:var(--in-accent);color:#fff}
8114
+ .int-btn:disabled{opacity:.55;cursor:default}
8115
+ .int-box{padding:14px;border:1px solid var(--in-line);border-radius:14px;background:linear-gradient(160deg,var(--in-panel),var(--in-soft));display:flex;flex-direction:column;gap:8px;min-width:0}
8116
+ .int-row{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
8117
+ .int-dot{width:8px;height:8px;border-radius:999px;background:#9f1239;display:inline-block;margin-right:6px}
8118
+ .int-dot.on{background:#0f766e}
8119
+ .int-code{font:11px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--in-muted);word-break:break-all;background:var(--in-panel);border:1px solid var(--in-line);border-radius:8px;padding:8px}
8120
+ .int-error{padding:8px 10px;border:1px solid rgba(159,18,57,.16);border-radius:9px;background:rgba(159,18,57,.06);color:#9f1239;font-size:12px;line-height:1.4}
8121
+ .int-empty{padding:18px;border:1px dashed var(--in-line);border-radius:12px;color:var(--in-muted);font-size:12px;line-height:1.5}
8122
+ @media(max-width:860px){.int-items{grid-template-columns:1fr}}
8123
+ @media(max-width:520px){.int-stats{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.int-stat{padding:10px 12px}.int-stat b{font-size:20px}.int-stat span{font-size:9px;letter-spacing:.04em}}
8124
+ `;
8125
+
8126
+ async function call(operation, payload) {
8127
+ let signal;
8128
+ try { signal = AbortSignal.timeout(30000); } catch { signal = undefined; }
8129
+ const result = await window.__DSH_INTEGRATIONS_CTX__.connection.rpc.call("/api", `dsh-integrations/${operation}`, payload ?? {}, signal);
8130
+ if (!result || result.ok !== true) throw new Error(result?.error?.message || "Ошибка RPC");
8131
+ return result.value;
8132
+ }
8133
+
8134
+ function IntegrationsSection(props) {
8135
+ const [state, setState] = useState({ loading: true, error: "", data: null });
8136
+ const [busy, setBusy] = useState("");
8137
+ const [notice, setNotice] = useState("");
8138
+ const useSessions = props && props.useSessions;
8139
+ const useWorkspaces = props && props.useWorkspaces;
8140
+ const workspaces = useWorkspaces ? useWorkspaces((snapshot) => snapshot) : undefined;
8141
+ const items = Array.isArray(workspaces?.items) ? workspaces.items : [];
8142
+ const cwd = typeof items[0]?.path === "string" ? items[0].path : undefined;
8143
+
8144
+ const load = async () => {
8145
+ try {
8146
+ const data = await call("status", { cwd });
8147
+ setState({ loading: false, error: "", data });
8148
+ } catch (error) {
8149
+ setState({ loading: false, error: error instanceof Error ? error.message : String(error), data: null });
8150
+ }
8151
+ };
8152
+
8153
+ useEffect(() => { void load(); }, [cwd]);
8154
+
8155
+ const act = async (name, payload, okText) => {
8156
+ setBusy(name);
8157
+ setNotice("");
8158
+ try {
8159
+ await call(name, { ...payload, cwd });
8160
+ setNotice(okText);
8161
+ await load();
8162
+ } catch (error) {
8163
+ setState((current) => ({ ...current, error: error instanceof Error ? error.message : String(error) }));
8164
+ } finally {
8165
+ setBusy("");
8166
+ }
8167
+ };
8168
+
8169
+ const catalog = state.data?.catalog ?? [];
8170
+ const bridge = state.data?.bridge ?? { running: false };
8171
+ const sandbox = state.data?.sandbox ?? { enforcement: false };
8172
+ const installed = catalog.filter((entry) => entry.installed).length;
8173
+ return h("section", { className: "int-root", "aria-label": "Интеграции" },
8174
+ h("div", { className: "int-head" },
8175
+ h("div", null,
8176
+ h("p", { className: "int-eyebrow" }, "Integrations · marketplace, IDE, sandbox"),
8177
+ h("h2", { className: "int-title" }, "Интеграции"),
8178
+ h("p", { className: "int-sub" }, "Локальный marketplace с checksum и backup, localhost IDE bridge и честный sandbox-аудит. Marketplace не тянет произвольный URL: только локальный каталог."),
8179
+ ),
8180
+ h("button", { className: "int-btn", type: "button", onClick: () => void load(), disabled: state.loading }, "Обновить"),
8181
+ ),
8182
+ state.error ? h("div", { className: "int-error", role: "alert" }, state.error) : null,
8183
+ notice ? h("div", { className: "int-hint", role: "status" }, notice) : null,
8184
+ h("div", { className: "int-stats" },
8185
+ h("div", { className: "int-stat" }, h("b", null, catalog.length), h("span", null, "в каталоге")),
8186
+ h("div", { className: "int-stat" }, h("b", null, installed), h("span", null, "установлено")),
8187
+ h("div", { className: "int-stat" }, h("b", null, bridge.running ? "on" : "off"), h("span", null, "IDE bridge")),
8188
+ ),
8189
+ h("div", { className: "int-section" },
8190
+ h("h3", null, "Marketplace"),
8191
+ h("p", { className: "int-hint" }, "Каталог: ~/.dsh/marketplace/catalog.json или .dsh/marketplace.json. Поле sha256 проверяется; существующий навык уходит в backup."),
8192
+ catalog.length > 0 ? h("div", { className: "int-items" }, catalog.map((entry) => h("article", { className: "int-item", key: entry.id },
8193
+ h("div", { className: "int-item-top" }, h("code", { title: entry.id }, entry.name), h("span", null, entry.installed ? "installed" : entry.version)),
8194
+ h("p", null, entry.description || entry.id),
8195
+ h("div", { className: "int-row" },
8196
+ h("span", { className: "int-hint" }, entry.scope),
8197
+ h("button", { className: "int-btn", type: "button", disabled: busy === `install:${entry.id}` || entry.installed, onClick: () => void act("install", { id: entry.id }, `Установлен ${entry.id}`) }, entry.installed ? "Уже установлен" : busy === `install:${entry.id}` ? "Устанавливаем…" : "Установить"),
8198
+ ),
8199
+ ))) : h("div", { className: "int-empty" }, "Каталог пуст. Добавьте записи в ~/.dsh/marketplace/catalog.json: id, source (локальная папка), sha256, version."),
8200
+ ),
8201
+ h("div", { className: "int-section" },
8202
+ h("h3", null, "IDE bridge"),
8203
+ h("p", { className: "int-hint" }, "Localhost JSON API для будущего расширения редактора. Это протокол, не само расширение."),
8204
+ h("div", { className: "int-box" },
8205
+ h("div", { className: "int-row" },
8206
+ h("span", null, h("i", { className: `int-dot${bridge.running ? " on" : ""}` }), bridge.running ? "Работает" : "Остановлен"),
8207
+ h("div", { className: "int-row" },
8208
+ bridge.running ? h("button", { className: "int-btn", type: "button", onClick: () => void act("bridge-stop", {}, "Bridge остановлен") }, "Остановить") : h("button", { className: "int-btn primary", type: "button", disabled: busy === "bridge-start", onClick: () => void act("bridge-start", {}, "Bridge запущен") }, busy === "bridge-start" ? "Запускаем…" : "Запустить"),
8209
+ ),
8210
+ ),
8211
+ bridge.running ? h(React.Fragment, null,
8212
+ h("div", { className: "int-code" }, `${bridge.url}/health?token=${bridge.token}`),
8213
+ h("p", { className: "int-hint" }, "Токен живёт до остановки. Эндпоинты: /health, /context."),
8214
+ ) : h("p", { className: "int-hint" }, "Слушает только 127.0.0.1 и требует bearer-токен."),
8215
+ ),
8216
+ ),
8217
+ h("div", { className: "int-section" },
8218
+ h("h3", null, "Sandbox"),
8219
+ h("p", { className: "int-hint" }, sandbox.note || "Политика DSH и kit guardrails; OS-level enforcement требует DSH core."),
8220
+ h("div", { className: "int-box" }, h("div", { className: "int-row" }, h("span", null, sandbox.enforcement ? "OS enforcement" : "Policy audit"), h("span", { className: "int-ok" }, "без иллюзий"))),
8221
+ ),
8222
+ h("p", { className: "int-hint" }, state.data?.project ? `Проект: ${state.data.project}` : "Проект определяется по рабочей папке."),
8223
+ );
8224
+ }
8225
+
8226
+ function apply(ctx) {
8227
+ window.__DSH_INTEGRATIONS_CTX__ = ctx;
8228
+ ctx.effect(() => {
8229
+ const style = document.createElement("style");
8230
+ style.id = "dsh-integrations";
8231
+ style.textContent = CSS;
8232
+ document.head.appendChild(style);
8233
+ return () => style.remove();
8234
+ }, "integrations: styles");
8235
+ ctx.effect(() => ctx.slots.inject("settings.section", () => ctx.slots.register({
8236
+ name: "settings.section",
8237
+ id: "dsh-integrations",
8238
+ order: 36,
8239
+ label: () => "Интеграции",
8240
+ }, IntegrationsSection)), "integrations: settings");
8241
+ }
8242
+
8243
+ exports.apply = apply;
8244
+ exports.inject = ["slots", "connection"];
8245
+ return module.exports;
8246
+ })());
8247
+
8248
+ const __partNames = ["dsh-gkb-ru-ui","dsh-token-lab","dsh-peak-guard","dsh-session-move","dsh-profile-transfer","dsh-memory-bridge","dsh-mcp-manager","dsh-agent-extensions","dsh-guardrails","dsh-integrations"];
8082
8249
  const __kitErrors = [];
8083
8250
  const __pushKitError = (label, error) => {
8084
8251
  const message = String(error && error.message ? error.message : error);
@@ -8086,7 +8253,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
8086
8253
  if (__kitErrors.length <= 5) console.error("[dsh-desktop-kit] registration failed:", label, message);
8087
8254
  };
8088
8255
  try {
8089
- window.__DSH_DESKTOP_KIT__ = { version: "2.15.10", parts: __partNames, errors: __kitErrors, ready: false };
8256
+ window.__DSH_DESKTOP_KIT__ = { version: "2.16.0", parts: __partNames, errors: __kitErrors, ready: false };
8090
8257
  } catch {}
8091
8258
  const __inject = [];
8092
8259
  for (const __part of __parts) {
@@ -0,0 +1,50 @@
1
+ # Интеграции: marketplace, IDE bridge, sandbox
2
+
3
+ ## Marketplace
4
+
5
+ Локальный каталог:
6
+
7
+ ```json
8
+ // ~/.dsh/marketplace/catalog.json
9
+ {
10
+ "entries": [
11
+ {
12
+ "id": "security-review",
13
+ "name": "Security Review",
14
+ "version": "1.2.0",
15
+ "description": "OWASP-минимум и проверка секретов",
16
+ "source": "C:/skills/security-review",
17
+ "sha256": "<sha256 SKILL.md>"
18
+ }
19
+ ]
20
+ }
21
+ ```
22
+
23
+ Установка:
24
+
25
+ 1. проверяется `sha256` файла `SKILL.md`;
26
+ 2. существующий `~/.dsh/skills/<id>` копируется в backup;
27
+ 3. папка копируется в `~/.dsh/skills/<id>`.
28
+
29
+ Нет загрузки по URL, нет исполнения install-скриптов.
30
+
31
+ ## IDE bridge
32
+
33
+ Запуск: Settings → Интеграции → **Запустить**.
34
+
35
+ ```text
36
+ GET http://127.0.0.1:<port>/health?token=<token>
37
+ GET http://127.0.0.1:<port>/context?token=<token>
38
+ ```
39
+
40
+ Токен одноразовый на запуск, живёт до остановки. Расширение редактора — отдельный deliverable.
41
+
42
+ ## Sandbox
43
+
44
+ `integration_status` возвращает:
45
+
46
+ - `sandbox.enforcement: false`;
47
+ - причину: policy ≠ OS sandbox;
48
+ - какие механизмы реально есть: DSH permission presets + kit guardrails.
49
+
50
+ OS-level sandbox требует изменений в DSH core (Windows Job Objects/AppContainer) или нативного helper. Пакет этого не имитирует.
@@ -0,0 +1,22 @@
1
+ # DSH Desktop Kit 2.15.11 — тест
2
+
3
+ Дата: 2026-11-12.
4
+
5
+ ## Auto-swarm
6
+
7
+ - `project_agent action=auto task=...`.
8
+ - Score: broad/security/architecture/audit/research + length + multi-area.
9
+ - `.dsh/swarm.json`: `{ "enabled": true, "threshold": 3 }`.
10
+ - Narrow task → `swarm:false`, reason.
11
+ - Broad → preset/roles + lead; external facts → research suffix.
12
+
13
+ ## Research policy
14
+
15
+ - System prompt: web_search + 2 sources + dates for external facts, versions, prices, standards, references.
16
+ - UI hint updated.
17
+
18
+ ## Проверки
19
+
20
+ - `swarm-tests` — OK.
21
+ - `npm test` — exit 0.
22
+ - `build:client` / `check:client` — OK.
@@ -0,0 +1,21 @@
1
+ # DSH Desktop Kit 2.16.0 — тест
2
+
3
+ Дата: 2026-11-12.
4
+
5
+ ## dsh-integrations
6
+
7
+ - Marketplace: локальный каталог, SHA-256, backup, установка навыка.
8
+ - IDE bridge: localhost HTTP, bearer, `/health`, `/context`.
9
+ - Sandbox: `enforcement:false` + объяснение.
10
+
11
+ ## UI
12
+
13
+ - Экран «Интеграции».
14
+ - 390/768/1440: overflow 0, console 0, markup 0.
15
+
16
+ ## Проверки
17
+
18
+ - `integrations-tests` — OK.
19
+ - `npm test` — exit 0.
20
+ - `build:client` / `check:client` — OK.
21
+ - Tarball включает `plugins/dsh-integrations` и скриншоты.
package/index.js CHANGED
@@ -39,6 +39,7 @@ import * as githubReview from "./plugins/dsh-github-review/index.js";
39
39
  import * as guardrails from "./plugins/dsh-guardrails/index.js";
40
40
  import * as agentExtensions from "./plugins/dsh-agent-extensions/index.js";
41
41
  import * as mcpManager from "./plugins/dsh-mcp-manager/index.js";
42
+ import * as integrations from "./plugins/dsh-integrations/index.js";
42
43
 
43
44
  const here = path.dirname(fileURLToPath(import.meta.url));
44
45
  const KIT_VERSION = (() => {
@@ -66,6 +67,7 @@ const parts = [
66
67
  ["dsh-guardrails", guardrails],
67
68
  ["dsh-agent-extensions", agentExtensions],
68
69
  ["dsh-mcp-manager", mcpManager],
70
+ ["dsh-integrations", integrations],
69
71
  ];
70
72
 
71
73
  /** The kit itself needs no service; each child declares its own. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-desktop-kit",
3
- "version": "2.15.10",
4
- "description": "DeepSeek Harness desktop kit 2.15.10: 16 plugins and 30 skills — MCP tools/resources/prompts with OAuth 2.1, sampling and elicitation, project agents, git worktrees, background runs and a read-only/writer swarm with a shared board, plus self-applying skills, token lab, Skills Studio, project memory, guardrails, repo map, checkpoints, plan mode, browser QA, GitHub review, hooks/commands, Russian UI and profile transfer.",
3
+ "version": "2.16.0",
4
+ "description": "DeepSeek Harness desktop kit 2.16.0: 16 plugins and 30 skills — MCP tools/resources/prompts with OAuth 2.1, sampling and elicitation, project agents, git worktrees, background runs and a read-only/writer swarm with a shared board, plus self-applying skills, token lab, Skills Studio, project memory, guardrails, repo map, checkpoints, plan mode, browser QA, GitHub review, hooks/commands, Russian UI and profile transfer. Includes local marketplace, localhost IDE bridge and an honest sandbox audit.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
7
7
  "dsh",
@@ -82,7 +82,7 @@
82
82
  "build:client": "node tools/build-client.mjs",
83
83
  "build:skills": "node tools/build-skill-manifest.mjs",
84
84
  "check:client": "node tools/check-client.mjs client.js",
85
- "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/transcripts-tests.mjs && node tools/team-messages-tests.mjs && node tools/team-presets-tests.mjs && node tools/team-board-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",
85
+ "test": "node tools/integrations-tests.mjs && 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/transcripts-tests.mjs && node tools/team-messages-tests.mjs && node tools/swarm-tests.mjs && node tools/team-presets-tests.mjs && node tools/team-board-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",
86
86
  "skills:cost": "node tools/skill-cost.mjs",
87
87
  "skills:check": "node tools/skill-cost.mjs --check",
88
88
  "release": "node tools/release.mjs"
@@ -208,7 +208,7 @@ window.__ModuleLoader__.load({
208
208
  agents.length > 0 ? h("div", { className: "ag-grid" }, agents.map((agent) => h(AgentCard, { key: agent.name, agent }))) : null,
209
209
  h("div", { className: "ag-section" },
210
210
  h("h3", null, "Параллельная команда"),
211
- h("p", { className: "ag-hint" }, "`project_agent action=team names=[reviewer,researcher] lead=coordinator task=...` запускает 2–6 read-only ролей и лида, который видит их run id, пишет им через `team_message` и ведёт задачи на board. Для пишущих добавьте `worktrees=true`."),
211
+ h("p", { className: "ag-hint" }, "`project_agent action=auto` сам оценивает задачу: если она широкая, запускает read-only рой с лидом; `team` — вручную. `action=auto` также добавляет research-требование для внешних фактов."),
212
212
  agents.filter((agent) => agent.permission === "read-only").length > 0
213
213
  ? h("div", { className: "ag-tools" }, agents.filter((agent) => agent.permission === "read-only").map((agent) => h("span", { key: agent.name, className: "ag-tool" }, agent.name)))
214
214
  : h("div", { className: "ag-mini-empty" }, "Нужна хотя бы одна read-only роль: team не запускает пишущих агентов в общем cwd."),
@@ -23,6 +23,7 @@ import { sendTeamMessage } from "./lib/messages.js";
23
23
  import { ensureGlobalScaffold, ensureProjectScaffold } from "./lib/scaffold.js";
24
24
  import { findDshDir, loadAgents, projectFor } from "./lib/project.js";
25
25
  import { findTeam, loadTeams } from "./lib/teams.js";
26
+ import { chooseSwarm, loadSwarmOptions } from "./lib/swarm.js";
26
27
 
27
28
  export const inject = ["tools", "systemPrompt"];
28
29
 
@@ -48,7 +49,7 @@ function toolDefinition(ctx) {
48
49
  type: "object",
49
50
  additionalProperties: false,
50
51
  properties: {
51
- 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" },
52
+ action: { type: "string", enum: ["list", "run", "team", "auto", "status", "cancel"], description: "list agents, run one, start a team, auto-decide whether a swarm is warranted, list runs, or cancel" },
52
53
  name: { type: "string", description: "Agent name from `.dsh/agents/<name>.md`" },
53
54
  names: { type: "array", items: { type: "string" }, maxItems: 6, description: "For team: 2–6 read-only agent names" },
54
55
  lead: { type: "string", description: "Optional read-only coordinator agent; receives member run ids and can message them" },
@@ -87,9 +88,17 @@ function toolDefinition(ctx) {
87
88
  return { ok: false, text: `project_agent cancel ${id}: ${error instanceof Error ? error.message : String(error)}` };
88
89
  }
89
90
  }
90
- if (input?.action !== "run" && input?.action !== "team") return { ok: false, text: "project_agent: action must be list, run, team, status or cancel" };
91
- const task = String(input?.task ?? "").trim();
91
+ if (input?.action !== "run" && input?.action !== "team" && input?.action !== "auto") return { ok: false, text: "project_agent: action must be list, run, team, auto, status or cancel" };
92
+ let task = String(input?.task ?? "").trim();
92
93
  if (!task) return { ok: false, text: `project_agent: task is required for ${input.action}` };
94
+ if (input.action === "auto") {
95
+ const decision = chooseSwarm(task, loadTeams(project.root, project.dsh ?? path.join(project.root, ".dsh")), agents, loadSwarmOptions(project.root));
96
+ if (!decision.swarm) return { ok: true, swarm: false, score: decision.score, text: `project_agent auto: swarm not needed (${decision.reason})` };
97
+ const members = decision.members.filter((name) => name !== decision.lead);
98
+ if (members.length < 2) return { ok: true, swarm: false, score: decision.score, text: "project_agent auto: not enough members after removing the lead" };
99
+ task = decision.research ? `${task}\n\nResearch requirement: use web_search/web_fetch, prefer official docs, and cite at least two sources with dates before conclusions.` : task;
100
+ input = { ...input, action: "team", names: members, lead: decision.lead, preset: "" };
101
+ }
93
102
  if (input.action === "team") {
94
103
  const preset = input?.preset ? findTeam(project.root, project.dsh ?? path.join(project.root, ".dsh"), input.preset) : null;
95
104
  if (input?.preset && !preset) return { ok: false, text: `project_agent team: unknown preset "${input.preset}"` };
@@ -369,6 +378,18 @@ export function apply(ctx) {
369
378
  ctx.logger?.warn?.(`[agent-extensions] system prompt registration failed: ${error instanceof Error ? error.message : String(error)}`);
370
379
  }
371
380
 
381
+ try {
382
+ ctx.systemPrompt.context({
383
+ name: "dsh-agent-extensions: research and swarm policy",
384
+ order: 136,
385
+ interpolate: false,
386
+ required: false,
387
+ text: () => "<research-policy>For external facts, versions, prices, standards, best practices, or UI references: call web_search and open at least two sources; cite URLs and dates before recommending. For broad, multi-area, security, architecture, audit or research tasks: call project_agent action=auto first; it decides whether to start a read-only swarm.</research-policy>",
388
+ });
389
+ } catch (error) {
390
+ ctx.logger?.warn?.(`[agent-extensions] research policy skipped: ${error instanceof Error ? error.message : String(error)}`);
391
+ }
392
+
372
393
  try {
373
394
  ctx.systemPrompt.context({
374
395
  name: "dsh-agent-extensions: project instructions",
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Automatic swarm router.
3
+ *
4
+ * The model (or a future host hook) calls `project_agent action=auto`.
5
+ * A cheap deterministic score decides whether a narrow task should run alone
6
+ * or whether a read-only team + lead is worth the tokens. No LLM call here.
7
+ */
8
+ import fs from "node:fs";
9
+ import path from "node:path";
10
+
11
+ const BROAD = [
12
+ /(?:audit|review|architecture|security|migration|refactor|research|compare|analy[sz]e|investigate)/iu,
13
+ /(?:провер|ревью|архитект|безопас|миграц|рефактор|исслед|сравн|проанализ|разбер)/iu,
14
+ ];
15
+ const EXTERNAL = [
16
+ /(?:latest|current|price|pricing|version|release|docs?|documentation|rfc|standard|benchmark|cve)/iu,
17
+ /(?:последн|актуальн|цен|тариф|верси|релиз|документац|стандарт|бенчмарк|уязвим)/iu,
18
+ ];
19
+ const MULTI = [/\b(?:and|plus|also)\b/iu, /(?:^|\s)(?:и|плюс|также)(?:\s|$)/iu];
20
+
21
+ export function loadSwarmOptions(projectRoot) {
22
+ try {
23
+ const parsed = JSON.parse(fs.readFileSync(path.join(projectRoot, ".dsh", "swarm.json"), "utf8"));
24
+ return { enabled: parsed.enabled !== false, threshold: Number(parsed.threshold) || 3 };
25
+ } catch {
26
+ return { enabled: true, threshold: 3 };
27
+ }
28
+ }
29
+
30
+ export function chooseSwarm(task, teams = [], agents = [], options = {}) {
31
+ const text = String(task ?? "").trim();
32
+ if (options.enabled === false) return { swarm: false, score: 0, reason: "auto-swarm disabled" };
33
+ const threshold = Number.isFinite(options.threshold) ? options.threshold : 3;
34
+ let score = 0;
35
+ const reasons = [];
36
+ if (text.length > 180) { score += 1; reasons.push("long task"); }
37
+ if (BROAD.some((pattern) => pattern.test(text))) { score += 2; reasons.push("broad/quality task"); }
38
+ if (EXTERNAL.some((pattern) => pattern.test(text))) { score += 1; reasons.push("external facts"); }
39
+ if (MULTI.some((pattern) => pattern.test(text))) { score += 1; reasons.push("multiple areas"); }
40
+ if ((text.match(/,/gu) ?? []).length >= 2) { score += 1; reasons.push("several deliverables"); }
41
+
42
+ const readOnly = agents.filter((agent) => agent.permission === "read-only");
43
+ if (readOnly.length < 2) return { swarm: false, score, reasons, reason: "need at least two read-only agents" };
44
+ if (score < threshold) return { swarm: false, score, reasons, reason: `score ${score} < ${threshold}` };
45
+
46
+ const research = EXTERNAL.some((pattern) => pattern.test(text));
47
+ const preset = teams.find((team) => team.members.every((name) => agents.some((agent) => agent.name === name)))
48
+ ?? teams[0]
49
+ ?? null;
50
+ if (preset && preset.members.length >= 2) {
51
+ return { swarm: true, score, reasons, research, preset: preset.id, members: preset.members, lead: preset.lead || "" };
52
+ }
53
+ const preferred = ["reviewer", "researcher", "tester"];
54
+ const members = readOnly
55
+ .slice()
56
+ .sort((a, b) => (preferred.indexOf(a.name) + 1 || 99) - (preferred.indexOf(b.name) + 1 || 99))
57
+ .slice(0, 4)
58
+ .map((agent) => agent.name);
59
+ const lead = readOnly.find((agent) => /^(?:lead|coordinator|orchestrator)$/iu.test(agent.name))?.name ?? "";
60
+ return { swarm: true, score, reasons, research, preset: "", members, lead };
61
+ }
@@ -0,0 +1,33 @@
1
+ # dsh-integrations
2
+
3
+ Три интеграционных слоя в одном плагине:
4
+
5
+ ## Marketplace (локальный)
6
+
7
+ - Каталог: `~/.dsh/marketplace/catalog.json` или `.dsh/marketplace.json`.
8
+ - Запись: `{ id, name, version, description, source, sha256 }`.
9
+ - `source` — **локальная папка** с `SKILL.md`.
10
+ - `sha256` проверяется до установки.
11
+ - Существующий навык уходит в `~/.dsh/.dsh-kit-backups/marketplace/`.
12
+ - Сеть не используется.
13
+
14
+ Это **не** удалённый реестр. Для публичного marketplace нужны подписи, trust и сервер — отдельный проект.
15
+
16
+ ## IDE bridge
17
+
18
+ - Локальный HTTP JSON API на `127.0.0.1`, случайный порт.
19
+ - Bearer-токен на каждый запуск.
20
+ - `/health` — живость.
21
+ - `/context` — проект, pid, время.
22
+ - Запуск/остановка из Settings → **Интеграции**.
23
+
24
+ Это протокол для будущего расширения VS Code/JetBrains; самого расширения в пакете нет.
25
+
26
+ ## Sandbox audit
27
+
28
+ Плагин **не** делает OS sandbox. Он показывает:
29
+
30
+ - DSH permission presets и kit guardrails — это политика;
31
+ - AppContainer/Job Objects требуют DSH core или нативного helper.
32
+
33
+ Честная маркировка важнее ложной кнопки «Sandbox».
@@ -0,0 +1,168 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "dsh-integrations",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ const React = require("react");
8
+ const h = React.createElement;
9
+ const { useEffect, useState } = React;
10
+
11
+ const CSS = `
12
+ .int-root{--in-line:var(--dsw-alias-border-l1,rgba(20,40,36,.13));--in-soft:var(--dsw-alias-bg-layer-1,#f4f7f5);--in-panel:var(--dsw-alias-bg-layer-2,#fff);--in-text:var(--dsw-alias-label-primary,#17231f);--in-muted:var(--dsw-alias-label-secondary,#61706b);--in-accent:var(--dsw-alias-brand-primary,#0f766e);display:flex;flex-direction:column;gap:20px;max-width:1040px;min-width:0;color:var(--in-text)}
13
+ .int-head{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;flex-wrap:wrap}
14
+ .int-eyebrow{margin:0 0 6px;font-size:11px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--in-accent)}
15
+ .int-title{margin:0;font-size:clamp(24px,2.6vw,32px);line-height:1.12;letter-spacing:-.025em;font-weight:680}
16
+ .int-sub{margin:8px 0 0;max-width:68ch;color:var(--in-muted);font-size:14px;line-height:1.5}
17
+ .int-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
18
+ .int-stat{padding:14px 16px;border:1px solid var(--in-line);border-radius:14px;background:linear-gradient(150deg,var(--in-panel),var(--in-soft));min-width:0}
19
+ .int-stat b{display:block;font-size:24px;line-height:1.1;letter-spacing:-.03em;font-variant-numeric:tabular-nums}
20
+ .int-stat span{display:block;margin-top:5px;color:var(--in-muted);font-size:11px;font-weight:650;letter-spacing:.08em;text-transform:uppercase}
21
+ .int-section{display:flex;flex-direction:column;gap:10px;min-width:0}
22
+ .int-section h3{margin:0;font-size:15px;letter-spacing:-.01em}
23
+ .int-hint{margin:0;color:var(--in-muted);font-size:12px;line-height:1.5}
24
+ .int-items{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;min-width:0}
25
+ .int-item{border:1px solid var(--in-line);border-radius:12px;background:var(--in-panel);padding:12px;min-width:0;display:flex;flex-direction:column;gap:6px}
26
+ .int-item-top{display:flex;justify-content:space-between;gap:8px;align-items:baseline;min-width:0}
27
+ .int-item-top code{font:inherit;font-weight:650;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
28
+ .int-item-top span{flex:none;font-size:9.5px;font-weight:750;letter-spacing:.06em;text-transform:uppercase;color:var(--in-muted)}
29
+ .int-item p{margin:0;color:var(--in-muted);font-size:11.5px;line-height:1.45;overflow-wrap:anywhere}
30
+ .int-ok{color:#0f766e}.int-bad{color:#9f1239}
31
+ .int-btn{font:inherit;font-size:11px;font-weight:650;border:1px solid var(--in-line);background:var(--in-panel);color:var(--in-text);border-radius:8px;padding:6px 9px;cursor:pointer;min-height:30px}
32
+ .int-btn:hover{border-color:rgba(15,118,110,.35);background:rgba(15,118,110,.05)}
33
+ .int-btn:focus-visible{outline:2px solid var(--in-accent);outline-offset:2px}
34
+ .int-btn.primary{background:var(--in-accent);border-color:var(--in-accent);color:#fff}
35
+ .int-btn:disabled{opacity:.55;cursor:default}
36
+ .int-box{padding:14px;border:1px solid var(--in-line);border-radius:14px;background:linear-gradient(160deg,var(--in-panel),var(--in-soft));display:flex;flex-direction:column;gap:8px;min-width:0}
37
+ .int-row{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
38
+ .int-dot{width:8px;height:8px;border-radius:999px;background:#9f1239;display:inline-block;margin-right:6px}
39
+ .int-dot.on{background:#0f766e}
40
+ .int-code{font:11px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--in-muted);word-break:break-all;background:var(--in-panel);border:1px solid var(--in-line);border-radius:8px;padding:8px}
41
+ .int-error{padding:8px 10px;border:1px solid rgba(159,18,57,.16);border-radius:9px;background:rgba(159,18,57,.06);color:#9f1239;font-size:12px;line-height:1.4}
42
+ .int-empty{padding:18px;border:1px dashed var(--in-line);border-radius:12px;color:var(--in-muted);font-size:12px;line-height:1.5}
43
+ @media(max-width:860px){.int-items{grid-template-columns:1fr}}
44
+ @media(max-width:520px){.int-stats{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.int-stat{padding:10px 12px}.int-stat b{font-size:20px}.int-stat span{font-size:9px;letter-spacing:.04em}}
45
+ `;
46
+
47
+ async function call(operation, payload) {
48
+ let signal;
49
+ try { signal = AbortSignal.timeout(30000); } catch { signal = undefined; }
50
+ const result = await window.__DSH_INTEGRATIONS_CTX__.connection.rpc.call("/api", `dsh-integrations/${operation}`, payload ?? {}, signal);
51
+ if (!result || result.ok !== true) throw new Error(result?.error?.message || "Ошибка RPC");
52
+ return result.value;
53
+ }
54
+
55
+ function IntegrationsSection(props) {
56
+ const [state, setState] = useState({ loading: true, error: "", data: null });
57
+ const [busy, setBusy] = useState("");
58
+ const [notice, setNotice] = useState("");
59
+ const useSessions = props && props.useSessions;
60
+ const useWorkspaces = props && props.useWorkspaces;
61
+ const workspaces = useWorkspaces ? useWorkspaces((snapshot) => snapshot) : undefined;
62
+ const items = Array.isArray(workspaces?.items) ? workspaces.items : [];
63
+ const cwd = typeof items[0]?.path === "string" ? items[0].path : undefined;
64
+
65
+ const load = async () => {
66
+ try {
67
+ const data = await call("status", { cwd });
68
+ setState({ loading: false, error: "", data });
69
+ } catch (error) {
70
+ setState({ loading: false, error: error instanceof Error ? error.message : String(error), data: null });
71
+ }
72
+ };
73
+
74
+ useEffect(() => { void load(); }, [cwd]);
75
+
76
+ const act = async (name, payload, okText) => {
77
+ setBusy(name);
78
+ setNotice("");
79
+ try {
80
+ await call(name, { ...payload, cwd });
81
+ setNotice(okText);
82
+ await load();
83
+ } catch (error) {
84
+ setState((current) => ({ ...current, error: error instanceof Error ? error.message : String(error) }));
85
+ } finally {
86
+ setBusy("");
87
+ }
88
+ };
89
+
90
+ const catalog = state.data?.catalog ?? [];
91
+ const bridge = state.data?.bridge ?? { running: false };
92
+ const sandbox = state.data?.sandbox ?? { enforcement: false };
93
+ const installed = catalog.filter((entry) => entry.installed).length;
94
+ return h("section", { className: "int-root", "aria-label": "Интеграции" },
95
+ h("div", { className: "int-head" },
96
+ h("div", null,
97
+ h("p", { className: "int-eyebrow" }, "Integrations · marketplace, IDE, sandbox"),
98
+ h("h2", { className: "int-title" }, "Интеграции"),
99
+ h("p", { className: "int-sub" }, "Локальный marketplace с checksum и backup, localhost IDE bridge и честный sandbox-аудит. Marketplace не тянет произвольный URL: только локальный каталог."),
100
+ ),
101
+ h("button", { className: "int-btn", type: "button", onClick: () => void load(), disabled: state.loading }, "Обновить"),
102
+ ),
103
+ state.error ? h("div", { className: "int-error", role: "alert" }, state.error) : null,
104
+ notice ? h("div", { className: "int-hint", role: "status" }, notice) : null,
105
+ h("div", { className: "int-stats" },
106
+ h("div", { className: "int-stat" }, h("b", null, catalog.length), h("span", null, "в каталоге")),
107
+ h("div", { className: "int-stat" }, h("b", null, installed), h("span", null, "установлено")),
108
+ h("div", { className: "int-stat" }, h("b", null, bridge.running ? "on" : "off"), h("span", null, "IDE bridge")),
109
+ ),
110
+ h("div", { className: "int-section" },
111
+ h("h3", null, "Marketplace"),
112
+ h("p", { className: "int-hint" }, "Каталог: ~/.dsh/marketplace/catalog.json или .dsh/marketplace.json. Поле sha256 проверяется; существующий навык уходит в backup."),
113
+ catalog.length > 0 ? h("div", { className: "int-items" }, catalog.map((entry) => h("article", { className: "int-item", key: entry.id },
114
+ h("div", { className: "int-item-top" }, h("code", { title: entry.id }, entry.name), h("span", null, entry.installed ? "installed" : entry.version)),
115
+ h("p", null, entry.description || entry.id),
116
+ h("div", { className: "int-row" },
117
+ h("span", { className: "int-hint" }, entry.scope),
118
+ h("button", { className: "int-btn", type: "button", disabled: busy === `install:${entry.id}` || entry.installed, onClick: () => void act("install", { id: entry.id }, `Установлен ${entry.id}`) }, entry.installed ? "Уже установлен" : busy === `install:${entry.id}` ? "Устанавливаем…" : "Установить"),
119
+ ),
120
+ ))) : h("div", { className: "int-empty" }, "Каталог пуст. Добавьте записи в ~/.dsh/marketplace/catalog.json: id, source (локальная папка), sha256, version."),
121
+ ),
122
+ h("div", { className: "int-section" },
123
+ h("h3", null, "IDE bridge"),
124
+ h("p", { className: "int-hint" }, "Localhost JSON API для будущего расширения редактора. Это протокол, не само расширение."),
125
+ h("div", { className: "int-box" },
126
+ h("div", { className: "int-row" },
127
+ h("span", null, h("i", { className: `int-dot${bridge.running ? " on" : ""}` }), bridge.running ? "Работает" : "Остановлен"),
128
+ h("div", { className: "int-row" },
129
+ bridge.running ? h("button", { className: "int-btn", type: "button", onClick: () => void act("bridge-stop", {}, "Bridge остановлен") }, "Остановить") : h("button", { className: "int-btn primary", type: "button", disabled: busy === "bridge-start", onClick: () => void act("bridge-start", {}, "Bridge запущен") }, busy === "bridge-start" ? "Запускаем…" : "Запустить"),
130
+ ),
131
+ ),
132
+ bridge.running ? h(React.Fragment, null,
133
+ h("div", { className: "int-code" }, `${bridge.url}/health?token=${bridge.token}`),
134
+ h("p", { className: "int-hint" }, "Токен живёт до остановки. Эндпоинты: /health, /context."),
135
+ ) : h("p", { className: "int-hint" }, "Слушает только 127.0.0.1 и требует bearer-токен."),
136
+ ),
137
+ ),
138
+ h("div", { className: "int-section" },
139
+ h("h3", null, "Sandbox"),
140
+ h("p", { className: "int-hint" }, sandbox.note || "Политика DSH и kit guardrails; OS-level enforcement требует DSH core."),
141
+ h("div", { className: "int-box" }, h("div", { className: "int-row" }, h("span", null, sandbox.enforcement ? "OS enforcement" : "Policy audit"), h("span", { className: "int-ok" }, "без иллюзий"))),
142
+ ),
143
+ h("p", { className: "int-hint" }, state.data?.project ? `Проект: ${state.data.project}` : "Проект определяется по рабочей папке."),
144
+ );
145
+ }
146
+
147
+ function apply(ctx) {
148
+ window.__DSH_INTEGRATIONS_CTX__ = ctx;
149
+ ctx.effect(() => {
150
+ const style = document.createElement("style");
151
+ style.id = "dsh-integrations";
152
+ style.textContent = CSS;
153
+ document.head.appendChild(style);
154
+ return () => style.remove();
155
+ }, "integrations: styles");
156
+ ctx.effect(() => ctx.slots.inject("settings.section", () => ctx.slots.register({
157
+ name: "settings.section",
158
+ id: "dsh-integrations",
159
+ order: 36,
160
+ label: () => "Интеграции",
161
+ }, IntegrationsSection)), "integrations: settings");
162
+ }
163
+
164
+ exports.apply = apply;
165
+ exports.inject = ["slots", "connection"];
166
+ return module.exports;
167
+ }
168
+ });
@@ -0,0 +1,65 @@
1
+ /**
2
+ * dsh-integrations: marketplace, IDE bridge, sandbox audit.
3
+ *
4
+ * Honest scope: the marketplace installs only local, checksummed skill
5
+ * directories; the bridge is a localhost protocol endpoint (an editor extension
6
+ * is a separate deliverable); sandbox is an audit of DSH policy, not OS-level
7
+ * enforcement.
8
+ */
9
+ import { inspectCatalog, installFromCatalog } from "./lib/catalog.js";
10
+ import { IdeBridge } from "./lib/bridge.js";
11
+ import { registerIntegrationApi } from "./lib/api.js";
12
+
13
+ export const inject = ["tools"];
14
+
15
+ function projectFrom(agent) {
16
+ return agent?.session?.header?.cwd ?? process.cwd();
17
+ }
18
+
19
+ function toolDefinition(ctx, bridge) {
20
+ return {
21
+ name: "integration_status",
22
+ description:
23
+ "Reports the local marketplace catalog, IDE bridge status, and sandbox policy audit. The marketplace installs only local checksummed skills; sandbox is policy audit, not OS enforcement.",
24
+ parameters: { type: "object", additionalProperties: false, properties: {} },
25
+ async execute(_input, exec) {
26
+ const root = projectFrom(exec?.agent);
27
+ const status = bridge.status();
28
+ return {
29
+ ok: true,
30
+ text: `integrations:\n- marketplace: ${inspectCatalog(root).length} entries\n- ide bridge: ${status.running ? status.url : "stopped"}\n- sandbox: policy audit only (no OS enforcement)`,
31
+ marketplace: inspectCatalog(root),
32
+ bridge: { running: status.running, url: status.url },
33
+ sandbox: { enforcement: false, note: "DSH permission presets + kit guardrails; OS sandbox requires DSH core/native helper" },
34
+ };
35
+ },
36
+ };
37
+ }
38
+
39
+ export function apply(ctx) {
40
+ const bridge = new IdeBridge();
41
+ const disposers = [];
42
+ ctx.effect(() => () => { for (const dispose of disposers) { try { dispose(); } catch { /* best effort */ } } void bridge.stop(); }, "integrations: cleanup");
43
+ try {
44
+ ctx.effect(() => ctx.tools.register(toolDefinition(ctx, bridge)), "integrations: status tool");
45
+ } catch (error) {
46
+ ctx.logger?.warn?.(`[integrations] tool registration failed: ${error instanceof Error ? error.message : String(error)}`);
47
+ }
48
+ try {
49
+ ctx.inject(["connection"], (child) => registerIntegrationApi(child, bridge));
50
+ } catch (error) {
51
+ ctx.logger?.warn?.(`[integrations] api skipped: ${error instanceof Error ? error.message : String(error)}`);
52
+ }
53
+ try {
54
+ ctx.inject(["commands"], (child) => {
55
+ const dispose = child.commands.register({
56
+ name: "integrations",
57
+ description: "Marketplace, IDE bridge and sandbox audit",
58
+ async execute() {
59
+ return inspectCatalog(projectFrom()).map((entry) => `${entry.installed ? "✓" : "○"} ${entry.id} ${entry.version}`).join("\n") || "Marketplace catalog is empty.";
60
+ },
61
+ });
62
+ if (typeof dispose === "function") disposers.push(dispose);
63
+ });
64
+ } catch { /* commands are optional */ }
65
+ }
@@ -0,0 +1,51 @@
1
+ import { inspectCatalog, installFromCatalog } from "./catalog.js";
2
+
3
+ export const RPC_NAMESPACE = "dsh-integrations";
4
+ const ROUTE_BASE = "/api/dsh-integrations";
5
+
6
+ function ok(rpcId, value) {
7
+ return Response.json({ type: "server-response", rpcId, result: { ok: true, value } });
8
+ }
9
+
10
+ function fail(rpcId, message) {
11
+ return Response.json({ type: "server-response", rpcId, result: { ok: false, error: { code: "integrations/bad-request", message, details: {} } } });
12
+ }
13
+
14
+ async function envelope(request) {
15
+ const body = await request.json();
16
+ if (!body || body.type !== "client-request" || typeof body.rpcId !== "string" || typeof body.method !== "string") throw new Error("bad Connection envelope");
17
+ return { rpcId: body.rpcId, method: body.method, payload: body.payload ?? {} };
18
+ }
19
+
20
+ export function registerIntegrationApi(ctx, bridge) {
21
+ const projectRoot = (payload) => payload?.cwd || ctx.get?.("sessions")?.list?.().at(-1)?.header?.cwd || process.cwd();
22
+ const sandbox = () => ({
23
+ enforcement: false,
24
+ note: "DSH permission presets and kit guardrails are policy, not an OS sandbox. AppContainer/Job Objects require DSH core or a native helper.",
25
+ });
26
+
27
+ const operation = (name, handler) => ({
28
+ path: `${ROUTE_BASE}/${name}`,
29
+ methods: ["POST"],
30
+ requestBody: "buffered",
31
+ fetch: async (request) => {
32
+ let rpcId = "invalid-request";
33
+ try {
34
+ const value = await envelope(request);
35
+ rpcId = value.rpcId;
36
+ if (value.method !== `${RPC_NAMESPACE}/${name}`) throw new Error("endpoint/method mismatch");
37
+ return ok(rpcId, await handler(value.payload ?? {}, projectRoot(value.payload)));
38
+ } catch (error) {
39
+ return fail(rpcId, error instanceof Error ? error.message : String(error));
40
+ }
41
+ },
42
+ });
43
+
44
+ const routes = [
45
+ operation("status", (payload, root) => ({ catalog: inspectCatalog(root), bridge: bridge.status(), sandbox: sandbox(), project: root })),
46
+ operation("install", (payload, root) => installFromCatalog(root, payload.id)),
47
+ operation("bridge-start", async (payload, root) => bridge.start(async () => ({ project: root, pid: process.pid, time: new Date().toISOString() }))),
48
+ operation("bridge-stop", () => bridge.stop()),
49
+ ];
50
+ return routes.map((route) => ctx.connection.rpc.register(route));
51
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * IDE bridge: a localhost-only JSON endpoint an editor extension can poll.
3
+ *
4
+ * It is deliberately a protocol bridge, not an editor extension. The token is
5
+ * generated per start, never logged, and every request must present it.
6
+ */
7
+ import crypto from "node:crypto";
8
+ import http from "node:http";
9
+
10
+ export class IdeBridge {
11
+ constructor() {
12
+ this.server = null;
13
+ this.token = "";
14
+ this.port = 0;
15
+ this.startedAt = null;
16
+ }
17
+
18
+ async start(handler) {
19
+ if (this.server) return this.status();
20
+ this.token = crypto.randomBytes(24).toString("hex");
21
+ this.server = http.createServer(async (request, response) => {
22
+ const url = new URL(request.url ?? "/", "http://127.0.0.1");
23
+ if (url.searchParams.get("token") !== this.token && request.headers.authorization !== `Bearer ${this.token}`) {
24
+ response.writeHead(401, { "content-type": "application/json" });
25
+ response.end(JSON.stringify({ error: "unauthorized" }));
26
+ return;
27
+ }
28
+ try {
29
+ if (request.method !== "GET") throw Object.assign(new Error("method not allowed"), { status: 405 });
30
+ if (url.pathname === "/health") {
31
+ response.writeHead(200, { "content-type": "application/json" });
32
+ response.end(JSON.stringify({ ok: true, service: "dsh-ide-bridge", version: "1.0.0" }));
33
+ return;
34
+ }
35
+ if (url.pathname === "/context") {
36
+ const value = await handler?.();
37
+ response.writeHead(200, { "content-type": "application/json" });
38
+ response.end(JSON.stringify(value ?? {}));
39
+ return;
40
+ }
41
+ response.writeHead(404, { "content-type": "application/json" });
42
+ response.end(JSON.stringify({ error: "not found" }));
43
+ } catch (error) {
44
+ response.writeHead(error?.status ?? 500, { "content-type": "application/json" });
45
+ response.end(JSON.stringify({ error: error instanceof Error ? error.message : String(error) }));
46
+ }
47
+ });
48
+ await new Promise((resolve, reject) => {
49
+ this.server.once("error", reject);
50
+ this.server.listen(0, "127.0.0.1", resolve);
51
+ });
52
+ this.port = this.server.address().port;
53
+ this.startedAt = new Date().toISOString();
54
+ return this.status();
55
+ }
56
+
57
+ status() {
58
+ return {
59
+ running: Boolean(this.server),
60
+ port: this.port,
61
+ url: this.server ? `http://127.0.0.1:${this.port}` : "",
62
+ token: this.server ? this.token : "",
63
+ startedAt: this.startedAt,
64
+ };
65
+ }
66
+
67
+ async stop() {
68
+ if (!this.server) return { running: false };
69
+ await new Promise((resolve) => this.server.close(resolve));
70
+ this.server = null;
71
+ this.port = 0;
72
+ this.token = "";
73
+ this.startedAt = null;
74
+ return { running: false };
75
+ }
76
+ }
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Local marketplace catalog.
3
+ *
4
+ * This is intentionally not a remote registry: entries point at a local skill
5
+ * directory and carry an optional SHA-256 of SKILL.md. Install verifies the
6
+ * digest, backs up an existing skill, then copies the directory. No network.
7
+ */
8
+ import crypto from "node:crypto";
9
+ import fs from "node:fs";
10
+ import os from "node:os";
11
+ import path from "node:path";
12
+
13
+ export function marketplaceHome() {
14
+ return path.join(dshHome(), "marketplace");
15
+ }
16
+
17
+ function dshHome() {
18
+ return process.env.DSH_HOME ? path.resolve(process.env.DSH_HOME) : path.join(os.homedir(), ".dsh");
19
+ }
20
+
21
+ export function catalogPath(scope = "global", projectRoot = "") {
22
+ return scope === "project" && projectRoot
23
+ ? path.join(projectRoot, ".dsh", "marketplace.json")
24
+ : path.join(marketplaceHome(), "catalog.json");
25
+ }
26
+
27
+ function readEntries(file, scope) {
28
+ try {
29
+ const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
30
+ const entries = Array.isArray(parsed) ? parsed : parsed.entries;
31
+ return (Array.isArray(entries) ? entries : [])
32
+ .filter((entry) => entry && typeof entry.id === "string" && typeof entry.source === "string")
33
+ .map((entry) => ({ ...entry, scope }));
34
+ } catch {
35
+ return [];
36
+ }
37
+ }
38
+
39
+ export function loadCatalog(projectRoot = "") {
40
+ const entries = [
41
+ ...readEntries(catalogPath("global"), "global"),
42
+ ...(projectRoot ? readEntries(catalogPath("project", projectRoot), "project") : []),
43
+ ];
44
+ const seen = new Set();
45
+ return entries.filter((entry) => (seen.has(entry.id) ? false : (seen.add(entry.id), true)));
46
+ }
47
+
48
+ function sha256(file) {
49
+ return crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex");
50
+ }
51
+
52
+ export function inspectCatalog(projectRoot = "") {
53
+ return loadCatalog(projectRoot).map((entry) => {
54
+ const target = path.join(dshHome(), "skills", entry.id);
55
+ return {
56
+ id: entry.id,
57
+ name: entry.name || entry.id,
58
+ version: entry.version || "0.0.0",
59
+ description: entry.description || "",
60
+ scope: entry.scope,
61
+ source: entry.source,
62
+ installed: fs.existsSync(path.join(target, "SKILL.md")),
63
+ };
64
+ });
65
+ }
66
+
67
+ export function installFromCatalog(projectRoot, id) {
68
+ const entry = loadCatalog(projectRoot).find((item) => item.id === String(id));
69
+ if (!entry) throw new Error(`marketplace: entry not found: ${id}`);
70
+ const source = path.resolve(entry.source);
71
+ const skillFile = path.join(source, "SKILL.md");
72
+ if (!fs.existsSync(skillFile)) throw new Error(`marketplace: source has no SKILL.md: ${source}`);
73
+ if (entry.sha256) {
74
+ const actual = sha256(skillFile);
75
+ if (actual !== String(entry.sha256).toLowerCase()) throw new Error("marketplace: SHA-256 mismatch; refusing to install");
76
+ }
77
+ const target = path.join(dshHome(), "skills", entry.id);
78
+ let backup = "";
79
+ if (fs.existsSync(target)) {
80
+ backup = path.join(dshHome(), ".dsh-kit-backups", "marketplace", `${entry.id}-${Date.now()}`);
81
+ fs.mkdirSync(path.dirname(backup), { recursive: true });
82
+ fs.cpSync(target, backup, { recursive: true });
83
+ }
84
+ fs.mkdirSync(path.dirname(target), { recursive: true });
85
+ fs.cpSync(source, target, { recursive: true });
86
+ return { id: entry.id, target, backup, version: entry.version || "0.0.0" };
87
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "dsh-integrations",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "description": "Marketplace, IDE bridge and sandbox audit for DSH Desktop Kit",
7
+ "exports": {
8
+ ".": "./index.js",
9
+ "./client": "./client.js"
10
+ }
11
+ }