dsh-desktop-kit 2.19.0 → 2.21.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 +13 -0
- package/README.md +26 -26
- package/client.js +1 -1
- package/docs/REMOTE-MARKETPLACE.md +13 -0
- package/docs/TEST-2.20.0.md +28 -0
- package/docs/TEST-2.21.0.md +29 -0
- package/docs/VSCODE-EXTENSION.md +25 -0
- package/integrations/vscode/README.md +27 -0
- package/integrations/vscode/extension.js +49 -0
- package/integrations/vscode/package.json +38 -0
- package/package.json +4 -3
- package/plugins/dsh-integrations/index.js +31 -1
- package/plugins/dsh-integrations/lib/api.js +2 -1
- package/plugins/dsh-integrations/lib/catalog.js +32 -0
- 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/lib/api.js +9 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.21.0 (2026-11-12)
|
|
4
|
+
|
|
5
|
+
- **Windows Job Objects.** `sandbox_run`: memory/process/timeout limits, kill-on-close, cwd внутри проекта; не файловая/сетевая изоляция.
|
|
6
|
+
- **MCP presets.** GitHub — official remote `https://api.githubcopilot.com/mcp/`; archived github/postgres presets удалены; trust только вручную.
|
|
7
|
+
- **Tests.** sandbox simple/timeout, integrations routes.
|
|
8
|
+
|
|
9
|
+
## 2.20.0 (2026-11-12)
|
|
10
|
+
|
|
11
|
+
- **VS Code extension.** `integrations/vscode`: `/health`, `/context`, bearer, loopback-only URL; packaging через `vsce`.
|
|
12
|
+
- **Remote marketplace sync.** HTTPS + обязательный SHA-256, атомарная запись `~/.dsh/marketplace/remote.json`, backup; API `/api/dsh-integrations/sync`.
|
|
13
|
+
- **Tests.** Remote catalog sync/mismatch, 5 API routes, extension syntax/JSON.
|
|
14
|
+
- **Files.** `integrations/**` в npm tarball.
|
|
15
|
+
|
|
3
16
|
## 2.19.0 (2026-11-12)
|
|
4
17
|
|
|
5
18
|
- **Deprecated MCP не предлагаются.** Вместо `@modelcontextprotocol/server-github` и archived `server-postgres` создаётся `mcp.suggestions.json` только с поддерживаемыми ссылками, причиной и заметкой; команды и trust не автоматизируются.
|
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# DSH Desktop Kit 2.
|
|
1
|
+
# DSH Desktop Kit 2.21
|
|
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.21.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
|
@@ -8253,7 +8253,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
8253
8253
|
if (__kitErrors.length <= 5) console.error("[dsh-desktop-kit] registration failed:", label, message);
|
|
8254
8254
|
};
|
|
8255
8255
|
try {
|
|
8256
|
-
window.__DSH_DESKTOP_KIT__ = { version: "2.
|
|
8256
|
+
window.__DSH_DESKTOP_KIT__ = { version: "2.21.0", parts: __partNames, errors: __kitErrors, ready: false };
|
|
8257
8257
|
} catch {}
|
|
8258
8258
|
const __inject = [];
|
|
8259
8259
|
for (const __part of __parts) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Remote marketplace sync
|
|
2
|
+
|
|
3
|
+
`syncCatalog(url, sha256)` загружает каталог по HTTPS и проверяет SHA-256 до записи.
|
|
4
|
+
|
|
5
|
+
Правила:
|
|
6
|
+
|
|
7
|
+
- HTTPS обязателен; HTTP разрешён только loopback для тестов.
|
|
8
|
+
- SHA-256 обязателен; без него синхронизация отклоняется.
|
|
9
|
+
- Каталог пишется в `~/.dsh/marketplace/remote.json` атомарно.
|
|
10
|
+
- Предыдущий каталог уходит в `~/.dsh/.dsh-kit-backups/marketplace/`.
|
|
11
|
+
- `installFromCatalog` по-прежнему устанавливает только локальные `SKILL.md`; URL-источники не исполняются.
|
|
12
|
+
|
|
13
|
+
API: `POST /api/dsh-integrations/sync` с `{ url, sha256 }`.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# DSH Desktop Kit 2.20.0 — тест
|
|
2
|
+
|
|
3
|
+
Дата: 2026-11-12.
|
|
4
|
+
|
|
5
|
+
## IDE
|
|
6
|
+
|
|
7
|
+
- `integrations/vscode/extension.js` — syntax OK.
|
|
8
|
+
- `package.json` — valid JSON.
|
|
9
|
+
- Команды: health, context.
|
|
10
|
+
- URL только 127.0.0.1; токен из настроек.
|
|
11
|
+
|
|
12
|
+
## Remote marketplace
|
|
13
|
+
|
|
14
|
+
- loopback HTTP каталог + SHA-256 → `remote.json`.
|
|
15
|
+
- mismatch → отказ.
|
|
16
|
+
- `loadCatalog` видит remote entries.
|
|
17
|
+
- API route `/sync` зарегистрирован.
|
|
18
|
+
|
|
19
|
+
## Проверки
|
|
20
|
+
|
|
21
|
+
- `integrations-tests` — OK.
|
|
22
|
+
- `npm test` — exit 0.
|
|
23
|
+
- build/check — OK.
|
|
24
|
+
|
|
25
|
+
## Не входит
|
|
26
|
+
|
|
27
|
+
- OS sandbox enforcement.
|
|
28
|
+
- E2E с авторизованным живым DSH.
|
|
@@ -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,25 @@
|
|
|
1
|
+
# VS Code extension
|
|
2
|
+
|
|
3
|
+
`integrations/vscode` — thin client for the DSH IDE bridge.
|
|
4
|
+
|
|
5
|
+
## Build
|
|
6
|
+
|
|
7
|
+
```powershell
|
|
8
|
+
cd integrations/vscode
|
|
9
|
+
npm install
|
|
10
|
+
npm run package
|
|
11
|
+
code --install-extension dsh-ide-bridge-0.1.0.vsix
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Then Settings → DSH:
|
|
15
|
+
|
|
16
|
+
- `bridgeUrl`: `http://127.0.0.1:7777`
|
|
17
|
+
- `token`: bearer from Settings → Интеграции
|
|
18
|
+
|
|
19
|
+
## Scope
|
|
20
|
+
|
|
21
|
+
- `/health` → status message.
|
|
22
|
+
- `/context` → JSON document.
|
|
23
|
+
- No file writes, no LSP, no auto-start of the bridge.
|
|
24
|
+
|
|
25
|
+
The bridge URL is restricted to `127.0.0.1`; the token is per-start and is not stored by the bridge.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# DSH IDE Bridge — VS Code
|
|
2
|
+
|
|
3
|
+
Расширение показывает `/health` и `/context` локального DSH bridge.
|
|
4
|
+
|
|
5
|
+
## Установка
|
|
6
|
+
|
|
7
|
+
1. DSH → **Настройки → Интеграции** → **Запустить** IDE bridge.
|
|
8
|
+
2. Скопируйте URL и bearer-токен.
|
|
9
|
+
3. В VS Code:
|
|
10
|
+
|
|
11
|
+
```powershell
|
|
12
|
+
cd integrations/vscode
|
|
13
|
+
npm install
|
|
14
|
+
npm run package
|
|
15
|
+
code --install-extension dsh-ide-bridge-0.1.0.vsix
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
4. Settings → DSH → `bridgeUrl`, `token`.
|
|
19
|
+
|
|
20
|
+
Токен живёт только на время запуска bridge. URL разрешён только `http://127.0.0.1:<port>`.
|
|
21
|
+
|
|
22
|
+
## Команды
|
|
23
|
+
|
|
24
|
+
- `DSH: Проверить bridge`
|
|
25
|
+
- `DSH: Показать контекст проекта`
|
|
26
|
+
|
|
27
|
+
Это первый thin-client; запись файлов и LSP — следующий слой.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const vscode = require("vscode");
|
|
2
|
+
|
|
3
|
+
function config() {
|
|
4
|
+
const value = vscode.workspace.getConfiguration("dsh");
|
|
5
|
+
return { url: String(value.get("bridgeUrl") || "http://127.0.0.1:7777").replace(/\/+$/u, ""), token: String(value.get("token") || "") };
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
async function request(path) {
|
|
9
|
+
const { url, token } = config();
|
|
10
|
+
if (!/^http:\/\/127\.0\.0\.1(?::\d+)?$/u.test(url)) throw new Error("DSH bridge URL must be http://127.0.0.1:<port>");
|
|
11
|
+
const response = await fetch(`${url}${path}`, { headers: token ? { authorization: `Bearer ${token}` } : {} });
|
|
12
|
+
const text = await response.text();
|
|
13
|
+
let body;
|
|
14
|
+
try { body = JSON.parse(text); } catch { body = text; }
|
|
15
|
+
if (!response.ok) throw new Error(`DSH bridge ${response.status}: ${typeof body === "string" ? body : JSON.stringify(body)}`);
|
|
16
|
+
return body;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function activate(context) {
|
|
20
|
+
const status = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100);
|
|
21
|
+
status.text = "DSH";
|
|
22
|
+
status.tooltip = "DSH IDE Bridge";
|
|
23
|
+
status.command = "dsh.health";
|
|
24
|
+
status.show();
|
|
25
|
+
context.subscriptions.push(status);
|
|
26
|
+
|
|
27
|
+
context.subscriptions.push(vscode.commands.registerCommand("dsh.health", async () => {
|
|
28
|
+
try {
|
|
29
|
+
const health = await request("/health");
|
|
30
|
+
vscode.window.showInformationMessage(`DSH bridge: ${health.status || "ok"} · ${health.project || "проект не определён"}`);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
vscode.window.showErrorMessage(error instanceof Error ? error.message : String(error));
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
context.subscriptions.push(vscode.commands.registerCommand("dsh.context", async () => {
|
|
37
|
+
try {
|
|
38
|
+
const data = await request("/context");
|
|
39
|
+
const document = await vscode.workspace.openTextDocument({ content: JSON.stringify(data, null, 2), language: "json" });
|
|
40
|
+
await vscode.window.showTextDocument(document, { preview: true });
|
|
41
|
+
} catch (error) {
|
|
42
|
+
vscode.window.showErrorMessage(error instanceof Error ? error.message : String(error));
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function deactivate() {}
|
|
48
|
+
|
|
49
|
+
module.exports = { activate, deactivate };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-ide-bridge",
|
|
3
|
+
"displayName": "DSH IDE Bridge",
|
|
4
|
+
"description": "Health and project context from the local DSH IDE bridge.",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"publisher": "dsh",
|
|
7
|
+
"engines": { "vscode": "^1.90.0" },
|
|
8
|
+
"categories": ["Other"],
|
|
9
|
+
"activationEvents": ["onStartupFinished"],
|
|
10
|
+
"main": "./extension.js",
|
|
11
|
+
"contributes": {
|
|
12
|
+
"commands": [
|
|
13
|
+
{ "command": "dsh.health", "title": "DSH: Проверить bridge" },
|
|
14
|
+
{ "command": "dsh.context", "title": "DSH: Показать контекст проекта" }
|
|
15
|
+
],
|
|
16
|
+
"configuration": {
|
|
17
|
+
"title": "DSH",
|
|
18
|
+
"properties": {
|
|
19
|
+
"dsh.bridgeUrl": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"default": "http://127.0.0.1:7777",
|
|
22
|
+
"description": "URL локального IDE bridge (только 127.0.0.1)."
|
|
23
|
+
},
|
|
24
|
+
"dsh.token": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"default": "",
|
|
27
|
+
"description": "Bearer-токен из Настройки → Интеграции. Храните как secret."
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"package": "vsce package"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@vscode/vsce": "^3.0.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
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.21.0",
|
|
4
|
+
"description": "DeepSeek Harness desktop kit 2.21.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",
|
|
@@ -76,7 +76,8 @@
|
|
|
76
76
|
"plugins/*/screenshots/**",
|
|
77
77
|
"skills/**",
|
|
78
78
|
"tools/skill-cost.mjs",
|
|
79
|
-
"plugins/*/docs/images/**"
|
|
79
|
+
"plugins/*/docs/images/**",
|
|
80
|
+
"integrations/**"
|
|
80
81
|
],
|
|
81
82
|
"scripts": {
|
|
82
83
|
"build:client": "node tools/build-client.mjs",
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
import { inspectCatalog, installFromCatalog } from "./lib/catalog.js";
|
|
10
10
|
import { IdeBridge } from "./lib/bridge.js";
|
|
11
11
|
import { registerIntegrationApi } from "./lib/api.js";
|
|
12
|
+
import { runJobSandbox } from "./lib/job-sandbox.js";
|
|
13
|
+
import path from "node:path";
|
|
12
14
|
|
|
13
15
|
export const inject = ["tools"];
|
|
14
16
|
|
|
@@ -30,17 +32,45 @@ function toolDefinition(ctx, bridge) {
|
|
|
30
32
|
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
33
|
marketplace: inspectCatalog(root),
|
|
32
34
|
bridge: { running: status.running, url: status.url },
|
|
33
|
-
sandbox: { enforcement: false,
|
|
35
|
+
sandbox: { enforcement: false, jobObjects: process.platform === "win32", optInTool: "sandbox_run", note: "Job Objects limit memory/processes/time; filesystem and network are not isolated" },
|
|
34
36
|
};
|
|
35
37
|
},
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
|
|
41
|
+
function sandboxTool() {
|
|
42
|
+
return {
|
|
43
|
+
name: "sandbox_run",
|
|
44
|
+
description:
|
|
45
|
+
"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.",
|
|
46
|
+
parameters: {
|
|
47
|
+
type: "object",
|
|
48
|
+
additionalProperties: false,
|
|
49
|
+
required: ["command"],
|
|
50
|
+
properties: {
|
|
51
|
+
command: { type: "string" },
|
|
52
|
+
args: { type: "array", items: { type: "string" } },
|
|
53
|
+
cwd: { type: "string" },
|
|
54
|
+
timeoutMs: { type: "number" },
|
|
55
|
+
memoryMb: { type: "number" },
|
|
56
|
+
processLimit: { type: "number" },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
async execute(input, exec) {
|
|
60
|
+
const root = projectFrom(exec?.agent);
|
|
61
|
+
const cwd = path.resolve(input?.cwd || root);
|
|
62
|
+
if (cwd !== path.resolve(root) && !cwd.startsWith(`${path.resolve(root)}${path.sep}`)) throw new Error("sandbox: cwd must be inside the project");
|
|
63
|
+
return runJobSandbox({ ...input, cwd });
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
39
68
|
export function apply(ctx) {
|
|
40
69
|
const bridge = new IdeBridge();
|
|
41
70
|
ctx.effect(() => () => { void bridge.stop(); }, "integrations: cleanup");
|
|
42
71
|
try {
|
|
43
72
|
ctx.effect(() => ctx.tools.register(toolDefinition(ctx, bridge)), "integrations: status tool");
|
|
73
|
+
ctx.effect(() => ctx.tools.register(sandboxTool()), "integrations: sandbox tool");
|
|
44
74
|
} catch (error) {
|
|
45
75
|
ctx.logger?.warn?.(`[integrations] tool registration failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
46
76
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inspectCatalog, installFromCatalog } from "./catalog.js";
|
|
1
|
+
import { inspectCatalog, installFromCatalog, syncCatalog } from "./catalog.js";
|
|
2
2
|
|
|
3
3
|
export const RPC_NAMESPACE = "dsh-integrations";
|
|
4
4
|
const ROUTE_BASE = "/api/dsh-integrations";
|
|
@@ -48,6 +48,7 @@ export function registerIntegrationApi(ctx, bridge) {
|
|
|
48
48
|
operation("install", (payload, root) => installFromCatalog(root, payload.id)),
|
|
49
49
|
operation("bridge-start", async (payload, root) => bridge.start(async () => ({ project: root, pid: process.pid, time: new Date().toISOString() }))),
|
|
50
50
|
operation("bridge-stop", () => bridge.stop()),
|
|
51
|
+
operation("sync", async (payload, root) => syncCatalog(payload.url, payload.sha256, { projectRoot: root })),
|
|
51
52
|
];
|
|
52
53
|
return routes.map((route) => connection.rpc.register(route));
|
|
53
54
|
}
|
|
@@ -19,6 +19,7 @@ function dshHome() {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export function catalogPath(scope = "global", projectRoot = "") {
|
|
22
|
+
if (scope === "remote") return path.join(marketplaceHome(), "remote.json");
|
|
22
23
|
return scope === "project" && projectRoot
|
|
23
24
|
? path.join(projectRoot, ".dsh", "marketplace.json")
|
|
24
25
|
: path.join(marketplaceHome(), "catalog.json");
|
|
@@ -39,12 +40,43 @@ function readEntries(file, scope) {
|
|
|
39
40
|
export function loadCatalog(projectRoot = "") {
|
|
40
41
|
const entries = [
|
|
41
42
|
...readEntries(catalogPath("global"), "global"),
|
|
43
|
+
...readEntries(catalogPath("remote"), "remote"),
|
|
42
44
|
...(projectRoot ? readEntries(catalogPath("project", projectRoot), "project") : []),
|
|
43
45
|
];
|
|
44
46
|
const seen = new Set();
|
|
45
47
|
return entries.filter((entry) => (seen.has(entry.id) ? false : (seen.add(entry.id), true)));
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
export async function syncCatalog(url, expectedSha256, { projectRoot = "" } = {}) {
|
|
51
|
+
const parsed = new URL(String(url));
|
|
52
|
+
const loopback = parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost";
|
|
53
|
+
if (parsed.protocol !== "https:" && !(loopback && parsed.protocol === "http:")) {
|
|
54
|
+
throw new Error("marketplace: remote catalog must use HTTPS (localhost HTTP allowed for tests)");
|
|
55
|
+
}
|
|
56
|
+
if (!/^[a-f0-9]{64}$/iu.test(String(expectedSha256 || ""))) throw new Error("marketplace: sync requires a SHA-256 of the catalog");
|
|
57
|
+
const response = await fetch(parsed, { redirect: "error" });
|
|
58
|
+
if (!response.ok) throw new Error(`marketplace: catalog HTTP ${response.status}`);
|
|
59
|
+
const bytes = Buffer.from(await response.arrayBuffer());
|
|
60
|
+
const actual = crypto.createHash("sha256").update(bytes).digest("hex");
|
|
61
|
+
if (actual !== String(expectedSha256).toLowerCase()) throw new Error("marketplace: catalog SHA-256 mismatch");
|
|
62
|
+
let parsedCatalog;
|
|
63
|
+
try { parsedCatalog = JSON.parse(bytes.toString("utf8")); } catch { throw new Error("marketplace: catalog is not valid JSON"); }
|
|
64
|
+
const entries = Array.isArray(parsedCatalog) ? parsedCatalog : parsedCatalog?.entries;
|
|
65
|
+
if (!Array.isArray(entries)) throw new Error("marketplace: catalog must contain entries[]");
|
|
66
|
+
const file = path.join(marketplaceHome(), "remote.json");
|
|
67
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
68
|
+
let backup = "";
|
|
69
|
+
if (fs.existsSync(file)) {
|
|
70
|
+
backup = path.join(dshHome(), ".dsh-kit-backups", "marketplace", `remote-${Date.now()}.json`);
|
|
71
|
+
fs.mkdirSync(path.dirname(backup), { recursive: true });
|
|
72
|
+
fs.copyFileSync(file, backup);
|
|
73
|
+
}
|
|
74
|
+
const temporary = `${file}.${process.pid}.tmp`;
|
|
75
|
+
fs.writeFileSync(temporary, `${JSON.stringify({ syncedAt: new Date().toISOString(), sha256: actual, entries }, null, 2)}\n`, "utf8");
|
|
76
|
+
fs.renameSync(temporary, file);
|
|
77
|
+
return { file, backup, sha256: actual, count: entries.length };
|
|
78
|
+
}
|
|
79
|
+
|
|
48
80
|
function sha256(file) {
|
|
49
81
|
return crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex");
|
|
50
82
|
}
|
|
@@ -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
|
+
}
|
|
@@ -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
|
}
|