dsh-desktop-kit 2.15.8 → 2.15.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.15.10 (2026-11-12)
4
+
5
+ - **Team presets.** `.dsh/teams/<id>.json` с `members` и `lead`; `project_agent action=team preset=review task=...`.
6
+ - **UI.** В «Параллельной команде» показываются доступные preset-составы.
7
+ - **API.** `/list` возвращает `teams`.
8
+ - **Тесты.** `team-presets-tests`: dedupe, malformed/invalid skip, find.
9
+
10
+ ## 2.15.9 (2026-11-12)
11
+
12
+ - **Транскрипт после restart.** При завершении/отмене run сохраняется redacted-снимок в `.dsh/agents/transcripts/<run>.json` (0600, 80 записей).
13
+ - **API.** Живая сессия — источник истины; если её нет, читается снимок; иначе честная ошибка.
14
+ - **Тесты.** `transcripts-tests`: extract, redaction, save/load, missing.
15
+
3
16
  ## 2.15.8 (2026-11-12)
4
17
 
5
18
  - **Транскрипт агента.** Кнопка «Транскрипт» у фонового run открывает чтение сессии ребёнка через `ctx.sessions`: user/assistant, tool calls, tool results, errors.
package/README.md CHANGED
@@ -4,39 +4,39 @@
4
4
 
5
5
  Набор из **16 плагинов и 30 навыков** для DeepSeek Harness 0.2.x: MCP tools/resources/prompts + OAuth 2.1, sampling, elicitation; проектные агенты, worktrees, фон и read-only рой с общей доской; русский интерфейс, автопилот навыков, токен-лаборатория, студия навыков, память проектов, guardrails, карта репозитория, чекпоинты, plan mode, browser QA, GitHub review, hooks/commands и резервные копии профиля.
6
6
 
7
- ![DSH Desktop Kit 2.7](https://unpkg.com/dsh-desktop-kit@2.15.8/docs/images/hero.png)
7
+ ![DSH Desktop Kit 2.7](https://unpkg.com/dsh-desktop-kit@2.15.10/docs/images/hero.png)
8
8
 
9
9
  ## MCP: подключения без JSON
10
10
 
11
11
  Настройки → **MCP**: пресеты GitHub, PostgreSQL и Filesystem, живые статусы, health, список tools и безопасное хранение токенов в `~/.dsh/mcp.secrets.json`. Промпты сервера открываются кнопкой **Prompts**: аргументы, запуск и копирование результата. HTTP-серверы подключаются через **OAuth 2.1 + PKCE**, **sampling** идёт через approval-карточку DSH, а **elicitation** — через глобальную форму с Accept/Decline.
12
12
 
13
- ![MCP Settings](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-mcp-manager/screenshots/settings-1440.png)
13
+ ![MCP Settings](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-mcp-manager/screenshots/settings-1440.png)
14
14
 
15
- ![MCP на 390px](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-mcp-manager/screenshots/settings-390.png)
15
+ ![MCP на 390px](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-mcp-manager/screenshots/settings-390.png)
16
16
 
17
- ![Добавление MCP-сервера](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-mcp-manager/screenshots/modal-390.png)
17
+ ![Добавление MCP-сервера](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-mcp-manager/screenshots/modal-390.png)
18
18
 
19
19
  ## Агенты, worktrees и рой
20
20
 
21
21
  - **Проектные роли** — `.dsh/agents/*.md`: `tools`, `permission` и `model` реально ограничивают ребёнка.
22
22
  - **Worktrees** — `project_worktree` создаёт ветку `dsh/<slug>` и папку `.dsh/worktrees/<slug>`; `merge` вливает чистую ветку в main и делает abort при конфликте; `project_agent worktree=auto` запускает агента в изоляции.
23
23
  - **Фон** — `background=true` возвращает run id сразу; страница **Агенты** показывает очередь и кнопку «Остановить».
24
- - **Команда** — `project_agent action=team names=[reviewer,researcher] task=...` запускает 2–6 read-only ролей; `worktrees=true` даёт каждому писателю отдельную ветку.
24
+ - **Команда** — `project_agent action=team names=[reviewer,researcher] task=...` или `preset=review` из `.dsh/teams/review.json` запускает 2–6 read-only ролей; `worktrees=true` даёт каждому писателю отдельную ветку.
25
25
  - **Рой и общая доска** — `team_board` хранит сообщения и задачи в `.dsh/agents/board.json` (0600, redaction, лимиты); team автоматически создаёт `teamId` и передаёт его ролям.
26
26
  - **Живые сообщения** — `team_message` отправляет текст лиду (`to="parent"`) или участнику по run id; копия каждого сообщения остаётся в board.
27
27
  - **Инструкции проекта** — `AGENTS.md`/`CLAUDE.md` иерархически (root → вложенные папки → `.dsh`) с `@import`; MCP roots сообщает корень проекта.
28
28
 
29
- ![Доска команды](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-agent-extensions/screenshots/board-1440.png)
29
+ ![Доска команды](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-agent-extensions/screenshots/board-1440.png)
30
30
 
31
- ![Доска команды на 390px](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-agent-extensions/screenshots/board-390.png)
31
+ ![Доска команды на 390px](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-agent-extensions/screenshots/board-390.png)
32
32
 
33
- ![Транскрипт фонового агента](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-agent-extensions/screenshots/transcript-1440.png)
33
+ ![Транскрипт фонового агента](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-agent-extensions/screenshots/transcript-1440.png)
34
34
 
35
- ![Транскрипт на 390px](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-agent-extensions/screenshots/transcript-390.png)
35
+ Транскрипт сохраняется в `.dsh/agents/transcripts/<run>.json` (0600) и доступен после restart.\n\n![Транскрипт на 390px](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-agent-extensions/screenshots/transcript-390.png)
36
36
 
37
- ![MCP sampling](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-mcp-manager/screenshots/sampling-1440.png)
37
+ ![MCP sampling](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-mcp-manager/screenshots/sampling-1440.png)
38
38
 
39
- ![MCP elicitation](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-mcp-manager/screenshots/elicitation-1440.png)
39
+ ![MCP elicitation](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-mcp-manager/screenshots/elicitation-1440.png)
40
40
 
41
41
  ## Права и субагенты
42
42
 
@@ -47,11 +47,11 @@
47
47
  - **Worktrees и фоновые агенты.** `project_worktree` создаёт ветку `dsh/<slug>` и отдельную папку `.dsh/worktrees/<slug>`; `project_agent ... worktree=auto background=true` запускает агента в изоляции, а страница **Агенты** показывает worktrees и очередь запусков с кнопкой «Остановить».
48
48
  - **Инструкции проекта.** `AGENTS.md` и `CLAUDE.md` читаются иерархически (root → вложенные папки → `.dsh`) с `@import`; MCP roots сообщает серверу корень проекта.
49
49
 
50
- ![Агенты проекта](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-agent-extensions/screenshots/agents-1440.png)
50
+ ![Агенты проекта](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-agent-extensions/screenshots/agents-1440.png)
51
51
 
52
- ![Права и ограничения](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-guardrails/screenshots/permissions-1440.png)
52
+ ![Права и ограничения](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-guardrails/screenshots/permissions-1440.png)
53
53
 
54
- **v2.15.8** · MIT · проверено на DSH `0.2.1-rc.5` и `0.2.2-rc.1` (Windows 11) · без внешних зависимостей и телеметрии
54
+ **v2.15.10** · MIT · проверено на DSH `0.2.1-rc.5` и `0.2.2-rc.1` (Windows 11) · без внешних зависимостей и телеметрии
55
55
 
56
56
  **План развития:** [docs/ROADMAP-3.0.md](docs/ROADMAP-3.0.md) — Memory Fabric, семантическое
57
57
  слияние, локальный индекс памяти, шифрованные переносы, Memory Hub и npm trusted publishing.
@@ -146,27 +146,27 @@
146
146
  - перед каждой синхронизацией проверяется, что репозиторий всё ещё приватный;
147
147
  - секреты и PII вычищаются, домашние пути заменяются токеном `%DSH_HOME%`; LLM не вызывается — **0 токенов**.
148
148
 
149
- ![Настройки памяти проектов](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-memory-bridge/docs/images/settings-light.png)
149
+ ![Настройки памяти проектов](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-memory-bridge/docs/images/settings-light.png)
150
150
 
151
- ![Конфликты досье](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-memory-bridge/docs/images/conflicts.png)
151
+ ![Конфликты досье](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-memory-bridge/docs/images/conflicts.png)
152
152
 
153
153
  ## Скриншоты
154
154
 
155
155
  ### Skills Studio: каталог, стоимость и редактор
156
156
 
157
- ![Каталог навыков](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-gkb-ru-ui/screenshots/02-skills-1440-light.png)
157
+ ![Каталог навыков](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-gkb-ru-ui/screenshots/02-skills-1440-light.png)
158
158
 
159
- ![Редактор навыка](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-gkb-ru-ui/screenshots/03-skills-editor-1440-light.png)
159
+ ![Редактор навыка](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-gkb-ru-ui/screenshots/03-skills-editor-1440-light.png)
160
160
 
161
161
  ### Token Lab: куда уходит контекст
162
162
 
163
- ![Токен-лаборатория](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-token-lab/screenshots/01-token-lab-1440-light.png)
163
+ ![Токен-лаборатория](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-token-lab/screenshots/01-token-lab-1440-light.png)
164
164
 
165
165
  ### Тёмная тема и мобильный
166
166
 
167
- ![Тёмная тема](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-gkb-ru-ui/screenshots/04-skills-1440-dark.png)
167
+ ![Тёмная тема](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-gkb-ru-ui/screenshots/04-skills-1440-dark.png)
168
168
 
169
- ![Каталог навыков на 390 px](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-gkb-ru-ui/screenshots/05-skills-390-light.png)
169
+ ![Каталог навыков на 390 px](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-gkb-ru-ui/screenshots/05-skills-390-light.png)
170
170
 
171
171
  ## Окно-напоминание: пиковый тариф
172
172
 
@@ -176,11 +176,11 @@ DeepSeek включает двойной тариф в пиковые часы (
176
176
  - **в окне** — красная карточка: причина, границы окна в местном времени и UTC, живой отсчёт до конца и рекомендация, когда вернуться;
177
177
  - **после окна** — карточка исчезает; состояние всегда доступно через `window.__DSH_PEAK_GUARD__.state()`.
178
178
 
179
- ![Окно-напоминание: светлая тема](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-peak-guard/screenshots/03-peak-card-1440-light.png)
179
+ ![Окно-напоминание: светлая тема](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-peak-guard/screenshots/03-peak-card-1440-light.png)
180
180
 
181
- ![Окно-напоминание: тёмная тема](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-peak-guard/screenshots/04-peak-card-1440-dark.png)
181
+ ![Окно-напоминание: тёмная тема](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-peak-guard/screenshots/04-peak-card-1440-dark.png)
182
182
 
183
- ![Окно-напоминание на 390 px](https://unpkg.com/dsh-desktop-kit@2.15.8/plugins/dsh-peak-guard/screenshots/05-peak-card-390-light.png)
183
+ ![Окно-напоминание на 390 px](https://unpkg.com/dsh-desktop-kit@2.15.10/plugins/dsh-peak-guard/screenshots/05-peak-card-390-light.png)
184
184
 
185
185
  Подробности и настройки — [plugins/dsh-peak-guard/README.md](plugins/dsh-peak-guard/README.md).
186
186
 
package/client.js CHANGED
@@ -7768,6 +7768,9 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
7768
7768
  agents.filter((agent) => agent.permission === "read-only").length > 0
7769
7769
  ? h("div", { className: "ag-tools" }, agents.filter((agent) => agent.permission === "read-only").map((agent) => h("span", { key: agent.name, className: "ag-tool" }, agent.name)))
7770
7770
  : h("div", { className: "ag-mini-empty" }, "Нужна хотя бы одна read-only роль: team не запускает пишущих агентов в общем cwd."),
7771
+ (state.data?.teams ?? []).length > 0
7772
+ ? h("div", { className: "ag-tools" }, state.data.teams.map((team) => h("span", { key: team.id, className: "ag-tool", title: team.description }, `preset:${team.id} · ${team.members.join(", ")}${team.lead ? ` + ${team.lead}` : ""}`)))
7773
+ : null,
7771
7774
  ),
7772
7775
  h("div", { className: "ag-section" },
7773
7776
  h("h3", null, "Доска команды"),
@@ -8083,7 +8086,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
8083
8086
  if (__kitErrors.length <= 5) console.error("[dsh-desktop-kit] registration failed:", label, message);
8084
8087
  };
8085
8088
  try {
8086
- window.__DSH_DESKTOP_KIT__ = { version: "2.15.8", parts: __partNames, errors: __kitErrors, ready: false };
8089
+ window.__DSH_DESKTOP_KIT__ = { version: "2.15.10", parts: __partNames, errors: __kitErrors, ready: false };
8087
8090
  } catch {}
8088
8091
  const __inject = [];
8089
8092
  for (const __part of __parts) {
@@ -0,0 +1,17 @@
1
+ # DSH Desktop Kit 2.15.10 — тест
2
+
3
+ Дата: 2026-11-12.
4
+
5
+ ## Team presets
6
+
7
+ - `.dsh/teams/review.json`:
8
+ `{ "members": ["reviewer","researcher","tester"], "lead": "coordinator" }`
9
+ - `project_agent action=team preset=review task=...`.
10
+ - Invalid presets (<2 members) and broken JSON are skipped.
11
+ - UI shows preset chips.
12
+
13
+ ## Проверки
14
+
15
+ - `team-presets-tests` — OK.
16
+ - `npm test` — exit 0.
17
+ - `build:client` / `check:client` — OK.
@@ -0,0 +1,16 @@
1
+ # DSH Desktop Kit 2.15.9 — тест
2
+
3
+ Дата: 2026-11-12.
4
+
5
+ ## Persistent transcript
6
+
7
+ - При завершении/отмене фонового run: `.dsh/agents/transcripts/<run>.json`, mode 0600.
8
+ - 80 записей, 4 КБ на сообщение, redaction.
9
+ - API: live session → snapshot → error.
10
+ - UI не менялся; кнопка «Транскрипт» работает после restart.
11
+
12
+ ## Проверки
13
+
14
+ - `transcripts-tests` — OK.
15
+ - `npm test` — exit 0.
16
+ - `build:client` / `check:client` — OK.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-desktop-kit",
3
- "version": "2.15.8",
4
- "description": "DeepSeek Harness desktop kit 2.15.8: 16 plugins and 30 skills — MCP tools/resources/prompts with OAuth 2.1, sampling and elicitation, project agents, git worktrees, background runs and a read-only/writer swarm with a shared board, plus self-applying skills, token lab, Skills Studio, project memory, guardrails, repo map, checkpoints, plan mode, browser QA, GitHub review, hooks/commands, Russian UI and profile transfer.",
3
+ "version": "2.15.10",
4
+ "description": "DeepSeek Harness desktop kit 2.15.10: 16 plugins and 30 skills — MCP tools/resources/prompts with OAuth 2.1, sampling and elicitation, project agents, git worktrees, background runs and a read-only/writer swarm with a shared board, plus self-applying skills, token lab, Skills Studio, project memory, guardrails, repo map, checkpoints, plan mode, browser QA, GitHub review, hooks/commands, Russian UI and profile transfer.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
7
7
  "dsh",
@@ -82,7 +82,7 @@
82
82
  "build:client": "node tools/build-client.mjs",
83
83
  "build:skills": "node tools/build-skill-manifest.mjs",
84
84
  "check:client": "node tools/check-client.mjs client.js",
85
- "test": "node tools/smoke-tests.mjs && node tools/memory-tests.mjs && node tools/skills-sync-tests.mjs && node tools/kit-upgrade-tests.mjs && node plugins/dsh-profile-transfer/test/transfer.test.mjs && node --test plugins/dsh-memory-bridge/test/bridge.test.mjs plugins/dsh-memory-bridge/test/github.test.mjs plugins/dsh-memory-bridge/test/merge.test.mjs plugins/dsh-memory-bridge/test/user-specific.test.mjs && node tools/repo-map-tests.mjs && node tools/checkpoints-tests.mjs && node tools/plan-mode-tests.mjs && node tools/browser-qa-tests.mjs && node tools/ui-gate-tests.mjs && node tools/agent-extensions-tests.mjs && node tools/mcp-manager-tests.mjs && node tools/github-review-tests.mjs && node tools/instructions-tests.mjs && node tools/mcp-elicitation-tests.mjs && node tools/mcp-sampling-tests.mjs && node tools/mcp-oauth-tests.mjs && node tools/worktrees-tests.mjs && node tools/team-messages-tests.mjs && node tools/team-board-tests.mjs && node tools/team-agents-tests.mjs && node tools/background-agents-tests.mjs && node tools/permissions-ui-tests.mjs && node plugins/dsh-guardrails/tools/guardrails-tests.mjs",
85
+ "test": "node tools/smoke-tests.mjs && node tools/memory-tests.mjs && node tools/skills-sync-tests.mjs && node tools/kit-upgrade-tests.mjs && node plugins/dsh-profile-transfer/test/transfer.test.mjs && node --test plugins/dsh-memory-bridge/test/bridge.test.mjs plugins/dsh-memory-bridge/test/github.test.mjs plugins/dsh-memory-bridge/test/merge.test.mjs plugins/dsh-memory-bridge/test/user-specific.test.mjs && node tools/repo-map-tests.mjs && node tools/checkpoints-tests.mjs && node tools/plan-mode-tests.mjs && node tools/browser-qa-tests.mjs && node tools/ui-gate-tests.mjs && node tools/agent-extensions-tests.mjs && node tools/mcp-manager-tests.mjs && node tools/github-review-tests.mjs && node tools/instructions-tests.mjs && node tools/mcp-elicitation-tests.mjs && node tools/mcp-sampling-tests.mjs && node tools/mcp-oauth-tests.mjs && node tools/worktrees-tests.mjs && node tools/transcripts-tests.mjs && node tools/team-messages-tests.mjs && node tools/team-presets-tests.mjs && node tools/team-board-tests.mjs && node tools/team-agents-tests.mjs && node tools/background-agents-tests.mjs && node tools/permissions-ui-tests.mjs && node plugins/dsh-guardrails/tools/guardrails-tests.mjs",
86
86
  "skills:cost": "node tools/skill-cost.mjs",
87
87
  "skills:check": "node tools/skill-cost.mjs --check",
88
88
  "release": "node tools/release.mjs"
@@ -212,6 +212,9 @@ window.__ModuleLoader__.load({
212
212
  agents.filter((agent) => agent.permission === "read-only").length > 0
213
213
  ? h("div", { className: "ag-tools" }, agents.filter((agent) => agent.permission === "read-only").map((agent) => h("span", { key: agent.name, className: "ag-tool" }, agent.name)))
214
214
  : h("div", { className: "ag-mini-empty" }, "Нужна хотя бы одна read-only роль: team не запускает пишущих агентов в общем cwd."),
215
+ (state.data?.teams ?? []).length > 0
216
+ ? h("div", { className: "ag-tools" }, state.data.teams.map((team) => h("span", { key: team.id, className: "ag-tool", title: team.description }, `preset:${team.id} · ${team.members.join(", ")}${team.lead ? ` + ${team.lead}` : ""}`)))
217
+ : null,
215
218
  ),
216
219
  h("div", { className: "ag-section" },
217
220
  h("h3", null, "Доска команды"),
@@ -22,6 +22,7 @@ import { addTask, postMessage, readBoard, updateTask } from "./lib/board.js";
22
22
  import { sendTeamMessage } from "./lib/messages.js";
23
23
  import { ensureGlobalScaffold, ensureProjectScaffold } from "./lib/scaffold.js";
24
24
  import { findDshDir, loadAgents, projectFor } from "./lib/project.js";
25
+ import { findTeam, loadTeams } from "./lib/teams.js";
25
26
 
26
27
  export const inject = ["tools", "systemPrompt"];
27
28
 
@@ -51,6 +52,7 @@ function toolDefinition(ctx) {
51
52
  name: { type: "string", description: "Agent name from `.dsh/agents/<name>.md`" },
52
53
  names: { type: "array", items: { type: "string" }, maxItems: 6, description: "For team: 2–6 read-only agent names" },
53
54
  lead: { type: "string", description: "Optional read-only coordinator agent; receives member run ids and can message them" },
55
+ preset: { type: "string", description: "Team preset from `.dsh/teams/<name>.json` (members + lead)" },
54
56
  task: { type: "string", description: "Task/prompt for the child agent (required for run)" },
55
57
  background: { type: "boolean", description: "Return immediately with a durable run id instead of waiting for the child" },
56
58
  worktree: { type: "string", description: "Run in a git worktree: `auto` picks a name, or pass a lowercase slug" },
@@ -89,7 +91,9 @@ function toolDefinition(ctx) {
89
91
  const task = String(input?.task ?? "").trim();
90
92
  if (!task) return { ok: false, text: `project_agent: task is required for ${input.action}` };
91
93
  if (input.action === "team") {
92
- const names = Array.isArray(input?.names) ? [...new Set(input.names.map((item) => String(item).trim()).filter(Boolean))] : [];
94
+ const preset = input?.preset ? findTeam(project.root, project.dsh ?? path.join(project.root, ".dsh"), input.preset) : null;
95
+ if (input?.preset && !preset) return { ok: false, text: `project_agent team: unknown preset "${input.preset}"` };
96
+ const names = preset ? preset.members : (Array.isArray(input?.names) ? [...new Set(input.names.map((item) => String(item).trim()).filter(Boolean))] : []);
93
97
  if (names.length < 2 || names.length > 6) return { ok: false, text: "project_agent team: names must contain 2–6 unique agents" };
94
98
  const definitions = [];
95
99
  for (const name of names) {
@@ -100,7 +104,7 @@ function toolDefinition(ctx) {
100
104
  }
101
105
  definitions.push(definition);
102
106
  }
103
- const leadName = String(input?.lead ?? "").trim();
107
+ const leadName = String(preset?.lead || input?.lead || "").trim();
104
108
  let leadDefinition = null;
105
109
  if (leadName) {
106
110
  if (names.includes(leadName)) return { ok: false, text: "project_agent team: lead cannot also be a member" };
@@ -9,6 +9,7 @@ import crypto from "node:crypto";
9
9
  import { loadAgents, projectFor } from "./project.js";
10
10
  import { clearChildPolicy, setChildPolicy } from "./policy.js";
11
11
  import { loadRuns, runPreview, updateRun, upsertRun } from "./runs.js";
12
+ import { saveTranscript } from "./transcripts.js";
12
13
 
13
14
  const background = new Map();
14
15
 
@@ -99,6 +100,7 @@ export async function runProjectAgent(ctx, exec, definition, task, options = {})
99
100
  upsertRun(project.root, record);
100
101
  remember(record, activation, project.root, signal, abort);
101
102
  activation.result.then(async (result) => {
103
+ try { saveTranscript(project.root, record.id, ctx.get("sessions")?.get(activeId)); } catch { /* best effort */ }
102
104
  const currentRecord = loadRuns(project.root).find((item) => item.id === record.id);
103
105
  if (currentRecord?.status !== "canceled") {
104
106
  const text = textFromOutput(result?.output);
@@ -115,6 +117,7 @@ export async function runProjectAgent(ctx, exec, definition, task, options = {})
115
117
  background.delete(record.id);
116
118
  signal?.removeEventListener?.("abort", abort);
117
119
  }).catch((error) => {
120
+ try { saveTranscript(project.root, record.id, ctx.get("sessions")?.get(activeId)); } catch { /* best effort */ }
118
121
  const currentRecord = loadRuns(project.root).find((item) => item.id === record.id);
119
122
  if (currentRecord?.status !== "canceled") {
120
123
  finishRun(project.root, record.id, {
@@ -214,6 +217,7 @@ export async function cancelRun(ctx, exec, id) {
214
217
  parentSessionId: entry.record.parentId ?? exec?.agent?.session?.id,
215
218
  });
216
219
  } catch { /* disposal below still stops the local activation */ }
220
+ try { saveTranscript(project.root, entry.record.id, ctx.get?.("sessions")?.get?.(entry.record.childId)); } catch { /* best effort */ }
217
221
  try { await entry.activation.dispose?.(); } catch { /* best effort */ }
218
222
  clearChildPolicy(entry.record.childId);
219
223
  background.delete(entry.record.id);
@@ -5,6 +5,8 @@ import { loadAgents, projectFor } from "./project.js";
5
5
  import { cancelRun, listRuns } from "./agents.js";
6
6
  import { worktreeSummary } from "./worktrees.js";
7
7
  import { readBoard } from "./board.js";
8
+ import { extractTranscript, loadTranscript } from "./transcripts.js";
9
+ import { loadTeams } from "./teams.js";
8
10
 
9
11
  export const RPC_NAMESPACE = "dsh-agent-extensions";
10
12
  const ROUTE_BASE = "/api/dsh-agent-extensions";
@@ -99,6 +101,7 @@ export function registerAgentApi(ctx) {
99
101
  worktreeError,
100
102
  runs: listRuns(project.root),
101
103
  board: readBoard(project.root),
104
+ teams: loadTeams(project.root, project.dsh),
102
105
  });
103
106
  } catch (error) {
104
107
  return fail(rpcId, error instanceof Error ? error.message : String(error));
@@ -122,8 +125,10 @@ export function registerAgentApi(ctx) {
122
125
  if (!run) throw new Error(`run not found: ${value.payload?.runId}`);
123
126
  const sessions = ctx.get?.("sessions");
124
127
  const child = sessions?.get?.(run.childId);
125
- if (!child) throw new Error("child session is not live (restart or already disposed)");
126
- return ok(rpcId, transcriptOf(child, run));
128
+ if (child) return ok(rpcId, { run, entries: extractTranscript(child), persisted: false });
129
+ const saved = loadTranscript(project.root, run.id);
130
+ if (!saved) throw new Error("transcript is unavailable: child session is gone and no saved snapshot exists");
131
+ return ok(rpcId, { run, entries: saved.entries, persisted: true, savedAt: saved.savedAt });
127
132
  } catch (error) {
128
133
  return fail(rpcId, error instanceof Error ? error.message : String(error));
129
134
  }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Team presets: `.dsh/teams/<name>.json`.
3
+ *
4
+ * Example:
5
+ * {
6
+ * "name": "review",
7
+ * "members": ["reviewer", "researcher", "tester"],
8
+ * "lead": "coordinator"
9
+ * }
10
+ */
11
+ import fs from "node:fs";
12
+ import path from "node:path";
13
+
14
+ export function teamsDir(projectRoot, dshDir) {
15
+ return path.join(dshDir ?? path.join(projectRoot, ".dsh"), "teams");
16
+ }
17
+
18
+ export function loadTeams(projectRoot, dshDir) {
19
+ const dir = teamsDir(projectRoot, dshDir);
20
+ let files = [];
21
+ try {
22
+ files = fs.readdirSync(dir).filter((file) => file.endsWith(".json"));
23
+ } catch {
24
+ return [];
25
+ }
26
+ const teams = [];
27
+ for (const file of files.sort()) {
28
+ try {
29
+ const parsed = JSON.parse(fs.readFileSync(path.join(dir, file), "utf8"));
30
+ const members = Array.isArray(parsed.members) ? parsed.members.map((item) => String(item).trim()).filter(Boolean) : [];
31
+ if (members.length < 2 || members.length > 6) continue;
32
+ teams.push({
33
+ id: file.slice(0, -5),
34
+ name: String(parsed.name ?? file.slice(0, -5)),
35
+ members: [...new Set(members)],
36
+ lead: typeof parsed.lead === "string" ? parsed.lead.trim() : "",
37
+ description: typeof parsed.description === "string" ? parsed.description : "",
38
+ });
39
+ } catch {
40
+ /* skip malformed preset */
41
+ }
42
+ }
43
+ return teams;
44
+ }
45
+
46
+ export function findTeam(projectRoot, dshDir, id) {
47
+ const key = String(id ?? "").trim();
48
+ return loadTeams(projectRoot, dshDir).find((team) => team.id === key || team.name === key) ?? null;
49
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Durable, bounded transcripts for background project agents.
3
+ *
4
+ * A live child session is authoritative while it exists. When the run finishes
5
+ * we persist a redacted snapshot so the Agents UI still has a transcript after
6
+ * a DSH restart or session disposal.
7
+ */
8
+ import fs from "node:fs";
9
+ import path from "node:path";
10
+ import { redact } from "./runs.js";
11
+
12
+ const LIMIT = 80;
13
+ const TEXT_LIMIT = 4_000;
14
+
15
+ function textOf(content) {
16
+ if (typeof content === "string") return content;
17
+ if (!Array.isArray(content)) return String(content?.text ?? "");
18
+ return content.map((block) => {
19
+ if (block?.type === "text") return block.text ?? "";
20
+ if (block?.type === "tool-call") return `→ ${block.name}(${block.arguments ?? ""})`;
21
+ if (block?.type === "image") return "[image]";
22
+ return "";
23
+ }).filter(Boolean).join("\n");
24
+ }
25
+
26
+ export function transcriptPath(projectRoot, runId) {
27
+ return path.join(projectRoot, ".dsh", "agents", "transcripts", `${String(runId)}.json`);
28
+ }
29
+
30
+ export function extractTranscript(session) {
31
+ const events = typeof session?.ownEvents === "function" ? session.ownEvents() : [];
32
+ const entries = [];
33
+ for (const event of events) {
34
+ const data = event?.data ?? {};
35
+ if (event.type === "user/message" || event.type === "assistant/message") {
36
+ const text = textOf(data.message?.content ?? data.content).trim();
37
+ if (text) entries.push({ role: event.type === "user/message" ? "user" : "assistant", text: text.slice(0, TEXT_LIMIT) });
38
+ } else if (event.type === "tool/call") {
39
+ entries.push({ role: "tool", text: `${data.name}(${String(data.arguments ?? "").slice(0, 500)})` });
40
+ } else if (event.type === "tool/result") {
41
+ const text = textOf(data.message?.content ?? data.content).trim();
42
+ if (text) entries.push({ role: data.error ? "error" : "tool-result", text: text.slice(0, 2_000) });
43
+ }
44
+ }
45
+ return entries.slice(-LIMIT).map((entry) => ({ ...entry, text: redact(entry.text) }));
46
+ }
47
+
48
+ export function saveTranscript(projectRoot, runId, session) {
49
+ const entries = extractTranscript(session);
50
+ if (entries.length === 0) return null;
51
+ const file = transcriptPath(projectRoot, runId);
52
+ fs.mkdirSync(path.dirname(file), { recursive: true });
53
+ const temp = `${file}.${process.pid}.tmp`;
54
+ fs.writeFileSync(temp, `${JSON.stringify({ runId: String(runId), savedAt: new Date().toISOString(), entries }, null, 2)}\n`, { mode: 0o600, encoding: "utf8" });
55
+ fs.renameSync(temp, file);
56
+ return { file, count: entries.length };
57
+ }
58
+
59
+ export function loadTranscript(projectRoot, runId) {
60
+ try {
61
+ const parsed = JSON.parse(fs.readFileSync(transcriptPath(projectRoot, runId), "utf8"));
62
+ return Array.isArray(parsed.entries) ? { savedAt: parsed.savedAt ?? "", entries: parsed.entries } : null;
63
+ } catch {
64
+ return null;
65
+ }
66
+ }