dsh-desktop-kit 2.12.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 +14 -0
- package/README.md +17 -17
- package/client.js +2 -2
- package/docs/TEST-2.13.0.md +21 -0
- package/docs/TEST-2.14.0.md +23 -0
- package/package.json +2 -2
- package/plugins/dsh-agent-extensions/client.js +1 -1
- package/plugins/dsh-agent-extensions/index.js +76 -3
- package/plugins/dsh-agent-extensions/lib/agents.js +12 -3
- package/plugins/dsh-agent-extensions/lib/board.js +113 -0
- package/plugins/dsh-agent-extensions/screenshots/team-1440.png +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
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
|
+
|
|
10
|
+
## 2.13.0 (2026-11-12)
|
|
11
|
+
|
|
12
|
+
- **Team с пишущими агентами.** `worktrees=true` выдаёт каждому участнику отдельную ветку `dsh/<name>-…` и рабочую копию; без флага team остаётся read-only.
|
|
13
|
+
- **Изоляция.** Пишущие агенты никогда не делят cwd; результат каждого — отдельный run и ветка, merge остаётся за пользователем.
|
|
14
|
+
- **UI.** Подсказка про `worktrees=true` в секции «Параллельная команда».
|
|
15
|
+
- **Тесты.** Полный набор зелёный; read-only team и worktree-тесты без изменений.
|
|
16
|
+
|
|
3
17
|
## 2.12.0 (2026-11-12)
|
|
4
18
|
|
|
5
19
|
- **Параллельная команда.** `project_agent action=team names=[...] task=...` запускает 2–6 **read-only** ролей на одной задаче; каждая получает свой контекст и отдельный run.
|
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
|
-

|
|
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
|
## Права и субагенты
|
|
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
|
-

|
|
29
29
|
|
|
30
|
-

|
|
31
31
|
|
|
32
|
-
**v2.
|
|
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
|
-

|
|
121
121
|
|
|
122
|
-

|
|
123
123
|
|
|
124
124
|
## Скриншоты
|
|
125
125
|
|
|
126
126
|
### Skills Studio: каталог, стоимость и редактор
|
|
127
127
|
|
|
128
|
-

|
|
129
129
|
|
|
130
|
-

|
|
131
131
|
|
|
132
132
|
### Token Lab: куда уходит контекст
|
|
133
133
|
|
|
134
|
-

|
|
135
135
|
|
|
136
136
|
### Тёмная тема и мобильный
|
|
137
137
|
|
|
138
|
-

|
|
139
139
|
|
|
140
|
-

|
|
141
141
|
|
|
142
142
|
## Окно-напоминание: пиковый тариф
|
|
143
143
|
|
|
@@ -147,11 +147,11 @@ DeepSeek включает двойной тариф в пиковые часы (
|
|
|
147
147
|
- **в окне** — красная карточка: причина, границы окна в местном времени и UTC, живой отсчёт до конца и рекомендация, когда вернуться;
|
|
148
148
|
- **после окна** — карточка исчезает; состояние всегда доступно через `window.__DSH_PEAK_GUARD__.state()`.
|
|
149
149
|
|
|
150
|
-

|
|
151
151
|
|
|
152
|
-

|
|
153
153
|
|
|
154
|
-

|
|
155
155
|
|
|
156
156
|
Подробности и настройки — [plugins/dsh-peak-guard/README.md](plugins/dsh-peak-guard/README.md).
|
|
157
157
|
|
package/client.js
CHANGED
|
@@ -7741,7 +7741,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
7741
7741
|
agents.length > 0 ? h("div", { className: "ag-grid" }, agents.map((agent) => h(AgentCard, { key: agent.name, agent }))) : null,
|
|
7742
7742
|
h("div", { className: "ag-section" },
|
|
7743
7743
|
h("h3", null, "Параллельная команда"),
|
|
7744
|
-
h("p", { className: "ag-hint" }, "`project_agent action=team names=[reviewer,researcher] task=...` запускает 2–6 read-only ролей на одной задаче.
|
|
7744
|
+
h("p", { className: "ag-hint" }, "`project_agent action=team names=[reviewer,researcher] task=...` запускает 2–6 read-only ролей на одной задаче. Для пишущих добавьте `worktrees=true` — каждый получит отдельную ветку и рабочую копию. Результаты — в «Фоновых запусках»."),
|
|
7745
7745
|
agents.filter((agent) => agent.permission === "read-only").length > 0
|
|
7746
7746
|
? 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
7747
|
: h("div", { className: "ag-mini-empty" }, "Нужна хотя бы одна read-only роль: team не запускает пишущих агентов в общем cwd."),
|
|
@@ -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.
|
|
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,21 @@
|
|
|
1
|
+
# DSH Desktop Kit 2.13.0 — тест
|
|
2
|
+
|
|
3
|
+
Дата: 2026-11-12.
|
|
4
|
+
|
|
5
|
+
## Team worktrees
|
|
6
|
+
|
|
7
|
+
- `project_agent action=team ... worktrees=true`.
|
|
8
|
+
- Пишущая роль получает `.dsh/worktrees/<slug>` и ветку `dsh/<slug>`.
|
|
9
|
+
- Read-only team по-прежнему работает в общем cwd.
|
|
10
|
+
- Без `worktrees=true` пишущая роль отклоняется.
|
|
11
|
+
- Merge автоматически не выполняется — это осознанно.
|
|
12
|
+
|
|
13
|
+
## Проверки
|
|
14
|
+
|
|
15
|
+
- `npm test` — exit 0.
|
|
16
|
+
- `build:client` / `check:client` — OK.
|
|
17
|
+
- UI-подсказка обновлена; layout не менялся, прежний аудит 390/768/1440 актуален.
|
|
18
|
+
|
|
19
|
+
## Ограничение
|
|
20
|
+
|
|
21
|
+
Нет обмена сообщениями между участниками и общей доски задач.
|
|
@@ -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.
|
|
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"
|
|
@@ -185,7 +185,7 @@ window.__ModuleLoader__.load({
|
|
|
185
185
|
agents.length > 0 ? h("div", { className: "ag-grid" }, agents.map((agent) => h(AgentCard, { key: agent.name, agent }))) : null,
|
|
186
186
|
h("div", { className: "ag-section" },
|
|
187
187
|
h("h3", null, "Параллельная команда"),
|
|
188
|
-
h("p", { className: "ag-hint" }, "`project_agent action=team names=[reviewer,researcher] task=...` запускает 2–6 read-only ролей на одной задаче.
|
|
188
|
+
h("p", { className: "ag-hint" }, "`project_agent action=team names=[reviewer,researcher] task=...` запускает 2–6 read-only ролей на одной задаче. Для пишущих добавьте `worktrees=true` — каждый получит отдельную ветку и рабочую копию. Результаты — в «Фоновых запусках»."),
|
|
189
189
|
agents.filter((agent) => agent.permission === "read-only").length > 0
|
|
190
190
|
? 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
191
|
: h("div", { className: "ag-mini-empty" }, "Нужна хотя бы одна read-only роль: team не запускает пишущих агентов в общем cwd."),
|
|
@@ -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
|
|
|
@@ -51,6 +52,7 @@ function toolDefinition(ctx) {
|
|
|
51
52
|
task: { type: "string", description: "Task/prompt for the child agent (required for run)" },
|
|
52
53
|
background: { type: "boolean", description: "Return immediately with a durable run id instead of waiting for the child" },
|
|
53
54
|
worktree: { type: "string", description: "Run in a git worktree: `auto` picks a name, or pass a lowercase slug" },
|
|
55
|
+
worktrees: { type: "boolean", description: "For team: give every writer its own worktree/branch (required for non-read-only agents)" },
|
|
54
56
|
id: { type: "string", description: "Run id for status/cancel" },
|
|
55
57
|
},
|
|
56
58
|
required: ["action"],
|
|
@@ -91,12 +93,33 @@ function toolDefinition(ctx) {
|
|
|
91
93
|
for (const name of names) {
|
|
92
94
|
const definition = agents.find((agent) => agent.name === name);
|
|
93
95
|
if (!definition) return { ok: false, text: `project_agent team: unknown agent "${name}"` };
|
|
94
|
-
if (definition.permission !== "read-only"
|
|
96
|
+
if (definition.permission !== "read-only" && input?.worktrees !== true) {
|
|
97
|
+
return { ok: false, text: `project_agent team: "${name}" is not read-only; pass worktrees=true to isolate writers` };
|
|
98
|
+
}
|
|
95
99
|
definitions.push(definition);
|
|
96
100
|
}
|
|
97
|
-
|
|
101
|
+
if (input?.worktrees === true) {
|
|
102
|
+
const teamId = `team-${Date.now().toString(36)}`;
|
|
103
|
+
postMessage(project.root, { teamId, from: "lead", text: `Task: ${task}` });
|
|
104
|
+
const results = [];
|
|
105
|
+
for (const definition of definitions) {
|
|
106
|
+
let worktree = null;
|
|
107
|
+
try {
|
|
108
|
+
worktree = createWorktree({ cwd: project.root, slug: `${safeSlug(definition.name)}-${Date.now().toString(36).slice(-5)}` });
|
|
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 });
|
|
111
|
+
} catch (error) {
|
|
112
|
+
results.push({ name: definition.name, ok: false, id: null, error: error instanceof Error ? error.message : String(error), worktree, teamId });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
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");
|
|
116
|
+
return { ok: results.every((result) => result.ok), text: `project_agent team (isolated worktrees, board ${teamId}):\n${text}`, runs: results, teamId };
|
|
117
|
+
}
|
|
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 });
|
|
98
121
|
const text = results.map((result) => `${result.ok ? "✓" : "✗"} ${result.name}${result.id ? ` · ${result.id}` : ""}${result.error ? ` — ${result.error}` : ""}`).join("\n");
|
|
99
|
-
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 };
|
|
100
123
|
}
|
|
101
124
|
const name = String(input?.name ?? "").trim();
|
|
102
125
|
if (!name) return { ok: false, text: "project_agent: name is required for run" };
|
|
@@ -173,6 +196,55 @@ function worktreeToolDefinition() {
|
|
|
173
196
|
};
|
|
174
197
|
}
|
|
175
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
|
+
|
|
176
248
|
export function apply(ctx) {
|
|
177
249
|
try {
|
|
178
250
|
const scaffold = ensureGlobalScaffold();
|
|
@@ -208,6 +280,7 @@ export function apply(ctx) {
|
|
|
208
280
|
try {
|
|
209
281
|
ctx.effect(() => ctx.tools.register(toolDefinition(ctx)), "agent-extensions: project_agent tool");
|
|
210
282
|
ctx.effect(() => ctx.tools.register(worktreeToolDefinition()), "agent-extensions: project_worktree tool");
|
|
283
|
+
ctx.effect(() => ctx.tools.register(boardToolDefinition()), "agent-extensions: team_board tool");
|
|
211
284
|
} catch (error) {
|
|
212
285
|
ctx.logger?.warn?.(`[agent-extensions] tool registration failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
213
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 = [
|
|
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
|
+
}
|
|
Binary file
|