dsh-desktop-kit 2.15.6 → 2.15.8
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 +26 -20
- package/client.js +42 -1
- package/docs/TEST-2.15.7.md +15 -0
- package/docs/TEST-2.15.8.md +20 -0
- package/package.json +2 -2
- package/plugins/dsh-agent-extensions/client.js +41 -0
- package/plugins/dsh-agent-extensions/lib/api.js +56 -0
- package/plugins/dsh-agent-extensions/screenshots/board-1440.png +0 -0
- package/plugins/dsh-agent-extensions/screenshots/board-390.png +0 -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.8 (2026-11-12)
|
|
4
|
+
|
|
5
|
+
- **Транскрипт агента.** Кнопка «Транскрипт» у фонового run открывает чтение сессии ребёнка через `ctx.sessions`: user/assistant, tool calls, tool results, errors.
|
|
6
|
+
- **API.** `dsh-agent-extensions/transcript`; live child only, иначе честная ошибка.
|
|
7
|
+
- **UI.** Модалка на 390/768/1440, overflow 0; новые screenshot `transcript-1440/390` в README.
|
|
8
|
+
- **Ограничение.** После restart/удаления сессии транскрипт недоступен — остаётся preview.
|
|
9
|
+
|
|
10
|
+
## 2.15.7 (2026-11-12)
|
|
11
|
+
|
|
12
|
+
- **Новые скриншоты.** Board UI: сообщения, лид, задачи и зависимости на 1440 и 390.
|
|
13
|
+
- **README.** Секция агентов теперь показывает board-1440 и board-390 вместо старого team-снимка.
|
|
14
|
+
- **Пакет.** Новые PNG включены в tarball и доступны через unpkg.
|
|
15
|
+
|
|
3
16
|
## 2.15.6 (2026-11-12)
|
|
4
17
|
|
|
5
18
|
- **Team lead.** `project_agent action=team lead=<name>` запускает read-only координатора после участников; он получает `member=run-id`, читает board, назначает задачи и пишет участникам через `team_message`.
|
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,11 +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
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+

|
|
38
|
+
|
|
39
|
+

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

|
|
45
51
|
|
|
46
|
-

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

|
|
144
150
|
|
|
145
|
-

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

|
|
152
158
|
|
|
153
|
-

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

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

|
|
162
168
|
|
|
163
|
-

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

|
|
174
180
|
|
|
175
|
-

|
|
176
182
|
|
|
177
|
-

|
|
178
184
|
|
|
179
185
|
Подробности и настройки — [plugins/dsh-peak-guard/README.md](plugins/dsh-peak-guard/README.md).
|
|
180
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.8", parts: __partNames, errors: __kitErrors, ready: false };
|
|
8046
8087
|
} catch {}
|
|
8047
8088
|
const __inject = [];
|
|
8048
8089
|
for (const __part of __parts) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# DSH Desktop Kit 2.15.7 — тест
|
|
2
|
+
|
|
3
|
+
Дата: 2026-11-12.
|
|
4
|
+
|
|
5
|
+
## README / npm images
|
|
6
|
+
|
|
7
|
+
- Новый `board-1440.png`: лид, сообщения, задачи, blocked/ready, worktrees.
|
|
8
|
+
- Новый `board-390.png`: мобильная доска без overflow.
|
|
9
|
+
- README использует новые снимки вместо старого team-1440.
|
|
10
|
+
|
|
11
|
+
## Проверки
|
|
12
|
+
|
|
13
|
+
- `browser_qa audit` 390/768/1440: overflow 0, console 0, markup 0.
|
|
14
|
+
- `npm test` — exit 0.
|
|
15
|
+
- PNG включены в tarball.
|
|
@@ -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.
|
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.8",
|
|
4
|
+
"description": "DeepSeek Harness desktop kit 2.15.8: 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",
|
|
@@ -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
|
}
|
|
@@ -23,6 +23,38 @@ async function envelope(request) {
|
|
|
23
23
|
return { rpcId: body.rpcId, method: body.method, payload: body.payload ?? {} };
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
function textOf(content) {
|
|
27
|
+
if (typeof content === "string") return content;
|
|
28
|
+
if (!Array.isArray(content)) return String(content?.text ?? "");
|
|
29
|
+
return content.map((block) => {
|
|
30
|
+
if (block?.type === "text") return block.text ?? "";
|
|
31
|
+
if (block?.type === "tool-call") return `→ ${block.name}(${block.arguments ?? ""})`;
|
|
32
|
+
if (block?.type === "image") return "[image]";
|
|
33
|
+
return "";
|
|
34
|
+
}).filter(Boolean).join("\n");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function transcriptOf(session, run) {
|
|
38
|
+
const events = typeof session.ownEvents === "function" ? session.ownEvents() : [];
|
|
39
|
+
const entries = [];
|
|
40
|
+
for (const event of events) {
|
|
41
|
+
const data = event?.data ?? {};
|
|
42
|
+
if (event.type === "user/message") {
|
|
43
|
+
const text = textOf(data.message?.content ?? data.content).trim();
|
|
44
|
+
if (text) entries.push({ role: "user", text: text.slice(0, 4_000) });
|
|
45
|
+
} else if (event.type === "assistant/message") {
|
|
46
|
+
const text = textOf(data.message?.content ?? data.content).trim();
|
|
47
|
+
if (text) entries.push({ role: "assistant", text: text.slice(0, 4_000) });
|
|
48
|
+
} else if (event.type === "tool/call") {
|
|
49
|
+
entries.push({ role: "tool", text: `${data.name}(${String(data.arguments ?? "").slice(0, 500)})` });
|
|
50
|
+
} else if (event.type === "tool/result") {
|
|
51
|
+
const text = textOf(data.message?.content ?? data.content).trim();
|
|
52
|
+
if (text) entries.push({ role: data.error ? "error" : "tool-result", text: text.slice(0, 2_000) });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return { run, entries: entries.slice(-80) };
|
|
56
|
+
}
|
|
57
|
+
|
|
26
58
|
export function registerAgentApi(ctx) {
|
|
27
59
|
const sessionFrom = (payload) => {
|
|
28
60
|
const sessions = ctx.get?.("sessions");
|
|
@@ -74,6 +106,30 @@ export function registerAgentApi(ctx) {
|
|
|
74
106
|
},
|
|
75
107
|
};
|
|
76
108
|
|
|
109
|
+
const transcriptRoute = {
|
|
110
|
+
path: `${ROUTE_BASE}/transcript`,
|
|
111
|
+
methods: ["POST"],
|
|
112
|
+
requestBody: "buffered",
|
|
113
|
+
fetch: async (request) => {
|
|
114
|
+
let rpcId = "invalid-request";
|
|
115
|
+
try {
|
|
116
|
+
const value = await envelope(request);
|
|
117
|
+
rpcId = value.rpcId;
|
|
118
|
+
if (value.method !== `${RPC_NAMESPACE}/transcript`) throw new Error("endpoint/method mismatch");
|
|
119
|
+
const session = sessionFrom(value.payload);
|
|
120
|
+
const project = projectFor(value.payload?.cwd || session?.header?.cwd || process.cwd());
|
|
121
|
+
const run = listRuns(project.root).find((item) => String(item.id) === String(value.payload?.runId));
|
|
122
|
+
if (!run) throw new Error(`run not found: ${value.payload?.runId}`);
|
|
123
|
+
const sessions = ctx.get?.("sessions");
|
|
124
|
+
const child = sessions?.get?.(run.childId);
|
|
125
|
+
if (!child) throw new Error("child session is not live (restart or already disposed)");
|
|
126
|
+
return ok(rpcId, transcriptOf(child, run));
|
|
127
|
+
} catch (error) {
|
|
128
|
+
return fail(rpcId, error instanceof Error ? error.message : String(error));
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
77
133
|
const cancelRoute = {
|
|
78
134
|
path: `${ROUTE_BASE}/cancel`,
|
|
79
135
|
methods: ["POST"],
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|