dsh-desktop-kit 2.15.2 → 2.15.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +21 -20
- package/client.js +2 -2
- package/docs/TEST-2.15.3.md +22 -0
- package/docs/TEST-2.15.4.md +22 -0
- package/package.json +3 -3
- package/plugins/dsh-agent-extensions/client.js +1 -1
- package/plugins/dsh-agent-extensions/index.js +32 -2
- package/plugins/dsh-agent-extensions/lib/agents.js +1 -1
- package/plugins/dsh-agent-extensions/lib/board.js +44 -7
- package/plugins/dsh-agent-extensions/lib/messages.js +47 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.15.4 (2026-11-12)
|
|
4
|
+
|
|
5
|
+
- **Зависимости задач.** `team_board add-task dependsOn=[...]`; `read` показывает `blockedBy` и `ready`.
|
|
6
|
+
- **Атомарный claim.** Задачу нельзя взять дважды разными владельцами и нельзя закрыть до выполнения зависимостей.
|
|
7
|
+
- **UI.** Заблокированная задача помечается `⊘`, готовые — `○`.
|
|
8
|
+
- **Тесты.** `team-board-tests`: blocked claim/done, claim conflict, dependency completion.
|
|
9
|
+
|
|
10
|
+
## 2.15.3 (2026-11-12)
|
|
11
|
+
|
|
12
|
+
- **Live team messages.** `team_message` — лид пишет любому участнику по run id, участник — лиду через `to="parent"`; сообщение идёт через `subagents.sendMessage` и дублируется в board.
|
|
13
|
+
- **Звезда, не mesh.** DSH разрешает только parent ⇄ direct child; sibling-сообщения остаются через board.
|
|
14
|
+
- **Тесты.** `team-messages-tests`: child→parent, lead→child, unknown/self/empty.
|
|
15
|
+
|
|
3
16
|
## 2.15.2 (2026-11-12)
|
|
4
17
|
|
|
5
18
|
- **Board UI.** В Агентах появилась секция «Доска команды»: последние сообщения, направления и задачи со статусами.
|
package/README.md
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
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
|
-

|
|
8
8
|
|
|
9
9
|
## MCP: подключения без JSON
|
|
10
10
|
|
|
11
11
|
Настройки → **MCP**: пресеты GitHub, PostgreSQL и Filesystem, живые статусы, health, список tools и безопасное хранение токенов в `~/.dsh/mcp.secrets.json`. Промпты сервера открываются кнопкой **Prompts**: аргументы, запуск и копирование результата. HTTP-серверы подключаются через **OAuth 2.1 + PKCE**, **sampling** идёт через approval-карточку DSH, а **elicitation** — через глобальную форму с Accept/Decline.
|
|
12
12
|
|
|
13
|
-

|
|
14
14
|
|
|
15
|
-

|
|
16
16
|
|
|
17
|
-

|
|
18
18
|
|
|
19
19
|
## Агенты, worktrees и рой
|
|
20
20
|
|
|
@@ -23,13 +23,14 @@
|
|
|
23
23
|
- **Фон** — `background=true` возвращает run id сразу; страница **Агенты** показывает очередь и кнопку «Остановить».
|
|
24
24
|
- **Команда** — `project_agent action=team names=[reviewer,researcher] task=...` запускает 2–6 read-only ролей; `worktrees=true` даёт каждому писателю отдельную ветку.
|
|
25
25
|
- **Рой и общая доска** — `team_board` хранит сообщения и задачи в `.dsh/agents/board.json` (0600, redaction, лимиты); team автоматически создаёт `teamId` и передаёт его ролям.
|
|
26
|
+
- **Живые сообщения** — `team_message` отправляет текст лиду (`to="parent"`) или участнику по run id; копия каждого сообщения остаётся в board.
|
|
26
27
|
- **Инструкции проекта** — `AGENTS.md`/`CLAUDE.md` иерархически (root → вложенные папки → `.dsh`) с `@import`; MCP roots сообщает корень проекта.
|
|
27
28
|
|
|
28
|
-

|
|
29
30
|
|
|
30
|
-

|
|
31
32
|
|
|
32
|
-

|
|
33
34
|
|
|
34
35
|
## Права и субагенты
|
|
35
36
|
|
|
@@ -40,11 +41,11 @@
|
|
|
40
41
|
- **Worktrees и фоновые агенты.** `project_worktree` создаёт ветку `dsh/<slug>` и отдельную папку `.dsh/worktrees/<slug>`; `project_agent ... worktree=auto background=true` запускает агента в изоляции, а страница **Агенты** показывает worktrees и очередь запусков с кнопкой «Остановить».
|
|
41
42
|
- **Инструкции проекта.** `AGENTS.md` и `CLAUDE.md` читаются иерархически (root → вложенные папки → `.dsh`) с `@import`; MCP roots сообщает серверу корень проекта.
|
|
42
43
|
|
|
43
|
-

|
|
44
45
|
|
|
45
|
-

|
|
46
47
|
|
|
47
|
-
**v2.15.
|
|
48
|
+
**v2.15.4** · MIT · проверено на DSH `0.2.1-rc.5` и `0.2.2-rc.1` (Windows 11) · без внешних зависимостей и телеметрии
|
|
48
49
|
|
|
49
50
|
**План развития:** [docs/ROADMAP-3.0.md](docs/ROADMAP-3.0.md) — Memory Fabric, семантическое
|
|
50
51
|
слияние, локальный индекс памяти, шифрованные переносы, Memory Hub и npm trusted publishing.
|
|
@@ -139,27 +140,27 @@
|
|
|
139
140
|
- перед каждой синхронизацией проверяется, что репозиторий всё ещё приватный;
|
|
140
141
|
- секреты и PII вычищаются, домашние пути заменяются токеном `%DSH_HOME%`; LLM не вызывается — **0 токенов**.
|
|
141
142
|
|
|
142
|
-

|
|
143
144
|
|
|
144
|
-

|
|
145
146
|
|
|
146
147
|
## Скриншоты
|
|
147
148
|
|
|
148
149
|
### Skills Studio: каталог, стоимость и редактор
|
|
149
150
|
|
|
150
|
-

|
|
151
152
|
|
|
152
|
-

|
|
153
154
|
|
|
154
155
|
### Token Lab: куда уходит контекст
|
|
155
156
|
|
|
156
|
-

|
|
157
158
|
|
|
158
159
|
### Тёмная тема и мобильный
|
|
159
160
|
|
|
160
|
-

|
|
161
162
|
|
|
162
|
-

|
|
163
164
|
|
|
164
165
|
## Окно-напоминание: пиковый тариф
|
|
165
166
|
|
|
@@ -169,11 +170,11 @@ DeepSeek включает двойной тариф в пиковые часы (
|
|
|
169
170
|
- **в окне** — красная карточка: причина, границы окна в местном времени и UTC, живой отсчёт до конца и рекомендация, когда вернуться;
|
|
170
171
|
- **после окна** — карточка исчезает; состояние всегда доступно через `window.__DSH_PEAK_GUARD__.state()`.
|
|
171
172
|
|
|
172
|
-

|
|
173
174
|
|
|
174
|
-

|
|
175
176
|
|
|
176
|
-

|
|
177
178
|
|
|
178
179
|
Подробности и настройки — [plugins/dsh-peak-guard/README.md](plugins/dsh-peak-guard/README.md).
|
|
179
180
|
|
package/client.js
CHANGED
|
@@ -7760,7 +7760,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
7760
7760
|
)))
|
|
7761
7761
|
: h("div", { className: "ag-mini-empty" }, "Сообщений пока нет. Запустите team — board создастся автоматически."),
|
|
7762
7762
|
board.tasks.length > 0
|
|
7763
|
-
? h("div", { className: "ag-tools" }, board.tasks.slice(-8).map((task) => h("span", { key: task.id, className: "ag-tool", title: task.title }, `${task.status === "done" ? "✓" : task.status === "claimed" ? "…" : "○"} ${task.title}`)))
|
|
7763
|
+
? h("div", { className: "ag-tools" }, board.tasks.slice(-8).map((task) => h("span", { key: task.id, className: "ag-tool", title: task.blockedBy?.length ? `blocked by ${task.blockedBy.join(", ")}` : task.title }, `${task.status === "done" ? "✓" : task.status === "claimed" ? "…" : task.ready ? "○" : "⊘"} ${task.title}`)))
|
|
7764
7764
|
: null,
|
|
7765
7765
|
),
|
|
7766
7766
|
h("div", { className: "ag-section" },
|
|
@@ -8042,7 +8042,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
8042
8042
|
if (__kitErrors.length <= 5) console.error("[dsh-desktop-kit] registration failed:", label, message);
|
|
8043
8043
|
};
|
|
8044
8044
|
try {
|
|
8045
|
-
window.__DSH_DESKTOP_KIT__ = { version: "2.15.
|
|
8045
|
+
window.__DSH_DESKTOP_KIT__ = { version: "2.15.4", parts: __partNames, errors: __kitErrors, ready: false };
|
|
8046
8046
|
} catch {}
|
|
8047
8047
|
const __inject = [];
|
|
8048
8048
|
for (const __part of __parts) {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# DSH Desktop Kit 2.15.3 — тест
|
|
2
|
+
|
|
3
|
+
Дата: 2026-11-12.
|
|
4
|
+
|
|
5
|
+
## Live messages
|
|
6
|
+
|
|
7
|
+
- `team_message action=send to=<run-id|parent> text=...`.
|
|
8
|
+
- Lead → any direct child run.
|
|
9
|
+
- Child → lead (`parent`/`lead`).
|
|
10
|
+
- Target resolution: run id, child session id, parent from runs registry.
|
|
11
|
+
- Self/unknown/empty rejected.
|
|
12
|
+
- Every successful message is copied to board (`teamId`).
|
|
13
|
+
|
|
14
|
+
## Ограничение
|
|
15
|
+
|
|
16
|
+
Sibling-to-sibling live messages API DSH не разрешает; board — общий канал.
|
|
17
|
+
|
|
18
|
+
## Проверки
|
|
19
|
+
|
|
20
|
+
- `team-messages-tests` — OK.
|
|
21
|
+
- `npm test` — exit 0.
|
|
22
|
+
- `build:client` / `check:client` — OK.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# DSH Desktop Kit 2.15.4 — тест
|
|
2
|
+
|
|
3
|
+
Дата: 2026-11-12.
|
|
4
|
+
|
|
5
|
+
## Task graph
|
|
6
|
+
|
|
7
|
+
- `team_board add-task dependsOn=[id]`.
|
|
8
|
+
- `read` returns `ready`, `blockedBy`.
|
|
9
|
+
- `claim-task` rejected while blocked or owned by another agent.
|
|
10
|
+
- `done-task` rejected until dependencies are done.
|
|
11
|
+
- Unknown dependency/self dependency rejected.
|
|
12
|
+
|
|
13
|
+
## UI
|
|
14
|
+
|
|
15
|
+
- `⊘` blocked, `○` ready, `…` claimed, `✓` done.
|
|
16
|
+
- 390/768/1440: overflow 0, console 0, markup 0.
|
|
17
|
+
|
|
18
|
+
## Проверки
|
|
19
|
+
|
|
20
|
+
- `team-board-tests` — OK.
|
|
21
|
+
- `npm test` — exit 0.
|
|
22
|
+
- `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.
|
|
4
|
-
"description": "DeepSeek Harness desktop kit 2.15.
|
|
3
|
+
"version": "2.15.4",
|
|
4
|
+
"description": "DeepSeek Harness desktop kit 2.15.4: 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-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/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",
|
|
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"
|
|
@@ -204,7 +204,7 @@ window.__ModuleLoader__.load({
|
|
|
204
204
|
)))
|
|
205
205
|
: h("div", { className: "ag-mini-empty" }, "Сообщений пока нет. Запустите team — board создастся автоматически."),
|
|
206
206
|
board.tasks.length > 0
|
|
207
|
-
? h("div", { className: "ag-tools" }, board.tasks.slice(-8).map((task) => h("span", { key: task.id, className: "ag-tool", title: task.title }, `${task.status === "done" ? "✓" : task.status === "claimed" ? "…" : "○"} ${task.title}`)))
|
|
207
|
+
? h("div", { className: "ag-tools" }, board.tasks.slice(-8).map((task) => h("span", { key: task.id, className: "ag-tool", title: task.blockedBy?.length ? `blocked by ${task.blockedBy.join(", ")}` : task.title }, `${task.status === "done" ? "✓" : task.status === "claimed" ? "…" : task.ready ? "○" : "⊘"} ${task.title}`)))
|
|
208
208
|
: null,
|
|
209
209
|
),
|
|
210
210
|
h("div", { className: "ag-section" },
|
|
@@ -19,6 +19,7 @@ import { registerCommands } from "./lib/commands.js";
|
|
|
19
19
|
import { registerAgentApi } from "./lib/api.js";
|
|
20
20
|
import { renderProjectInstructions } from "./lib/instructions.js";
|
|
21
21
|
import { addTask, postMessage, readBoard, updateTask } from "./lib/board.js";
|
|
22
|
+
import { sendTeamMessage } from "./lib/messages.js";
|
|
22
23
|
import { ensureGlobalScaffold, ensureProjectScaffold } from "./lib/scaffold.js";
|
|
23
24
|
import { findDshDir, loadAgents, projectFor } from "./lib/project.js";
|
|
24
25
|
|
|
@@ -211,6 +212,7 @@ function boardToolDefinition() {
|
|
|
211
212
|
to: { type: "string", description: "optional recipient label" },
|
|
212
213
|
title: { type: "string", description: "task title for add-task" },
|
|
213
214
|
id: { type: "string", description: "task id for claim-task/done-task" },
|
|
215
|
+
dependsOn: { type: "array", items: { type: "string" }, description: "task ids that must be done first" },
|
|
214
216
|
},
|
|
215
217
|
required: ["action"],
|
|
216
218
|
},
|
|
@@ -226,11 +228,11 @@ function boardToolDefinition() {
|
|
|
226
228
|
if (input?.action === "read") {
|
|
227
229
|
const board = readBoard(cwd, { teamId });
|
|
228
230
|
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})` : ""}`);
|
|
231
|
+
const tasks = board.tasks.map((task) => `- [${task.status}${task.ready ? "" : " · blocked"}] ${task.id} ${task.title}${task.owner ? ` (${task.owner})` : ""}${task.blockedBy?.length ? ` ← ${task.blockedBy.join(", ")}` : ""}`);
|
|
230
232
|
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
233
|
}
|
|
232
234
|
if (input?.action === "add-task") {
|
|
233
|
-
const result = addTask(cwd, { teamId, title: input?.title, owner: from });
|
|
235
|
+
const result = addTask(cwd, { teamId, title: input?.title, owner: from, dependsOn: input?.dependsOn, priority: input?.priority });
|
|
234
236
|
return { ok: true, text: `team_board task: ${result.task.id} · ${result.task.title}`, task: result.task };
|
|
235
237
|
}
|
|
236
238
|
if (input?.action === "claim-task" || input?.action === "done-task") {
|
|
@@ -245,6 +247,33 @@ function boardToolDefinition() {
|
|
|
245
247
|
};
|
|
246
248
|
}
|
|
247
249
|
|
|
250
|
+
function teamMessageToolDefinition() {
|
|
251
|
+
return {
|
|
252
|
+
name: "team_message",
|
|
253
|
+
description:
|
|
254
|
+
"Send a live text message inside a project team. The lead may target any run id; a member may use to=\"parent\" to message the lead. Sibling messaging is not supported by DSH — post to team_board for siblings. Every message is also copied to the board.",
|
|
255
|
+
parameters: {
|
|
256
|
+
type: "object",
|
|
257
|
+
additionalProperties: false,
|
|
258
|
+
properties: {
|
|
259
|
+
action: { type: "string", enum: ["send"], description: "send a message" },
|
|
260
|
+
to: { type: "string", description: "Run id, child session id, or `parent`/`lead`" },
|
|
261
|
+
text: { type: "string", description: "Message text" },
|
|
262
|
+
teamId: { type: "string", description: "Team id for the board copy" },
|
|
263
|
+
},
|
|
264
|
+
required: ["action", "to", "text"],
|
|
265
|
+
},
|
|
266
|
+
async execute(input, exec) {
|
|
267
|
+
try {
|
|
268
|
+
const result = await sendTeamMessage(ctx, exec, { to: input?.to, text: input?.text, teamId: input?.teamId });
|
|
269
|
+
return { ok: true, text: `team_message → ${result.targetId} (${result.messageId})`, targetId: result.targetId };
|
|
270
|
+
} catch (error) {
|
|
271
|
+
return { ok: false, text: `team_message: ${error instanceof Error ? error.message : String(error)}` };
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
248
277
|
export function apply(ctx) {
|
|
249
278
|
try {
|
|
250
279
|
const scaffold = ensureGlobalScaffold();
|
|
@@ -281,6 +310,7 @@ export function apply(ctx) {
|
|
|
281
310
|
ctx.effect(() => ctx.tools.register(toolDefinition(ctx)), "agent-extensions: project_agent tool");
|
|
282
311
|
ctx.effect(() => ctx.tools.register(worktreeToolDefinition()), "agent-extensions: project_worktree tool");
|
|
283
312
|
ctx.effect(() => ctx.tools.register(boardToolDefinition()), "agent-extensions: team_board tool");
|
|
313
|
+
ctx.effect(() => ctx.tools.register(teamMessageToolDefinition()), "agent-extensions: team_message tool");
|
|
284
314
|
} catch (error) {
|
|
285
315
|
ctx.logger?.warn?.(`[agent-extensions] tool registration failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
286
316
|
}
|
|
@@ -53,7 +53,7 @@ export async function runProjectAgent(ctx, exec, definition, task, options = {})
|
|
|
53
53
|
`<project-agent name="${definition.name}">`,
|
|
54
54
|
definition.body,
|
|
55
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.
|
|
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. 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>` : "",
|
|
57
57
|
"",
|
|
58
58
|
"Task:",
|
|
59
59
|
String(task ?? ""),
|
|
@@ -75,28 +75,54 @@ export function readBoard(cwd, { teamId = "", since = "" } = {}) {
|
|
|
75
75
|
const root = projectRoot(cwd);
|
|
76
76
|
const board = read(root);
|
|
77
77
|
const messages = board.messages.filter((message) => (!teamId || message.teamId === teamId) && (!since || message.createdAt > since));
|
|
78
|
-
const tasks = board.tasks
|
|
78
|
+
const tasks = board.tasks
|
|
79
|
+
.filter((task) => !teamId || task.teamId === teamId)
|
|
80
|
+
.map((task) => ({ ...task, ...taskState(board.tasks, task) }));
|
|
79
81
|
return { root, messages, tasks };
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
function dependencyIds(task) {
|
|
85
|
+
return Array.isArray(task?.dependsOn) ? task.dependsOn.map(String) : [];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function taskState(tasks, task) {
|
|
89
|
+
const byId = new Map(tasks.map((item) => [String(item.id), item]));
|
|
90
|
+
const blockedBy = dependencyIds(task).filter((id) => byId.get(id)?.status !== "done");
|
|
91
|
+
return { blockedBy, ready: task.status !== "done" && blockedBy.length === 0 };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function validateDependencies(tasks, id, dependsOn) {
|
|
95
|
+
const ids = [...new Set(dependsOn.map(String).filter(Boolean))];
|
|
96
|
+
const known = new Set(tasks.map((task) => String(task.id)));
|
|
97
|
+
for (const dependency of ids) {
|
|
98
|
+
if (dependency === id) throw new Error("board task cannot depend on itself");
|
|
99
|
+
if (!known.has(dependency)) throw new Error(`board dependency not found: ${dependency}`);
|
|
100
|
+
}
|
|
101
|
+
return ids;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function addTask(cwd, { teamId = "", title = "", owner = "", dependsOn = [], priority = "normal" } = {}) {
|
|
83
105
|
const clean = redact(title).trim();
|
|
84
106
|
if (!clean) throw new Error("board task title is required");
|
|
85
107
|
const root = projectRoot(cwd);
|
|
86
108
|
const board = read(root);
|
|
109
|
+
const id = crypto.randomUUID();
|
|
110
|
+
const dependencies = validateDependencies(board.tasks, id, Array.isArray(dependsOn) ? dependsOn : []);
|
|
87
111
|
const task = {
|
|
88
|
-
id
|
|
112
|
+
id,
|
|
89
113
|
teamId: String(teamId),
|
|
90
114
|
title: clean,
|
|
91
115
|
owner: String(owner),
|
|
92
116
|
status: "open",
|
|
117
|
+
priority: ["low", "normal", "high"].includes(priority) ? priority : "normal",
|
|
118
|
+
dependsOn: dependencies,
|
|
93
119
|
createdAt: new Date().toISOString(),
|
|
94
120
|
updatedAt: new Date().toISOString(),
|
|
95
121
|
};
|
|
96
122
|
board.tasks.push(task);
|
|
97
123
|
board.tasks = board.tasks.slice(-MAX_TASKS);
|
|
98
124
|
write(root, board);
|
|
99
|
-
return { root, task };
|
|
125
|
+
return { root, task: { ...task, ...taskState(board.tasks, task) } };
|
|
100
126
|
}
|
|
101
127
|
|
|
102
128
|
export function updateTask(cwd, { id = "", status = "", owner = "" } = {}) {
|
|
@@ -105,9 +131,20 @@ export function updateTask(cwd, { id = "", status = "", owner = "" } = {}) {
|
|
|
105
131
|
const board = read(root);
|
|
106
132
|
const task = board.tasks.find((item) => item.id === String(id));
|
|
107
133
|
if (!task) throw new Error(`board task not found: ${id}`);
|
|
108
|
-
|
|
109
|
-
if (
|
|
134
|
+
const state = taskState(board.tasks, task);
|
|
135
|
+
if (status === "claimed") {
|
|
136
|
+
if (task.status === "claimed" && task.owner && owner && task.owner !== owner) throw new Error(`board task already claimed by ${task.owner}`);
|
|
137
|
+
if (!state.ready) throw new Error(`board task is blocked by: ${state.blockedBy.join(", ")}`);
|
|
138
|
+
task.status = "claimed";
|
|
139
|
+
task.owner = owner || task.owner;
|
|
140
|
+
} else if (status === "done") {
|
|
141
|
+
if (task.owner && owner && task.owner !== owner) throw new Error(`board task is owned by ${task.owner}`);
|
|
142
|
+
if (!state.ready) throw new Error(`board task cannot be done before: ${state.blockedBy.join(", ")}`);
|
|
143
|
+
task.status = "done";
|
|
144
|
+
} else {
|
|
145
|
+
task.status = "open";
|
|
146
|
+
}
|
|
110
147
|
task.updatedAt = new Date().toISOString();
|
|
111
148
|
write(root, board);
|
|
112
|
-
return { root, task };
|
|
149
|
+
return { root, task: { ...task, ...taskState(board.tasks, task) } };
|
|
113
150
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live team messages over DSH's subagent seam.
|
|
3
|
+
*
|
|
4
|
+
* DSH allows `sendMessage` only between a direct parent and a direct child.
|
|
5
|
+
* The tool therefore implements the star topology: the lead can message any
|
|
6
|
+
* team member, and a member can message the lead. Sibling-to-sibling traffic is
|
|
7
|
+
* recorded on the board for the lead to relay, not sent directly.
|
|
8
|
+
*/
|
|
9
|
+
import { listRuns } from "./agents.js";
|
|
10
|
+
import { postMessage } from "./board.js";
|
|
11
|
+
import { projectFor } from "./project.js";
|
|
12
|
+
|
|
13
|
+
function text(value, max = 4_000) {
|
|
14
|
+
const clean = String(value ?? "").trim();
|
|
15
|
+
if (!clean) throw new Error("team_message: text is required");
|
|
16
|
+
if (clean.length > max) throw new Error("team_message: text is too long");
|
|
17
|
+
return clean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function resolveTeamTarget(projectRoot, senderId, to) {
|
|
21
|
+
const runs = listRuns(projectRoot);
|
|
22
|
+
const senderRun = runs.find((run) => String(run.childId) === String(senderId));
|
|
23
|
+
if (to === "parent" || to === "lead") {
|
|
24
|
+
const target = senderRun?.parentId ?? "";
|
|
25
|
+
if (!target) throw new Error("team_message: parent id is unknown for this agent");
|
|
26
|
+
return { targetId: target, run: null };
|
|
27
|
+
}
|
|
28
|
+
const run = runs.find((item) => String(item.id) === String(to) || String(item.childId) === String(to));
|
|
29
|
+
if (!run) throw new Error(`team_message: no team run "${to}"`);
|
|
30
|
+
if (String(run.childId) === String(senderId)) throw new Error("team_message: cannot message yourself");
|
|
31
|
+
return { targetId: String(run.childId), run };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function sendTeamMessage(ctx, exec, { to = "", text: body = "", teamId = "" } = {}) {
|
|
35
|
+
const subagents = ctx.get?.("subagents");
|
|
36
|
+
if (!subagents || typeof subagents.sendMessage !== "function") throw new Error("team_message: subagents service is unavailable");
|
|
37
|
+
const sender = exec?.agent;
|
|
38
|
+
if (!sender?.id) throw new Error("team_message: active agent is required");
|
|
39
|
+
const root = projectFor(sender?.session?.header?.cwd).root;
|
|
40
|
+
const target = resolveTeamTarget(root, sender.id, String(to ?? ""));
|
|
41
|
+
const message = text(body);
|
|
42
|
+
const messageId = await subagents.sendMessage(sender, target.targetId, [{ type: "text", text: message }], {
|
|
43
|
+
signal: exec?.signal ?? AbortSignal.timeout(15_000),
|
|
44
|
+
});
|
|
45
|
+
postMessage(root, { teamId: String(teamId), from: String(sender.id), to: target.targetId, text: message });
|
|
46
|
+
return { targetId: target.targetId, messageId: String(messageId ?? ""), run: target.run };
|
|
47
|
+
}
|