dsh-desktop-kit 2.15.7 → 2.15.9
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 +25 -21
- package/client.js +42 -1
- package/docs/TEST-2.15.8.md +20 -0
- package/docs/TEST-2.15.9.md +16 -0
- package/package.json +3 -3
- package/plugins/dsh-agent-extensions/client.js +41 -0
- package/plugins/dsh-agent-extensions/lib/agents.js +4 -0
- package/plugins/dsh-agent-extensions/lib/api.js +59 -0
- package/plugins/dsh-agent-extensions/lib/transcripts.js +66 -0
- package/plugins/dsh-agent-extensions/screenshots/transcript-1440.png +0 -0
- package/plugins/dsh-agent-extensions/screenshots/transcript-390.png +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.15.9 (2026-11-12)
|
|
4
|
+
|
|
5
|
+
- **Транскрипт после restart.** При завершении/отмене run сохраняется redacted-снимок в `.dsh/agents/transcripts/<run>.json` (0600, 80 записей).
|
|
6
|
+
- **API.** Живая сессия — источник истины; если её нет, читается снимок; иначе честная ошибка.
|
|
7
|
+
- **Тесты.** `transcripts-tests`: extract, redaction, save/load, missing.
|
|
8
|
+
|
|
9
|
+
## 2.15.8 (2026-11-12)
|
|
10
|
+
|
|
11
|
+
- **Транскрипт агента.** Кнопка «Транскрипт» у фонового run открывает чтение сессии ребёнка через `ctx.sessions`: user/assistant, tool calls, tool results, errors.
|
|
12
|
+
- **API.** `dsh-agent-extensions/transcript`; live child only, иначе честная ошибка.
|
|
13
|
+
- **UI.** Модалка на 390/768/1440, overflow 0; новые screenshot `transcript-1440/390` в README.
|
|
14
|
+
- **Ограничение.** После restart/удаления сессии транскрипт недоступен — остаётся preview.
|
|
15
|
+
|
|
3
16
|
## 2.15.7 (2026-11-12)
|
|
4
17
|
|
|
5
18
|
- **Новые скриншоты.** Board UI: сообщения, лид, задачи и зависимости на 1440 и 390.
|
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
|
|
|
@@ -26,13 +26,17 @@
|
|
|
26
26
|
- **Живые сообщения** — `team_message` отправляет текст лиду (`to="parent"`) или участнику по run id; копия каждого сообщения остаётся в board.
|
|
27
27
|
- **Инструкции проекта** — `AGENTS.md`/`CLAUDE.md` иерархически (root → вложенные папки → `.dsh`) с `@import`; MCP roots сообщает корень проекта.
|
|
28
28
|
|
|
29
|
-

|
|
30
30
|
|
|
31
|
-

|
|
32
32
|
|
|
33
|
-

|
|
34
34
|
|
|
35
|
-

|
|
36
|
+
|
|
37
|
+

|
|
38
|
+
|
|
39
|
+

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

|
|
47
51
|
|
|
48
|
-

|
|
49
53
|
|
|
50
|
-
**v2.15.
|
|
54
|
+
**v2.15.9** · MIT · проверено на DSH `0.2.1-rc.5` и `0.2.2-rc.1` (Windows 11) · без внешних зависимостей и телеметрии
|
|
51
55
|
|
|
52
56
|
**План развития:** [docs/ROADMAP-3.0.md](docs/ROADMAP-3.0.md) — Memory Fabric, семантическое
|
|
53
57
|
слияние, локальный индекс памяти, шифрованные переносы, Memory Hub и npm trusted publishing.
|
|
@@ -142,27 +146,27 @@
|
|
|
142
146
|
- перед каждой синхронизацией проверяется, что репозиторий всё ещё приватный;
|
|
143
147
|
- секреты и PII вычищаются, домашние пути заменяются токеном `%DSH_HOME%`; LLM не вызывается — **0 токенов**.
|
|
144
148
|
|
|
145
|
-

|
|
146
150
|
|
|
147
|
-

|
|
148
152
|
|
|
149
153
|
## Скриншоты
|
|
150
154
|
|
|
151
155
|
### Skills Studio: каталог, стоимость и редактор
|
|
152
156
|
|
|
153
|
-

|
|
154
158
|
|
|
155
|
-

|
|
156
160
|
|
|
157
161
|
### Token Lab: куда уходит контекст
|
|
158
162
|
|
|
159
|
-

|
|
160
164
|
|
|
161
165
|
### Тёмная тема и мобильный
|
|
162
166
|
|
|
163
|
-

|
|
164
168
|
|
|
165
|
-

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

|
|
176
180
|
|
|
177
|
-

|
|
178
182
|
|
|
179
|
-

|
|
180
184
|
|
|
181
185
|
Подробности и настройки — [plugins/dsh-peak-guard/README.md](plugins/dsh-peak-guard/README.md).
|
|
182
186
|
|
package/client.js
CHANGED
|
@@ -7598,6 +7598,17 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
7598
7598
|
.ag-empty h3{margin:0;font-size:18px;letter-spacing:-.015em}
|
|
7599
7599
|
.ag-empty p{margin:0;max-width:62ch;color:var(--ag-muted);font-size:13px;line-height:1.5}
|
|
7600
7600
|
.ag-code{width:100%;box-sizing:border-box;padding:12px;border:1px solid var(--ag-line);border-radius:10px;background:var(--ag-panel);color:var(--ag-text);font:12px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre;overflow:auto}
|
|
7601
|
+
.ag-overlay{position:fixed;inset:0;z-index:80;display:flex;align-items:center;justify-content:center;padding:10px;background:rgba(12,24,20,.34);backdrop-filter:blur(5px)}
|
|
7602
|
+
.ag-modal{box-sizing:border-box;width:min(720px,100%);max-height:min(86vh,820px);overflow:auto;background:var(--ag-panel);border:1px solid var(--ag-line);border-radius:18px;box-shadow:0 24px 80px rgba(10,20,18,.24);padding:20px;display:flex;flex-direction:column;gap:12px}
|
|
7603
|
+
.ag-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
|
|
7604
|
+
.ag-modal-head h3{margin:0;font-size:18px;letter-spacing:-.015em}
|
|
7605
|
+
.ag-modal-head p{margin:4px 0 0;color:var(--ag-muted);font-size:12px;line-height:1.45}
|
|
7606
|
+
.ag-entry{display:grid;grid-template-columns:72px minmax(0,1fr);gap:10px;padding:9px 0;border-top:1px solid var(--ag-line);min-width:0}
|
|
7607
|
+
.ag-entry:first-of-type{border-top:0}
|
|
7608
|
+
.ag-entry b{font-size:10px;font-weight:750;letter-spacing:.06em;text-transform:uppercase;color:var(--ag-muted);padding-top:2px}
|
|
7609
|
+
.ag-entry p{margin:0;font-size:12px;line-height:1.5;color:var(--ag-text);white-space:pre-wrap;overflow-wrap:anywhere;min-width:0}
|
|
7610
|
+
.ag-entry.tool p,.ag-entry.tool-result p{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:11px;color:var(--ag-muted)}
|
|
7611
|
+
.ag-entry.error p{color:#9f1239}
|
|
7601
7612
|
.ag-error{padding:8px 10px;border:1px solid rgba(159,18,57,.16);border-radius:9px;background:rgba(159,18,57,.06);color:#9f1239;font-size:12px;line-height:1.4}
|
|
7602
7613
|
.ag-loading{color:var(--ag-muted);font-size:13px;padding:18px 0}
|
|
7603
7614
|
.ag-note{margin:0;color:var(--ag-muted);font-size:11px;line-height:1.45}
|
|
@@ -7668,6 +7679,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
7668
7679
|
function AgentsSection(props) {
|
|
7669
7680
|
const [state, setState] = useState({ loading: true, error: null, data: null });
|
|
7670
7681
|
const [canceling, setCanceling] = useState("");
|
|
7682
|
+
const [transcript, setTranscript] = useState(null);
|
|
7671
7683
|
const useSessions = props && props.useSessions;
|
|
7672
7684
|
const useWorkspaces = props && props.useWorkspaces;
|
|
7673
7685
|
const sessionId = useSessions ? useSessions(currentSessionSelector) : undefined;
|
|
@@ -7712,6 +7724,16 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
7712
7724
|
}
|
|
7713
7725
|
};
|
|
7714
7726
|
|
|
7727
|
+
const openTranscript = async (run) => {
|
|
7728
|
+
setTranscript({ runId: run.id, name: run.name, loading: true, entries: [], error: "" });
|
|
7729
|
+
try {
|
|
7730
|
+
const result = await call(window.__DSH_AGENTS_CTX__, "transcript", { sessionId, cwd, runId: run.id });
|
|
7731
|
+
setTranscript({ runId: run.id, name: run.name, loading: false, entries: result.entries ?? [], error: "" });
|
|
7732
|
+
} catch (error) {
|
|
7733
|
+
setTranscript({ runId: run.id, name: run.name, loading: false, entries: [], error: fallbackError(error) });
|
|
7734
|
+
}
|
|
7735
|
+
};
|
|
7736
|
+
|
|
7715
7737
|
const agents = state.data?.agents ?? [];
|
|
7716
7738
|
const worktrees = state.data?.worktrees ?? [];
|
|
7717
7739
|
const runs = state.data?.runs ?? [];
|
|
@@ -7786,6 +7808,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
7786
7808
|
run.task ? h("p", { className: "ag-task", title: run.task }, run.task) : null,
|
|
7787
7809
|
h("div", { className: "ag-actions" },
|
|
7788
7810
|
run.worktree?.branch ? h("p", null, run.worktree.branch) : null,
|
|
7811
|
+
h("button", { className: "ag-btn", type: "button", onClick: () => void openTranscript(run) }, "Транскрипт"),
|
|
7789
7812
|
run.status === "running" ? h("button", {
|
|
7790
7813
|
className: "ag-btn",
|
|
7791
7814
|
type: "button",
|
|
@@ -7795,6 +7818,24 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
7795
7818
|
),
|
|
7796
7819
|
))) : h("div", { className: "ag-mini-empty" }, "Фоновых запусков нет."),
|
|
7797
7820
|
),
|
|
7821
|
+
transcript ? h("div", { className: "ag-overlay", onMouseDown: (event) => { if (event.target === event.currentTarget) setTranscript(null); } },
|
|
7822
|
+
h("div", { className: "ag-modal", role: "dialog", "aria-modal": "true", "aria-labelledby": "ag-transcript-title" },
|
|
7823
|
+
h("div", { className: "ag-modal-head" },
|
|
7824
|
+
h("div", null,
|
|
7825
|
+
h("h3", { id: "ag-transcript-title" }, `Транскрипт · ${transcript.name}`),
|
|
7826
|
+
h("p", null, transcript.runId),
|
|
7827
|
+
),
|
|
7828
|
+
h("button", { className: "ag-btn", type: "button", onClick: () => setTranscript(null) }, "Закрыть"),
|
|
7829
|
+
),
|
|
7830
|
+
transcript.loading ? h("p", { className: "ag-note" }, "Читаем сессию ребёнка…") : null,
|
|
7831
|
+
transcript.error ? h("div", { className: "ag-error", role: "alert" }, transcript.error) : null,
|
|
7832
|
+
!transcript.loading && !transcript.error && transcript.entries.length === 0 ? h("p", { className: "ag-note" }, "В сессии пока нет сообщений.") : null,
|
|
7833
|
+
transcript.entries.map((entry, index) => h("div", { className: `ag-entry ${entry.role}`, key: `${entry.role}-${index}` },
|
|
7834
|
+
h("b", null, entry.role),
|
|
7835
|
+
h("p", null, entry.text),
|
|
7836
|
+
)),
|
|
7837
|
+
),
|
|
7838
|
+
) : null,
|
|
7798
7839
|
h("p", { className: "ag-note" }, state.data?.project ? `Проект: ${state.data.project}` : "Проект определяется по текущей рабочей папке."),
|
|
7799
7840
|
);
|
|
7800
7841
|
}
|
|
@@ -8042,7 +8083,7 @@ var(--dsw-alias-bg-layer-1,#fff);box-shadow:inset 0 1px 0 color-mix(in srgb,#fff
|
|
|
8042
8083
|
if (__kitErrors.length <= 5) console.error("[dsh-desktop-kit] registration failed:", label, message);
|
|
8043
8084
|
};
|
|
8044
8085
|
try {
|
|
8045
|
-
window.__DSH_DESKTOP_KIT__ = { version: "2.15.
|
|
8086
|
+
window.__DSH_DESKTOP_KIT__ = { version: "2.15.9", parts: __partNames, errors: __kitErrors, ready: false };
|
|
8046
8087
|
} catch {}
|
|
8047
8088
|
const __inject = [];
|
|
8048
8089
|
for (const __part of __parts) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# DSH Desktop Kit 2.15.8 — тест
|
|
2
|
+
|
|
3
|
+
Дата: 2026-11-12.
|
|
4
|
+
|
|
5
|
+
## Transcript
|
|
6
|
+
|
|
7
|
+
- Run card → «Транскрипт».
|
|
8
|
+
- Host читает `ctx.sessions.get(run.childId).ownEvents()`.
|
|
9
|
+
- Показывает user/assistant/tool/tool-result/error, лимит 80 записей.
|
|
10
|
+
- Live session only; после restart — ошибка «child session is not live».
|
|
11
|
+
|
|
12
|
+
## UI
|
|
13
|
+
|
|
14
|
+
- Модалка 390/768/1440, overflow 0, console 0, markup 0.
|
|
15
|
+
- Скриншоты transcript-1440/390 в README.
|
|
16
|
+
|
|
17
|
+
## Проверки
|
|
18
|
+
|
|
19
|
+
- `npm test` — exit 0.
|
|
20
|
+
- `build:client` / `check:client` — OK.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# DSH Desktop Kit 2.15.9 — тест
|
|
2
|
+
|
|
3
|
+
Дата: 2026-11-12.
|
|
4
|
+
|
|
5
|
+
## Persistent transcript
|
|
6
|
+
|
|
7
|
+
- При завершении/отмене фонового run: `.dsh/agents/transcripts/<run>.json`, mode 0600.
|
|
8
|
+
- 80 записей, 4 КБ на сообщение, redaction.
|
|
9
|
+
- API: live session → snapshot → error.
|
|
10
|
+
- UI не менялся; кнопка «Транскрипт» работает после restart.
|
|
11
|
+
|
|
12
|
+
## Проверки
|
|
13
|
+
|
|
14
|
+
- `transcripts-tests` — OK.
|
|
15
|
+
- `npm test` — exit 0.
|
|
16
|
+
- `build:client` / `check:client` — OK.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-desktop-kit",
|
|
3
|
-
"version": "2.15.
|
|
4
|
-
"description": "DeepSeek Harness desktop kit 2.15.
|
|
3
|
+
"version": "2.15.9",
|
|
4
|
+
"description": "DeepSeek Harness desktop kit 2.15.9: 16 plugins and 30 skills — MCP tools/resources/prompts with OAuth 2.1, sampling and elicitation, project agents, git worktrees, background runs and a read-only/writer swarm with a shared board, plus self-applying skills, token lab, Skills Studio, project memory, guardrails, repo map, checkpoints, plan mode, browser QA, GitHub review, hooks/commands, Russian UI and profile transfer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
7
7
|
"dsh",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"build:client": "node tools/build-client.mjs",
|
|
83
83
|
"build:skills": "node tools/build-skill-manifest.mjs",
|
|
84
84
|
"check:client": "node tools/check-client.mjs client.js",
|
|
85
|
-
"test": "node tools/smoke-tests.mjs && node tools/memory-tests.mjs && node tools/skills-sync-tests.mjs && node tools/kit-upgrade-tests.mjs && node plugins/dsh-profile-transfer/test/transfer.test.mjs && node --test plugins/dsh-memory-bridge/test/bridge.test.mjs plugins/dsh-memory-bridge/test/github.test.mjs plugins/dsh-memory-bridge/test/merge.test.mjs plugins/dsh-memory-bridge/test/user-specific.test.mjs && node tools/repo-map-tests.mjs && node tools/checkpoints-tests.mjs && node tools/plan-mode-tests.mjs && node tools/browser-qa-tests.mjs && node tools/ui-gate-tests.mjs && node tools/agent-extensions-tests.mjs && node tools/mcp-manager-tests.mjs && node tools/github-review-tests.mjs && node tools/instructions-tests.mjs && node tools/mcp-elicitation-tests.mjs && node tools/mcp-sampling-tests.mjs && node tools/mcp-oauth-tests.mjs && node tools/worktrees-tests.mjs && node tools/team-messages-tests.mjs && node tools/team-board-tests.mjs && node tools/team-agents-tests.mjs && node tools/background-agents-tests.mjs && node tools/permissions-ui-tests.mjs && node plugins/dsh-guardrails/tools/guardrails-tests.mjs",
|
|
85
|
+
"test": "node tools/smoke-tests.mjs && node tools/memory-tests.mjs && node tools/skills-sync-tests.mjs && node tools/kit-upgrade-tests.mjs && node plugins/dsh-profile-transfer/test/transfer.test.mjs && node --test plugins/dsh-memory-bridge/test/bridge.test.mjs plugins/dsh-memory-bridge/test/github.test.mjs plugins/dsh-memory-bridge/test/merge.test.mjs plugins/dsh-memory-bridge/test/user-specific.test.mjs && node tools/repo-map-tests.mjs && node tools/checkpoints-tests.mjs && node tools/plan-mode-tests.mjs && node tools/browser-qa-tests.mjs && node tools/ui-gate-tests.mjs && node tools/agent-extensions-tests.mjs && node tools/mcp-manager-tests.mjs && node tools/github-review-tests.mjs && node tools/instructions-tests.mjs && node tools/mcp-elicitation-tests.mjs && node tools/mcp-sampling-tests.mjs && node tools/mcp-oauth-tests.mjs && node tools/worktrees-tests.mjs && node tools/transcripts-tests.mjs && node tools/team-messages-tests.mjs && node tools/team-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"
|
|
@@ -42,6 +42,17 @@ window.__ModuleLoader__.load({
|
|
|
42
42
|
.ag-empty h3{margin:0;font-size:18px;letter-spacing:-.015em}
|
|
43
43
|
.ag-empty p{margin:0;max-width:62ch;color:var(--ag-muted);font-size:13px;line-height:1.5}
|
|
44
44
|
.ag-code{width:100%;box-sizing:border-box;padding:12px;border:1px solid var(--ag-line);border-radius:10px;background:var(--ag-panel);color:var(--ag-text);font:12px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre;overflow:auto}
|
|
45
|
+
.ag-overlay{position:fixed;inset:0;z-index:80;display:flex;align-items:center;justify-content:center;padding:10px;background:rgba(12,24,20,.34);backdrop-filter:blur(5px)}
|
|
46
|
+
.ag-modal{box-sizing:border-box;width:min(720px,100%);max-height:min(86vh,820px);overflow:auto;background:var(--ag-panel);border:1px solid var(--ag-line);border-radius:18px;box-shadow:0 24px 80px rgba(10,20,18,.24);padding:20px;display:flex;flex-direction:column;gap:12px}
|
|
47
|
+
.ag-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
|
|
48
|
+
.ag-modal-head h3{margin:0;font-size:18px;letter-spacing:-.015em}
|
|
49
|
+
.ag-modal-head p{margin:4px 0 0;color:var(--ag-muted);font-size:12px;line-height:1.45}
|
|
50
|
+
.ag-entry{display:grid;grid-template-columns:72px minmax(0,1fr);gap:10px;padding:9px 0;border-top:1px solid var(--ag-line);min-width:0}
|
|
51
|
+
.ag-entry:first-of-type{border-top:0}
|
|
52
|
+
.ag-entry b{font-size:10px;font-weight:750;letter-spacing:.06em;text-transform:uppercase;color:var(--ag-muted);padding-top:2px}
|
|
53
|
+
.ag-entry p{margin:0;font-size:12px;line-height:1.5;color:var(--ag-text);white-space:pre-wrap;overflow-wrap:anywhere;min-width:0}
|
|
54
|
+
.ag-entry.tool p,.ag-entry.tool-result p{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:11px;color:var(--ag-muted)}
|
|
55
|
+
.ag-entry.error p{color:#9f1239}
|
|
45
56
|
.ag-error{padding:8px 10px;border:1px solid rgba(159,18,57,.16);border-radius:9px;background:rgba(159,18,57,.06);color:#9f1239;font-size:12px;line-height:1.4}
|
|
46
57
|
.ag-loading{color:var(--ag-muted);font-size:13px;padding:18px 0}
|
|
47
58
|
.ag-note{margin:0;color:var(--ag-muted);font-size:11px;line-height:1.45}
|
|
@@ -112,6 +123,7 @@ window.__ModuleLoader__.load({
|
|
|
112
123
|
function AgentsSection(props) {
|
|
113
124
|
const [state, setState] = useState({ loading: true, error: null, data: null });
|
|
114
125
|
const [canceling, setCanceling] = useState("");
|
|
126
|
+
const [transcript, setTranscript] = useState(null);
|
|
115
127
|
const useSessions = props && props.useSessions;
|
|
116
128
|
const useWorkspaces = props && props.useWorkspaces;
|
|
117
129
|
const sessionId = useSessions ? useSessions(currentSessionSelector) : undefined;
|
|
@@ -156,6 +168,16 @@ window.__ModuleLoader__.load({
|
|
|
156
168
|
}
|
|
157
169
|
};
|
|
158
170
|
|
|
171
|
+
const openTranscript = async (run) => {
|
|
172
|
+
setTranscript({ runId: run.id, name: run.name, loading: true, entries: [], error: "" });
|
|
173
|
+
try {
|
|
174
|
+
const result = await call(window.__DSH_AGENTS_CTX__, "transcript", { sessionId, cwd, runId: run.id });
|
|
175
|
+
setTranscript({ runId: run.id, name: run.name, loading: false, entries: result.entries ?? [], error: "" });
|
|
176
|
+
} catch (error) {
|
|
177
|
+
setTranscript({ runId: run.id, name: run.name, loading: false, entries: [], error: fallbackError(error) });
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
159
181
|
const agents = state.data?.agents ?? [];
|
|
160
182
|
const worktrees = state.data?.worktrees ?? [];
|
|
161
183
|
const runs = state.data?.runs ?? [];
|
|
@@ -230,6 +252,7 @@ window.__ModuleLoader__.load({
|
|
|
230
252
|
run.task ? h("p", { className: "ag-task", title: run.task }, run.task) : null,
|
|
231
253
|
h("div", { className: "ag-actions" },
|
|
232
254
|
run.worktree?.branch ? h("p", null, run.worktree.branch) : null,
|
|
255
|
+
h("button", { className: "ag-btn", type: "button", onClick: () => void openTranscript(run) }, "Транскрипт"),
|
|
233
256
|
run.status === "running" ? h("button", {
|
|
234
257
|
className: "ag-btn",
|
|
235
258
|
type: "button",
|
|
@@ -239,6 +262,24 @@ window.__ModuleLoader__.load({
|
|
|
239
262
|
),
|
|
240
263
|
))) : h("div", { className: "ag-mini-empty" }, "Фоновых запусков нет."),
|
|
241
264
|
),
|
|
265
|
+
transcript ? h("div", { className: "ag-overlay", onMouseDown: (event) => { if (event.target === event.currentTarget) setTranscript(null); } },
|
|
266
|
+
h("div", { className: "ag-modal", role: "dialog", "aria-modal": "true", "aria-labelledby": "ag-transcript-title" },
|
|
267
|
+
h("div", { className: "ag-modal-head" },
|
|
268
|
+
h("div", null,
|
|
269
|
+
h("h3", { id: "ag-transcript-title" }, `Транскрипт · ${transcript.name}`),
|
|
270
|
+
h("p", null, transcript.runId),
|
|
271
|
+
),
|
|
272
|
+
h("button", { className: "ag-btn", type: "button", onClick: () => setTranscript(null) }, "Закрыть"),
|
|
273
|
+
),
|
|
274
|
+
transcript.loading ? h("p", { className: "ag-note" }, "Читаем сессию ребёнка…") : null,
|
|
275
|
+
transcript.error ? h("div", { className: "ag-error", role: "alert" }, transcript.error) : null,
|
|
276
|
+
!transcript.loading && !transcript.error && transcript.entries.length === 0 ? h("p", { className: "ag-note" }, "В сессии пока нет сообщений.") : null,
|
|
277
|
+
transcript.entries.map((entry, index) => h("div", { className: `ag-entry ${entry.role}`, key: `${entry.role}-${index}` },
|
|
278
|
+
h("b", null, entry.role),
|
|
279
|
+
h("p", null, entry.text),
|
|
280
|
+
)),
|
|
281
|
+
),
|
|
282
|
+
) : null,
|
|
242
283
|
h("p", { className: "ag-note" }, state.data?.project ? `Проект: ${state.data.project}` : "Проект определяется по текущей рабочей папке."),
|
|
243
284
|
);
|
|
244
285
|
}
|
|
@@ -9,6 +9,7 @@ import crypto from "node:crypto";
|
|
|
9
9
|
import { loadAgents, projectFor } from "./project.js";
|
|
10
10
|
import { clearChildPolicy, setChildPolicy } from "./policy.js";
|
|
11
11
|
import { loadRuns, runPreview, updateRun, upsertRun } from "./runs.js";
|
|
12
|
+
import { saveTranscript } from "./transcripts.js";
|
|
12
13
|
|
|
13
14
|
const background = new Map();
|
|
14
15
|
|
|
@@ -99,6 +100,7 @@ export async function runProjectAgent(ctx, exec, definition, task, options = {})
|
|
|
99
100
|
upsertRun(project.root, record);
|
|
100
101
|
remember(record, activation, project.root, signal, abort);
|
|
101
102
|
activation.result.then(async (result) => {
|
|
103
|
+
try { saveTranscript(project.root, record.id, ctx.get("sessions")?.get(activeId)); } catch { /* best effort */ }
|
|
102
104
|
const currentRecord = loadRuns(project.root).find((item) => item.id === record.id);
|
|
103
105
|
if (currentRecord?.status !== "canceled") {
|
|
104
106
|
const text = textFromOutput(result?.output);
|
|
@@ -115,6 +117,7 @@ export async function runProjectAgent(ctx, exec, definition, task, options = {})
|
|
|
115
117
|
background.delete(record.id);
|
|
116
118
|
signal?.removeEventListener?.("abort", abort);
|
|
117
119
|
}).catch((error) => {
|
|
120
|
+
try { saveTranscript(project.root, record.id, ctx.get("sessions")?.get(activeId)); } catch { /* best effort */ }
|
|
118
121
|
const currentRecord = loadRuns(project.root).find((item) => item.id === record.id);
|
|
119
122
|
if (currentRecord?.status !== "canceled") {
|
|
120
123
|
finishRun(project.root, record.id, {
|
|
@@ -214,6 +217,7 @@ export async function cancelRun(ctx, exec, id) {
|
|
|
214
217
|
parentSessionId: entry.record.parentId ?? exec?.agent?.session?.id,
|
|
215
218
|
});
|
|
216
219
|
} catch { /* disposal below still stops the local activation */ }
|
|
220
|
+
try { saveTranscript(project.root, entry.record.id, ctx.get?.("sessions")?.get?.(entry.record.childId)); } catch { /* best effort */ }
|
|
217
221
|
try { await entry.activation.dispose?.(); } catch { /* best effort */ }
|
|
218
222
|
clearChildPolicy(entry.record.childId);
|
|
219
223
|
background.delete(entry.record.id);
|
|
@@ -5,6 +5,7 @@ import { loadAgents, projectFor } from "./project.js";
|
|
|
5
5
|
import { cancelRun, listRuns } from "./agents.js";
|
|
6
6
|
import { worktreeSummary } from "./worktrees.js";
|
|
7
7
|
import { readBoard } from "./board.js";
|
|
8
|
+
import { extractTranscript, loadTranscript } from "./transcripts.js";
|
|
8
9
|
|
|
9
10
|
export const RPC_NAMESPACE = "dsh-agent-extensions";
|
|
10
11
|
const ROUTE_BASE = "/api/dsh-agent-extensions";
|
|
@@ -23,6 +24,38 @@ async function envelope(request) {
|
|
|
23
24
|
return { rpcId: body.rpcId, method: body.method, payload: body.payload ?? {} };
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
function textOf(content) {
|
|
28
|
+
if (typeof content === "string") return content;
|
|
29
|
+
if (!Array.isArray(content)) return String(content?.text ?? "");
|
|
30
|
+
return content.map((block) => {
|
|
31
|
+
if (block?.type === "text") return block.text ?? "";
|
|
32
|
+
if (block?.type === "tool-call") return `→ ${block.name}(${block.arguments ?? ""})`;
|
|
33
|
+
if (block?.type === "image") return "[image]";
|
|
34
|
+
return "";
|
|
35
|
+
}).filter(Boolean).join("\n");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function transcriptOf(session, run) {
|
|
39
|
+
const events = typeof session.ownEvents === "function" ? session.ownEvents() : [];
|
|
40
|
+
const entries = [];
|
|
41
|
+
for (const event of events) {
|
|
42
|
+
const data = event?.data ?? {};
|
|
43
|
+
if (event.type === "user/message") {
|
|
44
|
+
const text = textOf(data.message?.content ?? data.content).trim();
|
|
45
|
+
if (text) entries.push({ role: "user", text: text.slice(0, 4_000) });
|
|
46
|
+
} else if (event.type === "assistant/message") {
|
|
47
|
+
const text = textOf(data.message?.content ?? data.content).trim();
|
|
48
|
+
if (text) entries.push({ role: "assistant", text: text.slice(0, 4_000) });
|
|
49
|
+
} else if (event.type === "tool/call") {
|
|
50
|
+
entries.push({ role: "tool", text: `${data.name}(${String(data.arguments ?? "").slice(0, 500)})` });
|
|
51
|
+
} else if (event.type === "tool/result") {
|
|
52
|
+
const text = textOf(data.message?.content ?? data.content).trim();
|
|
53
|
+
if (text) entries.push({ role: data.error ? "error" : "tool-result", text: text.slice(0, 2_000) });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { run, entries: entries.slice(-80) };
|
|
57
|
+
}
|
|
58
|
+
|
|
26
59
|
export function registerAgentApi(ctx) {
|
|
27
60
|
const sessionFrom = (payload) => {
|
|
28
61
|
const sessions = ctx.get?.("sessions");
|
|
@@ -74,6 +107,32 @@ export function registerAgentApi(ctx) {
|
|
|
74
107
|
},
|
|
75
108
|
};
|
|
76
109
|
|
|
110
|
+
const transcriptRoute = {
|
|
111
|
+
path: `${ROUTE_BASE}/transcript`,
|
|
112
|
+
methods: ["POST"],
|
|
113
|
+
requestBody: "buffered",
|
|
114
|
+
fetch: async (request) => {
|
|
115
|
+
let rpcId = "invalid-request";
|
|
116
|
+
try {
|
|
117
|
+
const value = await envelope(request);
|
|
118
|
+
rpcId = value.rpcId;
|
|
119
|
+
if (value.method !== `${RPC_NAMESPACE}/transcript`) throw new Error("endpoint/method mismatch");
|
|
120
|
+
const session = sessionFrom(value.payload);
|
|
121
|
+
const project = projectFor(value.payload?.cwd || session?.header?.cwd || process.cwd());
|
|
122
|
+
const run = listRuns(project.root).find((item) => String(item.id) === String(value.payload?.runId));
|
|
123
|
+
if (!run) throw new Error(`run not found: ${value.payload?.runId}`);
|
|
124
|
+
const sessions = ctx.get?.("sessions");
|
|
125
|
+
const child = sessions?.get?.(run.childId);
|
|
126
|
+
if (child) return ok(rpcId, { run, entries: extractTranscript(child), persisted: false });
|
|
127
|
+
const saved = loadTranscript(project.root, run.id);
|
|
128
|
+
if (!saved) throw new Error("transcript is unavailable: child session is gone and no saved snapshot exists");
|
|
129
|
+
return ok(rpcId, { run, entries: saved.entries, persisted: true, savedAt: saved.savedAt });
|
|
130
|
+
} catch (error) {
|
|
131
|
+
return fail(rpcId, error instanceof Error ? error.message : String(error));
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
77
136
|
const cancelRoute = {
|
|
78
137
|
path: `${ROUTE_BASE}/cancel`,
|
|
79
138
|
methods: ["POST"],
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable, bounded transcripts for background project agents.
|
|
3
|
+
*
|
|
4
|
+
* A live child session is authoritative while it exists. When the run finishes
|
|
5
|
+
* we persist a redacted snapshot so the Agents UI still has a transcript after
|
|
6
|
+
* a DSH restart or session disposal.
|
|
7
|
+
*/
|
|
8
|
+
import fs from "node:fs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { redact } from "./runs.js";
|
|
11
|
+
|
|
12
|
+
const LIMIT = 80;
|
|
13
|
+
const TEXT_LIMIT = 4_000;
|
|
14
|
+
|
|
15
|
+
function textOf(content) {
|
|
16
|
+
if (typeof content === "string") return content;
|
|
17
|
+
if (!Array.isArray(content)) return String(content?.text ?? "");
|
|
18
|
+
return content.map((block) => {
|
|
19
|
+
if (block?.type === "text") return block.text ?? "";
|
|
20
|
+
if (block?.type === "tool-call") return `→ ${block.name}(${block.arguments ?? ""})`;
|
|
21
|
+
if (block?.type === "image") return "[image]";
|
|
22
|
+
return "";
|
|
23
|
+
}).filter(Boolean).join("\n");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function transcriptPath(projectRoot, runId) {
|
|
27
|
+
return path.join(projectRoot, ".dsh", "agents", "transcripts", `${String(runId)}.json`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function extractTranscript(session) {
|
|
31
|
+
const events = typeof session?.ownEvents === "function" ? session.ownEvents() : [];
|
|
32
|
+
const entries = [];
|
|
33
|
+
for (const event of events) {
|
|
34
|
+
const data = event?.data ?? {};
|
|
35
|
+
if (event.type === "user/message" || event.type === "assistant/message") {
|
|
36
|
+
const text = textOf(data.message?.content ?? data.content).trim();
|
|
37
|
+
if (text) entries.push({ role: event.type === "user/message" ? "user" : "assistant", text: text.slice(0, TEXT_LIMIT) });
|
|
38
|
+
} else if (event.type === "tool/call") {
|
|
39
|
+
entries.push({ role: "tool", text: `${data.name}(${String(data.arguments ?? "").slice(0, 500)})` });
|
|
40
|
+
} else if (event.type === "tool/result") {
|
|
41
|
+
const text = textOf(data.message?.content ?? data.content).trim();
|
|
42
|
+
if (text) entries.push({ role: data.error ? "error" : "tool-result", text: text.slice(0, 2_000) });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return entries.slice(-LIMIT).map((entry) => ({ ...entry, text: redact(entry.text) }));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function saveTranscript(projectRoot, runId, session) {
|
|
49
|
+
const entries = extractTranscript(session);
|
|
50
|
+
if (entries.length === 0) return null;
|
|
51
|
+
const file = transcriptPath(projectRoot, runId);
|
|
52
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
53
|
+
const temp = `${file}.${process.pid}.tmp`;
|
|
54
|
+
fs.writeFileSync(temp, `${JSON.stringify({ runId: String(runId), savedAt: new Date().toISOString(), entries }, null, 2)}\n`, { mode: 0o600, encoding: "utf8" });
|
|
55
|
+
fs.renameSync(temp, file);
|
|
56
|
+
return { file, count: entries.length };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function loadTranscript(projectRoot, runId) {
|
|
60
|
+
try {
|
|
61
|
+
const parsed = JSON.parse(fs.readFileSync(transcriptPath(projectRoot, runId), "utf8"));
|
|
62
|
+
return Array.isArray(parsed.entries) ? { savedAt: parsed.savedAt ?? "", entries: parsed.entries } : null;
|
|
63
|
+
} catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
Binary file
|
|
Binary file
|