dsh-desktop-kit 2.15.1 → 2.15.3
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 +12 -0
- package/README.md +22 -21
- package/client.js +18 -1
- package/docs/TEST-2.15.2.md +20 -0
- package/docs/TEST-2.15.3.md +22 -0
- package/package.json +3 -3
- package/plugins/dsh-agent-extensions/client.js +17 -0
- package/plugins/dsh-agent-extensions/index.js +29 -0
- package/plugins/dsh-agent-extensions/lib/agents.js +1 -1
- package/plugins/dsh-agent-extensions/lib/api.js +2 -0
- package/plugins/dsh-agent-extensions/lib/messages.js +47 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.15.3 (2026-11-12)
|
|
4
|
+
|
|
5
|
+
- **Live team messages.** `team_message` — лид пишет любому участнику по run id, участник — лиду через `to="parent"`; сообщение идёт через `subagents.sendMessage` и дублируется в board.
|
|
6
|
+
- **Звезда, не mesh.** DSH разрешает только parent ⇄ direct child; sibling-сообщения остаются через board.
|
|
7
|
+
- **Тесты.** `team-messages-tests`: child→parent, lead→child, unknown/self/empty.
|
|
8
|
+
|
|
9
|
+
## 2.15.2 (2026-11-12)
|
|
10
|
+
|
|
11
|
+
- **Board UI.** В Агентах появилась секция «Доска команды»: последние сообщения, направления и задачи со статусами.
|
|
12
|
+
- **API.** Снимок `/api/dsh-agent-extensions/list` теперь возвращает `board`.
|
|
13
|
+
- **Аудит.** 390/768/1440: overflow 0, console 0, markup 0.
|
|
14
|
+
|
|
3
15
|
## 2.15.1 (2026-11-12)
|
|
4
16
|
|
|
5
17
|
- **npm description.** Обновлено описание пакета: MCP OAuth/sampling/elicitation, worktrees, фон и рой с общей доской.
|
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# DSH Desktop Kit 2.15
|
|
1
|
+
# DSH Desktop Kit 2.15.1
|
|
2
2
|
|
|
3
3
|
**MCP с OAuth, sampling и elicitation. Агенты, worktrees и рой с общей доской. Интерфейс, который не мешает.**
|
|
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.3** · 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
|
@@ -7715,6 +7715,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
7715
7715
|
const agents = state.data?.agents ?? [];
|
|
7716
7716
|
const worktrees = state.data?.worktrees ?? [];
|
|
7717
7717
|
const runs = state.data?.runs ?? [];
|
|
7718
|
+
const board = state.data?.board ?? { messages: [], tasks: [] };
|
|
7718
7719
|
const readOnly = agents.filter((agent) => agent.permission === "read-only").length;
|
|
7719
7720
|
const models = new Set(agents.map((agent) => agent.model).filter(Boolean)).size;
|
|
7720
7721
|
return h("section", { className: "ag-root", "aria-label": "Агенты проекта" },
|
|
@@ -7746,6 +7747,22 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
7746
7747
|
? h("div", { className: "ag-tools" }, agents.filter((agent) => agent.permission === "read-only").map((agent) => h("span", { key: agent.name, className: "ag-tool" }, agent.name)))
|
|
7747
7748
|
: h("div", { className: "ag-mini-empty" }, "Нужна хотя бы одна read-only роль: team не запускает пишущих агентов в общем cwd."),
|
|
7748
7749
|
),
|
|
7750
|
+
h("div", { className: "ag-section" },
|
|
7751
|
+
h("h3", null, "Доска команды"),
|
|
7752
|
+
h("p", { className: "ag-hint" }, "`team_board` — общий журнал сообщений и задач. Последние записи; полный журнал — `.dsh/agents/board.json`."),
|
|
7753
|
+
board.messages.length > 0
|
|
7754
|
+
? h("div", { className: "ag-items" }, board.messages.slice(-6).reverse().map((message) => h("article", { className: "ag-item", key: message.id },
|
|
7755
|
+
h("div", { className: "ag-item-top" },
|
|
7756
|
+
h("code", { title: message.from }, message.from || "agent"),
|
|
7757
|
+
h("span", null, message.to ? `→ ${message.to}` : "board"),
|
|
7758
|
+
),
|
|
7759
|
+
h("p", { className: "ag-task", title: message.text }, message.text),
|
|
7760
|
+
)))
|
|
7761
|
+
: h("div", { className: "ag-mini-empty" }, "Сообщений пока нет. Запустите team — board создастся автоматически."),
|
|
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}`)))
|
|
7764
|
+
: null,
|
|
7765
|
+
),
|
|
7749
7766
|
h("div", { className: "ag-section" },
|
|
7750
7767
|
h("h3", null, "Worktrees"),
|
|
7751
7768
|
h("p", { className: "ag-hint" }, "Изолированные рабочие копии: `project_worktree create` или `project_agent` с `worktree=auto`."),
|
|
@@ -8025,7 +8042,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
8025
8042
|
if (__kitErrors.length <= 5) console.error("[dsh-desktop-kit] registration failed:", label, message);
|
|
8026
8043
|
};
|
|
8027
8044
|
try {
|
|
8028
|
-
window.__DSH_DESKTOP_KIT__ = { version: "2.15.
|
|
8045
|
+
window.__DSH_DESKTOP_KIT__ = { version: "2.15.3", parts: __partNames, errors: __kitErrors, ready: false };
|
|
8029
8046
|
} catch {}
|
|
8030
8047
|
const __inject = [];
|
|
8031
8048
|
for (const __part of __parts) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# DSH Desktop Kit 2.15.2 — тест
|
|
2
|
+
|
|
3
|
+
Дата: 2026-11-12.
|
|
4
|
+
|
|
5
|
+
## Board UI
|
|
6
|
+
|
|
7
|
+
- Секция «Доска команды» в Агентах.
|
|
8
|
+
- Последние 6 сообщений: from, to, текст.
|
|
9
|
+
- Задачи: open / claimed / done.
|
|
10
|
+
- Пустое состояние, если team ещё не запускалась.
|
|
11
|
+
|
|
12
|
+
## API
|
|
13
|
+
|
|
14
|
+
- `/list` возвращает `board` из `.dsh/agents/board.json`.
|
|
15
|
+
|
|
16
|
+
## Проверки
|
|
17
|
+
|
|
18
|
+
- `npm test` — exit 0.
|
|
19
|
+
- `build:client` / `check:client` — OK.
|
|
20
|
+
- UI 390/768/1440: overflow 0, console 0, markup 0.
|
|
@@ -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.
|
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: 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.3",
|
|
4
|
+
"description": "DeepSeek Harness desktop kit 2.15.3: 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"
|
|
@@ -159,6 +159,7 @@ window.__ModuleLoader__.load({
|
|
|
159
159
|
const agents = state.data?.agents ?? [];
|
|
160
160
|
const worktrees = state.data?.worktrees ?? [];
|
|
161
161
|
const runs = state.data?.runs ?? [];
|
|
162
|
+
const board = state.data?.board ?? { messages: [], tasks: [] };
|
|
162
163
|
const readOnly = agents.filter((agent) => agent.permission === "read-only").length;
|
|
163
164
|
const models = new Set(agents.map((agent) => agent.model).filter(Boolean)).size;
|
|
164
165
|
return h("section", { className: "ag-root", "aria-label": "Агенты проекта" },
|
|
@@ -190,6 +191,22 @@ window.__ModuleLoader__.load({
|
|
|
190
191
|
? h("div", { className: "ag-tools" }, agents.filter((agent) => agent.permission === "read-only").map((agent) => h("span", { key: agent.name, className: "ag-tool" }, agent.name)))
|
|
191
192
|
: h("div", { className: "ag-mini-empty" }, "Нужна хотя бы одна read-only роль: team не запускает пишущих агентов в общем cwd."),
|
|
192
193
|
),
|
|
194
|
+
h("div", { className: "ag-section" },
|
|
195
|
+
h("h3", null, "Доска команды"),
|
|
196
|
+
h("p", { className: "ag-hint" }, "`team_board` — общий журнал сообщений и задач. Последние записи; полный журнал — `.dsh/agents/board.json`."),
|
|
197
|
+
board.messages.length > 0
|
|
198
|
+
? h("div", { className: "ag-items" }, board.messages.slice(-6).reverse().map((message) => h("article", { className: "ag-item", key: message.id },
|
|
199
|
+
h("div", { className: "ag-item-top" },
|
|
200
|
+
h("code", { title: message.from }, message.from || "agent"),
|
|
201
|
+
h("span", null, message.to ? `→ ${message.to}` : "board"),
|
|
202
|
+
),
|
|
203
|
+
h("p", { className: "ag-task", title: message.text }, message.text),
|
|
204
|
+
)))
|
|
205
|
+
: h("div", { className: "ag-mini-empty" }, "Сообщений пока нет. Запустите team — board создастся автоматически."),
|
|
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}`)))
|
|
208
|
+
: null,
|
|
209
|
+
),
|
|
193
210
|
h("div", { className: "ag-section" },
|
|
194
211
|
h("h3", null, "Worktrees"),
|
|
195
212
|
h("p", { className: "ag-hint" }, "Изолированные рабочие копии: `project_worktree create` или `project_agent` с `worktree=auto`."),
|
|
@@ -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
|
|
|
@@ -245,6 +246,33 @@ function boardToolDefinition() {
|
|
|
245
246
|
};
|
|
246
247
|
}
|
|
247
248
|
|
|
249
|
+
function teamMessageToolDefinition() {
|
|
250
|
+
return {
|
|
251
|
+
name: "team_message",
|
|
252
|
+
description:
|
|
253
|
+
"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.",
|
|
254
|
+
parameters: {
|
|
255
|
+
type: "object",
|
|
256
|
+
additionalProperties: false,
|
|
257
|
+
properties: {
|
|
258
|
+
action: { type: "string", enum: ["send"], description: "send a message" },
|
|
259
|
+
to: { type: "string", description: "Run id, child session id, or `parent`/`lead`" },
|
|
260
|
+
text: { type: "string", description: "Message text" },
|
|
261
|
+
teamId: { type: "string", description: "Team id for the board copy" },
|
|
262
|
+
},
|
|
263
|
+
required: ["action", "to", "text"],
|
|
264
|
+
},
|
|
265
|
+
async execute(input, exec) {
|
|
266
|
+
try {
|
|
267
|
+
const result = await sendTeamMessage(ctx, exec, { to: input?.to, text: input?.text, teamId: input?.teamId });
|
|
268
|
+
return { ok: true, text: `team_message → ${result.targetId} (${result.messageId})`, targetId: result.targetId };
|
|
269
|
+
} catch (error) {
|
|
270
|
+
return { ok: false, text: `team_message: ${error instanceof Error ? error.message : String(error)}` };
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
|
|
248
276
|
export function apply(ctx) {
|
|
249
277
|
try {
|
|
250
278
|
const scaffold = ensureGlobalScaffold();
|
|
@@ -281,6 +309,7 @@ export function apply(ctx) {
|
|
|
281
309
|
ctx.effect(() => ctx.tools.register(toolDefinition(ctx)), "agent-extensions: project_agent tool");
|
|
282
310
|
ctx.effect(() => ctx.tools.register(worktreeToolDefinition()), "agent-extensions: project_worktree tool");
|
|
283
311
|
ctx.effect(() => ctx.tools.register(boardToolDefinition()), "agent-extensions: team_board tool");
|
|
312
|
+
ctx.effect(() => ctx.tools.register(teamMessageToolDefinition()), "agent-extensions: team_message tool");
|
|
284
313
|
} catch (error) {
|
|
285
314
|
ctx.logger?.warn?.(`[agent-extensions] tool registration failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
286
315
|
}
|
|
@@ -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 ?? ""),
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { loadAgents, projectFor } from "./project.js";
|
|
5
5
|
import { cancelRun, listRuns } from "./agents.js";
|
|
6
6
|
import { worktreeSummary } from "./worktrees.js";
|
|
7
|
+
import { readBoard } from "./board.js";
|
|
7
8
|
|
|
8
9
|
export const RPC_NAMESPACE = "dsh-agent-extensions";
|
|
9
10
|
const ROUTE_BASE = "/api/dsh-agent-extensions";
|
|
@@ -65,6 +66,7 @@ export function registerAgentApi(ctx) {
|
|
|
65
66
|
worktrees,
|
|
66
67
|
worktreeError,
|
|
67
68
|
runs: listRuns(project.root),
|
|
69
|
+
board: readBoard(project.root),
|
|
68
70
|
});
|
|
69
71
|
} catch (error) {
|
|
70
72
|
return fail(rpcId, error instanceof Error ? error.message : String(error));
|
|
@@ -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
|
+
}
|