dsh-desktop-kit 2.33.0 → 2.34.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,3 +1,18 @@
1
+ ## 2.34.0 (2026-12-02)
2
+
3
+ **Надёжность: locks без гонки, test runner, release polling, atomic checkpoints, UI coverage.**
4
+
5
+ - **Locks:** атомарный захват `wx`, heartbeat 30 с, проверка PID, stale-lock takeover; release останавливает heartbeat. Тест: чужой owner, истёкший lock, повторный захват.
6
+ - **Test runner:** `npm test` → `node tools/run-tests.mjs`; шаги из `test:steps` запускаются напрямую через Node, без PowerShell-обёртки; точный failing step и exit code.
7
+ - **Release:** `tools/release.mjs --publish` ждёт появления версии в registry до 10 минут (`--wait-seconds`), различает published/still processing/staged; `verify-release` больше не запускается в окно асинхронной публикации.
8
+ - **Checkpoints:** snapshot в `<id>.tmp-*` → `rename`; скан файлов до 512 КБ через guardrails secret scanner, секретные файлы пропускаются; retention 20.
9
+ - **UI coverage:** `.dsh/quality/ui.json` со списком критических сценариев; strict-гейт требует отдельный passing `interact` на каждый сценарий, а не один любой.
10
+ - **Runtime:** снапшот ask/deny сохраняется в `~/.dsh/agent-extensions/runtime.json` (bounded, без текста команд); `loaded/persisted` в ответе.
11
+ - **Роли:** `max_turns`/`skills` уходят в prompt роли как advisory-бюджет; `isolation: worktree` автоматически создаёт worktree для одиночного запуска; контрактный тест парсинга/промпта.
12
+ - **Instruction validator:** сверка навыков с `skills/manifest.json` + пользовательские навыки из `DSH_HOME`; тест stale/valid.
13
+ - **Release consistency:** `skills/manifest.json` версия теперь проверяется вместе с package/README/CHANGELOG/measured.
14
+ - **Проверки:** полный набор 43 шага; guardrails 44 теста; UI gate, agent extensions, instructions, memory, quality, smoke.
15
+
1
16
  ## 2.33.0 (2026-12-02)
2
17
 
3
18
  **Approval runtime, валидатор инструкций, health проекта и writer locks.**
package/README.en.md CHANGED
@@ -1,4 +1,4 @@
1
- # DSH Desktop Kit 2.33.0
1
+ # DSH Desktop Kit 2.34.0
2
2
 
3
3
  [Русский](README.md) · **English**
4
4
 
@@ -6,13 +6,24 @@
6
6
 
7
7
  21 plugins and 35 skills in one npm package: a quality mission with phases and G0..G13 gates, browser QA with interactions/accessibility/performance, 14 project roles (ui-critic, a11y, cms-ops, release-ops, builder in a worktree), phase-aware skill routing with a token budget, a read-only swarm with a shared board, a research ledger with source checks, MCP with OAuth 2.1 / sampling / elicitation, a local marketplace, an IDE bridge, guardrails, project memory, checkpoints, `/kit doctor|plan|tune`, and a Russian-first UI.
8
8
 
9
- ![DSH Desktop Kit 2.33](https://unpkg.com/dsh-desktop-kit@2.33.0/docs/images/hero-2.31.png)
9
+ ![DSH Desktop Kit 2.33](https://unpkg.com/dsh-desktop-kit@2.34.0/docs/images/hero-2.31.png)
10
10
 
11
11
  > The Russian [README.md](README.md) is the canonical document. This page is a compact English map for npm and GitHub readers.
12
12
 
13
+ ## What's new in 2.34.0
14
+
15
+ - **Race-free writer locks:** O_EXCL acquire, 30s heartbeat, PID liveness and stale-lock takeover; two `project_agent` writers can no longer start in one root.
16
+ - **Reliable test runner:** `npm test` runs `node tools/run-tests.mjs`, so no PowerShell/`&&` wrapper hides the failing step.
17
+ - **Release waits for the registry:** `release.mjs --publish` polls the packument for up to 10 minutes and distinguishes visible / still-processing / staged instead of treating npm exit 0 as live.
18
+ - **Atomic checkpoints with secret scan:** snapshot goes to a temporary directory and is renamed; files with detected secrets are skipped; the last 20 snapshots are kept.
19
+ - **Critical-scenario coverage:** with `.dsh/quality/ui.json`, one passing `interact` is not enough; each listed scenario needs its own run.
20
+ - **Runtime survives restart:** `guardrails action=runtime` persists a bounded snapshot in `~/.dsh/agent-extensions/runtime.json`; command text is still not stored.
21
+ - **Role budget/isolation:** `max_turns` and `skills` are injected into the role prompt; `isolation: worktree` creates a worktree for a single run.
22
+ - **Manifest version gate:** release consistency now checks `skills/manifest.json` against `package.json`.
23
+
13
24
  ## What's new in 2.33.0
14
25
 
15
- - **`guardrails action=runtime`** classifies a call (`read/write/external/destructive/credential`) and records the actual ask/deny decisions as a bounded in-memory snapshot; command text is never stored.
26
+ - **`guardrails action=runtime`** classifies a call (`read/write/external/destructive/credential`) and records ask/deny decisions (level, mode, rule, fingerprint); command text is never stored.
16
27
  - **Instruction validator** checks `AGENTS.md`/`CLAUDE.md` for broken `@import`, stale skills, duplicate root files and size; warnings appear in `<instructions-warning>`, and `/instructions` prints the report.
17
28
  - **`project_memory action=health`** reports git, `.dsh`, `PROJECT.md`, AGENTS/CLAUDE, scan warnings and scan age.
18
29
  - **Writer locks** stop two `project_agent` writers from starting in the same root: lock under `~/.dsh/agent-extensions/locks`, 15-minute TTL, another owner cannot release it.
@@ -52,7 +63,7 @@ The kit is a bundle for [DeepSeek Harness](https://deepseek.com) (DSH) that inst
52
63
  From npm:
53
64
 
54
65
  ```powershell
55
- dsh plugin --profile desktop add dsh-desktop-kit@2.33.0
66
+ dsh plugin --profile desktop add dsh-desktop-kit@2.34.0
56
67
  ```
57
68
 
58
69
  From a local clone, with the interactive installer (Windows):
@@ -86,7 +97,7 @@ npm run skills:check # every skill core stays under the 6 000-token
86
97
  npm run measure # refresh docs/measured.json + docs/MEASURED.md
87
98
  npm run measure -- --check # the stored measurements match package.json
88
99
  npm run check:release # versions agree across READMEs, measured.json and CHANGELOG
89
- npm run verify:release -- 2.33.0 # verify the published npm artifact (after publishing)
100
+ npm run verify:release -- 2.34.0 # verify the published npm artifact (after publishing)
90
101
  ```
91
102
 
92
103
  ## Measured, not claimed
@@ -115,4 +126,4 @@ Every number in [docs/MEASURED.md](docs/MEASURED.md) is reproducible: the comman
115
126
 
116
127
  MIT. Built for DeepSeek Harness; no external runtime dependencies and no telemetry.
117
128
 
118
- **2.33.0** · 21 plugins · 35 skills · 14 roles · 7 presets · 14 gates · Windows 11 · DSH 0.2.x
129
+ **2.34.0** · 21 plugins · 35 skills · 14 roles · 7 presets · 14 gates · Windows 11 · DSH 0.2.x
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # DSH Desktop Kit 2.33.0
1
+ # DSH Desktop Kit 2.34.0
2
2
 
3
3
  **Русский** · [English](README.en.md)
4
4
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  `21 плагин` · `35 навыков` · `14 ролей` · `7 пресетов` · `14 гейтов` · `0 внешних runtime-зависимостей`
8
8
 
9
- ![DSH Desktop Kit 2.33: миссия качества, диагностика и браузерная проверка](https://unpkg.com/dsh-desktop-kit@2.33.0/docs/images/hero-2.31.png)
9
+ ![DSH Desktop Kit 2.33: миссия качества, диагностика и браузерная проверка](https://unpkg.com/dsh-desktop-kit@2.34.0/docs/images/hero-2.31.png)
10
10
 
11
11
  ---
12
12
 
@@ -25,9 +25,9 @@
25
25
  ## Быстрый старт
26
26
 
27
27
  ```powershell
28
- # в DSH: Плагины → Add plugin → dsh-desktop-kit@2.33.0
28
+ # в DSH: Плагины → Add plugin → dsh-desktop-kit@2.34.0
29
29
  # или из терминала:
30
- dsh plugin --profile desktop add dsh-desktop-kit@2.33.0
30
+ dsh plugin --profile desktop add dsh-desktop-kit@2.34.0
31
31
  ```
32
32
 
33
33
  После установки перезапустите окно DSH (`Ctrl+R`). Проверка:
@@ -44,11 +44,24 @@ node tools/e2e-http.mjs # живой web + API
44
44
 
45
45
  ---
46
46
 
47
+ ## Что нового в 2.34.0
48
+
49
+ | Что | Зачем |
50
+ |---|---|
51
+ | **Lock без гонки** | Атомарный `wx`-захват, heartbeat 30 с, проверка PID и stale-lock. Два writer-агента больше не могут одновременно стартовать в одном корне. |
52
+ | **Надёжный test runner** | `npm test` → `node tools/run-tests.mjs`: шаги запускаются без PowerShell/`&&`-обёртки, виден точный упавший шаг. |
53
+ | **Release ждёт registry** | `release.mjs --publish` опрашивает packument до 10 минут и различает «опубликовано / ещё обрабатывается / staged». Ноль от npm больше не выдаётся за live. |
54
+ | **Checkpoint: atomic + secret scan** | Snapshot пишется во временную папку и переименовывается атомарно; файлы с секретами пропускаются; хранятся последние 20 snapshot. |
55
+ | **Coverage критических сценариев** | Если есть `.dsh/quality/ui.json`, одного passing `interact` уже недостаточно: нужен отдельный прогон на каждый сценарий. |
56
+ | **Runtime переживает рестарт** | `guardrails action=runtime` сохраняет bounded-снапшот в `~/.dsh/agent-extensions/runtime.json`; текст команд по-прежнему не хранится. |
57
+ | **Роли: budget и isolation** | `max_turns` и `skills` попадают в prompt роли; `isolation: worktree` автоматически создаёт worktree для одиночного запуска. |
58
+ | **Manifest-версия в гейте** | `check-release-consistency` теперь сверяет `skills/manifest.json` с `package.json`, чтобы каталог навыков не отставал от релиза. |
59
+
47
60
  ## Что нового в 2.33.0
48
61
 
49
62
  | Что | Зачем |
50
63
  |---|---|
51
- | **`guardrails action=runtime`** | Consequence-классификатор (`read/write/external/destructive/credential`) и in-memory snapshot последних ask/deny: видно, что именно DSH попросил подтвердить, без хранения текста команды. |
64
+ | **`guardrails action=runtime`** | Consequence-классификатор (`read/write/external/destructive/credential`) и snapshot последних ask/deny: видно, что именно DSH попросил подтвердить, без хранения текста команды. |
52
65
  | **Валидатор инструкций** | AGENTS.md/CLAUDE.md проверяются на битые `@import`, устаревшие навыки, дубли корня и размер; предупреждение попадает в `<instructions-warning>`, команда `/instructions` показывает отчёт. |
53
66
  | **`project_memory action=health`** | Сканер проекта: git, `.dsh`, `PROJECT.md`, AGENTS/CLAUDE, предупреждения автоскана, свежесть. |
54
67
  | **Writer locks** | Два `project_agent`-писателя не стартуют в одном корне одновременно: lock в `~/.dsh/agent-extensions/locks`, TTL 15 минут, чужой owner не снимает. |
@@ -92,7 +105,7 @@ node tools/e2e-http.mjs # живой web + API
92
105
 
93
106
  ## Что внутри
94
107
 
95
- ![Карта возможностей: 21 плагин по слоям](https://unpkg.com/dsh-desktop-kit@2.33.0/docs/images/capability-map-2.30.png)
108
+ ![Карта возможностей: 21 плагин по слоям](https://unpkg.com/dsh-desktop-kit@2.34.0/docs/images/capability-map-2.30.png)
96
109
 
97
110
  *Один пакет закрывает полный контур: качество, агенты, навыки, ops, знания, безопасность и платформу.*
98
111
 
@@ -110,7 +123,7 @@ node tools/e2e-http.mjs # живой web + API
110
123
 
111
124
  ## Миссия качества
112
125
 
113
- ![Схема миссии качества: 7 фаз, 14 гейтов, evidence](https://unpkg.com/dsh-desktop-kit@2.33.0/docs/images/quality-pipeline-2.30.png)
126
+ ![Схема миссии качества: 7 фаз, 14 гейтов, evidence](https://unpkg.com/dsh-desktop-kit@2.34.0/docs/images/quality-pipeline-2.30.png)
114
127
 
115
128
  `quality_gate` превращает «сделай премиально» в исполняемое состояние:
116
129
 
@@ -262,7 +275,7 @@ i18n_sync action=check lang=ar
262
275
 
263
276
  MCP: GitHub (official remote), Filesystem и свои серверы; OAuth 2.1 + PKCE; sampling через approval-карточку DSH; elicitation через Accept/Decline; tools/resources/prompts, health и статусы. Секреты — в `~/.dsh/mcp.secrets.json`, trust — только вручную.
264
277
 
265
- ![Настройки MCP: серверы, tools, trust](https://unpkg.com/dsh-desktop-kit@2.33.0/plugins/dsh-mcp-manager/screenshots/settings-1440.png)
278
+ ![Настройки MCP: серверы, tools, trust](https://unpkg.com/dsh-desktop-kit@2.34.0/plugins/dsh-mcp-manager/screenshots/settings-1440.png)
266
279
 
267
280
  *Настройки → MCP: серверы, health, tools и ручной trust.*
268
281
 
@@ -285,7 +298,7 @@ MCP: GitHub (official remote), Filesystem и свои серверы; OAuth 2.1
285
298
  - **Sandbox** — Job Objects; файловая/сетевая изоляция не заявляется.
286
299
  - **Данные** — `.dsh/` в проекте; транскрипты `0600`; PII и секреты не попадают в board.
287
300
 
288
- ![Права: жёсткие правила, защищённые пути и пресеты DSH](https://unpkg.com/dsh-desktop-kit@2.33.0/plugins/dsh-guardrails/screenshots/permissions-1440.png)
301
+ ![Права: жёсткие правила, защищённые пути и пресеты DSH](https://unpkg.com/dsh-desktop-kit@2.34.0/plugins/dsh-guardrails/screenshots/permissions-1440.png)
289
302
 
290
303
  *Настройки → Права: эффективные правила, защищённые пути и статус hooks.*
291
304
 
@@ -361,6 +374,7 @@ node tools/e2e-http.mjs
361
374
  ## Документация
362
375
 
363
376
  - [CHANGELOG.md](CHANGELOG.md)
377
+ - [docs/TEST-2.34.0.md](docs/TEST-2.34.0.md)
364
378
  - [docs/TEST-2.33.0.md](docs/TEST-2.33.0.md)
365
379
  - [docs/TEST-2.32.0.md](docs/TEST-2.32.0.md)
366
380
  - [docs/TEST-2.31.0.md](docs/TEST-2.31.0.md)
@@ -383,4 +397,4 @@ node tools/e2e-http.mjs
383
397
 
384
398
  MIT. Сделано для DeepSeek Harness; без внешних зависимостей и телеметрии.
385
399
 
386
- **2.33.0** · 21 плагин · 35 навыков · 14 ролей · 7 пресетов · 14 гейтов · Windows 11 · DSH 0.2.x
400
+ **2.34.0** · 21 плагин · 35 навыков · 14 ролей · 7 пресетов · 14 гейтов · Windows 11 · DSH 0.2.x
package/client.js CHANGED
@@ -8374,7 +8374,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
8374
8374
  if (__kitErrors.length <= 5) console.error("[dsh-desktop-kit] registration failed:", label, message);
8375
8375
  };
8376
8376
  try {
8377
- window.__DSH_DESKTOP_KIT__ = { version: "2.33.0", parts: __partNames, errors: __kitErrors, ready: false };
8377
+ window.__DSH_DESKTOP_KIT__ = { version: "2.34.0", parts: __partNames, errors: __kitErrors, ready: false };
8378
8378
  } catch {}
8379
8379
  const __inject = [];
8380
8380
  for (const __part of __parts) {
package/docs/MEASURED.md CHANGED
@@ -7,7 +7,7 @@
7
7
  Отрицательный результат тоже результат: если метрика ухудшилась, она остаётся в таблице — с новой датой и честным объяснением, а не удаляется.
8
8
 
9
9
  <!-- MEASURED:START -->
10
- Версия **2.33.0** · замер 2026-12-02T11:32:42.256Z · Windows_NT 10.0.26200 · AMD Ryzen 7 4800H with Radeon Graphics · 16 потоков · 7.4 ГБ RAM · Node v24.20.0.
10
+ Версия **2.34.0** · замер 2026-12-02T11:57:06.966Z · Windows_NT 10.0.26200 · AMD Ryzen 7 4800H with Radeon Graphics · 16 потоков · 7.4 ГБ RAM · Node v24.20.0.
11
11
 
12
12
  | Метрика | Значение | Как измерено |
13
13
  |---|---:|---|
@@ -16,10 +16,10 @@
16
16
  | Каталог навыков, токенов | 53460 | node tools/skill-cost.mjs |
17
17
  | references, токенов | 224412 | node tools/skill-cost.mjs |
18
18
  | Самое тяжёлое ядро | 2417 (web-build) | бюджет 6000 токенов |
19
- | Документов в docs/ | 84 | tools/measure.mjs → docs/**/*.md |
20
- | README.md, байт | 29777 | stat README.md |
21
- | README.en.md, байт | 7654 | stat README.en.md |
22
- | Tarball, байт | 12417273 | npm pack --dry-run --json |
23
- | Файлов в tarball | 551 | npm pack --dry-run --json |
24
- | Распакованный размер, байт | 16617311 | npm pack --dry-run --json |
19
+ | Документов в docs/ | 85 | tools/measure.mjs → docs/**/*.md |
20
+ | README.md, байт | 31799 | stat README.md |
21
+ | README.en.md, байт | 8885 | stat README.en.md |
22
+ | Tarball, байт | 12366640 | npm pack --dry-run --json |
23
+ | Файлов в tarball | 545 | npm pack --dry-run --json |
24
+ | Распакованный размер, байт | 16455127 | npm pack --dry-run --json |
25
25
  <!-- MEASURED:END -->
@@ -0,0 +1,36 @@
1
+ # TEST 2.34.0 — locks, runner, release polling, checkpoints, UI coverage
2
+
3
+ Дата: 2026-12-02 · Windows 11 · Node v24.20.0 · DSH 0.2.x.
4
+
5
+ ## Что проверялось
6
+
7
+ - **Locks:** атомарный захват, чужой owner, stale takeover, heartbeat/release.
8
+ - **Test runner:** шаги из `test:steps` без PowerShell/`&&`-обёртки; failing step.
9
+ - **Release:** polling packument и сообщение об асинхронной/staged публикации.
10
+ - **Checkpoints:** atomic temp→rename, secret scan, retention, restore.
11
+ - **UI coverage:** `.dsh/quality/ui.json`, отдельный interact на сценарий.
12
+ - **Runtime:** persistence в `runtime.json`, отсутствие текста команд.
13
+ - **Roles:** parsing/prompt `max_turns`/`skills`/`isolation`.
14
+ - **Instructions:** catalog + user skills, stale/valid.
15
+ - **Release consistency:** `skills/manifest.json`.
16
+
17
+ ## Команды и результаты
18
+
19
+ | Команда | Результат |
20
+ |---|---|
21
+ | `node tools/run-tests.mjs` | 43/43 шага |
22
+ | `node plugins/dsh-guardrails/tools/guardrails-tests.mjs` | 44 tests OK |
23
+ | `node tools/agent-extensions-tests.mjs` | OK |
24
+ | `node tools/instructions-tests.mjs` | OK |
25
+ | `node tools/ui-gate-tests.mjs` | OK |
26
+ | `node tools/memory-tests.mjs` | OK |
27
+ | `node tools/quality-pipeline-tests.mjs` | 27 groups OK |
28
+ | `node tools/check-release-consistency.mjs` | OK для 2.34.0 |
29
+
30
+ ## Ограничения
31
+
32
+ - `max_turns` остаётся **advisory**: DSH subagent API не принимает лимит шагов; роль получает бюджет в prompt и должна остановиться сама. Жёсткое принуждение потребует API DSH.
33
+ - Locks advisory для не-`project_agent` инструментов; heartbeat 30 с, TTL 15 мин.
34
+ - File checkpoint сканирует только файлы ≤512 КБ; крупные бинарники копируются без content-скана.
35
+ - Store snapshot/retention не дедуплицирует содержимое: 20 полных копий проекта могут занимать место.
36
+ - Release polling ограничен 10 минутами; staged-публикация всё ещё требует 2FA-подтверждения владельца.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": 1,
3
- "version": "2.33.0",
4
- "measuredAt": "2026-12-02T11:32:42.256Z",
3
+ "version": "2.34.0",
4
+ "measuredAt": "2026-12-02T11:57:06.966Z",
5
5
  "command": "npm run measure",
6
6
  "machine": {
7
7
  "platform": "win32 x64",
@@ -19,12 +19,12 @@
19
19
  "skillCoreBudget": 6000,
20
20
  "skillCoreMaxTokens": 2417,
21
21
  "skillCoreMaxName": "web-build",
22
- "docsFiles": 84,
23
- "readmeBytes": 29777,
24
- "readmeEnBytes": 7654,
25
- "tarballBytes": 12417273,
26
- "unpackedBytes": 16617311,
27
- "tarballEntries": 551,
28
- "tarballName": "dsh-desktop-kit-2.33.0.tgz"
22
+ "docsFiles": 85,
23
+ "readmeBytes": 31799,
24
+ "readmeEnBytes": 8885,
25
+ "tarballBytes": 12366640,
26
+ "unpackedBytes": 16455127,
27
+ "tarballEntries": 545,
28
+ "tarballName": "dsh-desktop-kit-2.34.0.tgz"
29
29
  }
30
30
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-desktop-kit",
3
- "version": "2.33.0",
3
+ "version": "2.34.0",
4
4
  "description": "DeepSeek Harness desktop kit 2.31.0 — 21 plugins and 35 skills: quality mission with phases, gates G0..G13, a pre-work layer (product brief, measured references, IA/content inventory, plan with dependencies, risks and blockers), an art-direction brief with variants, a release pipeline and remote_ops (typed ssh/scp with host state diff), units of work and an evidence trail; browser QA with 18 actions (interaction scenarios, accessibility WCAG 2.2 AA, performance budgets, element locate, pixel-diff baselines, palette contrast matrix, cross-page consistency, interactive-state and content checks, design report, reference take), plus an i18n dictionary pipeline; 14 project agents including ui-critic, a11y, cms-ops and a worktree builder; phase-aware skill routing with a token budget; MCP with OAuth 2.1, sampling and elicitation; read-only/writer swarm with a shared board; token lab, Skills Studio, project memory, guardrails, repo map, checkpoints, plan mode, 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",
@@ -92,13 +92,14 @@
92
92
  "build:client": "node tools/build-client.mjs",
93
93
  "build:skills": "node tools/build-skill-manifest.mjs",
94
94
  "check:client": "node tools/check-client.mjs client.js",
95
- "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/quality-pipeline-tests.mjs && node tools/remote-ops-tests.mjs && node tools/i18n-tests.mjs && node tools/autopilot-route-tests.mjs && node tools/browser-qa-tests.mjs && node tools/browser-qa-extras-tests.mjs && node tools/ui-gate-tests.mjs && node tools/agent-extensions-tests.mjs && node tools/research-ledger-tests.mjs && node tools/research-eval.mjs && node tools/citation-eval.mjs && node tools/mcp-manager-tests.mjs && node tools/github-review-tests.mjs && node tools/mcp-catalog-tests.mjs && node tools/mcp-bootstrap-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/rc3-compat-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 && node tools/kit-diagnostics-tests.mjs && node tools/onboarding-tests.mjs && node tools/check-release-consistency.mjs",
95
+ "test": "node tools/run-tests.mjs",
96
96
  "skills:cost": "node tools/skill-cost.mjs",
97
97
  "skills:check": "node tools/skill-cost.mjs --check",
98
98
  "release": "node tools/release.mjs",
99
99
  "verify:release": "node tools/verify-release.mjs",
100
100
  "measure": "node tools/measure.mjs",
101
- "check:release": "node tools/check-release-consistency.mjs"
101
+ "check:release": "node tools/check-release-consistency.mjs",
102
+ "test:steps": "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/quality-pipeline-tests.mjs && node tools/remote-ops-tests.mjs && node tools/i18n-tests.mjs && node tools/autopilot-route-tests.mjs && node tools/browser-qa-tests.mjs && node tools/browser-qa-extras-tests.mjs && node tools/ui-gate-tests.mjs && node tools/agent-extensions-tests.mjs && node tools/research-ledger-tests.mjs && node tools/research-eval.mjs && node tools/citation-eval.mjs && node tools/mcp-manager-tests.mjs && node tools/github-review-tests.mjs && node tools/mcp-catalog-tests.mjs && node tools/mcp-bootstrap-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/rc3-compat-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 && node tools/kit-diagnostics-tests.mjs && node tools/onboarding-tests.mjs && node tools/check-release-consistency.mjs"
102
103
  },
103
104
  "engines": {
104
105
  "node": ">=20"
@@ -174,7 +174,7 @@ function toolDefinition(ctx) {
174
174
  if (!definition) return { ok: false, text: `project_agent: unknown agent "${name}"` };
175
175
  let worktree = null;
176
176
  try {
177
- const requested = input?.worktree;
177
+ const requested = input?.worktree ?? (definition.isolation === "worktree" ? "auto" : false);
178
178
  if (requested) {
179
179
  const auto = requested === true || String(requested).toLowerCase() === "auto";
180
180
  const slug = auto ? `${safeSlug(name)}-${Date.now().toString(36).slice(-4)}` : String(requested);
@@ -39,6 +39,17 @@ function remember(record, activation, projectRoot, signal, onAbort) {
39
39
  background.set(record.id, { record, activation, projectRoot, signal, onAbort });
40
40
  }
41
41
 
42
+ export function rolePrompt(definition = {}) {
43
+ const lines = [];
44
+ if (definition.maxTurns > 0) {
45
+ lines.push(`Turn budget (advisory): ${definition.maxTurns}. Stop when the deliverable is done; if blocked, report the blocker instead of looping.`);
46
+ }
47
+ if (definition.skills) {
48
+ lines.push(`Available skills: ${definition.skills}. Load exactly the ones you need with the skill tool.`);
49
+ }
50
+ return lines.join("\n");
51
+ }
52
+
42
53
  export async function runProjectAgent(ctx, exec, definition, task, options = {}) { const subagents = ctx.get("subagents");
43
54
  if (!subagents || typeof subagents.startActivation !== "function") {
44
55
  throw new Error("subagents service is unavailable");
@@ -82,6 +93,7 @@ export async function runProjectAgent(ctx, exec, definition, task, options = {})
82
93
  const prompt = [
83
94
  `<project-agent name="${definition.name}">`,
84
95
  definition.body,
96
+ rolePrompt(definition),
85
97
  "</project-agent>",
86
98
  options.teamId ? `<team id="${options.teamId}">Use team_board action=post/read with teamId=${options.teamId} to share findings; use add-task/claim/done for work items. Use team_message to=\"parent\" for a live message to the lead; sibling live messaging is not available — the board is the shared channel.</team>` : "",
87
99
  options.leadContext ? `<team-lead>You coordinate this team. Members: ${options.leadContext}. Read the board first; assign/claim tasks with acceptance criteria and non-overlapping scopes; use team_message to=<run-id> for live directions and team_message to=\"parent\" to report to the parent. Finish with a PASS/FAIL synthesis, blockers and unresolved risks.</team-lead>` : "",
@@ -11,6 +11,7 @@ import fs from "node:fs";
11
11
  import os from "node:os";
12
12
  import path from "node:path";
13
13
  import { spawnSync } from "node:child_process";
14
+ import { scanTextForSecrets } from "../../dsh-guardrails/lib/secrets.js";
14
15
 
15
16
  function git(cwd, args, env, allowFail = false) {
16
17
  const result = spawnSync("git", args, {
@@ -50,6 +51,8 @@ function fileCheckpointDir(root, home) {
50
51
  const FILE_SKIP = /(?:^|[\\/])(?:node_modules|\.git|\.dsh|dist|build|coverage|\.cache|vendor|\.next|target|\.ssh|\.aws|\.azure|\.gnupg)(?:[\\/]|$)|(?:^|[\\/])\.env(?:\.|$)|(?:^|[\\/])(?:\.npmrc|\.git-credentials|credentials)(?:[\\/]|$)|\.(?:pem|key|pfx|p12|kdbx)$/iu;
51
52
  const FILE_LIMIT = 5000;
52
53
  const BYTE_LIMIT = 200 * 1024 * 1024;
54
+ const SECRET_SCAN_BYTES = 512 * 1024;
55
+ const RETENTION = 20;
53
56
 
54
57
  function resolveRoot(cwd) {
55
58
  try {
@@ -80,33 +83,76 @@ function walkFiles(root, relative = "", state = { files: [], bytes: 0 }) {
80
83
  return state;
81
84
  }
82
85
 
83
- function copyFiles(root, destination, files) {
86
+ function copyFiles(root, destination, files, { scanSecrets = false } = {}) {
87
+ const skipped = [];
84
88
  for (const rel of files) {
89
+ const source = path.join(root, rel);
90
+ if (scanSecrets) {
91
+ try {
92
+ if (fs.statSync(source).size <= SECRET_SCAN_BYTES) {
93
+ const text = fs.readFileSync(source, "utf8");
94
+ if (scanTextForSecrets(text, { maxFindings: 1 }).length > 0) {
95
+ skipped.push(rel);
96
+ continue;
97
+ }
98
+ }
99
+ } catch {
100
+ skipped.push(rel);
101
+ continue;
102
+ }
103
+ }
85
104
  const target = path.join(destination, rel);
86
105
  fs.mkdirSync(path.dirname(target), { recursive: true, mode: 0o700 });
87
- fs.copyFileSync(path.join(root, rel), target);
106
+ fs.copyFileSync(source, target);
88
107
  }
108
+ return { skipped };
89
109
  }
90
110
 
91
111
  function createFileCheckpoint({ cwd, label, home }) {
92
112
  const root = path.resolve(cwd || process.cwd());
93
113
  const id = `cp-${new Date().toISOString().replace(/[-:T.Z]/gu, "").slice(0, 14)}-${crypto.randomBytes(3).toString("hex")}`;
94
114
  const state = walkFiles(root);
95
- const directory = path.join(fileCheckpointDir(root, home), id);
96
- fs.mkdirSync(path.join(directory, "files"), { recursive: true, mode: 0o700 });
97
- copyFiles(root, path.join(directory, "files"), state.files);
98
- const meta = {
99
- id,
100
- kind: "files",
101
- label: String(label ?? ""),
102
- createdAt: new Date().toISOString(),
103
- root,
104
- files: state.files.length,
105
- bytes: state.bytes,
106
- snapshot: path.join(directory, "files"),
107
- };
108
- fs.writeFileSync(path.join(directory, "meta.json"), `${JSON.stringify(meta, null, 2)}\n`, { mode: 0o600 });
109
- return meta;
115
+ const parent = fileCheckpointDir(root, home);
116
+ const finalDirectory = path.join(parent, id);
117
+ const temporary = path.join(parent, `${id}.tmp-${process.pid}-${crypto.randomBytes(3).toString("hex")}`);
118
+ let copied;
119
+ try {
120
+ fs.mkdirSync(path.join(temporary, "files"), { recursive: true, mode: 0o700 });
121
+ copied = copyFiles(root, path.join(temporary, "files"), state.files, { scanSecrets: true });
122
+ const meta = {
123
+ id,
124
+ kind: "files",
125
+ label: String(label ?? ""),
126
+ createdAt: new Date().toISOString(),
127
+ root,
128
+ files: state.files.length - copied.skipped.length,
129
+ skippedSecrets: copied.skipped.length,
130
+ bytes: state.bytes,
131
+ snapshot: path.join(finalDirectory, "files"),
132
+ };
133
+ fs.writeFileSync(path.join(temporary, "meta.json"), `${JSON.stringify(meta, null, 2)}\n`, { mode: 0o600 });
134
+ fs.renameSync(temporary, finalDirectory);
135
+ pruneFileCheckpoints(root, home);
136
+ return meta;
137
+ } catch (error) {
138
+ try { fs.rmSync(temporary, { recursive: true, force: true }); } catch { /* best effort */ }
139
+ throw error;
140
+ }
141
+ }
142
+
143
+ function pruneFileCheckpoints(root, home) {
144
+ const directory = fileCheckpointDir(root, home);
145
+ if (!fs.existsSync(directory)) return;
146
+ const entries = fs.readdirSync(directory)
147
+ .filter((name) => /^cp-[^\\/]+$/u.test(name))
148
+ .map((name) => {
149
+ try { return { name, at: fs.statSync(path.join(directory, name)).mtimeMs }; } catch { return null; }
150
+ })
151
+ .filter(Boolean)
152
+ .sort((left, right) => right.at - left.at);
153
+ for (const entry of entries.slice(RETENTION)) {
154
+ try { fs.rmSync(path.join(directory, entry.name), { recursive: true, force: true }); } catch { /* best effort */ }
155
+ }
110
156
  }
111
157
 
112
158
  function listFileCheckpoints(root, home) {
@@ -119,7 +119,7 @@ function statusText(ctx) {
119
119
  `Checkpoints: ${checkpoints.length}`,
120
120
  `Instructions: ${instructions.files.length} файлов · ${instructions.bytes} байт · предупреждений ${instructions.findings.length}`,
121
121
  ...instructions.findings.slice(0, 5).map((item) => ` ! ${item.code}: ${item.message}`),
122
- `Locks: ${locks.length}${locks.length ? ` · ${locks.map((lock) => `${lock.root} (${lock.owner})`).join("; ")}` : ""}`,
122
+ `Locks: ${locks.length}${locks.length ? ` · ${locks.slice(0, 5).map((lock) => `${lock.root} (${lock.owner})`).join("; ")}${locks.length > 5 ? " …" : ""}` : ""}`,
123
123
  `Quality: ${quality ? `${quality.profile} · ${quality.phase} · гейтов ${Object.values(quality.gates ?? {}).filter((gate) => gate.status === "passed").length}/${Object.keys(quality.gates ?? {}).length}` : "миссии нет (/quality start)"}`,
124
124
  ].join("\n");
125
125
  }
@@ -115,12 +115,27 @@ function dshSkillsDir() {
115
115
  return path.join(process.env.DSH_HOME || path.join(os.homedir(), ".dsh"), "skills");
116
116
  }
117
117
 
118
+ function kitSkillCatalog() {
119
+ try {
120
+ const manifest = JSON.parse(fs.readFileSync(path.resolve(import.meta.dirname, "../../../skills/manifest.json"), "utf8"));
121
+ const raw = manifest?.skills;
122
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) return new Set(Object.keys(raw).map((name) => name.toLowerCase()));
123
+ if (Array.isArray(raw)) return new Set(raw.map((item) => String(item?.name ?? "").toLowerCase()).filter(Boolean));
124
+ return null;
125
+ } catch {
126
+ return null;
127
+ }
128
+ }
129
+
130
+ const KIT_SKILLS = kitSkillCatalog();
131
+
118
132
  function skillExists(name) {
119
133
  try {
120
- return fs.existsSync(path.join(dshSkillsDir(), name, "SKILL.md"));
134
+ if (fs.existsSync(path.join(dshSkillsDir(), name, "SKILL.md"))) return true;
121
135
  } catch {
122
- return false;
136
+ /* fall through to the kit catalog */
123
137
  }
138
+ return Boolean(KIT_SKILLS?.has(name));
124
139
  }
125
140
 
126
141
  /** Extract explicit skill references, not every hyphenated word. */
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Advisory writer locks for project agents.
3
3
  *
4
- * DSH does not serialise two writers in the same project. This lock is a
5
- * local, best-effort guard: it lives under DSH_HOME, contains no secrets, and
6
- * expires so a crashed agent cannot block the project forever. It is advisory
7
- * (other tools can still edit); the value is that two `project_agent` writers
8
- * no longer start on the same root by accident.
4
+ * The lock is acquired atomically with O_EXCL (`wx`), refreshed by a heartbeat,
5
+ * and released by the owner. It is still advisory: other tools can edit the
6
+ * project; the value is that two `project_agent` writers do not start on the
7
+ * same root by accident. A dead PID or an expired heartbeat makes a lock
8
+ * stealable, so a crashed agent cannot block the project forever.
9
9
  */
10
10
  import crypto from "node:crypto";
11
11
  import fs from "node:fs";
@@ -13,6 +13,8 @@ import os from "node:os";
13
13
  import path from "node:path";
14
14
 
15
15
  const DEFAULT_TTL_MS = 15 * 60 * 1000;
16
+ const HEARTBEAT_MS = 30 * 1000;
17
+ const heartbeats = new Map();
16
18
 
17
19
  function homeDirectory(home) {
18
20
  return home || process.env.DSH_HOME || path.join(os.homedir(), ".dsh");
@@ -35,34 +37,69 @@ function readLock(file) {
35
37
  }
36
38
  }
37
39
 
40
+ function processAlive(pid) {
41
+ if (!Number.isInteger(pid) || pid <= 0) return false;
42
+ try {
43
+ process.kill(pid, 0);
44
+ return true;
45
+ } catch (error) {
46
+ return error?.code === "EPERM";
47
+ }
48
+ }
49
+
38
50
  function isStale(lock, now = Date.now()) {
39
51
  const heartbeat = Date.parse(lock?.heartbeatAt ?? lock?.createdAt ?? "");
40
52
  const ttl = Number(lock?.ttlMs) > 0 ? Number(lock.ttlMs) : DEFAULT_TTL_MS;
41
- return !Number.isFinite(heartbeat) || now - heartbeat > ttl;
53
+ if (!Number.isFinite(heartbeat) || now - heartbeat > ttl) return true;
54
+ return !processAlive(Number(lock?.pid));
42
55
  }
43
56
 
44
- function safeWrite(file, value) {
45
- fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
57
+ function atomicWrite(file, value) {
46
58
  const temporary = `${file}.${process.pid}.${Date.now()}.tmp`;
47
59
  fs.writeFileSync(temporary, `${JSON.stringify(value, null, 2)}\n`, { mode: 0o600 });
48
60
  fs.renameSync(temporary, file);
49
61
  }
50
62
 
63
+ function createExclusive(file, value) {
64
+ fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
65
+ const fd = fs.openSync(file, "wx", 0o600);
66
+ try {
67
+ fs.writeFileSync(fd, `${JSON.stringify(value, null, 2)}\n`);
68
+ } finally {
69
+ fs.closeSync(fd);
70
+ }
71
+ }
72
+
73
+ function stopHeartbeat(file) {
74
+ const timer = heartbeats.get(file);
75
+ if (timer) clearInterval(timer);
76
+ heartbeats.delete(file);
77
+ }
78
+
79
+ function startHeartbeat(file, owner) {
80
+ stopHeartbeat(file);
81
+ const timer = setInterval(() => {
82
+ try {
83
+ const current = readLock(file);
84
+ if (!current || String(current.owner) !== String(owner)) {
85
+ stopHeartbeat(file);
86
+ return;
87
+ }
88
+ atomicWrite(file, { ...current, heartbeatAt: new Date().toISOString() });
89
+ } catch {
90
+ stopHeartbeat(file);
91
+ }
92
+ }, HEARTBEAT_MS);
93
+ timer.unref?.();
94
+ heartbeats.set(file, timer);
95
+ }
96
+
51
97
  export function acquireLock({ cwd, owner, scope = "writer", ttlMs = DEFAULT_TTL_MS, home } = {}) {
52
98
  if (!cwd) throw new Error("lock: cwd is required");
53
99
  if (!owner) throw new Error("lock: owner is required");
54
100
  const root = path.resolve(cwd);
55
101
  const file = lockFile(root, home);
56
102
  const now = new Date().toISOString();
57
- const existing = readLock(file);
58
- if (existing && !isStale(existing)) {
59
- if (String(existing.owner) === String(owner)) {
60
- const refreshed = { ...existing, heartbeatAt: now };
61
- safeWrite(file, refreshed);
62
- return { ok: true, lock: refreshed, refreshed: true };
63
- }
64
- return { ok: false, holder: existing, file };
65
- }
66
103
  const lock = {
67
104
  id: crypto.randomUUID(),
68
105
  root,
@@ -73,16 +110,38 @@ export function acquireLock({ cwd, owner, scope = "writer", ttlMs = DEFAULT_TTL_
73
110
  heartbeatAt: now,
74
111
  ttlMs: Number(ttlMs) > 0 ? Number(ttlMs) : DEFAULT_TTL_MS,
75
112
  };
76
- safeWrite(file, lock);
77
- return { ok: true, lock, refreshed: false };
113
+ for (let attempt = 0; attempt < 3; attempt += 1) {
114
+ try {
115
+ createExclusive(file, lock);
116
+ startHeartbeat(file, owner);
117
+ return { ok: true, lock, refreshed: false, stop: () => stopHeartbeat(file) };
118
+ } catch (error) {
119
+ if (error?.code !== "EEXIST") throw error;
120
+ const existing = readLock(file);
121
+ if (!existing) continue;
122
+ if (String(existing.owner) === String(owner)) {
123
+ const refreshed = { ...existing, heartbeatAt: now };
124
+ atomicWrite(file, refreshed);
125
+ startHeartbeat(file, owner);
126
+ return { ok: true, lock: refreshed, refreshed: true, stop: () => stopHeartbeat(file) };
127
+ }
128
+ if (!isStale(existing)) return { ok: false, holder: existing, file };
129
+ try { fs.rmSync(file, { force: true }); } catch { /* another contender may win */ }
130
+ }
131
+ }
132
+ return { ok: false, holder: readLock(file) ?? null, file };
78
133
  }
79
134
 
80
135
  export function releaseLock({ cwd, owner, home } = {}) {
81
136
  if (!cwd || !owner) return { ok: false, reason: "cwd and owner are required" };
82
137
  const file = lockFile(cwd, home);
83
138
  const existing = readLock(file);
84
- if (!existing) return { ok: true, released: false };
139
+ if (!existing) {
140
+ stopHeartbeat(file);
141
+ return { ok: true, released: false };
142
+ }
85
143
  if (String(existing.owner) !== String(owner)) return { ok: false, reason: "lock belongs to another owner", holder: existing };
144
+ stopHeartbeat(file);
86
145
  fs.rmSync(file, { force: true });
87
146
  return { ok: true, released: true };
88
147
  }
@@ -92,7 +151,7 @@ export function refreshLock({ cwd, owner, home } = {}) {
92
151
  const existing = readLock(file);
93
152
  if (!existing || String(existing.owner) !== String(owner)) return { ok: false, reason: "lock not held by owner" };
94
153
  const refreshed = { ...existing, heartbeatAt: new Date().toISOString() };
95
- safeWrite(file, refreshed);
154
+ atomicWrite(file, refreshed);
96
155
  return { ok: true, lock: refreshed };
97
156
  }
98
157
 
@@ -112,3 +171,4 @@ export function lockCount({ home } = {}) {
112
171
  }
113
172
 
114
173
  export const LOCK_TTL_MS = DEFAULT_TTL_MS;
174
+ export const LOCK_HEARTBEAT_MS = HEARTBEAT_MS;
@@ -27,6 +27,29 @@ const SHELL_WRITE = /(?:^|[\s"'=])(?:>|>>|Set-Content|Add-Content|Out-File|Copy-
27
27
  const MAX_REMINDERS = 4;
28
28
  const MAX_PATHS = 12;
29
29
 
30
+ /**
31
+ * Optional critical-scenario coverage: `.dsh/quality/ui.json` with
32
+ * `{ "scenarios": ["menu", "checkout"] }`. When present, a single passing
33
+ * interact is no longer enough; distinct interact runs must cover the list.
34
+ */
35
+ export function readUiCoverage(cwd) {
36
+ if (!cwd) return [];
37
+ for (const name of ["ui.json", "ui-coverage.json"]) {
38
+ try {
39
+ const raw = JSON.parse(fs.readFileSync(path.join(cwd, ".dsh", "quality", name), "utf8"));
40
+ const scenarios = Array.isArray(raw?.scenarios) ? raw.scenarios : [];
41
+ return scenarios
42
+ .map((item) => (typeof item === "string" ? item : item?.name))
43
+ .filter((item) => typeof item === "string" && item.trim().length > 0)
44
+ .map((item) => item.trim())
45
+ .slice(0, 20);
46
+ } catch {
47
+ /* optional */
48
+ }
49
+ }
50
+ return [];
51
+ }
52
+
30
53
  function shellUiPath(command) {
31
54
  const match = String(command).match(/(?:[A-Za-z]:[\\/]|\.{0,2}[\\/])?[^\s"'<>|;]+\.(?:html?|xhtml|css|scss|sass|less|jsx|tsx|vue|svelte|astro|mdx)/iu);
32
55
  return match?.[0] ?? "";
@@ -217,6 +240,8 @@ export function createUiGate(ctx) {
217
240
  a11y: null,
218
241
  interactAt: 0,
219
242
  interact: null,
243
+ interactRuns: new Set(),
244
+ coverage: [],
220
245
  paths: new Set(),
221
246
  reminders: 0,
222
247
  };
@@ -238,6 +263,8 @@ export function createUiGate(ctx) {
238
263
  state.clean = false;
239
264
  state.a11y = null;
240
265
  state.interact = null;
266
+ state.interactRuns.clear();
267
+ state.coverage = readUiCoverage(cwdOf(ctx, actor));
241
268
  state.lastEditAt = Date.now();
242
269
  state.reminders = 0;
243
270
  state.paths.add(file);
@@ -272,6 +299,11 @@ export function createUiGate(ctx) {
272
299
  if (!parsed) return;
273
300
  state.interactAt = Date.now();
274
301
  state.interact = parsed;
302
+ if (parsed.pass === true) {
303
+ const steps = exec?.arguments?.steps ?? exec?.args?.steps ?? exec?.input?.steps ?? [];
304
+ const digest = crypto.createHash("sha1").update(JSON.stringify(steps)).digest("hex").slice(0, 12);
305
+ state.interactRuns.add(digest);
306
+ }
275
307
  }
276
308
 
277
309
  /** What still blocks the turn, in the order the model should fix it. */
@@ -284,6 +316,7 @@ export function createUiGate(ctx) {
284
316
  else if (Number(state.a11y?.serious ?? 0) > 0) missing.push("a11y-issues");
285
317
  if (!state.interactAt || state.interactAt < state.lastEditAt) missing.push("interact-missing");
286
318
  else if (state.interact && state.interact.pass !== true) missing.push("interact-fail");
319
+ else if ((state.coverage?.length ?? 0) > 0 && (state.interactRuns?.size ?? 0) < state.coverage.length) missing.push("interact-coverage");
287
320
  return missing;
288
321
  }
289
322
 
@@ -314,6 +347,9 @@ export function createUiGate(ctx) {
314
347
  if (missing.includes("interact-fail")) {
315
348
  lines.push("Сценарий browser_qa action=interact упал: элемент перекрыт, невидим или не прошло ожидание. Почини и прогони сценарий заново.");
316
349
  }
350
+ if (missing.includes("interact-coverage")) {
351
+ lines.push(`Нужно покрытие критических сценариев (${(state.coverage ?? []).join(", ")}): сейчас пройдено ${state.interactRuns?.size ?? 0}/${state.coverage?.length ?? 0}. Прогони отдельный interact для каждого сценария из .dsh/quality/ui.json.`);
352
+ }
317
353
  lines.push("</ui-gate>");
318
354
  return lines.join("\n");
319
355
  }
@@ -18,6 +18,7 @@
18
18
  * `<DSH_HOME>/guardrails.json`.
19
19
  */
20
20
  import fs from "node:fs";
21
+ import os from "node:os";
21
22
  import path from "node:path";
22
23
 
23
24
  import { createGuard, createHookState, registerHooks } from "./lib/hooks.js";
@@ -339,7 +340,8 @@ export function apply(ctx) {
339
340
  const env = process.env;
340
341
  const logger = ctx?.logger;
341
342
  const hookState = createHookState();
342
- const runtime = createRuntimeState();
343
+ const runtimeFile = path.join(env.DSH_HOME || path.join(os.homedir(), ".dsh"), "agent-extensions", "runtime.json");
344
+ const runtime = createRuntimeState({ persistPath: runtimeFile });
343
345
  const guard = createGuard({ env, logger, runtime, modeFor: (agent) => resolveMode(ctx, agent) });
344
346
  try {
345
347
  registerHooks(ctx, guard, hookState);
@@ -7,6 +7,8 @@
7
7
  * `/guardrails action=runtime`. Command text is never stored; only a hash.
8
8
  */
9
9
  import crypto from "node:crypto";
10
+ import fs from "node:fs";
11
+ import path from "node:path";
10
12
 
11
13
  const DESTRUCTIVE = /\b(?:rm\s+-rf|rmdir\s+\/s|rd\s+\/s|del\s+\/[sfq]|git\s+(?:reset\s+--hard|clean\s+-[a-z]*f|push\s+(?:--force|-f)|checkout\s+--\s+\.)|drop\s+(?:table|database|schema)|truncate\s+table|delete\s+from|format\s+[a-z]:|shutdown|Stop-Computer|Remove-Item\b[^\n]*-Recurse|migrate:fresh|migrate:refresh|db:wipe|pg_dropcluster)\b/iu;
12
14
  const EXTERNAL = /\b(?:git\s+push|npm\s+publish|pnpm\s+publish|gh\s+release|gh\s+pr\s+(?:create|merge)|ssh\b|scp\b|remote_ops|curl\b[^\n]*(?:-X\s*(?:POST|PUT|DELETE)|--data)|Invoke-WebRequest\b[^\n]*-Method\s*(?:Post|Put|Delete)|wget\b[^\n]*--post)/iu;
@@ -74,12 +76,37 @@ export function classifyConsequence(exec, cwd = "") {
74
76
  const MAX_DECISIONS = 80;
75
77
 
76
78
  /**
77
- * Bounded in-memory runtime. No disk writes, no command text, no secrets.
79
+ * Bounded runtime. No command text, no secrets. When `persistPath` is set the
80
+ * snapshot survives a DSH restart, which makes `/guardrails runtime` useful for
81
+ * "what did I approve an hour ago" instead of only the current process.
78
82
  */
79
- export function createRuntimeState({ limit = MAX_DECISIONS } = {}) {
83
+ export function createRuntimeState({ limit = MAX_DECISIONS, persistPath = "" } = {}) {
80
84
  const decisions = [];
81
85
  let asks = 0;
82
86
  let denies = 0;
87
+ let loaded = false;
88
+ if (persistPath) {
89
+ try {
90
+ const raw = JSON.parse(fs.readFileSync(persistPath, "utf8"));
91
+ if (Array.isArray(raw?.decisions)) decisions.push(...raw.decisions.slice(-limit));
92
+ asks = Number(raw?.asks) || 0;
93
+ denies = Number(raw?.denies) || 0;
94
+ loaded = true;
95
+ } catch {
96
+ /* no previous runtime */
97
+ }
98
+ }
99
+ function persist() {
100
+ if (!persistPath) return;
101
+ try {
102
+ fs.mkdirSync(path.dirname(persistPath), { recursive: true, mode: 0o700 });
103
+ const temporary = `${persistPath}.${process.pid}.tmp`;
104
+ fs.writeFileSync(temporary, `${JSON.stringify({ updatedAt: new Date().toISOString(), asks, denies, decisions }, null, 2)}\n`, { mode: 0o600 });
105
+ fs.renameSync(temporary, persistPath);
106
+ } catch {
107
+ /* diagnostics are best effort */
108
+ }
109
+ }
83
110
  return {
84
111
  record(exec, decision, { mode, rule } = {}) {
85
112
  if (!decision || (decision.kind !== "ask" && decision.kind !== "deny")) return;
@@ -101,11 +128,14 @@ export function createRuntimeState({ limit = MAX_DECISIONS } = {}) {
101
128
  if (decisions.length > limit) decisions.splice(0, decisions.length - limit);
102
129
  if (decision.kind === "ask") asks += 1;
103
130
  else denies += 1;
131
+ persist();
104
132
  return item;
105
133
  },
106
134
  snapshot() {
107
135
  return {
108
136
  ok: true,
137
+ persisted: Boolean(persistPath),
138
+ loaded,
109
139
  count: decisions.length,
110
140
  asks,
111
141
  denies,
@@ -117,6 +147,7 @@ export function createRuntimeState({ limit = MAX_DECISIONS } = {}) {
117
147
  decisions.length = 0;
118
148
  asks = 0;
119
149
  denies = 0;
150
+ persist();
120
151
  },
121
152
  };
122
153
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema": 1,
3
- "kitVersion": "2.31.0",
4
- "generatedAt": "2026-12-01T19:01:37.037Z",
3
+ "kitVersion": "2.34.0",
4
+ "generatedAt": "2026-12-02T11:57:02.832Z",
5
5
  "skills": {
6
6
  "a11y-audit": {
7
7
  "hash": "707659a5cc1207b478bcf45012b06ba46ba88e795ef7e482799f415072fc47b2",
@@ -109,9 +109,9 @@
109
109
  "bytes": 4257
110
110
  },
111
111
  "seo": {
112
- "hash": "4e2a6a3c960fa51edbdac0467d41ea023be37a50afb67b03c0474f33adfb6fc6",
112
+ "hash": "ed48ebc4c1278f857ff430f9a5ec55f638c2f9ba07cc406185cfb94be18ee80d",
113
113
  "files": 29,
114
- "bytes": 386399
114
+ "bytes": 386169
115
115
  },
116
116
  "service-desk-conventions": {
117
117
  "hash": "22ae6c29b7debb0154d183bc732795b67557aeaa0ac906d7b038134aea8ba39a",
@@ -174,9 +174,9 @@
174
174
  "bytes": 14150
175
175
  },
176
176
  "wow-design": {
177
- "hash": "bba0d65db46c89d971eed43e7cd934f59752c062795a4e0d3d345d7313640e48",
177
+ "hash": "81139f32fc759f438a36eb4c0212ed3ea17df9d8075e909580e12bc47a0848dd",
178
178
  "files": 52,
179
- "bytes": 918621
179
+ "bytes": 913669
180
180
  }
181
181
  }
182
182
  }
@@ -23,7 +23,7 @@
23
23
  "requirements-and-planning": "16f3235a9dcdcd1858112806854ef03d76f77588b56434bbacab803bd204f005",
24
24
  "research-first": "ea5e3684d20529fca65a233044e914ba5b7be56a3d93ce283d8632e87904c23e",
25
25
  "security-review": "8665b2c469de8e83aca670021d5c335fa8c9b93b8dc6bb866759e6062b1abde4",
26
- "seo": "4e2a6a3c960fa51edbdac0467d41ea023be37a50afb67b03c0474f33adfb6fc6",
26
+ "seo": "ed48ebc4c1278f857ff430f9a5ec55f638c2f9ba07cc406185cfb94be18ee80d",
27
27
  "service-desk-conventions": "22ae6c29b7debb0154d183bc732795b67557aeaa0ac906d7b038134aea8ba39a",
28
28
  "service-desk-db-safety": "672c08d25e0a9262aeb0eec27b6daa2a619fade6ff3269bc2b9dc27e22c83d28",
29
29
  "service-desk-release": "1bd0c03f772bf4b79ec4e887f5d0ebd564653bafd3d0d33d70f6c934afdcce47",
@@ -36,7 +36,7 @@
36
36
  "web-build": "9e8aa571f28e6974f8ba25a5004ba983efedd7def9daa865a39c78cecd16d55c",
37
37
  "web-quality": "9cffe064faac7ec5763d4644c52e28e7993adca633e0ad92bbd4a88c67ceee23",
38
38
  "web-research": "9bf4d8ba6d2a0fc39c241cdd9f5fe54835af28872473aa617941589c526387c8",
39
- "wow-design": "bba0d65db46c89d971eed43e7cd934f59752c062795a4e0d3d345d7313640e48"
39
+ "wow-design": "81139f32fc759f438a36eb4c0212ed3ea17df9d8075e909580e12bc47a0848dd"
40
40
  },
41
41
  "2.2.0": {
42
42
  "code-review-checklist": "e665bf72cfbfb77948a3cd6df6ebced38777f9aff543d7b9c80b2ced8cccc662",