dsh-desktop-kit 2.20.0 → 2.23.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 +20 -0
- package/README.md +26 -26
- package/client.js +11 -5
- package/docs/TEST-2.21.0.md +29 -0
- package/docs/TEST-2.22.0.md +24 -0
- package/docs/TEST-2.23.0.md +32 -0
- package/package.json +2 -2
- package/plugins/dsh-integrations/index.js +38 -20
- package/plugins/dsh-integrations/lib/api.js +3 -2
- package/plugins/dsh-integrations/lib/catalog.js +36 -1
- package/plugins/dsh-integrations/lib/job-sandbox.js +31 -0
- package/plugins/dsh-integrations/lib/job-sandbox.ps1 +50 -0
- package/plugins/dsh-mcp-manager/client.js +10 -4
- package/plugins/dsh-mcp-manager/lib/api.js +9 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.23.0 (2026-11-12)
|
|
4
|
+
|
|
5
|
+
- **Fixed live 404.** Integration routes now register through `ctx.connection.fetch.register` with top-level `inject:["tools","connection"]`; verified by a real DSH web profile, auth cookie and POST.
|
|
6
|
+
- **HTTP E2E.** `tools/e2e-http.mjs`: isolated DSH_HOME → install → real web → token cookie → `/api/dsh-integrations/status` → 200.
|
|
7
|
+
- **Trust button.** «Проверить и доверять» с подтверждением команды/URL; пресеты untrusted.
|
|
8
|
+
- **Remote artifact install.** HTTPS `.tgz`, SHA-256, 5 MB limit, path traversal check, backup.
|
|
9
|
+
- **Job Object sandbox.** `sandbox_run` (2.21).
|
|
10
|
+
|
|
11
|
+
## 2.22.0 (2026-11-12)
|
|
12
|
+
|
|
13
|
+
- **MCP trust button.** «Проверить и доверять» с подтверждением; пресеты больше не trusted по умолчанию; клиентские пресеты GitHub/Filesystem обновлены.
|
|
14
|
+
- **Remote artifact install.** `installFromCatalog` скачивает `.tgz` по HTTPS, проверяет SHA-256, отклоняет path traversal, ограничивает 5 MB, извлекает и ставит в `~/.dsh/skills`.
|
|
15
|
+
- **Tests.** remote tgz install, local HTTP loopback, 5 routes.
|
|
16
|
+
|
|
17
|
+
## 2.21.0 (2026-11-12)
|
|
18
|
+
|
|
19
|
+
- **Windows Job Objects.** `sandbox_run`: memory/process/timeout limits, kill-on-close, cwd внутри проекта; не файловая/сетевая изоляция.
|
|
20
|
+
- **MCP presets.** GitHub — official remote `https://api.githubcopilot.com/mcp/`; archived github/postgres presets удалены; trust только вручную.
|
|
21
|
+
- **Tests.** sandbox simple/timeout, integrations routes.
|
|
22
|
+
|
|
3
23
|
## 2.20.0 (2026-11-12)
|
|
4
24
|
|
|
5
25
|
- **VS Code extension.** `integrations/vscode`: `/health`, `/context`, bearer, loopback-only URL; packaging через `vsce`.
|
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# DSH Desktop Kit 2.
|
|
1
|
+
# DSH Desktop Kit 2.23
|
|
2
2
|
|
|
3
3
|
**MCP с OAuth, sampling и elicitation. Агенты, worktrees и рой с общей доской. Интерфейс, который не мешает.**
|
|
4
4
|
|
|
5
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
|
-

|
|
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
|
-

|
|
14
14
|
|
|
15
|
-

|
|
16
16
|
|
|
17
|
-

|
|
18
18
|
|
|
19
19
|
## Агенты, worktrees и рой
|
|
20
20
|
|
|
@@ -26,17 +26,17 @@
|
|
|
26
26
|
- **Живые сообщения** — `team_message` отправляет текст лиду (`to="parent"`) или участнику по run id; копия каждого сообщения остаётся в board.
|
|
27
27
|
- **Инструкции проекта** — `AGENTS.md`/`CLAUDE.md` иерархически (root → вложенные папки → `.dsh`) с `@import`; MCP roots сообщает корень проекта.
|
|
28
28
|
|
|
29
|
-

|
|
30
30
|
|
|
31
|
-

|
|
32
32
|
|
|
33
|
-

|
|
34
34
|
|
|
35
|
-
Транскрипт сохраняется в `.dsh/agents/transcripts/<run>.json` (0600) и доступен после restart.\n\n и доступен после restart.\n\n
|
|
36
36
|
|
|
37
|
-

|
|
38
38
|
|
|
39
|
-

|
|
40
40
|
|
|
41
41
|
## Интеграции
|
|
42
42
|
|
|
@@ -46,9 +46,9 @@ Marketplace, IDE bridge и sandbox-аудит — в одном экране **
|
|
|
46
46
|
- **IDE bridge** — localhost JSON API (`/health`, `/context`) с bearer-токеном; расширение редактора — отдельный проект.
|
|
47
47
|
- **Sandbox** — честный аудит: DSH preset + kit guardrails — это политика, не OS sandbox.
|
|
48
48
|
|
|
49
|
-

|
|
50
50
|
|
|
51
|
-

|
|
52
52
|
|
|
53
53
|
## Ноль настройки
|
|
54
54
|
|
|
@@ -70,11 +70,11 @@ MCP-предложения — это только **ссылки на подд
|
|
|
70
70
|
- **Worktrees и фоновые агенты.** `project_worktree` создаёт ветку `dsh/<slug>` и отдельную папку `.dsh/worktrees/<slug>`; `project_agent ... worktree=auto background=true` запускает агента в изоляции, а страница **Агенты** показывает worktrees и очередь запусков с кнопкой «Остановить».
|
|
71
71
|
- **Инструкции проекта.** `AGENTS.md` и `CLAUDE.md` читаются иерархически (root → вложенные папки → `.dsh`) с `@import`; MCP roots сообщает серверу корень проекта.
|
|
72
72
|
|
|
73
|
-

|
|
74
74
|
|
|
75
|
-

|
|
76
76
|
|
|
77
|
-
**v2.
|
|
77
|
+
**v2.23.0** · MIT · проверено на DSH `0.2.1-rc.5` и `0.2.2-rc.1` (Windows 11) · без внешних зависимостей и телеметрии
|
|
78
78
|
|
|
79
79
|
**План развития:** [docs/ROADMAP-3.0.md](docs/ROADMAP-3.0.md) — Memory Fabric, семантическое
|
|
80
80
|
слияние, локальный индекс памяти, шифрованные переносы, Memory Hub и npm trusted publishing.
|
|
@@ -169,27 +169,27 @@ MCP-предложения — это только **ссылки на подд
|
|
|
169
169
|
- перед каждой синхронизацией проверяется, что репозиторий всё ещё приватный;
|
|
170
170
|
- секреты и PII вычищаются, домашние пути заменяются токеном `%DSH_HOME%`; LLM не вызывается — **0 токенов**.
|
|
171
171
|
|
|
172
|
-

|
|
173
173
|
|
|
174
|
-

|
|
175
175
|
|
|
176
176
|
## Скриншоты
|
|
177
177
|
|
|
178
178
|
### Skills Studio: каталог, стоимость и редактор
|
|
179
179
|
|
|
180
|
-

|
|
181
181
|
|
|
182
|
-

|
|
183
183
|
|
|
184
184
|
### Token Lab: куда уходит контекст
|
|
185
185
|
|
|
186
|
-

|
|
187
187
|
|
|
188
188
|
### Тёмная тема и мобильный
|
|
189
189
|
|
|
190
|
-

|
|
191
191
|
|
|
192
|
-

|
|
193
193
|
|
|
194
194
|
## Окно-напоминание: пиковый тариф
|
|
195
195
|
|
|
@@ -199,11 +199,11 @@ DeepSeek включает двойной тариф в пиковые часы (
|
|
|
199
199
|
- **в окне** — красная карточка: причина, границы окна в местном времени и UTC, живой отсчёт до конца и рекомендация, когда вернуться;
|
|
200
200
|
- **после окна** — карточка исчезает; состояние всегда доступно через `window.__DSH_PEAK_GUARD__.state()`.
|
|
201
201
|
|
|
202
|
-

|
|
203
203
|
|
|
204
|
-

|
|
205
205
|
|
|
206
|
-

|
|
207
207
|
|
|
208
208
|
Подробности и настройки — [plugins/dsh-peak-guard/README.md](plugins/dsh-peak-guard/README.md).
|
|
209
209
|
|
package/client.js
CHANGED
|
@@ -6970,9 +6970,8 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
6970
6970
|
`;
|
|
6971
6971
|
|
|
6972
6972
|
const PRESETS = [
|
|
6973
|
-
{ id: "github", title: "GitHub", subtitle: "
|
|
6974
|
-
{ id: "
|
|
6975
|
-
{ id: "filesystem", title: "Filesystem", subtitle: "Папка проекта, без токена", transport: "stdio", command: "npx", args: "-y\n@modelcontextprotocol/server-filesystem\n.", trusted: true },
|
|
6973
|
+
{ id: "github", title: "GitHub", subtitle: "Официальный remote MCP", transport: "http", command: "npx", args: "", url: "https://api.githubcopilot.com/mcp/", tokenEnv: "GITHUB_PERSONAL_ACCESS_TOKEN", tokenLabel: "GitHub PAT", trusted: false },
|
|
6974
|
+
{ id: "filesystem", title: "Filesystem", subtitle: "Папка проекта, без токена", transport: "stdio", command: "npx", args: "-y\n@modelcontextprotocol/server-filesystem\n.", trusted: false },
|
|
6976
6975
|
];
|
|
6977
6976
|
|
|
6978
6977
|
function call(ctx, operation, payload, timeout = 60000) {
|
|
@@ -6992,7 +6991,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
6992
6991
|
);
|
|
6993
6992
|
}
|
|
6994
6993
|
|
|
6995
|
-
function ServerCard({ server, busy, onToggle, onTest, onTools, onPrompts, onOAuth, onRemove, tools }) {
|
|
6994
|
+
function ServerCard({ server, busy, onToggle, onTrust, onTest, onTools, onPrompts, onOAuth, onRemove, tools }) {
|
|
6996
6995
|
const [open, setOpen] = useState(false);
|
|
6997
6996
|
const connected = server.connected;
|
|
6998
6997
|
const status = connected ? "on" : (server.error ? "err" : "off");
|
|
@@ -7014,6 +7013,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
7014
7013
|
h("div", { className: "mcp-controls" },
|
|
7015
7014
|
h(Toggle, { checked: server.enabled, label: "Включён", disabled: busy, onChange: (value) => onToggle(server.id, { enabled: value }) }),
|
|
7016
7015
|
h(Toggle, { checked: server.trusted, label: "Доверен", disabled: busy, onChange: (value) => onToggle(server.id, { trusted: value }) }),
|
|
7016
|
+
!server.trusted ? h("button", { className: "mcp-btn primary", disabled: busy, onClick: () => onTrust(server) }, "Проверить и доверять") : null,
|
|
7017
7017
|
h("div", { className: "mcp-actions" },
|
|
7018
7018
|
h("button", { className: "mcp-btn ghost", disabled: busy, onClick: () => onTest(server.id) }, "Проверить"),
|
|
7019
7019
|
server.transport === "http" ? h("button", { className: "mcp-btn ghost", disabled: busy, onClick: () => onOAuth(server.id) }, server.oauth?.hasToken ? "OAuth" : "Войти") : null,
|
|
@@ -7362,6 +7362,12 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
7362
7362
|
busy,
|
|
7363
7363
|
tools: tools[server.id],
|
|
7364
7364
|
onToggle: (id, flags) => run("toggle", { id, ...flags }, "Настройки сервера обновлены"),
|
|
7365
|
+
onTrust: (server) => {
|
|
7366
|
+
const target = server.url || server.command || server.id;
|
|
7367
|
+
if (window.confirm(`Доверять MCP-серверу «${server.id}»?\n\n${target}\n\nОн получит доступ к инструментам и сможет выполнять команды от твоего имени.`)) {
|
|
7368
|
+
void run("toggle", { id: server.id, trusted: true, enabled: true }, "Сервер включён и доверен");
|
|
7369
|
+
}
|
|
7370
|
+
},
|
|
7365
7371
|
onTest: async (id) => {
|
|
7366
7372
|
setBusy(true);
|
|
7367
7373
|
try {
|
|
@@ -8253,7 +8259,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
8253
8259
|
if (__kitErrors.length <= 5) console.error("[dsh-desktop-kit] registration failed:", label, message);
|
|
8254
8260
|
};
|
|
8255
8261
|
try {
|
|
8256
|
-
window.__DSH_DESKTOP_KIT__ = { version: "2.
|
|
8262
|
+
window.__DSH_DESKTOP_KIT__ = { version: "2.23.0", parts: __partNames, errors: __kitErrors, ready: false };
|
|
8257
8263
|
} catch {}
|
|
8258
8264
|
const __inject = [];
|
|
8259
8265
|
for (const __part of __parts) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# DSH Desktop Kit 2.21.0 — тест
|
|
2
|
+
|
|
3
|
+
Дата: 2026-11-12.
|
|
4
|
+
|
|
5
|
+
## Job Objects
|
|
6
|
+
|
|
7
|
+
- `sandbox_run` запускает команду в Windows Job Object.
|
|
8
|
+
- Лимиты: memoryMb, processLimit, timeoutMs; kill-on-close.
|
|
9
|
+
- cwd только внутри проекта.
|
|
10
|
+
- Тест: простой процесс, timeout 1s → exit 124.
|
|
11
|
+
|
|
12
|
+
## MCP trust
|
|
13
|
+
|
|
14
|
+
- GitHub preset переведён на официальный remote `https://api.githubcopilot.com/mcp/`.
|
|
15
|
+
- Archived `server-github`/`server-postgres` больше не пресеты.
|
|
16
|
+
- `trusted:false` у пресетов: trust только вручную.
|
|
17
|
+
|
|
18
|
+
## Remote marketplace
|
|
19
|
+
|
|
20
|
+
- HTTPS + SHA-256 sync, atomic remote.json, backup.
|
|
21
|
+
|
|
22
|
+
## IDE
|
|
23
|
+
|
|
24
|
+
- VS Code thin client: health/context.
|
|
25
|
+
|
|
26
|
+
## E2E
|
|
27
|
+
|
|
28
|
+
- profile mount через реальный CLI — OK.
|
|
29
|
+
- HTTP routes под GUI auth — не автоматизированы.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# DSH Desktop Kit 2.22.0 — тест
|
|
2
|
+
|
|
3
|
+
Дата: 2026-11-12.
|
|
4
|
+
|
|
5
|
+
## MCP trust-flow
|
|
6
|
+
|
|
7
|
+
- Пресеты GitHub/Filesystem: `trusted:false`.
|
|
8
|
+
- ServerCard: кнопка «Проверить и доверять» + confirm с командой/URL.
|
|
9
|
+
- После подтверждения: trusted+enabled.
|
|
10
|
+
- Deprecated presets удалены из host и client.
|
|
11
|
+
|
|
12
|
+
## Remote marketplace
|
|
13
|
+
|
|
14
|
+
- `installFromCatalog` поддерживает `{ url, sha256 }`.
|
|
15
|
+
- HTTPS, max 5 MB, SHA-256, tar path traversal check.
|
|
16
|
+
- Тест: loopback `.tgz` → установлен `SKILL.md`.
|
|
17
|
+
- `loadCatalog` принимает entry без `source`, если есть `url`.
|
|
18
|
+
|
|
19
|
+
## Проверки
|
|
20
|
+
|
|
21
|
+
- `marketplace-remote-tests` — OK.
|
|
22
|
+
- `integrations-tests` — OK.
|
|
23
|
+
- `npm test` — OK.
|
|
24
|
+
- build/check — OK.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# DSH Desktop Kit 2.23.0 — тест
|
|
2
|
+
|
|
3
|
+
Дата: 2026-11-12.
|
|
4
|
+
|
|
5
|
+
## Live HTTP
|
|
6
|
+
|
|
7
|
+
- Изолированный `DSH_HOME`, профиль web, установка tarball.
|
|
8
|
+
- `dsh --profile e2e --no-open --port 0`.
|
|
9
|
+
- Токен из `/?token=…` → cookie.
|
|
10
|
+
- `POST /api/dsh-integrations/status` → **200**, `result.ok=true`.
|
|
11
|
+
- Это поймало реальную причину 404: неверный registry (`rpc` вместо `fetch`) и отсутствие `connection` в inject.
|
|
12
|
+
|
|
13
|
+
## Trust
|
|
14
|
+
|
|
15
|
+
- Кнопка с confirm; пресеты untrusted.
|
|
16
|
+
- Deprecated presets удалены.
|
|
17
|
+
|
|
18
|
+
## Remote install
|
|
19
|
+
|
|
20
|
+
- `.tgz` HTTPS, SHA-256, 5 MB, path traversal.
|
|
21
|
+
- Loopback test.
|
|
22
|
+
|
|
23
|
+
## Sandbox
|
|
24
|
+
|
|
25
|
+
- Job Object: simple/timeout — OK.
|
|
26
|
+
|
|
27
|
+
## Проверки
|
|
28
|
+
|
|
29
|
+
- `e2e-http` — OK.
|
|
30
|
+
- `marketplace-remote-tests` — OK.
|
|
31
|
+
- `integrations-tests` — OK.
|
|
32
|
+
- `npm test` — exit 0.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-desktop-kit",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "DeepSeek Harness desktop kit 2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
|
+
"description": "DeepSeek Harness desktop kit 2.23.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",
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dsh-integrations: marketplace, IDE bridge, sandbox audit.
|
|
3
3
|
*
|
|
4
|
-
* Honest scope: the marketplace installs
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* enforcement.
|
|
4
|
+
* Honest scope: the marketplace installs checksummed skills (local or HTTPS
|
|
5
|
+
* archive); the bridge is a localhost protocol endpoint; sandbox_run is Windows
|
|
6
|
+
* Job Object process containment, not filesystem/network isolation.
|
|
8
7
|
*/
|
|
9
8
|
import { inspectCatalog, installFromCatalog } from "./lib/catalog.js";
|
|
10
9
|
import { IdeBridge } from "./lib/bridge.js";
|
|
11
10
|
import { registerIntegrationApi } from "./lib/api.js";
|
|
11
|
+
import { runJobSandbox } from "./lib/job-sandbox.js";
|
|
12
|
+
import path from "node:path";
|
|
12
13
|
|
|
13
|
-
export const inject = ["tools"];
|
|
14
|
+
export const inject = ["tools", "connection"];
|
|
14
15
|
|
|
15
16
|
function projectFrom(agent) {
|
|
16
17
|
return agent?.session?.header?.cwd ?? process.cwd();
|
|
@@ -20,44 +21,61 @@ function toolDefinition(ctx, bridge) {
|
|
|
20
21
|
return {
|
|
21
22
|
name: "integration_status",
|
|
22
23
|
description:
|
|
23
|
-
"Reports the
|
|
24
|
+
"Reports the marketplace catalog, IDE bridge status, and sandbox capabilities. Marketplace supports local and HTTPS checksummed archives; sandbox_run enforces Job Object memory/process/time limits, not filesystem or network isolation.",
|
|
24
25
|
parameters: { type: "object", additionalProperties: false, properties: {} },
|
|
25
26
|
async execute(_input, exec) {
|
|
26
27
|
const root = projectFrom(exec?.agent);
|
|
27
28
|
const status = bridge.status();
|
|
28
29
|
return {
|
|
29
30
|
ok: true,
|
|
30
|
-
text: `integrations:\n- marketplace: ${inspectCatalog(root).length} entries\n- ide bridge: ${status.running ? status.url : "stopped"}\n- sandbox:
|
|
31
|
+
text: `integrations:\n- marketplace: ${inspectCatalog(root).length} entries\n- ide bridge: ${status.running ? status.url : "stopped"}\n- sandbox: Windows Job Objects (process/memory/time), no FS/network isolation`,
|
|
31
32
|
marketplace: inspectCatalog(root),
|
|
32
33
|
bridge: { running: status.running, url: status.url },
|
|
33
|
-
sandbox: { enforcement: false,
|
|
34
|
+
sandbox: { enforcement: false, jobObjects: process.platform === "win32", optInTool: "sandbox_run", note: "Job Objects limit memory/processes/time; filesystem and network are not isolated" },
|
|
34
35
|
};
|
|
35
36
|
},
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
function sandboxTool() {
|
|
41
|
+
return {
|
|
42
|
+
name: "sandbox_run",
|
|
43
|
+
description:
|
|
44
|
+
"Runs a command inside a Windows Job Object with memory, process and timeout limits (kill-on-close). This is process containment only, not filesystem or network sandboxing. cwd must be inside the project.",
|
|
45
|
+
parameters: {
|
|
46
|
+
type: "object",
|
|
47
|
+
additionalProperties: false,
|
|
48
|
+
required: ["command"],
|
|
49
|
+
properties: {
|
|
50
|
+
command: { type: "string" },
|
|
51
|
+
args: { type: "array", items: { type: "string" } },
|
|
52
|
+
cwd: { type: "string" },
|
|
53
|
+
timeoutMs: { type: "number" },
|
|
54
|
+
memoryMb: { type: "number" },
|
|
55
|
+
processLimit: { type: "number" },
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
async execute(input, exec) {
|
|
59
|
+
const root = projectFrom(exec?.agent);
|
|
60
|
+
const cwd = path.resolve(input?.cwd || root);
|
|
61
|
+
if (cwd !== path.resolve(root) && !cwd.startsWith(`${path.resolve(root)}${path.sep}`)) throw new Error("sandbox: cwd must be inside the project");
|
|
62
|
+
return runJobSandbox({ ...input, cwd });
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
39
67
|
export function apply(ctx) {
|
|
40
68
|
const bridge = new IdeBridge();
|
|
41
69
|
ctx.effect(() => () => { void bridge.stop(); }, "integrations: cleanup");
|
|
42
70
|
try {
|
|
43
71
|
ctx.effect(() => ctx.tools.register(toolDefinition(ctx, bridge)), "integrations: status tool");
|
|
72
|
+
ctx.effect(() => ctx.tools.register(sandboxTool()), "integrations: sandbox tool");
|
|
44
73
|
} catch (error) {
|
|
45
74
|
ctx.logger?.warn?.(`[integrations] tool registration failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
46
75
|
}
|
|
47
76
|
try {
|
|
48
77
|
registerIntegrationApi(ctx, bridge);
|
|
49
78
|
} catch (error) {
|
|
50
|
-
ctx.logger?.warn?.(`[integrations]
|
|
51
|
-
try {
|
|
52
|
-
ctx.inject(["connection"], (child) => {
|
|
53
|
-
try {
|
|
54
|
-
registerIntegrationApi(child, bridge);
|
|
55
|
-
} catch (cause) {
|
|
56
|
-
child.logger?.warn?.(`[integrations] api registration failed: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
} catch (cause) {
|
|
60
|
-
ctx.logger?.warn?.(`[integrations] api skipped: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
61
|
-
}
|
|
79
|
+
ctx.logger?.warn?.(`[integrations] api registration failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
62
80
|
}
|
|
63
81
|
}
|
|
@@ -19,7 +19,8 @@ async function envelope(request) {
|
|
|
19
19
|
|
|
20
20
|
export function registerIntegrationApi(ctx, bridge) {
|
|
21
21
|
const connection = ctx.connection ?? ctx.get?.("connection");
|
|
22
|
-
|
|
22
|
+
const registry = connection?.fetch ?? connection?.rpc;
|
|
23
|
+
if (!registry?.register) throw new Error("connection.fetch.rpc service is unavailable");
|
|
23
24
|
const projectRoot = (payload) => payload?.cwd || ctx.get?.("sessions")?.list?.().at(-1)?.header?.cwd || process.cwd();
|
|
24
25
|
const sandbox = () => ({
|
|
25
26
|
enforcement: false,
|
|
@@ -50,5 +51,5 @@ export function registerIntegrationApi(ctx, bridge) {
|
|
|
50
51
|
operation("bridge-stop", () => bridge.stop()),
|
|
51
52
|
operation("sync", async (payload, root) => syncCatalog(payload.url, payload.sha256, { projectRoot: root })),
|
|
52
53
|
];
|
|
53
|
-
return routes.map((route) =>
|
|
54
|
+
return routes.map((route) => registry.register(route));
|
|
54
55
|
}
|
|
@@ -9,6 +9,7 @@ import crypto from "node:crypto";
|
|
|
9
9
|
import fs from "node:fs";
|
|
10
10
|
import os from "node:os";
|
|
11
11
|
import path from "node:path";
|
|
12
|
+
import { execFileSync } from "node:child_process";
|
|
12
13
|
|
|
13
14
|
export function marketplaceHome() {
|
|
14
15
|
return path.join(dshHome(), "marketplace");
|
|
@@ -30,7 +31,7 @@ function readEntries(file, scope) {
|
|
|
30
31
|
const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
31
32
|
const entries = Array.isArray(parsed) ? parsed : parsed.entries;
|
|
32
33
|
return (Array.isArray(entries) ? entries : [])
|
|
33
|
-
.filter((entry) => entry && typeof entry.id === "string" && typeof entry.source === "string")
|
|
34
|
+
.filter((entry) => entry && typeof entry.id === "string" && (typeof entry.source === "string" || typeof entry.url === "string"))
|
|
34
35
|
.map((entry) => ({ ...entry, scope }));
|
|
35
36
|
} catch {
|
|
36
37
|
return [];
|
|
@@ -99,6 +100,7 @@ export function inspectCatalog(projectRoot = "") {
|
|
|
99
100
|
export function installFromCatalog(projectRoot, id) {
|
|
100
101
|
const entry = loadCatalog(projectRoot).find((item) => item.id === String(id));
|
|
101
102
|
if (!entry) throw new Error(`marketplace: entry not found: ${id}`);
|
|
103
|
+
if (typeof entry.url === "string" && entry.url) return installRemote(entry);
|
|
102
104
|
const source = path.resolve(entry.source);
|
|
103
105
|
const skillFile = path.join(source, "SKILL.md");
|
|
104
106
|
if (!fs.existsSync(skillFile)) throw new Error(`marketplace: source has no SKILL.md: ${source}`);
|
|
@@ -106,6 +108,10 @@ export function installFromCatalog(projectRoot, id) {
|
|
|
106
108
|
const actual = sha256(skillFile);
|
|
107
109
|
if (actual !== String(entry.sha256).toLowerCase()) throw new Error("marketplace: SHA-256 mismatch; refusing to install");
|
|
108
110
|
}
|
|
111
|
+
return copySkill(entry, source);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function copySkill(entry, source) {
|
|
109
115
|
const target = path.join(dshHome(), "skills", entry.id);
|
|
110
116
|
let backup = "";
|
|
111
117
|
if (fs.existsSync(target)) {
|
|
@@ -117,3 +123,32 @@ export function installFromCatalog(projectRoot, id) {
|
|
|
117
123
|
fs.cpSync(source, target, { recursive: true });
|
|
118
124
|
return { id: entry.id, target, backup, version: entry.version || "0.0.0" };
|
|
119
125
|
}
|
|
126
|
+
|
|
127
|
+
async function installRemote(entry) {
|
|
128
|
+
const parsed = new URL(entry.url);
|
|
129
|
+
const loopback = parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost";
|
|
130
|
+
if (parsed.protocol !== "https:" && !(loopback && parsed.protocol === "http:")) throw new Error("marketplace: remote skill must use HTTPS (localhost HTTP allowed for tests)");
|
|
131
|
+
if (!/^[a-f0-9]{64}$/iu.test(String(entry.sha256 || ""))) throw new Error("marketplace: remote skill requires SHA-256 of the archive");
|
|
132
|
+
const response = await fetch(parsed, { redirect: "error" });
|
|
133
|
+
if (!response.ok) throw new Error(`marketplace: skill HTTP ${response.status}`);
|
|
134
|
+
const bytes = Buffer.from(await response.arrayBuffer());
|
|
135
|
+
if (bytes.length > 5 * 1024 * 1024) throw new Error("marketplace: skill archive is too large (max 5 MB)");
|
|
136
|
+
const actual = crypto.createHash("sha256").update(bytes).digest("hex");
|
|
137
|
+
if (actual !== String(entry.sha256).toLowerCase()) throw new Error("marketplace: archive SHA-256 mismatch");
|
|
138
|
+
const work = fs.mkdtempSync(path.join(os.tmpdir(), `dsh-market-${entry.id}-`));
|
|
139
|
+
try {
|
|
140
|
+
const archive = path.join(work, "skill.tgz");
|
|
141
|
+
fs.writeFileSync(archive, bytes);
|
|
142
|
+
const extract = path.join(work, "source");
|
|
143
|
+
fs.mkdirSync(extract);
|
|
144
|
+
const entries = execFileSync("tar", ["-tzf", archive], { encoding: "utf8", timeout: 30_000 }).split(/\r?\n/u).filter(Boolean);
|
|
145
|
+
if (entries.some((name) => name.startsWith("/") || name.split("/").includes(".."))) throw new Error("marketplace: archive contains an unsafe path");
|
|
146
|
+
execFileSync("tar", ["-xzf", archive, "-C", extract], { timeout: 30_000 });
|
|
147
|
+
const files = fs.readdirSync(extract);
|
|
148
|
+
const root = files.length === 1 && fs.statSync(path.join(extract, files[0])).isDirectory() ? path.join(extract, files[0]) : extract;
|
|
149
|
+
if (!fs.existsSync(path.join(root, "SKILL.md"))) throw new Error("marketplace: archive has no SKILL.md");
|
|
150
|
+
return copySkill(entry, root);
|
|
151
|
+
} finally {
|
|
152
|
+
fs.rmSync(work, { recursive: true, force: true });
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const script = path.join(path.dirname(fileURLToPath(import.meta.url)), "job-sandbox.ps1");
|
|
6
|
+
|
|
7
|
+
export function runJobSandbox({ command, args = [], cwd = process.cwd(), timeoutMs = 30_000, memoryMb = 512, processLimit = 16 } = {}) {
|
|
8
|
+
if (process.platform !== "win32") return { supported: false, error: "Job Objects are Windows-only" };
|
|
9
|
+
if (typeof command !== "string" || !command.trim()) throw new Error("sandbox: command is required");
|
|
10
|
+
const spec = {
|
|
11
|
+
command,
|
|
12
|
+
args: Array.isArray(args) ? args.map(String) : [],
|
|
13
|
+
cwd,
|
|
14
|
+
timeoutMs: Math.max(1000, Math.min(300_000, Number(timeoutMs) || 30_000)),
|
|
15
|
+
memoryMb: Math.max(64, Math.min(4096, Number(memoryMb) || 512)),
|
|
16
|
+
processLimit: Math.max(1, Math.min(64, Number(processLimit) || 16)),
|
|
17
|
+
};
|
|
18
|
+
const result = spawnSync(process.env.DSH_POWERSHELL || "powershell.exe", ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", script], {
|
|
19
|
+
encoding: "utf8",
|
|
20
|
+
timeout: spec.timeoutMs + 10_000,
|
|
21
|
+
env: { ...process.env, DSH_JOB_SPEC: JSON.stringify(spec) },
|
|
22
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
23
|
+
});
|
|
24
|
+
if (result.error) throw new Error(`sandbox: ${result.error.message}`);
|
|
25
|
+
const line = String(result.stdout || "").trim().split(/\r?\n/u).at(-1) || "";
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(line);
|
|
28
|
+
} catch {
|
|
29
|
+
throw new Error(`sandbox: invalid helper output: ${line.slice(0, 300)}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
$ErrorActionPreference = "Stop"
|
|
2
|
+
$spec = $env:DSH_JOB_SPEC | ConvertFrom-Json
|
|
3
|
+
Add-Type @"
|
|
4
|
+
using System;
|
|
5
|
+
using System.Runtime.InteropServices;
|
|
6
|
+
public static class DshJob {
|
|
7
|
+
[StructLayout(LayoutKind.Sequential)] public struct IO_COUNTERS { public ulong ReadOperationCount; public ulong WriteOperationCount; public ulong OtherOperationCount; public ulong ReadTransferCount; public ulong WriteTransferCount; public ulong OtherTransferCount; }
|
|
8
|
+
[StructLayout(LayoutKind.Sequential)] public struct JOBOBJECT_BASIC_LIMIT_INFORMATION { public long PerProcessUserTimeLimit; public long PerJobUserTimeLimit; public uint LimitFlags; public UIntPtr MinimumWorkingSetSize; public UIntPtr MaximumWorkingSetSize; public uint ActiveProcessLimit; public UIntPtr Affinity; public uint PriorityClass; public uint SchedulingClass; }
|
|
9
|
+
[StructLayout(LayoutKind.Sequential)] public struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION { public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; public IO_COUNTERS IoInfo; public UIntPtr ProcessMemoryLimit; public UIntPtr JobMemoryLimit; public UIntPtr PeakProcessMemoryUsed; public UIntPtr PeakJobMemoryUsed; }
|
|
10
|
+
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)] public static extern IntPtr CreateJobObject(IntPtr a, string name);
|
|
11
|
+
[DllImport("kernel32.dll")] public static extern bool SetInformationJobObject(IntPtr job, int infoClass, ref JOBOBJECT_EXTENDED_LIMIT_INFORMATION info, int length);
|
|
12
|
+
[DllImport("kernel32.dll")] public static extern bool AssignProcessToJobObject(IntPtr job, IntPtr process);
|
|
13
|
+
[DllImport("kernel32.dll")] public static extern bool TerminateJobObject(IntPtr job, uint exitCode);
|
|
14
|
+
[DllImport("kernel32.dll")] public static extern bool CloseHandle(IntPtr handle);
|
|
15
|
+
}
|
|
16
|
+
"@
|
|
17
|
+
|
|
18
|
+
$job = [DshJob]::CreateJobObject([IntPtr]::Zero, $null)
|
|
19
|
+
if ($job -eq [IntPtr]::Zero) { throw "CreateJobObject failed" }
|
|
20
|
+
$out = [System.IO.Path]::GetTempFileName()
|
|
21
|
+
$err = [System.IO.Path]::GetTempFileName()
|
|
22
|
+
try {
|
|
23
|
+
$info = New-Object DshJob+JOBOBJECT_EXTENDED_LIMIT_INFORMATION
|
|
24
|
+
$info.BasicLimitInformation.LimitFlags = 0x2000 -bor 0x100 -bor 0x8
|
|
25
|
+
$info.BasicLimitInformation.ActiveProcessLimit = [uint32]$spec.processLimit
|
|
26
|
+
$info.ProcessMemoryLimit = [UIntPtr]([uint64]([int64]$spec.memoryMb * 1MB))
|
|
27
|
+
$size = [System.Runtime.InteropServices.Marshal]::SizeOf($info)
|
|
28
|
+
if (-not [DshJob]::SetInformationJobObject($job, 9, [ref]$info, $size)) { throw "SetInformationJobObject failed" }
|
|
29
|
+
$started = Get-Date
|
|
30
|
+
$process = Start-Process -FilePath $spec.command -ArgumentList $spec.args -WorkingDirectory $spec.cwd -PassThru -NoNewWindow -RedirectStandardOutput $out -RedirectStandardError $err
|
|
31
|
+
if (-not [DshJob]::AssignProcessToJobObject($job, $process.Handle)) { throw "AssignProcessToJobObject failed" }
|
|
32
|
+
$finished = $process.WaitForExit([int]$spec.timeoutMs)
|
|
33
|
+
if (-not $finished) { [void][DshJob]::TerminateJobObject($job, 124); $process.WaitForExit(2000) | Out-Null }
|
|
34
|
+
$stdout = if (Test-Path $out) { [System.IO.File]::ReadAllText($out) } else { "" }
|
|
35
|
+
$stderr = if (Test-Path $err) { [System.IO.File]::ReadAllText($err) } else { "" }
|
|
36
|
+
[pscustomobject]@{
|
|
37
|
+
supported = $true
|
|
38
|
+
exitCode = if ($finished) { $process.ExitCode } else { 124 }
|
|
39
|
+
timedOut = -not $finished
|
|
40
|
+
stdout = $stdout
|
|
41
|
+
stderr = $stderr
|
|
42
|
+
durationMs = [int]((Get-Date) - $started).TotalMilliseconds
|
|
43
|
+
limits = @{ memoryMb = [int]$spec.memoryMb; processLimit = [int]$spec.processLimit }
|
|
44
|
+
} | ConvertTo-Json -Compress -Depth 5
|
|
45
|
+
} catch {
|
|
46
|
+
[pscustomobject]@{ supported = $false; error = $_.Exception.Message } | ConvertTo-Json -Compress
|
|
47
|
+
} finally {
|
|
48
|
+
[void][DshJob]::CloseHandle($job)
|
|
49
|
+
Remove-Item $out, $err -Force -ErrorAction SilentlyContinue
|
|
50
|
+
}
|
|
@@ -105,9 +105,8 @@ window.__ModuleLoader__.load({
|
|
|
105
105
|
`;
|
|
106
106
|
|
|
107
107
|
const PRESETS = [
|
|
108
|
-
{ id: "github", title: "GitHub", subtitle: "
|
|
109
|
-
{ id: "
|
|
110
|
-
{ id: "filesystem", title: "Filesystem", subtitle: "Папка проекта, без токена", transport: "stdio", command: "npx", args: "-y\n@modelcontextprotocol/server-filesystem\n.", trusted: true },
|
|
108
|
+
{ id: "github", title: "GitHub", subtitle: "Официальный remote MCP", transport: "http", command: "npx", args: "", url: "https://api.githubcopilot.com/mcp/", tokenEnv: "GITHUB_PERSONAL_ACCESS_TOKEN", tokenLabel: "GitHub PAT", trusted: false },
|
|
109
|
+
{ id: "filesystem", title: "Filesystem", subtitle: "Папка проекта, без токена", transport: "stdio", command: "npx", args: "-y\n@modelcontextprotocol/server-filesystem\n.", trusted: false },
|
|
111
110
|
];
|
|
112
111
|
|
|
113
112
|
function call(ctx, operation, payload, timeout = 60000) {
|
|
@@ -127,7 +126,7 @@ window.__ModuleLoader__.load({
|
|
|
127
126
|
);
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
function ServerCard({ server, busy, onToggle, onTest, onTools, onPrompts, onOAuth, onRemove, tools }) {
|
|
129
|
+
function ServerCard({ server, busy, onToggle, onTrust, onTest, onTools, onPrompts, onOAuth, onRemove, tools }) {
|
|
131
130
|
const [open, setOpen] = useState(false);
|
|
132
131
|
const connected = server.connected;
|
|
133
132
|
const status = connected ? "on" : (server.error ? "err" : "off");
|
|
@@ -149,6 +148,7 @@ window.__ModuleLoader__.load({
|
|
|
149
148
|
h("div", { className: "mcp-controls" },
|
|
150
149
|
h(Toggle, { checked: server.enabled, label: "Включён", disabled: busy, onChange: (value) => onToggle(server.id, { enabled: value }) }),
|
|
151
150
|
h(Toggle, { checked: server.trusted, label: "Доверен", disabled: busy, onChange: (value) => onToggle(server.id, { trusted: value }) }),
|
|
151
|
+
!server.trusted ? h("button", { className: "mcp-btn primary", disabled: busy, onClick: () => onTrust(server) }, "Проверить и доверять") : null,
|
|
152
152
|
h("div", { className: "mcp-actions" },
|
|
153
153
|
h("button", { className: "mcp-btn ghost", disabled: busy, onClick: () => onTest(server.id) }, "Проверить"),
|
|
154
154
|
server.transport === "http" ? h("button", { className: "mcp-btn ghost", disabled: busy, onClick: () => onOAuth(server.id) }, server.oauth?.hasToken ? "OAuth" : "Войти") : null,
|
|
@@ -497,6 +497,12 @@ window.__ModuleLoader__.load({
|
|
|
497
497
|
busy,
|
|
498
498
|
tools: tools[server.id],
|
|
499
499
|
onToggle: (id, flags) => run("toggle", { id, ...flags }, "Настройки сервера обновлены"),
|
|
500
|
+
onTrust: (server) => {
|
|
501
|
+
const target = server.url || server.command || server.id;
|
|
502
|
+
if (window.confirm(`Доверять MCP-серверу «${server.id}»?\n\n${target}\n\nОн получит доступ к инструментам и сможет выполнять команды от твоего имени.`)) {
|
|
503
|
+
void run("toggle", { id: server.id, trusted: true, enabled: true }, "Сервер включён и доверен");
|
|
504
|
+
}
|
|
505
|
+
},
|
|
500
506
|
onTest: async (id) => {
|
|
501
507
|
setBusy(true);
|
|
502
508
|
try {
|
|
@@ -61,26 +61,14 @@ function presets() {
|
|
|
61
61
|
{
|
|
62
62
|
id: "github",
|
|
63
63
|
title: "GitHub",
|
|
64
|
-
subtitle: "
|
|
65
|
-
transport: "
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
tokenLabel: "GitHub
|
|
70
|
-
tokenPlaceholder: "
|
|
71
|
-
trusted:
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: "postgres",
|
|
75
|
-
title: "PostgreSQL",
|
|
76
|
-
subtitle: "Схема и read-only запросы; отдельная роль обязательна",
|
|
77
|
-
transport: "stdio",
|
|
78
|
-
command: "npx",
|
|
79
|
-
args: ["-y", "@modelcontextprotocol/server-postgres", "postgresql://readonly@localhost:5432/postgres"],
|
|
80
|
-
tokenEnv: "PGPASSWORD",
|
|
81
|
-
tokenLabel: "Пароль read-only роли",
|
|
82
|
-
tokenPlaceholder: "пароль",
|
|
83
|
-
trusted: true,
|
|
64
|
+
subtitle: "Официальный remote MCP: issues, PR, code search",
|
|
65
|
+
transport: "http",
|
|
66
|
+
url: "https://api.githubcopilot.com/mcp/",
|
|
67
|
+
tokenEnv: "GITHUB_PERSONAL_ACCESS_TOKEN",
|
|
68
|
+
tokenHeader: "Authorization",
|
|
69
|
+
tokenLabel: "GitHub PAT",
|
|
70
|
+
tokenPlaceholder: "github_pat_…",
|
|
71
|
+
trusted: false,
|
|
84
72
|
},
|
|
85
73
|
{
|
|
86
74
|
id: "filesystem",
|
|
@@ -89,7 +77,7 @@ function presets() {
|
|
|
89
77
|
transport: "stdio",
|
|
90
78
|
command: "npx",
|
|
91
79
|
args: ["-y", "@modelcontextprotocol/server-filesystem", "${cwd}"],
|
|
92
|
-
trusted:
|
|
80
|
+
trusted: false,
|
|
93
81
|
},
|
|
94
82
|
];
|
|
95
83
|
}
|