dsh-desktop-kit 2.13.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.14.0 (2026-11-12)
4
+
5
+ - **Team board / swarm.** `team_board` — durable `.dsh/agents/board.json` (0600) с сообщениями и задачами; `post`, `read`, `add-task`, `claim-task`, `done-task`.
6
+ - **Обмен информацией.** Team-промпт каждой роли содержит `teamId` и инструкцию писать findings в board; board — общий канал для sibling-агентов.
7
+ - **Безопасность.** Redaction `sk-*`, GitHub tokens, Bearer, password/token; лимиты 200 сообщений/100 задач/4 КБ; атомарная запись.
8
+ - **Тесты.** `team-board-tests`: post/read, task lifecycle, redaction.
9
+
3
10
  ## 2.13.0 (2026-11-12)
4
11
 
5
12
  - **Team с пишущими агентами.** `worktrees=true` выдаёт каждому участнику отдельную ветку `dsh/<name>-…` и рабочую копию; без флага team остаётся read-only.
package/README.md CHANGED
@@ -4,17 +4,17 @@
4
4
 
5
5
  Набор из **16 плагинов и 30 навыков** для DeepSeek Harness 0.2.x: русский интерфейс, автопилот навыков, токен-лаборатория, студия навыков, память проектов, обмен памятью между машинами (GitHub и USB), guardrails, карта репозитория, чекпоинты, plan mode, browser QA, GitHub review, Claude Code-подобные hooks/agents/commands, перенос чатов и резервные копии профиля.
6
6
 
7
- ![DSH Desktop Kit 2.7](https://unpkg.com/dsh-desktop-kit@2.13.0/docs/images/hero.png)
7
+ ![DSH Desktop Kit 2.7](https://unpkg.com/dsh-desktop-kit@2.14.0/docs/images/hero.png)
8
8
 
9
9
  ## MCP: подключения без JSON
10
10
 
11
11
  Настройки → **MCP**: пресеты GitHub, PostgreSQL и Filesystem, живые статусы, health, список tools и безопасное хранение токенов в `~/.dsh/mcp.secrets.json`. Промпты сервера открываются кнопкой **Prompts**: аргументы, запуск и копирование результата. HTTP-серверы подключаются через **OAuth 2.1 + PKCE**, **sampling** идёт через approval-карточку DSH, а **elicitation** — через глобальную форму с Accept/Decline.
12
12
 
13
- ![MCP Settings](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-mcp-manager/screenshots/settings-1440.png)
13
+ ![MCP Settings](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-mcp-manager/screenshots/settings-1440.png)
14
14
 
15
- ![MCP на 390px](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-mcp-manager/screenshots/settings-390.png)
15
+ ![MCP на 390px](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-mcp-manager/screenshots/settings-390.png)
16
16
 
17
- ![Добавление MCP-сервера](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-mcp-manager/screenshots/modal-390.png)
17
+ ![Добавление MCP-сервера](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-mcp-manager/screenshots/modal-390.png)
18
18
 
19
19
  ## Права и субагенты
20
20
 
@@ -25,11 +25,11 @@
25
25
  - **Worktrees и фоновые агенты.** `project_worktree` создаёт ветку `dsh/<slug>` и отдельную папку `.dsh/worktrees/<slug>`; `project_agent ... worktree=auto background=true` запускает агента в изоляции, а страница **Агенты** показывает worktrees и очередь запусков с кнопкой «Остановить».
26
26
  - **Инструкции проекта.** `AGENTS.md` и `CLAUDE.md` читаются иерархически (root → вложенные папки → `.dsh`) с `@import`; MCP roots сообщает серверу корень проекта.
27
27
 
28
- ![Агенты проекта](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-agent-extensions/screenshots/agents-1440.png)
28
+ ![Агенты проекта](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-agent-extensions/screenshots/agents-1440.png)
29
29
 
30
- ![Права и ограничения](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-guardrails/screenshots/permissions-1440.png)
30
+ ![Права и ограничения](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-guardrails/screenshots/permissions-1440.png)
31
31
 
32
- **v2.13.0** · MIT · проверено на DSH `0.2.1-rc.5` и `0.2.2-rc.1` (Windows 11) · без внешних зависимостей и телеметрии
32
+ **v2.14.0** · MIT · проверено на DSH `0.2.1-rc.5` и `0.2.2-rc.1` (Windows 11) · без внешних зависимостей и телеметрии
33
33
 
34
34
  **План развития:** [docs/ROADMAP-3.0.md](docs/ROADMAP-3.0.md) — Memory Fabric, семантическое
35
35
  слияние, локальный индекс памяти, шифрованные переносы, Memory Hub и npm trusted publishing.
@@ -117,27 +117,27 @@
117
117
  - перед каждой синхронизацией проверяется, что репозиторий всё ещё приватный;
118
118
  - секреты и PII вычищаются, домашние пути заменяются токеном `%DSH_HOME%`; LLM не вызывается — **0 токенов**.
119
119
 
120
- ![Настройки памяти проектов](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-memory-bridge/docs/images/settings-light.png)
120
+ ![Настройки памяти проектов](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-memory-bridge/docs/images/settings-light.png)
121
121
 
122
- ![Конфликты досье](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-memory-bridge/docs/images/conflicts.png)
122
+ ![Конфликты досье](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-memory-bridge/docs/images/conflicts.png)
123
123
 
124
124
  ## Скриншоты
125
125
 
126
126
  ### Skills Studio: каталог, стоимость и редактор
127
127
 
128
- ![Каталог навыков](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-gkb-ru-ui/screenshots/02-skills-1440-light.png)
128
+ ![Каталог навыков](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-gkb-ru-ui/screenshots/02-skills-1440-light.png)
129
129
 
130
- ![Редактор навыка](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-gkb-ru-ui/screenshots/03-skills-editor-1440-light.png)
130
+ ![Редактор навыка](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-gkb-ru-ui/screenshots/03-skills-editor-1440-light.png)
131
131
 
132
132
  ### Token Lab: куда уходит контекст
133
133
 
134
- ![Токен-лаборатория](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-token-lab/screenshots/01-token-lab-1440-light.png)
134
+ ![Токен-лаборатория](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-token-lab/screenshots/01-token-lab-1440-light.png)
135
135
 
136
136
  ### Тёмная тема и мобильный
137
137
 
138
- ![Тёмная тема](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-gkb-ru-ui/screenshots/04-skills-1440-dark.png)
138
+ ![Тёмная тема](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-gkb-ru-ui/screenshots/04-skills-1440-dark.png)
139
139
 
140
- ![Каталог навыков на 390 px](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-gkb-ru-ui/screenshots/05-skills-390-light.png)
140
+ ![Каталог навыков на 390 px](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-gkb-ru-ui/screenshots/05-skills-390-light.png)
141
141
 
142
142
  ## Окно-напоминание: пиковый тариф
143
143
 
@@ -147,11 +147,11 @@ DeepSeek включает двойной тариф в пиковые часы (
147
147
  - **в окне** — красная карточка: причина, границы окна в местном времени и UTC, живой отсчёт до конца и рекомендация, когда вернуться;
148
148
  - **после окна** — карточка исчезает; состояние всегда доступно через `window.__DSH_PEAK_GUARD__.state()`.
149
149
 
150
- ![Окно-напоминание: светлая тема](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-peak-guard/screenshots/03-peak-card-1440-light.png)
150
+ ![Окно-напоминание: светлая тема](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-peak-guard/screenshots/03-peak-card-1440-light.png)
151
151
 
152
- ![Окно-напоминание: тёмная тема](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-peak-guard/screenshots/04-peak-card-1440-dark.png)
152
+ ![Окно-напоминание: тёмная тема](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-peak-guard/screenshots/04-peak-card-1440-dark.png)
153
153
 
154
- ![Окно-напоминание на 390 px](https://unpkg.com/dsh-desktop-kit@2.13.0/plugins/dsh-peak-guard/screenshots/05-peak-card-390-light.png)
154
+ ![Окно-напоминание на 390 px](https://unpkg.com/dsh-desktop-kit@2.14.0/plugins/dsh-peak-guard/screenshots/05-peak-card-390-light.png)
155
155
 
156
156
  Подробности и настройки — [plugins/dsh-peak-guard/README.md](plugins/dsh-peak-guard/README.md).
157
157
 
package/client.js CHANGED
@@ -8025,7 +8025,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
8025
8025
  if (__kitErrors.length <= 5) console.error("[dsh-desktop-kit] registration failed:", label, message);
8026
8026
  };
8027
8027
  try {
8028
- window.__DSH_DESKTOP_KIT__ = { version: "2.13.0", parts: __partNames, errors: __kitErrors, ready: false };
8028
+ window.__DSH_DESKTOP_KIT__ = { version: "2.14.0", parts: __partNames, errors: __kitErrors, ready: false };
8029
8029
  } catch {}
8030
8030
  const __inject = [];
8031
8031
  for (const __part of __parts) {
@@ -0,0 +1,23 @@
1
+ # DSH Desktop Kit 2.14.0 — тест
2
+
3
+ Дата: 2026-11-12.
4
+
5
+ ## Team board
6
+
7
+ - `team_board action=post|read|add-task|claim-task|done-task`.
8
+ - `.dsh/agents/board.json`, mode 0600, atomic rename.
9
+ - 200 messages, 100 tasks, 4 КБ на сообщение.
10
+ - Redaction ключей и токенов.
11
+ - Team автоматически создаёт `teamId`, пишет задачу lead и передаёт teamId детям.
12
+
13
+ ## Обмен
14
+
15
+ - Read-only swarm использует общий board в корне проекта.
16
+ - Worktree-участники видят собственный `.dsh` worktree; их board локальный (ограничение).
17
+ - Прямой sibling messaging в DSH недоступен; board — durable канал.
18
+
19
+ ## Тесты
20
+
21
+ - `team-board-tests` — OK.
22
+ - `npm test` — exit 0.
23
+ - `build:client` / `check:client` — OK.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-desktop-kit",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "description": "DeepSeek Harness desktop kit 2.7: 16 plugins and 30 skills — self-applying skills, token lab, Skills Studio, project memory, GitHub and USB memory transfer, guardrails, repo map, checkpoints, plan mode, browser QA, GitHub review, Claude Code-like hooks/agents/commands, Russian UI, peak guard, chat move and profile transfer.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -74,7 +74,7 @@
74
74
  "build:client": "node tools/build-client.mjs",
75
75
  "build:skills": "node tools/build-skill-manifest.mjs",
76
76
  "check:client": "node tools/check-client.mjs client.js",
77
- "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-agents-tests.mjs && node tools/background-agents-tests.mjs && node tools/permissions-ui-tests.mjs && node plugins/dsh-guardrails/tools/guardrails-tests.mjs",
77
+ "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-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",
78
78
  "skills:cost": "node tools/skill-cost.mjs",
79
79
  "skills:check": "node tools/skill-cost.mjs --check",
80
80
  "release": "node tools/release.mjs"
@@ -18,6 +18,7 @@ import { registerChildPolicyHook } from "./lib/policy.js";
18
18
  import { registerCommands } from "./lib/commands.js";
19
19
  import { registerAgentApi } from "./lib/api.js";
20
20
  import { renderProjectInstructions } from "./lib/instructions.js";
21
+ import { addTask, postMessage, readBoard, updateTask } from "./lib/board.js";
21
22
  import { ensureGlobalScaffold, ensureProjectScaffold } from "./lib/scaffold.js";
22
23
  import { findDshDir, loadAgents, projectFor } from "./lib/project.js";
23
24
 
@@ -98,23 +99,27 @@ function toolDefinition(ctx) {
98
99
  definitions.push(definition);
99
100
  }
100
101
  if (input?.worktrees === true) {
102
+ const teamId = `team-${Date.now().toString(36)}`;
103
+ postMessage(project.root, { teamId, from: "lead", text: `Task: ${task}` });
101
104
  const results = [];
102
105
  for (const definition of definitions) {
103
106
  let worktree = null;
104
107
  try {
105
108
  worktree = createWorktree({ cwd: project.root, slug: `${safeSlug(definition.name)}-${Date.now().toString(36).slice(-5)}` });
106
- const result = await runProjectAgent(ctx, exec, definition, task, { background: true, worktree, cwd: worktree.path });
107
- results.push({ name: definition.name, ok: !result.error, id: result.id, error: result.error ?? "", worktree });
109
+ const result = await runProjectAgent(ctx, exec, definition, task, { background: true, worktree, cwd: worktree.path, teamId });
110
+ results.push({ name: definition.name, ok: !result.error, id: result.id, error: result.error ?? "", worktree, teamId });
108
111
  } catch (error) {
109
- results.push({ name: definition.name, ok: false, id: null, error: error instanceof Error ? error.message : String(error), worktree });
112
+ results.push({ name: definition.name, ok: false, id: null, error: error instanceof Error ? error.message : String(error), worktree, teamId });
110
113
  }
111
114
  }
112
115
  const text = results.map((result) => `${result.ok ? "✓" : "✗"} ${result.name}${result.id ? ` · ${result.id}` : ""}${result.worktree ? ` · ${result.worktree.branch}` : ""}${result.error ? ` — ${result.error}` : ""}`).join("\n");
113
- return { ok: results.every((result) => result.ok), text: `project_agent team (isolated worktrees):\n${text}`, runs: results };
116
+ return { ok: results.every((result) => result.ok), text: `project_agent team (isolated worktrees, board ${teamId}):\n${text}`, runs: results, teamId };
114
117
  }
115
- const results = await runProjectTeam(ctx, exec, definitions, task);
118
+ const teamId = `team-${Date.now().toString(36)}`;
119
+ postMessage(project.root, { teamId, from: "lead", text: `Task: ${task}` });
120
+ const results = await runProjectTeam(ctx, exec, definitions, task, { teamId });
116
121
  const text = results.map((result) => `${result.ok ? "✓" : "✗"} ${result.name}${result.id ? ` · ${result.id}` : ""}${result.error ? ` — ${result.error}` : ""}`).join("\n");
117
- return { ok: results.every((result) => result.ok), text: `project_agent team:\n${text}`, runs: results };
122
+ return { ok: results.every((result) => result.ok), text: `project_agent team (board ${teamId}):\n${text}`, runs: results, teamId };
118
123
  }
119
124
  const name = String(input?.name ?? "").trim();
120
125
  if (!name) return { ok: false, text: "project_agent: name is required for run" };
@@ -191,6 +196,55 @@ function worktreeToolDefinition() {
191
196
  };
192
197
  }
193
198
 
199
+ function boardToolDefinition() {
200
+ return {
201
+ name: "team_board",
202
+ description:
203
+ "Shared task board and message log for project-agent teams, stored in `.dsh/agents/board.json` (0600, redacted, bounded). Use `post/read` to exchange findings asynchronously (the durable sibling channel), and `add-task/claim-task/done-task` for work items.",
204
+ parameters: {
205
+ type: "object",
206
+ additionalProperties: false,
207
+ properties: {
208
+ action: { type: "string", enum: ["post", "read", "add-task", "claim-task", "done-task"], description: "board operation" },
209
+ teamId: { type: "string", description: "team identifier shared by the swarm" },
210
+ text: { type: "string", description: "message text for post" },
211
+ to: { type: "string", description: "optional recipient label" },
212
+ title: { type: "string", description: "task title for add-task" },
213
+ id: { type: "string", description: "task id for claim-task/done-task" },
214
+ },
215
+ required: ["action"],
216
+ },
217
+ async execute(input, exec) {
218
+ const cwd = exec?.agent?.session?.header?.cwd;
219
+ const teamId = String(input?.teamId ?? "");
220
+ const from = String(exec?.agent?.session?.id ?? "");
221
+ try {
222
+ if (input?.action === "post") {
223
+ const result = postMessage(cwd, { teamId, from, to: input?.to, text: input?.text });
224
+ return { ok: true, text: `team_board post: ${result.message.id}` };
225
+ }
226
+ if (input?.action === "read") {
227
+ const board = readBoard(cwd, { teamId });
228
+ const messages = board.messages.slice(-20).map((message) => `- ${message.from}${message.to ? ` → ${message.to}` : ""}: ${message.text}`);
229
+ const tasks = board.tasks.map((task) => `- [${task.status}] ${task.id} ${task.title}${task.owner ? ` (${task.owner})` : ""}`);
230
+ return { ok: true, text: `team_board ${teamId || "all"}:\n${messages.join("\n") || "messages: none"}\n${tasks.join("\n") || "tasks: none"}`, messages: board.messages, tasks: board.tasks };
231
+ }
232
+ if (input?.action === "add-task") {
233
+ const result = addTask(cwd, { teamId, title: input?.title, owner: from });
234
+ return { ok: true, text: `team_board task: ${result.task.id} · ${result.task.title}`, task: result.task };
235
+ }
236
+ if (input?.action === "claim-task" || input?.action === "done-task") {
237
+ const result = updateTask(cwd, { id: input?.id, status: input.action === "claim-task" ? "claimed" : "done", owner: from });
238
+ return { ok: true, text: `team_board task: ${result.task.id} · ${result.task.status}`, task: result.task };
239
+ }
240
+ return { ok: false, text: "team_board: unsupported action" };
241
+ } catch (error) {
242
+ return { ok: false, text: `team_board ${input?.action}: ${error instanceof Error ? error.message : String(error)}` };
243
+ }
244
+ },
245
+ };
246
+ }
247
+
194
248
  export function apply(ctx) {
195
249
  try {
196
250
  const scaffold = ensureGlobalScaffold();
@@ -226,6 +280,7 @@ export function apply(ctx) {
226
280
  try {
227
281
  ctx.effect(() => ctx.tools.register(toolDefinition(ctx)), "agent-extensions: project_agent tool");
228
282
  ctx.effect(() => ctx.tools.register(worktreeToolDefinition()), "agent-extensions: project_worktree tool");
283
+ ctx.effect(() => ctx.tools.register(boardToolDefinition()), "agent-extensions: team_board tool");
229
284
  } catch (error) {
230
285
  ctx.logger?.warn?.(`[agent-extensions] tool registration failed: ${error instanceof Error ? error.message : String(error)}`);
231
286
  }
@@ -49,7 +49,15 @@ export async function runProjectAgent(ctx, exec, definition, task, options = {})
49
49
  setChildPolicy(reservedId, definition);
50
50
  let activation;
51
51
  try {
52
- const prompt = [`<project-agent name="${definition.name}">`, definition.body, "</project-agent>", "", "Task:", String(task ?? "")].join("\n");
52
+ const prompt = [
53
+ `<project-agent name="${definition.name}">`,
54
+ definition.body,
55
+ "</project-agent>",
56
+ 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. Sibling live messaging is not available — the board is the shared channel.</team>` : "",
57
+ "",
58
+ "Task:",
59
+ String(task ?? ""),
60
+ ].filter((line) => line !== "").join("\n");
53
61
  activation = await subagents.startActivation({
54
62
  provider,
55
63
  label: `agent:${definition.name}`,
@@ -79,6 +87,7 @@ export async function runProjectAgent(ctx, exec, definition, task, options = {})
79
87
  cwd,
80
88
  worktree: options.worktree ?? null,
81
89
  parentId: exec?.agent?.session?.id ?? null,
90
+ teamId: options.teamId ?? null,
82
91
  startedAt,
83
92
  finishedAt: null,
84
93
  status: "running",
@@ -143,6 +152,7 @@ export async function runProjectAgent(ctx, exec, definition, task, options = {})
143
152
  cwd,
144
153
  worktree: options.worktree ?? null,
145
154
  parentId: exec?.agent?.session?.id ?? null,
155
+ teamId: options.teamId ?? null,
146
156
  startedAt: new Date().toISOString(),
147
157
  finishedAt: new Date().toISOString(),
148
158
  status: "failed",
@@ -168,8 +178,7 @@ export async function runProjectTeam(ctx, exec, definitions, task, options = {})
168
178
  const runs = [];
169
179
  for (const definition of definitions) {
170
180
  try {
171
- const result = await runProjectAgent(ctx, exec, definition, task, { ...options, background: true });
172
- runs.push({ name: definition.name, ok: !result.error, id: result.id, text: result.text, error: result.error ?? "" });
181
+ const result = await runProjectAgent(ctx, exec, definition, task, { ...options, background: true }); runs.push({ name: definition.name, ok: !result.error, id: result.id, text: result.text, error: result.error ?? "" });
173
182
  } catch (error) {
174
183
  runs.push({ name: definition.name, ok: false, id: null, text: "", error: error instanceof Error ? error.message : String(error) });
175
184
  }
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Team board: durable, file-backed task/message exchange for project agents.
3
+ *
4
+ * Messages are the asynchronous sibling channel; DSH's live `sendMessage`
5
+ * remains parent ⇄ direct child only. Every write is redacted, bounded and
6
+ * atomically renamed, so a crashed child cannot leave half a board.
7
+ */
8
+ import crypto from "node:crypto";
9
+ import fs from "node:fs";
10
+ import path from "node:path";
11
+ import { projectFor } from "./project.js";
12
+
13
+ const MAX_MESSAGES = 200;
14
+ const MAX_TASKS = 100;
15
+ const MAX_TEXT = 4_000;
16
+
17
+ function boardPath(root) {
18
+ return path.join(root, ".dsh", "agents", "board.json");
19
+ }
20
+
21
+ function redact(text) {
22
+ return String(text ?? "")
23
+ .replace(/\b(?:sk|pk|npm)[-_][A-Za-z0-9_-]{12,}\b/gu, "[redacted]")
24
+ .replace(/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}\b/gu, "[redacted]")
25
+ .replace(/\bBearer\s+[A-Za-z0-9._~+/=-]{20,}\b/giu, "Bearer [redacted]")
26
+ .replace(/\b(password|passwd|token|secret|api[_-]?key)\s*[:=]\s*\S+/giu, "$1=[redacted]");
27
+ }
28
+
29
+ function read(root) {
30
+ const file = boardPath(root);
31
+ try {
32
+ const parsed = JSON.parse(fs.readFileSync(file, "utf8"));
33
+ return {
34
+ messages: Array.isArray(parsed.messages) ? parsed.messages : [],
35
+ tasks: Array.isArray(parsed.tasks) ? parsed.tasks : [],
36
+ };
37
+ } catch {
38
+ return { messages: [], tasks: [] };
39
+ }
40
+ }
41
+
42
+ function write(root, board) {
43
+ const file = boardPath(root);
44
+ fs.mkdirSync(path.dirname(file), { recursive: true });
45
+ const temp = `${file}.${process.pid}.${Date.now()}.tmp`;
46
+ fs.writeFileSync(temp, `${JSON.stringify(board, null, 2)}\n`, { mode: 0o600, encoding: "utf8" });
47
+ fs.renameSync(temp, file);
48
+ }
49
+
50
+ function projectRoot(cwd) {
51
+ return projectFor(cwd || process.cwd()).root;
52
+ }
53
+
54
+ export function postMessage(cwd, { teamId = "", from = "", to = "", text = "" } = {}) {
55
+ const clean = redact(text).trim();
56
+ if (!clean) throw new Error("board message text is required");
57
+ if (clean.length > MAX_TEXT) throw new Error("board message is too long");
58
+ const root = projectRoot(cwd);
59
+ const board = read(root);
60
+ const message = {
61
+ id: crypto.randomUUID(),
62
+ teamId: String(teamId),
63
+ from: String(from),
64
+ to: String(to),
65
+ text: clean,
66
+ createdAt: new Date().toISOString(),
67
+ };
68
+ board.messages.push(message);
69
+ board.messages = board.messages.slice(-MAX_MESSAGES);
70
+ write(root, board);
71
+ return { root, message };
72
+ }
73
+
74
+ export function readBoard(cwd, { teamId = "", since = "" } = {}) {
75
+ const root = projectRoot(cwd);
76
+ const board = read(root);
77
+ const messages = board.messages.filter((message) => (!teamId || message.teamId === teamId) && (!since || message.createdAt > since));
78
+ const tasks = board.tasks.filter((task) => !teamId || task.teamId === teamId);
79
+ return { root, messages, tasks };
80
+ }
81
+
82
+ export function addTask(cwd, { teamId = "", title = "", owner = "" } = {}) {
83
+ const clean = redact(title).trim();
84
+ if (!clean) throw new Error("board task title is required");
85
+ const root = projectRoot(cwd);
86
+ const board = read(root);
87
+ const task = {
88
+ id: crypto.randomUUID(),
89
+ teamId: String(teamId),
90
+ title: clean,
91
+ owner: String(owner),
92
+ status: "open",
93
+ createdAt: new Date().toISOString(),
94
+ updatedAt: new Date().toISOString(),
95
+ };
96
+ board.tasks.push(task);
97
+ board.tasks = board.tasks.slice(-MAX_TASKS);
98
+ write(root, board);
99
+ return { root, task };
100
+ }
101
+
102
+ export function updateTask(cwd, { id = "", status = "", owner = "" } = {}) {
103
+ if (!["open", "claimed", "done"].includes(status)) throw new Error("board task status must be open, claimed or done");
104
+ const root = projectRoot(cwd);
105
+ const board = read(root);
106
+ const task = board.tasks.find((item) => item.id === String(id));
107
+ if (!task) throw new Error(`board task not found: ${id}`);
108
+ task.status = status;
109
+ if (owner) task.owner = String(owner);
110
+ task.updatedAt = new Date().toISOString();
111
+ write(root, board);
112
+ return { root, task };
113
+ }